summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-10-20 12:11:32 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2017-11-05 14:52:10 +0100
commit20bc94a2b8449b7700b6bfa25a87ce2320a1c649 (patch)
tree4f470a0055f24505c86d789e746731c49d99fb45 /configure
parentab37bfc7d64141e8fe4633744012140ee415648b (diff)
downloadqemu-20bc94a2b8449b7700b6bfa25a87ce2320a1c649.tar.gz
build: disable -Wmissing-braces on older compilers
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>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure13
1 files changed, 13 insertions, 0 deletions
diff --git a/configure b/configure
index 285d123dbf..e31d6a7fee 100755
--- 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