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.
This commit is contained in:
Tom Tromey 2013-05-30 17:30:03 +00:00
parent c27e16e3f1
commit f330038710
4 changed files with 13 additions and 3 deletions

View 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

View 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);

View 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)

View 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)