summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2012-11-19 14:17:53 -0700
committerGary V. Vaughan <gary@gnu.org>2013-09-18 20:53:32 +0700
commit845013907b194e5de4d30e777b21d6e9708e7b4c (patch)
tree632353ad160e919e765944f5e47ae75a5df4eb1c
parentb3c0e2e14e34699b513661ae07dc3aba1628cfb5 (diff)
downloadm4-845013907b194e5de4d30e777b21d6e9708e7b4c.tar.gz
build: avoid problematic gcc 4.4 warnings
Warnings that make sense under newer gcc can cause spurious failures under older gcc; it's nice to allow out-of-the-box development on stable releases while still getting the benefit of improved warning detection in bleeding-edge setups. * configure.ac (nw): Disable gcc warnings that cause build failures under RHEL 6.3. * gnulib: Update to latest. Signed-off-by: Eric Blake <eblake@redhat.com>
-rw-r--r--configure.ac23
1 files changed, 22 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 17cce617..904f6247 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,6 +114,7 @@ if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
AC_SUBST([WERROR_CFLAGS])
+ # This, $nw, is the list of warnings we disable.
nw=
nw="$nw -Waggregate-return" # K&R is anachronistic
nw="$nw -Wtraditional-conversion" # K&R is anachronistic
@@ -126,7 +127,27 @@ if test "$gl_gcc_warnings" = yes; then
nw="$nw -Wsign-conversion" # Too many warnings for now
nw="$nw -Wcast-qual" # Too many warnings for now
nw="$nw -Wswitch-enum" # Too many warnings for now
- # This, $nw, is the list of warnings we disable.
+ # gcc 4.4.6 complains enum-compare is C++ only; gcc 4.7.0 implies it in -Wall
+ nw="$nw -Wenum-compare"
+
+ # Gnulib uses '#pragma GCC diagnostic push' to silence some
+ # warnings, but older gcc doesn't support this.
+ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
+ [M4_cv_gcc_pragma_push_works], [
+ save_CFLAGS=$CFLAGS
+ CFLAGS='-Wunknown-pragmas -Werror'
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic pop
+ ]])],
+ [M4_cv_gcc_pragma_push_works=yes],
+ [M4_cv_gcc_pragma_push_works=no])
+ CFLAGS=$save_CFLAGS])
+ if test $M4_cv_gcc_pragma_push_works = no; then
+ nw="$nw -Wmissing-prototypes"
+ nw="$nw -Wmissing-declarations"
+ nw="$nw -Wunreachable-code"
+ fi
gl_MANYWARN_ALL_GCC([ws])
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])