summaryrefslogtreecommitdiff
path: root/m4/warnings.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-05-16 00:10:39 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-05-16 00:10:39 -0700
commitcdd0de4b056b4612e055fa15f65af118dafc9b18 (patch)
treea9d72533fb38b82969308316c958a3263d85d10d /m4/warnings.m4
parent9df4ec5e9044e92e792ba9e8cb714603e32c5cc5 (diff)
downloademacs-cdd0de4b056b4612e055fa15f65af118dafc9b18.tar.gz
Merge from gnulib.
2013-05-15 manywarnings: update for GCC 4.8.0 2013-05-15 stdio: use __REDIRECT for fwrite, fwrite_unlocked 2013-05-15 sig2str, stdio, warnings: port to clang
Diffstat (limited to 'm4/warnings.m4')
-rw-r--r--m4/warnings.m415
1 files changed, 12 insertions, 3 deletions
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index 4b2ac385019..184873283bb 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,4 +1,4 @@
-# warnings.m4 serial 7
+# warnings.m4 serial 8
dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -27,7 +27,7 @@ AC_DEFUN([gl_COMPILER_OPTION_IF],
AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
gl_save_compiler_FLAGS="$gl_Flags"
- gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $1"])
+ gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $gl_unknown_warnings_are_errors $1"])
AC_COMPILE_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
[AS_VAR_SET(gl_Warn, [yes])],
[AS_VAR_SET(gl_Warn, [no])])
@@ -38,6 +38,14 @@ AS_VAR_POPDEF([gl_Flags])dnl
AS_VAR_POPDEF([gl_Warn])dnl
])
+# gl_UNKNOWN_WARNINGS_ARE_ERRORS
+# ------------------------------
+# Clang doesn't complain about unknown warning options unless one also
+# specifies -Wunknown-warning-option -Werror. Detect this.
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
+[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option],
+ [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'],
+ [gl_unknown_warnings_are_errors=])])
# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
# [PROGRAM = AC_LANG_PROGRAM()])
@@ -47,7 +55,8 @@ AS_VAR_POPDEF([gl_Warn])dnl
#
# If VARIABLE is a variable name, AC_SUBST it.
AC_DEFUN([gl_WARN_ADD],
-[gl_COMPILER_OPTION_IF([$1],
+[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS])
+gl_COMPILER_OPTION_IF([$1],
[gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
[],
[$3])