diff options
| author | Paul Eggert | 2012-10-04 00:15:42 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-10-04 00:15:42 -0700 |
| commit | bb1dfdadd507bb4b77595c87875ef807c101ed7b (patch) | |
| tree | eb92a2335896c34e76a9e19362049396b8d0483f /m4/manywarnings.m4 | |
| parent | 88d69b7ddca305bb96d6e671300f6724e4f147dd (diff) | |
| download | emacs-bb1dfdadd507bb4b77595c87875ef807c101ed7b.tar.gz emacs-bb1dfdadd507bb4b77595c87875ef807c101ed7b.zip | |
Merge from gnulib.
Diffstat (limited to 'm4/manywarnings.m4')
| -rw-r--r-- | m4/manywarnings.m4 | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index 2760efb3f27..f3cb23be1cd 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # manywarnings.m4 serial 4 | 1 | # manywarnings.m4 serial 5 |
| 2 | dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -35,14 +35,12 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT], | |||
| 35 | # make sure your gcc understands it. | 35 | # make sure your gcc understands it. |
| 36 | AC_DEFUN([gl_MANYWARN_ALL_GCC], | 36 | AC_DEFUN([gl_MANYWARN_ALL_GCC], |
| 37 | [ | 37 | [ |
| 38 | dnl First, check if -Wno-missing-field-initializers is needed. | 38 | dnl First, check for some issues that only occur when combining multiple |
| 39 | dnl -Wmissing-field-initializers is implied by -W, but that issues | 39 | dnl gcc warning categories. |
| 40 | dnl warnings with GCC version before 4.7, for the common idiom | ||
| 41 | dnl of initializing types on the stack to zero, using { 0, } | ||
| 42 | AC_REQUIRE([AC_PROG_CC]) | 40 | AC_REQUIRE([AC_PROG_CC]) |
| 43 | if test -n "$GCC"; then | 41 | if test -n "$GCC"; then |
| 44 | 42 | ||
| 45 | dnl First, check -W -Werror -Wno-missing-field-initializers is supported | 43 | dnl Check if -W -Werror -Wno-missing-field-initializers is supported |
| 46 | dnl with the current $CC $CFLAGS $CPPFLAGS. | 44 | dnl with the current $CC $CFLAGS $CPPFLAGS. |
| 47 | AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) | 45 | AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) |
| 48 | AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ | 46 | AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ |
| @@ -77,8 +75,24 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], | |||
| 77 | ]) | 75 | ]) |
| 78 | AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) | 76 | AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) |
| 79 | fi | 77 | fi |
| 78 | |||
| 79 | dnl Next, check if -Werror -Wuninitialized is useful with the | ||
| 80 | dnl user's choice of $CFLAGS; some versions of gcc warn that it | ||
| 81 | dnl has no effect if -O is not also used | ||
| 82 | AC_MSG_CHECKING([whether -Wuninitialized is supported]) | ||
| 83 | AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [ | ||
| 84 | gl_save_CFLAGS="$CFLAGS" | ||
| 85 | CFLAGS="$CFLAGS -Werror -Wuninitialized" | ||
| 86 | AC_COMPILE_IFELSE( | ||
| 87 | [AC_LANG_PROGRAM([[]], [[]])], | ||
| 88 | [gl_cv_cc_uninitialized_supported=yes], | ||
| 89 | [gl_cv_cc_uninitialized_supported=no]) | ||
| 90 | CFLAGS="$gl_save_CFLAGS"]) | ||
| 91 | AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported]) | ||
| 92 | |||
| 80 | fi | 93 | fi |
| 81 | 94 | ||
| 95 | # List all gcc warning categories. | ||
| 82 | gl_manywarn_set= | 96 | gl_manywarn_set= |
| 83 | for gl_manywarn_item in \ | 97 | for gl_manywarn_item in \ |
| 84 | -W \ | 98 | -W \ |
| @@ -197,10 +211,14 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], | |||
| 197 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" | 211 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" |
| 198 | done | 212 | done |
| 199 | 213 | ||
| 200 | # Disable the missing-field-initializers warning if needed | 214 | # Disable specific options as needed. |
| 201 | if test "$gl_cv_cc_nomfi_needed" = yes; then | 215 | if test "$gl_cv_cc_nomfi_needed" = yes; then |
| 202 | gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" | 216 | gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" |
| 203 | fi | 217 | fi |
| 204 | 218 | ||
| 219 | if test "$gl_cv_cc_uninitialized_supported" = no; then | ||
| 220 | gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized" | ||
| 221 | fi | ||
| 222 | |||
| 205 | $1=$gl_manywarn_set | 223 | $1=$gl_manywarn_set |
| 206 | ]) | 224 | ]) |