diff options
author | Tom Tromey <tromey@redhat.com> | 2013-05-30 17:30:03 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-05-30 17:30:03 +0000 |
commit | 232cf858dc9952f123510778333b2e8ab2dc56f9 (patch) | |
tree | 712e835f7e4521ea10f2cb39b90c9c57467ee3b0 /gdb | |
parent | 2ddc5b46e057658b157c26045d74d7d3bbc0c271 (diff) | |
download | gdb-232cf858dc9952f123510778333b2e8ab2dc56f9.tar.gz |
use explicit returns to avoid checker confusion
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/python/py-breakpoint.c | 3 | ||||
-rw-r--r-- | gdb/python/py-frame.c | 3 | ||||
-rw-r--r-- | gdb/python/python.c | 3 |
4 files changed, 13 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 55df48c30d0..666868f396e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 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 do_cleanups on all return paths. diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index eaa1bc52738..87f1fdc1f83 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -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); diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 2615ddf75fb..f960b08bffa 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -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) diff --git a/gdb/python/python.c b/gdb/python/python.c index 690534f1539..c94198e2985 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -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) |