From 1906fdf30e2e890a2819bd30ec141476422ffc53 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Thu, 1 Apr 2021 19:11:59 +0200 Subject: [PATCH] [pyext] Update Makefile to disable warning Wconversion for older swig (#817) Older swig version may generate some code that can warn on long to double conversion. --- configure.ac | 11 +++++++++++ pyext/py2/Makefile.am | 3 ++- pyext/py3/Makefile.am | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f3c85cd063c6..ce403d8cbcd1 100644 --- a/configure.ac +++ b/configure.ac @@ -135,6 +135,17 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([no])]) CXXFLAGS="$SAVED_FLAGS" +AC_SUBST(NO_CAST_FUNCTION_TYPE) + +SAVED_FLAGS="$CXXFLAGS" +CXXFLAGS="-Wno-cast-function-type" +AC_MSG_CHECKING([whether CXX supports -Wno-cast-function-type]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])] + [AC_SUBST([NO_CAST_FUNCTION_TYPE], ["-Wno-cast-function-type"])], + [AC_MSG_RESULT([no])]) +CXXFLAGS="$SAVED_FLAGS" + AC_SUBST(CFLAGS_COMMON) AC_OUTPUT(Makefile diff --git a/pyext/py2/Makefile.am b/pyext/py2/Makefile.am index c73c0e5421b2..c4d97ae3342a 100644 --- a/pyext/py2/Makefile.am +++ b/pyext/py2/Makefile.am @@ -8,7 +8,8 @@ INCLUDE=-I../../SAI/inc -I../../SAI/meta -I../../SAI/experimental -I../../lib/in _pysairedis_la_SOURCES = pysairedis_wrap.cpp $(SOURCES) _pysairedis_la_CPPFLAGS = $(INCLUDE) -I/usr/include/python$(PYTHON_VERSION) $(AM_CPPFLAGS) $(CFLAGS_COMMON) \ - -Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-cast-function-type + -Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-conversion $(NO_CAST_FUNCTION_TYPE) + _pysairedis_la_LDFLAGS = -module \ -lhiredis -lswsscommon -lpthread \ -L$(top_srcdir)/lib/src/.libs -lsairedis \ diff --git a/pyext/py3/Makefile.am b/pyext/py3/Makefile.am index 994ad81d4306..97b82350b6a3 100644 --- a/pyext/py3/Makefile.am +++ b/pyext/py3/Makefile.am @@ -8,7 +8,8 @@ INCLUDE=-I../../SAI/inc -I../../SAI/meta -I../../SAI/experimental -I../../lib/in _pysairedis_la_SOURCES = pysairedis_wrap.cpp $(SOURCES) _pysairedis_la_CPPFLAGS = $(INCLUDE) -I/usr/include/python$(PYTHON3_VERSION) $(AM_CPPFLAGS) $(CFLAGS_COMMON) \ - -Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-cast-function-type + -Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-conversion $(NO_CAST_FUNCTION_TYPE) + _pysairedis_la_LDFLAGS = -module \ -lhiredis -lswsscommon -lpthread \ -L$(top_srcdir)/lib/src/.libs -lsairedis \