From 27b778ca743eca6f318de4aa21b1700dbaf3bb3511d58095735319e99781a59b Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Fri, 9 Mar 2018 17:08:53 +0000 Subject: [PATCH] fix check for -Wno flag OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=178 --- gdb.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb.spec b/gdb.spec index 511ebfa..a39c291 100644 --- a/gdb.spec +++ b/gdb.spec @@ -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}