AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
+# as above, C++ flags
+AC_DEFUN([AC_GXX_WARNING_SUBST_NO],[
+ AC_MSG_CHECKING([if g++ accepts -W$1])
+ safe_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="-W$1 -Werror"
+ AC_LANG_PUSH(C++)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
+ AC_SUBST([$2], [-Wno-$1])
+ AC_LANG_POP()
+ AC_MSG_RESULT([yes])], [
+ AC_SUBST([$2], [])
+ AC_MSG_RESULT([no])])
+ CXXFLAGS=$safe_CXXFLAGS
+])
+
+AC_GXX_WARNING_SUBST_NO([missing-exception-spec], [FLAG_W_NO_MISSING_EXCEPTION_SPEC])
+AC_GXX_WARNING_SUBST_NO([implicit-exception-spec-mismatch], [FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH])
+
# Does this compiler support -Wformat-security ?
# Special handling is needed, because certain GCC versions require -Wformat
# being present if -Wformat-security is given. Otherwise a warning is issued.
new_cpp_SOURCES = new-cpp.cpp
overloaded_new_SOURCES = overloaded-new.cpp
# aligned new needs C++17
-overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) -Wno-implicit-exception-spec-mismatch -Wno-missing-exception-spec -std=c++17
+overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) @FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH@ @FLAG_W_NO_MISSING_EXCEPTION_SPEC@ -std=c++17
# Suppress warnings for issues we are testing for
alloc_fns_CFLAGS = $(AM_CFLAGS) -Wno-unused-result