From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6012 invoked by alias); 19 Apr 2013 14:32:05 -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 6003 invoked by uid 89); 19 Apr 2013 14:32:05 -0000 X-Spam-SWARE-Status: No, score=-6.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BJ,TW_EV,TW_VP 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; Fri, 19 Apr 2013 14:32:04 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3JEW3ov013335 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Apr 2013 10:32:03 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3JEW11U026140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 19 Apr 2013 10:32:02 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 09/28] introduce and use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION References: <87ehe638ww.fsf@fleche.redhat.com> Date: Fri, 19 Apr 2013 14:41:00 -0000 In-Reply-To: <87ehe638ww.fsf@fleche.redhat.com> (Tom Tromey's message of "Fri, 19 Apr 2013 08:13:51 -0600") Message-ID: <87y5cezj4u.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-04/txt/msg00592.txt.bz2 The checker provides an attribute that indicates that a function sets the Python exception if it returns a negative value. This patch introduces a new macro for this attribute and changes gdb to use it where appropriate. * python/py-event.h (gdbpy_initialize_event_generic): Use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION. * python/py-evts.c (add_new_registry): Use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION. * python/python-internal.h (CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION): New macro. --- gdb/python/py-event.h | 7 ++++--- gdb/python/py-evts.c | 2 +- gdb/python/python-internal.h | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h index 1db8bd2..4850f1a 100644 --- a/gdb/python/py-event.h +++ b/gdb/python/py-event.h @@ -115,8 +115,9 @@ extern int emit_new_objfile_event (struct objfile *objfile); extern void evpy_dealloc (PyObject *self); extern int evpy_add_attribute (PyObject *event, - char *name, PyObject *attr); -int gdbpy_initialize_event_generic (PyTypeObject *type, char *name); - + char *name, PyObject *attr) + CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; +int gdbpy_initialize_event_generic (PyTypeObject *type, char *name) + CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; #endif /* GDB_PY_EVENT_H */ diff --git a/gdb/python/py-evts.c b/gdb/python/py-evts.c index 4c079e2..427b6d5 100644 --- a/gdb/python/py-evts.c +++ b/gdb/python/py-evts.c @@ -37,7 +37,7 @@ static struct PyModuleDef EventModuleDef = /* Initialize python events. */ -static int +static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION add_new_registry (eventregistry_object **registryp, char *name) { *registryp = create_eventregistry_object (); diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 57fcc74..b887b66 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -47,6 +47,13 @@ #define CPYCHECKER_SETS_EXCEPTION #endif +#ifdef WITH_CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION_ATTRIBUTE +#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION \ + __attribute__ ((cpychecker_negative_result_sets_exception)) +#else +#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION +#endif + #include /* Python 2.4 doesn't include stdint.h soon enough to get {u,}intptr_t -- 1.8.1.4