From a8cecd6ed7b3a87d6b3360011ef13b0a24e08b7d Mon Sep 17 00:00:00 2001 From: kcudnik Date: Thu, 1 Apr 2021 10:14:35 +0200 Subject: [PATCH 1/2] [pyext] Update Makefile to not use conversion Older swig version may generate some code that can warn on long to double conversion. --- pyext/py2/Makefile.am | 3 ++- pyext/py3/Makefile.am | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyext/py2/Makefile.am b/pyext/py2/Makefile.am index c73c0e542..f424f41d4 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 + _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 994ad81d4..c93309283 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 + _pysairedis_la_LDFLAGS = -module \ -lhiredis -lswsscommon -lpthread \ -L$(top_srcdir)/lib/src/.libs -lsairedis \ From 73cbb71a0e53be5e72d39cd623fa7b62c1ef9189 Mon Sep 17 00:00:00 2001 From: kcudnik Date: Thu, 1 Apr 2021 10:42:57 +0200 Subject: [PATCH 2/2] [pyext] Make cast-function-type optional param --- configure.ac | 11 +++++++++++ pyext/py2/Makefile.am | 2 +- pyext/py3/Makefile.am | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f3c85cd06..ce403d8cb 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 f424f41d4..c4d97ae33 100644 --- a/pyext/py2/Makefile.am +++ b/pyext/py2/Makefile.am @@ -8,7 +8,7 @@ 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-conversion + -Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-conversion $(NO_CAST_FUNCTION_TYPE) _pysairedis_la_LDFLAGS = -module \ -lhiredis -lswsscommon -lpthread \ diff --git a/pyext/py3/Makefile.am b/pyext/py3/Makefile.am index c93309283..97b82350b 100644 --- a/pyext/py3/Makefile.am +++ b/pyext/py3/Makefile.am @@ -8,7 +8,7 @@ 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-conversion + -Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-conversion $(NO_CAST_FUNCTION_TYPE) _pysairedis_la_LDFLAGS = -module \ -lhiredis -lswsscommon -lpthread \