From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: tromey@redhat.com (Tom Tromey)
Cc: gdb-patches@sourceware.org
Subject: [commit] Fix !HAVE_THREAD Python build error (Re: RFC: fix atexit.register)
Date: Thu, 29 Nov 2012 19:13:00 -0000 [thread overview]
Message-ID: <201211291913.qATJDdkF014222@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <874nn5d5ur.fsf@fleche.redhat.com> from "Tom Tromey" at Sep 10, 2012 01:40:12 PM
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
prev parent reply other threads:[~2012-11-29 19:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 15:43 RFC: fix atexit.register Tom Tromey
2012-09-06 16:13 ` Eli Zaretskii
2012-09-10 19:40 ` Tom Tromey
2012-09-10 19:52 ` Eli Zaretskii
2012-09-20 20:46 ` Tom Tromey
2012-09-21 7:05 ` Regression for build --without-python [Re: RFC: fix atexit.register] Jan Kratochvil
2012-11-29 19:13 ` Ulrich Weigand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201211291913.qATJDdkF014222@d06av02.portsmouth.uk.ibm.com \
--to=uweigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox