[llvm-commits] [PATCH 1/3] Disable -Wuninitialized for gcc
David Greene
dag at cray.com
Tue Jan 8 13:11:05 PST 2013
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.
---
llvm/autoconf/configure.ac | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/llvm/autoconf/configure.ac b/llvm/autoconf/configure.ac
index 102147c..e1bb046 100644
--- a/llvm/autoconf/configure.ac
+++ b/llvm/autoconf/configure.ac
@@ -1231,7 +1231,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===
--
1.7.8.4
More information about the llvm-commits
mailing list