summaryrefslogtreecommitdiffstats
path: root/llvm/autoconf/configure.ac
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2013-01-15 18:21:15 +0000
committerDavid Greene <greened@obbligato.org>2013-01-15 18:21:15 +0000
commit57ad4297a3f3b15bde4190611781fdda1b94f7db (patch)
treec78dbfa8e3df9d31cf3414c2d175eaedf5b413d0 /llvm/autoconf/configure.ac
parent3d7eb2f80653d8b84760adf96281203ca41c7a88 (diff)
downloadbcm5719-llvm-57ad4297a3f3b15bde4190611781fdda1b94f7db.tar.gz
bcm5719-llvm-57ad4297a3f3b15bde4190611781fdda1b94f7db.zip
Disable Uninitialized Use Warnings for Broken gcc Versions
Some versions of gcc accept unsupported -W flags and run just fine if there are no warnings, but die with an unsupported flag error if a warning is encountered. gcc 4.3 and gcc 4.4 both exhibit this behavior for -Wno-maybe-uninitialized. Therefore, if the flag check for -Wno-maybe-uninitialized succeeds, only use -Wno-maybe-uninitialized if we are using gcc version 4.7 or greater. Use -Wno-uninitialized otherwise. llvm-svn: 172543
Diffstat (limited to 'llvm/autoconf/configure.ac')
-rw-r--r--llvm/autoconf/configure.ac19
1 files changed, 17 insertions, 2 deletions
diff --git a/llvm/autoconf/configure.ac b/llvm/autoconf/configure.ac
index c186ed55744..ce360109d2e 100644
--- a/llvm/autoconf/configure.ac
+++ b/llvm/autoconf/configure.ac
@@ -1269,8 +1269,23 @@ then
then
CXX_FLAG_CHECK(NO_UNINITIALIZED, [-Wno-uninitialized])
else
- dnl AC_SUBST doesn't work with empty strings.
- NO_UNINITIALIZED=
+ dnl Some versions of gcc accept unsupported -W flags if there is
+ dnl no warning but stop with an error when a warning is
+ dnl encountered. If this gcc is earlier than 4.7, just use
+ dnl -Wno-uninitialized.
+ gxx_version=`$CXX -dumpversion`
+ gxx_version_major=`echo $gxx_version | cut -d'.' -f1`
+ gxx_version_minor=`echo $gxx_version | cut -d'.' -f2`
+ gxx_version_patch=`echo $gxx_version | cut -d'.' -f3`
+
+ if test "$gxx_version_major" -ge "4" \
+ && test "$gxx_version_minor" -ge "7"; then
+ dnl AC_SUBST doesn't work with empty strings.
+ NO_UNINITIALIZED=
+ else
+ NO_MAYBE_UNINITIALIZED=
+ CXX_FLAG_CHECK(NO_UNINITIALIZED, [-Wno-uninitialized])
+ fi
fi
else
NO_UNINITIALIZED=
OpenPOWER on IntegriCloud