[obv] Fix python-2.4 compilation compat. [Re: [commit] [PATCH] Allow 64-bit enum values]

Jan Kratochvil
2012-04-20T07:21:23Z

On Fri, 20 Apr 2012 04:47:20 +0200, Siddhesh Poyarekar wrote:
> On Thu, 19 Apr 2012 18:38:07 +0200 (CEST), Ulrich wrote:
> > This causes a build failure for me due to:
> > py-type.c: In function 'convert_field':
> > py-type.c:186: warning: passing argument 2 of
> > 'PyObject_SetAttrString' discards qualifiers from pointer target type
[...]
> I think you should be able to patch that header safely.

GDB Python is kept compatible backwards to python-2.4 (although testsuite is
lacking that compatibility). At least Red Hat even needs that compatibility
for RHEL-5.

Added CentOS-5 (and CentOS-6) for the automatic nightly regression testing of
CVS HEAD.

Checked in. I do not think autoconf-checking is worth this case.

Thanks,
Jan

http://sourceware.org/ml/gdb-cvs/2012-04/msg00163.html

--- src/gdb/ChangeLog 2012/04/19 20:18:22 1.14140
+++ src/gdb/ChangeLog 2012/04/20 07:17:53 1.14141
@@ -1,3 +1,9 @@
+2012-04-20 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix compilation compatibility with python-2.4
+ * python/py-type.c (convert_field): Cast ADDRSTRING for
+ PyObject_SetAttrString as non-const. New comment.
+
2012-04-19 Tom Tromey <tromey@redhat.com>

* top.c (quit_target): Use all_cleanups.
--- src/gdb/python/py-type.c 2012/04/18 06:46:46 1.37
+++ src/gdb/python/py-type.c 2012/04/20 07:17:58 1.38
@@ -183,7 +183,8 @@
if (!arg)
goto fail;

- if (PyObject_SetAttrString (result, attrstring, arg) < 0)
+ /* At least python-2.4 had the second parameter non-const. */
+ if (PyObject_SetAttrString (result, (char *) attrstring, arg) < 0)
goto failarg;
}