From 2d44f8b36dc75971082d70f3f4bd0cac523c2eef Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Wed, 14 Apr 2021 15:14:45 -0400 Subject: [PATCH] Fix: python: -Wshadow warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes warning when building Python Bindings with SWIG 3.0.12. lttng_wrap.c: In function ‘SWIG_Python_NewShadowInstance’: lttng_wrap.c:2483:65: warning: declaration of ‘swig_this’ shadows a global declaration [-Wshadow] SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) ^~~~~~~~~ lttng_wrap.c:2224:18: note: shadowed declaration is here static PyObject *swig_this = NULL; ^~~~~~~~~ lttng_wrap.c: In function ‘SWIG_Python_SetSwigThis’: lttng_wrap.c:2558:51: warning: declaration of ‘swig_this’ shadows a global declaration [-Wshadow] SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) ^~~~~~~~~ lttng_wrap.c:2224:18: note: shadowed declaration is here static PyObject *swig_this = NULL; Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: Icde5f124e914a158eb190f95e3c012b7f800d7d1 --- extras/bindings/swig/python/Makefile.am | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extras/bindings/swig/python/Makefile.am b/extras/bindings/swig/python/Makefile.am index bdecadcae..209f5bd61 100644 --- a/extras/bindings/swig/python/Makefile.am +++ b/extras/bindings/swig/python/Makefile.am @@ -3,6 +3,13 @@ lttng.i: lttng.i.in $(SED) "s/LTTNG_VERSION_STR/LTTng $(PACKAGE_VERSION)/g" < $(srcdir)/lttng.i.in >lttng.i +# Some versions of SWIG (like 3.0.12) generate code where a parameter called +# `swig_this` shadows a global of the same name. Later versions (like 4.0.1) +# have renamed this global to `Swig_This_global`. +# +# Disable -Wshadow for that file. +AM_CFLAGS += -Wno-shadow + AM_CPPFLAGS += $(PYTHON_INCLUDE) EXTRA_DIST = lttng.i.in -- 2.34.1