Skip to content

Commit 1906fdf

Browse files
authored
[pyext] Update Makefile to disable warning Wconversion for older swig (sonic-net#817)
Older swig version may generate some code that can warn on long to double conversion.
1 parent 1dbcaeb commit 1906fdf

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

configure.ac

+11
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
135135
[AC_MSG_RESULT([no])])
136136
CXXFLAGS="$SAVED_FLAGS"
137137

138+
AC_SUBST(NO_CAST_FUNCTION_TYPE)
139+
140+
SAVED_FLAGS="$CXXFLAGS"
141+
CXXFLAGS="-Wno-cast-function-type"
142+
AC_MSG_CHECKING([whether CXX supports -Wno-cast-function-type])
143+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
144+
[AC_MSG_RESULT([yes])]
145+
[AC_SUBST([NO_CAST_FUNCTION_TYPE], ["-Wno-cast-function-type"])],
146+
[AC_MSG_RESULT([no])])
147+
CXXFLAGS="$SAVED_FLAGS"
148+
138149
AC_SUBST(CFLAGS_COMMON)
139150

140151
AC_OUTPUT(Makefile

pyext/py2/Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ INCLUDE=-I../../SAI/inc -I../../SAI/meta -I../../SAI/experimental -I../../lib/in
88

99
_pysairedis_la_SOURCES = pysairedis_wrap.cpp $(SOURCES)
1010
_pysairedis_la_CPPFLAGS = $(INCLUDE) -I/usr/include/python$(PYTHON_VERSION) $(AM_CPPFLAGS) $(CFLAGS_COMMON) \
11-
-Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-cast-function-type
11+
-Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-conversion $(NO_CAST_FUNCTION_TYPE)
12+
1213
_pysairedis_la_LDFLAGS = -module \
1314
-lhiredis -lswsscommon -lpthread \
1415
-L$(top_srcdir)/lib/src/.libs -lsairedis \

pyext/py3/Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ INCLUDE=-I../../SAI/inc -I../../SAI/meta -I../../SAI/experimental -I../../lib/in
88

99
_pysairedis_la_SOURCES = pysairedis_wrap.cpp $(SOURCES)
1010
_pysairedis_la_CPPFLAGS = $(INCLUDE) -I/usr/include/python$(PYTHON3_VERSION) $(AM_CPPFLAGS) $(CFLAGS_COMMON) \
11-
-Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-cast-function-type
11+
-Wno-cast-qual -Wno-shadow -Wno-redundant-decls -Wno-conversion $(NO_CAST_FUNCTION_TYPE)
12+
1213
_pysairedis_la_LDFLAGS = -module \
1314
-lhiredis -lswsscommon -lpthread \
1415
-L$(top_srcdir)/lib/src/.libs -lsairedis \

0 commit comments

Comments
 (0)