From 845013907b194e5de4d30e777b21d6e9708e7b4c Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 19 Nov 2012 14:17:53 -0700 Subject: 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 --- configure.ac | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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]) -- cgit v1.2.1