This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/4 v20] Add xmethod support to the Python API


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]