[llvm-commits] [llvm] r172543 - in /llvm/trunk: autoconf/configure.ac configure

David Greene greened at obbligato.org
Tue Jan 15 10:21:15 PST 2013


Author: greened
Date: Tue Jan 15 12:21:15 2013
New Revision: 172543

URL: http://llvm.org/viewvc/llvm-project?rev=172543&view=rev
Log:
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.

Modified:
    llvm/trunk/autoconf/configure.ac
    llvm/trunk/configure

Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=172543&r1=172542&r2=172543&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Tue Jan 15 12:21:15 2013
@@ -1269,8 +1269,23 @@
   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=

Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=172543&r1=172542&r2=172543&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Tue Jan 15 12:21:15 2013
@@ -12257,7 +12257,19 @@
     NO_UNINITIALIZED=`$CXX -Werror -Wno-uninitialized -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-uninitialized`
 
   else
-        NO_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
+            NO_UNINITIALIZED=
+    else
+      NO_MAYBE_UNINITIALIZED=
+      NO_UNINITIALIZED=`$CXX -Werror -Wno-uninitialized -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-uninitialized`
+
+    fi
   fi
 else
   NO_UNINITIALIZED=





More information about the llvm-commits mailing list