+ BASE_WARNINGS="-pedantic -Wall -Wextra ${W_FAIL} -Wundef -Wshadow -Wmissing-declarations -Wstrict-aliasing -Wformat=2 ${F_DIAGNOSTICS_SHOW_OPTION} ${W_CONVERSION}"
+ CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wswitch-default -Wswitch-enum -Wcast-align"
+ CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wold-style-cast -Weffc++ -Wno-long-long"
+
+ AC_CACHE_CHECK([whether it is safe to use -Wlogical-op],
+ [ac_cv_safe_to_use_Wlogical_op_],
+ [save_CFLAGS="$CFLAGS"
+ CFLAGS="-Wlogical-op"
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM(
+ [[
+#include <stdio>
+ ]], [[]])
+ ],
+ [ac_cv_safe_to_use_Wlogical_op_=yes],
+ [ac_cv_safe_to_use_Wlogical_op_=no])
+ CFLAGS="$save_CFLAGS"])
+ AS_IF([test "$ac_cv_safe_to_use_Wlogical_op_" = "yes"],
+ [CC_WARNINGS="${CC_WARNINGS} -Wlogical-op"])
+
+ AC_CACHE_CHECK([whether it is safe to use -Wredundant-decls from C++],
+ [ac_cv_safe_to_use_Wredundant_decls_],
+ [AC_LANG_PUSH(C++)
+ save_CXXFLAGS="${CXXFLAGS}"
+ CXXFLAGS="${CXXFLAGS} ${W_FAIL} -Wredundant-decls"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+template <typename E> struct C { void foo(); };
+template <typename E> void C<E>::foo() { }
+template <> void C<int>::foo();
+ AC_INCLUDES_DEFAULT])],
+ [ac_cv_safe_to_use_Wredundant_decls_=yes],
+ [ac_cv_safe_to_use_Wredundant_decls_=no])
+ CXXFLAGS="${save_CXXFLAGS}"
+ AC_LANG_POP()])
+ AS_IF([test "$ac_cv_safe_to_use_Wredundant_decls_" = "yes"],
+ [CXX_WARNINGS="${CXX_WARNINGS} -Wredundant-decls"],
+ [CXX_WARNINGS="${CXX_WARNINGS} -Wno-redundant-decls"])
+
+ NO_REDUNDANT_DECLS="-Wno-redundant-decls"
+fi