fix check for -Wno flag

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=178
This commit is contained in:
Michael Matz 2018-03-09 17:08:53 +00:00 committed by Git OBS Bridge
parent e7db4ec014
commit 27b778ca74

View File

@ -586,7 +586,13 @@ export CXX
export CFLAGS="$RPM_OPT_FLAGS"
# FIXME: gcc-7 compatibility.
if echo "" | $CC -x c -c - -o /dev/null -Wno-implicit-fallthrough >/dev/null 2>&1; then
# checking for acceptance of -Wno-foo is a bit wieldy: GCC doesn't
# warn about unknown -Wno- flags, _except_ if there are other
# diagnostics as well, so let's force an uninitialized use warning
# and grep for the diagnostic about the -Wno flag:
if echo "int foo(void) { int a; return a;} " | \
$CC -x c -c - -o /dev/null -W -Wno-implicit-fallthrough 2>&1 | \
grep Wno-implici >/dev/null; then
CFLAGS="$CFLAGS -Wno-implicit-fallthrough"
fi
%if %{have_libipt}