From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24296 invoked by alias); 9 May 2013 18:52:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 24266 invoked by uid 89); 9 May 2013 18:52:08 -0000 X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 09 May 2013 18:52:07 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r49Iq5En012133 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 9 May 2013 14:52:06 -0400 Received: from barimba (ovpn-113-133.phx2.redhat.com [10.3.113.133]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r49Iq4LK011048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 9 May 2013 14:52:05 -0400 From: Tom Tromey From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 28/40] use explicit returns to avoid checker confusion In-Reply-To: References: Message-Id: <27ac4476e9e4f7a238ca9f86ec955ef6d2d21c02.1368124285.git.tromey@redhat.com> Date: Thu, 09 May 2013 18:52:00 -0000 MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-05/txt/msg00342.txt.bz2 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/python/py-breakpoint.c | 2 +- gdb/python/py-frame.c | 2 +- gdb/python/python.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index d099892..fd13811 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -492,7 +492,7 @@ bppy_get_commands (PyObject *self, void *closure) if (except.reason < 0) { do_cleanups (chain); - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_convert_exception (except); } cmdstr = ui_file_xstrdup (string_file, &length); diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 33d0bd0..10a50ea 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -472,7 +472,7 @@ frapy_read_var (PyObject *self, PyObject *args) if (except.reason < 0) { do_cleanups (cleanup); - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_convert_exception (except); } if (!var) diff --git a/gdb/python/python.c b/gdb/python/python.c index 67d06e5..c4be31b 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -644,7 +644,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args) { do_cleanups (cleanups); /* We know this will always throw. */ - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_convert_exception (except); } if (sals.nelts) -- 1.8.1.4