This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix !HAVE_THREAD Python build error (Re: RFC: fix atexit.register)
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: tromey at redhat dot com (Tom Tromey)
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 29 Nov 2012 20:13:39 +0100 (CET)
- Subject: [commit] Fix !HAVE_THREAD Python build error (Re: RFC: fix atexit.register)
Tom Tromey wrote:
> +static void
> +finalize_python (void *ignore)
> +{
> + /* We don't use ensure_python_env here because if we ever ran the
> + cleanup, gdb would crash -- because the cleanup calls into the
> + Python interpreter, which we are about to destroy. It seems
> + clearer to make the needed calls explicitly here than to create a
> + cleanup and then mysteriously discard it. */
> + PyGILState_Ensure ();
> + python_gdbarch = target_gdbarch;
> + python_language = current_language;
> +
> + Py_Finalize ();
> +}
If WITH_THREAD is not defined, we use this definition from python-internal.h:
#define PyGILState_Ensure() ((PyGILState_STATE) 0)
This causes build to abort for me with the error:
/home/uweigand/fsf/gdb-head/gdb/python/python.c: In function 'finalize_python':
/home/uweigand/fsf/gdb-head/gdb/python/python.c:1418: warning: statement with no effect
Fixed by the following patch, committed as obvious.
Bye,
Ulrich
ChangeLog:
* python/python.c (finalize_python): Cast unused PyGILState_Ensure
return value to void to avoid compiler warning.
Index: gdb/python/python.c
===================================================================
RCS file: /cvs/src/src/gdb/python/python.c,v
retrieving revision 1.101
diff -u -p -r1.101 python.c
--- gdb/python/python.c 12 Nov 2012 19:24:14 -0000 1.101
+++ gdb/python/python.c 29 Nov 2012 18:58:30 -0000
@@ -1415,7 +1415,7 @@ finalize_python (void *ignore)
Python interpreter, which we are about to destroy. It seems
clearer to make the needed calls explicitly here than to create a
cleanup and then mysteriously discard it. */
- PyGILState_Ensure ();
+ (void) PyGILState_Ensure ();
python_gdbarch = target_gdbarch ();
python_language = current_language;
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com