]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
build: disable -Wmissing-braces on older compilers
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 20 Oct 2017 10:11:32 +0000 (12:11 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 5 Nov 2017 13:52:10 +0000 (14:52 +0100)
GCC 4.9 and newer stopped warning for missing braces around the
"universal" C zero initializer {0}.  One such initializer sneaked
into scsi/qemu-pr-helper.c and is breaking the build with such
older GCC versions.

Detect the lack of support for the idiom, and disable the warning
in that case.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
configure

index 285d123dbf5dd12e7a715c082e3c992d7602a3c9..e31d6a7fee88900559fb2ccd1a94a784993d047d 100755 (executable)
--- a/configure
+++ b/configure
@@ -1669,6 +1669,19 @@ EOF
   fi
 fi
 
+# Disable -Wmissing-braces on older compilers that warn even for
+# the "universal" C zero initializer {0}.
+cat > $TMPC << EOF
+struct {
+  int a[2];
+} x = {0};
+EOF
+if compile_object "-Werror" "" ; then
+  :
+else
+  QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
+fi
+
 # Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
 # large functions that use global variables.  The bug is in all releases of
 # GCC, but it became particularly acute in 4.6.x and 4.7.x.  It is fixed in