This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 4/4 v20] Add xmethod support to the Python API
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: sivachandra at google dot com (Siva Chandra)
- Cc: gdb-patches at sourceware dot org (gdb-patches)
- Date: Wed, 4 Jun 2014 16:39:05 +0200 (CEST)
- Subject: Re: [PATCH 4/4 v20] Add xmethod support to the Python API
- Authentication-results: sourceware.org; auth=none
Siva Chandra wrote:
> 2014-06-02 Siva Chandra Reddy <sivachandra@google.com>
>
> * 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