This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fix compilation warnings triggered by Python's pyerrors.h
> Date: Fri, 15 Mar 2013 16:39:29 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: gdb-patches@sourceware.org
>
> > From: Tom Tromey <tromey@redhat.com>
> > Cc: gdb-patches@sourceware.org
> > Date: Thu, 14 Mar 2013 11:45:57 -0600
> >
> > >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
> >
> > Eli> Suggested work-around: Define HAVE_SNPRINTF in defs.h:
> >
> > Why defs.h and not python-internal.h?
>
> Because I didn't know that all includes of pyerrors.h go through
> python-internal.h ;-)
>
> > I think that, if it works, it is better to try to contain the weirdness
> > to the Python code.
>
> I agree. I will make sure it works and commit a modified patch.
It worked, so I committed the below.
Could someone please do me a favor and commit the same to the 7.6
branch? TIA.
2013-03-17 Eli Zaretskii <eliz@gnu.org>
* python/python-internal.h (HAVE_SNPRINTF)
[_WIN32 && HAVE_DECL_SNPRINTF]: Define, to avoid compiler warnings
about redefinition of snprintf by pyerrors.h.
Index: gdb/python/python-internal.h
===================================================================
RCS file: /cvs/src/src/gdb/python/python-internal.h,v
retrieving revision 1.63
diff -u -r1.63 python-internal.h
--- gdb/python/python-internal.h 6 Mar 2013 19:51:18 -0000 1.63
+++ gdb/python/python-internal.h 17 Mar 2013 19:09:01 -0000
@@ -41,6 +41,11 @@
around technique as above. */
#undef _FILE_OFFSET_BITS
+/* A kludge to avoid redefinition of snprintf on Windows by pyerrors.h. */
+#if defined(_WIN32) && defined(HAVE_DECL_SNPRINTF)
+#define HAVE_SNPRINTF 1
+#endif
+
/* Request clean size types from Python. */
#define PY_SSIZE_T_CLEAN