Skip to content

Commit

Permalink
build: disable -Wmissing-braces on older compilers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bonzini committed Nov 5, 2017
1 parent ab37bfc commit 20bc94a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions configure
Expand Up @@ -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
Expand Down

0 comments on commit 20bc94a

Please sign in to comment.