Use a GCC-specific #pragma instead of GCC-specific

-Wno-uninitialized to silence a bogus warning.
This commit is contained in:
Lasse Collin 2009-05-02 16:10:14 +03:00
parent f6ce63ebdb
commit a6f43e6412
3 changed files with 5 additions and 18 deletions

View 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

View 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

View File

@ -22,6 +22,11 @@
//
///////////////////////////////////////////////////////////////////////////////
// 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