diff options
Diffstat (limited to 'm4')
-rw-r--r-- | m4/manywarnings.m4 | 6 | ||||
-rw-r--r-- | m4/warnings.m4 | 15 |
2 files changed, 14 insertions, 7 deletions
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index 45a30afda70..be6d4c91c50 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 @@ -98,6 +98,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], -W \ -Wabi \ -Waddress \ + -Waggressive-loop-optimizations \ -Wall \ -Warray-bounds \ -Wattributes \ @@ -125,7 +126,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], -Wformat-security \ -Wformat-y2k \ -Wformat-zero-length \ - -Wformat=2 \ -Wfree-nonheap-object \ -Wignored-qualifiers \ -Wimplicit \ @@ -143,9 +143,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], -Wmissing-braces \ -Wmissing-declarations \ -Wmissing-field-initializers \ - -Wmissing-format-attribute \ -Wmissing-include-dirs \ - -Wmissing-noreturn \ -Wmissing-parameter-type \ -Wmissing-prototypes \ -Wmudflap \ @@ -166,6 +164,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], -Wpointer-sign \ -Wpointer-to-int-cast \ -Wpragmas \ + -Wreturn-local-addr \ -Wreturn-type \ -Wsequence-point \ -Wshadow \ @@ -187,7 +186,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], -Wtype-limits \ -Wuninitialized \ -Wunknown-pragmas \ - -Wunreachable-code \ -Wunsafe-loop-optimizations \ -Wunused \ -Wunused-but-set-parameter \ 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]) |