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.

Backports commit 20bc94a2b8449b7700b6bfa25a87ce2320a1c649 from qemu
This commit is contained in:
Paolo Bonzini 2018-03-05 11:29:49 -05:00 committed by Lioncash
parent 5ef155a68f
commit 5216dcd157
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

13
qemu/configure vendored
View file

@ -736,6 +736,19 @@ if test "$stack_protector" != "no"; then
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