Use a GCC-specific #pragma instead of GCC-specific
authorLasse Collin <lasse.collin@tukaani.org>
Sat, 2 May 2009 13:10:14 +0000 (16:10 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Sat, 2 May 2009 13:16:28 +0000 (16:16 +0300)
-Wno-uninitialized to silence a bogus warning.

configure.ac
src/liblzma/check/Makefile.am
src/liblzma/check/sha256.c

index 2df36e5..c9676cf 100644 (file)
@@ -534,8 +534,6 @@ lc_CPUCORES
 # If using GCC, set some additional AM_CFLAGS:
 ###############################################################################
 
-Wno_uninitialized=no
-
 if test "x$GCC" = xyes ; then
        echo
        echo "GCC extensions:"
@@ -544,15 +542,6 @@ if test "x$GCC" = xyes ; then
                AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
        fi
 
-       # -Wno-uninitialized is needed with -Werror with SHA256 code
-       # to omit a bogus warning.
-       AC_MSG_CHECKING([if $CC accepts -Wno-uninitialized])
-       OLD_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS -Wno-uninitialized"
-       AC_COMPILE_IFELSE([void foo(void) { }], [Wno_uninitialized=yes])
-       CFLAGS="$OLD_CFLAGS"
-       AC_MSG_RESULT([$Wno_uninitialized])
-
        # Enable as much warnings as possible. These commented warnings won't
        # work for this package though:
        #   * -Wunreachable-code breaks several assert(0) cases, which are
@@ -608,8 +597,6 @@ if test "x$GCC" = xyes ; then
        fi
 fi
 
-AM_CONDITIONAL([COND_WNO_UNINITIALIZED], test "x$Wno_uninitialized" = "xyes")
-
 
 ###############################################################################
 # Create the makefiles and config.h
index 1409bec..6c43a70 100644 (file)
@@ -44,9 +44,4 @@ endif
 
 if COND_CHECK_SHA256
 libcheck_la_SOURCES += sha256.c
-# Hide bogus warning to allow usage of -Werror. If more issues like this
-# pop up, we'll drop -Werror.
-if COND_WNO_UNINITIALIZED
-AM_CFLAGS += -Wno-uninitialized
-endif
 endif
index 978fc66..6053a51 100644 (file)
 //
 ///////////////////////////////////////////////////////////////////////////////
 
+// Avoid bogus warnings in transform().
+#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) || __GNUC__ > 4
+#      pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
+
 #include "check.h"
 
 #ifndef WORDS_BIGENDIAN