From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12495 invoked by alias); 4 Jun 2014 14:39:15 -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 12486 invoked by uid 89); 4 Jun 2014 14:39:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: e06smtp11.uk.ibm.com Received: from e06smtp11.uk.ibm.com (HELO e06smtp11.uk.ibm.com) (195.75.94.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 04 Jun 2014 14:39:14 +0000 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Jun 2014 15:39:11 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Jun 2014 15:39:08 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 272211B08051 for ; Wed, 4 Jun 2014 15:39:31 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s54Ed7eW29950018 for ; Wed, 4 Jun 2014 14:39:07 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s54Ed62R003673 for ; Wed, 4 Jun 2014 08:39:07 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id s54Ed5O9003601; Wed, 4 Jun 2014 08:39:05 -0600 Message-Id: <201406041439.s54Ed5O9003601@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 04 Jun 2014 16:39:05 +0200 Subject: Re: [PATCH 4/4 v20] Add xmethod support to the Python API To: sivachandra@google.com (Siva Chandra) Date: Wed, 04 Jun 2014 14:39:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org (gdb-patches) In-Reply-To: from "Siva Chandra" at Jun 02, 2014 11:58:44 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14060414-5024-0000-0000-0000003A4864 X-SW-Source: 2014-06/txt/msg00169.txt.bz2 Siva Chandra wrote: > 2014-06-02 Siva Chandra Reddy > > * python/py-xmethods.c: New file. This fails to build with -Werror against Python 2.4: cc1: warnings being treated as errors /home/uweigand/dailybuild/spu-tc-2014-06-03/binutils-gdb-head/binutils-gdb/gdb/python/py-xmethods.c: In function 'invoke_match_method': /home/uweigand/dailybuild/spu-tc-2014-06-03/binutils-gdb-head/binutils-gdb/gdb/python/py-xmethods.c:109: warning: passing argument 2 of 'PyObject_GetAttrString' discards qualifiers from pointer target type /home/uweigand/dailybuild/spu-tc-2014-06-03/binutils-gdb-head/binutils-gdb/gdb/python/py-xmethods.c:130: warning: passing argument 2 of 'PyObject_GetAttrString' discards qualifiers from pointer target type /home/uweigand/dailybuild/spu-tc-2014-06-03/binutils-gdb-head/binutils-gdb/gdb/python/py-xmethods.c: In function 'gdbpy_get_matching_xmethod_workers': /home/uweigand/dailybuild/spu-tc-2014-06-03/binutils-gdb-head/binutils-gdb/gdb/python/py-xmethods.c:255: warning: passing argument 2 of 'PyObject_HasAttrString' discards qualifiers from pointer target type /home/uweigand/dailybuild/spu-tc-2014-06-03/binutils-gdb-head/binutils-gdb/gdb/python/py-xmethods.c:261: warning: passing argument 2 of 'PyObject_GetAttrString' discards qualifiers from pointer target type /home/uweigand/dailybuild/spu-tc-2014-06-03/binutils-gdb-head/binutils-gdb/gdb/python/py-xmethods.c: In function 'gdbpy_get_xmethod_arg_types': /home/uweigand/dailybuild/spu-tc-2014-06-03/binutils-gdb-head/binutils-gdb/gdb/python/py-xmethods.c:395: warning: passing argument 2 of 'PyObject_GetAttrString' discards qualifiers from pointer target type The problem is that in Python 2.4, the second argument to PyObject_GetAttrString was missing the "const" qualifier. In other places, we've been working around this by adding (char *) casts as necessary. However, with the new code I'm wondering: static const char enabled_field_name[] = "enabled"; [...] enabled_field = PyObject_GetAttrString (matcher, enabled_field_name); What's the reason for using that variable instead of just enabled_field = PyObject_GetAttrString (matcher, "enabled"); (as is done elsewhere in the GDB Python code)? Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com