summaryrefslogtreecommitdiff
path: root/autoconf
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2013-01-09 22:11:13 +0000
committerDavid Greene <greened@obbligato.org>2013-01-09 22:11:13 +0000
commitd2f8216ba496b139815aee29052093c1b0d7a996 (patch)
treec67b0c125cbb888ca8dfc850f03512200603e4ea /autoconf
parent78ec0255d9ab184af7799c14d93879e5f21b9007 (diff)
Disable -Wuninitialized for gcc
If the compiler is gcc, disable variants of -Wuninitialized depending on the gcc version. This gets a lot of false positive warnings out of the build. Generate a new configure for the gcc -Wno-uninitialized fix. Pick up -Wno-uninitialized from configure Add the option -Wno[-maybe]-uninitialized as determined by configure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac22
1 files changed, 21 insertions, 1 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index a1426c1832d..c186ed55744 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -1257,7 +1257,27 @@ AC_MSG_CHECKING([optional compiler flags])
CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
CXX_FLAG_CHECK(COVERED_SWITCH_DEFAULT, [-Wcovered-switch-default])
-AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT])
+dnl GCC's potential uninitialized use analysis is weak and presents lots of
+dnl false positives, so disable it.
+if test "$GXX" = "yes"
+then
+ CXX_FLAG_CHECK(NO_MAYBE_UNINITIALIZED, [-Wno-maybe-uninitialized])
+ dnl gcc 4.7 introduced -Wmaybe-uninitialized to distinguish cases which are
+ dnl known to be uninitialized from cases which might be uninitialized. We
+ dnl still want to catch the first kind of errors.
+ if test "$NO_MAYBE_UNINITIALIZED" != "-Wno-maybe-uninitialized"
+ then
+ CXX_FLAG_CHECK(NO_UNINITIALIZED, [-Wno-uninitialized])
+ else
+ dnl AC_SUBST doesn't work with empty strings.
+ NO_UNINITIALIZED=
+ fi
+else
+ NO_UNINITIALIZED=
+ NO_MAYBE_UNINITIALIZED=
+fi
+AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED])
+
dnl===-----------------------------------------------------------------------===
dnl===