summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--m4/ax_compiler_flags_cflags.m422
-rw-r--r--m4/ax_compiler_flags_cxxflags.m423
2 files changed, 30 insertions, 15 deletions
diff --git a/m4/ax_compiler_flags_cflags.m4 b/m4/ax_compiler_flags_cflags.m4
index 87ce4d0..e4f64c5 100644
--- a/m4/ax_compiler_flags_cflags.m4
+++ b/m4/ax_compiler_flags_cflags.m4
@@ -25,7 +25,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 6
+#serial 7
AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
@@ -55,10 +55,6 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
$3 dnl
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
- # In the flags below, when disabling specific flags, always add *both*
- # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
- # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall,
- # which effectively turns that flag back on again as an error.
AS_IF([test "$ax_enable_compile_warnings" != "no"],[
# "minimum" flags
AX_APPEND_COMPILE_FLAGS([ dnl
@@ -80,9 +76,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
-Wstrict-prototypes dnl
-Wredundant-decls dnl
-Wno-unused-parameter dnl
- -Wno-error=unused-parameter dnl
-Wno-missing-field-initializers dnl
- -Wno-error=missing-field-initializers dnl
-Wdeclaration-after-statement dnl
-Wformat=2 dnl
-Wold-style-definition dnl
@@ -129,6 +123,20 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
])
+ # In the flags below, when disabling specific flags, always add *both*
+ # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
+ # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall,
+ # which effectively turns that flag back on again as an error.
+ for flag in $ax_warn_cflags_variable; do
+ AS_CASE([$flag],
+ [-Wno-*=*],[],
+ [-Wno-*],[
+ AX_APPEND_COMPILE_FLAGS([-Wno-error=${flag:5}],
+ ax_warn_cflags_variable,
+ [$ax_compiler_flags_test])
+ ])
+ done
+
AC_LANG_POP([C])
# Substitute the variables
diff --git a/m4/ax_compiler_flags_cxxflags.m4 b/m4/ax_compiler_flags_cxxflags.m4
index 6031a6f..d3e872b 100644
--- a/m4/ax_compiler_flags_cxxflags.m4
+++ b/m4/ax_compiler_flags_cxxflags.m4
@@ -26,7 +26,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 2
+#serial 3
AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
@@ -56,10 +56,6 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
$3 dnl
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
- # In the flags below, when disabling specific flags, always add *both*
- # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
- # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall,
- # which effectively turns that flag back on again as an error.
AS_IF([test "$ax_enable_compile_warnings" != "no"],[
# "minimum" flags
AX_APPEND_COMPILE_FLAGS([ dnl
@@ -78,9 +74,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
-Wmissing-declarations dnl
-Wredundant-decls dnl
-Wno-unused-parameter dnl
- -Wno-error=unused-parameter dnl
-Wno-missing-field-initializers dnl
- -Wno-error=missing-field-initializers dnl
-Wformat=2 dnl
-Wcast-align dnl
-Wformat-nonliteral dnl
@@ -99,7 +93,6 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
-Warray-bounds dnl
-Wreturn-type dnl
-Wno-overloaded-virtual dnl
- -Wno-error=overloaded-virtual dnl
$5 dnl
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
])
@@ -126,6 +119,20 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
])
+ # In the flags below, when disabling specific flags, always add *both*
+ # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
+ # we enable -Werror, disable a flag, and a build bot passes CXXFLAGS=-Wall,
+ # which effectively turns that flag back on again as an error.
+ for flag in $ax_warn_cxxflags_variable; do
+ AS_CASE([$flag],
+ [-Wno-*=*],[],
+ [-Wno-*],[
+ AX_APPEND_COMPILE_FLAGS([-Wno-error=${flag:5}],
+ ax_warn_cxxflags_variable,
+ [$ax_compiler_flags_test])
+ ])
+ done
+
AC_LANG_POP([C++])
# Substitute the variables