]> xenbits.xensource.com Git - libvirt.git/commitdiff
Ensure consistent enablement of gcc 'diagnostic' pragma
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 13 May 2013 11:41:07 +0000 (12:41 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 14 May 2013 14:00:22 +0000 (15:00 +0100)
The virt-compile-warnings.m4 file would do an explicit
check for whether the compile could use the 'diagnostic'
pragma push/pop feature. The src/internal.h file would
then only enable it for GCC >= 4.6

This breaks with clang which supports the pragma but
does not claim GCC 4.6 compat. Export a variable from
the m4 check to the header file so they are consistent.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
m4/virt-compile-warnings.m4
src/internal.h

index e05491308c9b3254d2cfe01112e412bd2bfd3af1..fbeb3eb5e1c3d14555b6792f62e8215b216952fb 100644 (file)
@@ -94,6 +94,9 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
       dontwarn="$dontwarn -Wmissing-prototypes"
       dontwarn="$dontwarn -Wmissing-declarations"
       dontwarn="$dontwarn -Wcast-align"
+    else
+      AC_DEFINE_UNQUOTED([WORKING_PRAGMA_PUSH], 1,
+       [Define to 1 if gcc supports pragma push/pop])
     fi
 
     dnl Check whether strchr(s, char variable) causes a bogus compile
index d819aa39a2b8aecc8419f37b6052f63b7c4ead2a..03c2493c7d2171d2b50b11a2e782cdcfd596f0eb 100644 (file)
 # endif                                /* __GNUC__ */
 
 
-# if __GNUC_PREREQ (4, 6)
+# if WORKING_PRAGMA_PUSH
 #  define VIR_WARNINGS_NO_CAST_ALIGN \
     _Pragma ("GCC diagnostic push") \
     _Pragma ("GCC diagnostic ignored \"-Wcast-align\"")