summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2017-03-21 16:19:50 +0100
committerPeter Simons <simons@cryp.to>2017-03-21 16:21:13 +0100
commit8f31e69c1b7fc79f78bf93ef10a18a53ddaeb765 (patch)
tree5956e170ae74462861157a0769e11e81a528a1f3
parent45f2bf2a9deffb2383051590852c371729561906 (diff)
downloadautoconf-archive-8f31e69c1b7fc79f78bf93ef10a18a53ddaeb765.tar.gz
AX_COMPILER_FLAGS_C(XX)FLAGS: only use -Wno-suggest-attribute=format if compiler supports it
Submitted in https://savannah.gnu.org/patch/index.php?9243. Suggested-by: Attila <attila@stalphonsos.com>
-rw-r--r--m4/ax_compiler_flags_cflags.m411
-rw-r--r--m4/ax_compiler_flags_cxxflags.m411
2 files changed, 18 insertions, 4 deletions
diff --git a/m4/ax_compiler_flags_cflags.m4 b/m4/ax_compiler_flags_cflags.m4
index 69162e1..aeb16e3 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 13
+#serial 14
AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
AC_REQUIRE([AC_PROG_SED])
@@ -50,6 +50,13 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
ax_compiler_flags_test=""
])
+ # Check that -Wno-suggest-attribute=format is supported
+ AX_CHECK_COMPILE_FLAG([-Wno-suggest-attribute=format],[
+ ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format"
+ ],[
+ ax_compiler_no_suggest_attribute_flags=""
+ ])
+
# Base flags
AX_APPEND_COMPILE_FLAGS([ dnl
-fno-strict-aliasing dnl
@@ -108,7 +115,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
AX_APPEND_FLAG([-Werror],ax_warn_cflags_variable)
AX_APPEND_COMPILE_FLAGS([ dnl
- -Wno-suggest-attribute=format dnl
+ [$ax_compiler_no_suggest_attribute_flags] dnl
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
])
diff --git a/m4/ax_compiler_flags_cxxflags.m4 b/m4/ax_compiler_flags_cxxflags.m4
index 405cee0..3067d9b 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 9
+#serial 10
AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
AC_REQUIRE([AC_PROG_SED])
@@ -51,6 +51,13 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
ax_compiler_flags_test=""
])
+ # Check that -Wno-suggest-attribute=format is supported
+ AX_CHECK_COMPILE_FLAG([-Wno-suggest-attribute=format],[
+ ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format"
+ ],[
+ ax_compiler_no_suggest_attribute_flags=""
+ ])
+
# Base flags
AX_APPEND_COMPILE_FLAGS([ dnl
-fno-strict-aliasing dnl
@@ -104,7 +111,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
AX_APPEND_FLAG([-Werror],ax_warn_cxxflags_variable)
AX_APPEND_COMPILE_FLAGS([ dnl
- -Wno-suggest-attribute=format dnl
+ [$ax_compiler_no_suggest_attribute_flags] dnl
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
])