bt2: ignore -Wredundant-decls warning
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 23 Feb 2023 19:29:42 +0000 (14:29 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 13 Mar 2023 15:26:10 +0000 (11:26 -0400)
The ppc builder on the CI, which uses Python 3.11 + gcc 12.2.0, shows
this warning:

    In file included from /usr/include/python3.11/Python.h:91,
                     from bt2/native_bt.c:168:
    /usr/include/python3.11/modsupport.h:37:24: error: redundant redeclaration of ‘_Py_BuildValue_SizeT’ [-Werror=redundant-decls]
       37 | PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
          |                        ^~~~~~~~~~~~~~~~~~~~
    /usr/include/python3.11/modsupport.h:20:41: note: previous declaration of ‘_Py_BuildValue_SizeT’ with type ‘PyObject *(const char *, ...)’ {aka ‘struct _object *(const char *, ...)’}
       20 | #define Py_BuildValue                   _Py_BuildValue_SizeT
          |                                         ^~~~~~~~~~~~~~~~~~~~
    /usr/include/python3.11/modsupport.h:36:24: note: in expansion of macro ‘Py_BuildValue’
       36 | PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
          |                        ^~~~~~~~~~~~~

I tried fixing it by placing some push/ignored/pop diagnostic pragmas in
the SWIG sections %begin and %runtime, which would be around the
Python.h including in the generated native_bt.c file, but it doesn't
silence the warning for some reason.

Ignore the warning for the whole native_bt.c compilation instead.

Change-Id: Idae04fb30af8108ad14647d9b8f85b2d01a568be
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
(cherry picked from commit 92e41f9132ac72f234deb2f39f2eae0b1858cfc0)
Reviewed-on: https://review.lttng.org/c/babeltrace/+/9567
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/bindings/python/bt2/Makefile.am

index 7efab895abd069c095584bb4877ca18acba4e6c9..6dc518d2ba5d194a68029823d32ed64ea0b21773 100644 (file)
@@ -117,6 +117,9 @@ WARN_CFLAGS += -Wno-null-dereference
 # code.
 WARN_CFLAGS += -Wno-deprecated-declarations
 
+# Python 3.11 + gcc 12.2.0 gave warnings of this kind in Python.h.
+WARN_CFLAGS += -Wno-redundant-decls
+
 BUILD_FLAGS=CC="$(CC)" \
                CFLAGS="$(GLIB_CFLAGS) $(AM_CFLAGS) $(CFLAGS) $(WARN_CFLAGS)" \
                CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS) -I$(srcdir)/bt2" \
This page took 0.025724 seconds and 4 git commands to generate.