use explicit returns to avoid checker confusion
authorTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:30:03 +0000 (17:30 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:30:03 +0000 (17:30 +0000)
The checker does not understand the idiom

if (except.reason < 0) {
   do_cleanups (whatever);
   GDB_PY_HANDLE_EXCEPTION (except);
}

because it doesn't realize that the nested 'if' actually has the same
condition.

This fixes instances of this to be more explicit.

* python/py-breakpoint.c (bppy_get_commands): Use
explicit, unconditional return.
* python/py-frame.c (frapy_read_var): Likewise.
* python/python.c (gdbpy_decode_line): Likewise.

gdb/ChangeLog
gdb/python/py-breakpoint.c
gdb/python/py-frame.c
gdb/python/python.c

index 55df48c30d0417eabdd7fe4061dd0c825bf20b31..666868f396e5f566bc2dc7b5cd21e7dee2b56575 100644 (file)
@@ -1,3 +1,10 @@
+2013-05-30  Tom Tromey  <tromey@redhat.com>
+
+       * python/py-breakpoint.c (bppy_get_commands): Use
+       explicit, unconditional return.
+       * python/py-frame.c (frapy_read_var): Likewise.
+       * python/python.c (gdbpy_decode_line): Likewise.
+
 2013-05-30  Tom Tromey  <tromey@redhat.com>
 
        * cp-namespace.c (cp_lookup_symbol_imports_or_template): Call
index eaa1bc5273879cc2813057674c48e91b7d02048e..87f1fdc1f837662f8ccddc1e4b56a5ed3b1e318a 100644 (file)
@@ -492,7 +492,8 @@ bppy_get_commands (PyObject *self, void *closure)
   if (except.reason < 0)
     {
       do_cleanups (chain);
-      GDB_PY_HANDLE_EXCEPTION (except);
+      gdbpy_convert_exception (except);
+      return NULL;
     }
 
   cmdstr = ui_file_xstrdup (string_file, &length);
index 2615ddf75fb14a8b7fe599b59f53ca14f9e6ff64..f960b08bffa55f2abaefd67c822b706790438733 100644 (file)
@@ -477,7 +477,8 @@ frapy_read_var (PyObject *self, PyObject *args)
       if (except.reason < 0)
        {
          do_cleanups (cleanup);
-         GDB_PY_HANDLE_EXCEPTION (except);
+         gdbpy_convert_exception (except);
+         return NULL;
        }
 
       if (!var)
index 690534f1539dbf6327c7651b7512836d8c33e10e..c94198e2985f8e4c1b378714ea1ff24d187780aa 100644 (file)
@@ -653,7 +653,8 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
     {
       do_cleanups (cleanups);
       /* We know this will always throw.  */
-      GDB_PY_HANDLE_EXCEPTION (except);
+      gdbpy_convert_exception (except);
+      return NULL;
     }
 
   if (sals.nelts)