Skip to contentSkip to conversation

configure: use -Wwombat to test whether gcc recognizes -Wno-wombat

PATCH Applied Peter Maydell 4 participants 4 messages Oct 27, 2012 – Oct 30, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: use -Wwombat to test whether gcc recognizes -Wno-wombat

gcc will silently accept unrecognized -Wno-wombat warning suppression options (it only mentions them if it has to print a compiler warning for some other reason). Since we already run a check for whether gcc recognizes the warning options we use, we can easily make this use the positive sense of the option when checking for support for the suppression option. This doesn't have any effect except that it avoids gcc emitting extra messages about unrecognized command line options when it is printing other warning messages.

---
 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure +5 -1
index 37f712d..4c2ba06 100755
@@ -1169,7 +1169,11 @@ cat > $TMPC << EOF
 int main(void) { return 0; }
 EOF
 for flag in $gcc_flags; do
-    if compile_prog "-Werror $flag" "" ; then
+    # Use the positive sense of the flag when testing for -Wno-wombat
+    # support (gcc will happily accept the -Wno- form of unknown
+    # warning options).
+    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
+    if compile_prog "-Werror $optflag" "" ; then
 	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
     fi
 done
Signature · 1 line
1.7.11.4
Reviewed-by on v1 1/1
#1 lore raw

Am 27.10.2012 23:19, schrieb Peter Maydell:

Quoted 21 lines

gcc will silently accept unrecognized -Wno-wombat warning suppression options (it only mentions them if it has to print a compiler warning for some other reason). Since we already run a check for whether gcc recognizes the warning options we use, we can easily make this use the positive sense of the option when checking for support for the suppression option. This doesn't have any effect except that it avoids gcc emitting extra messages about unrecognized command line options when it is printing other warning messages.

---
  configure | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
configure +0 -0
index 37f712d..4c2ba06 100755
@@ -1169,7 +1169,11 @@ cat>  $TMPC<<  EOF
  int main(void) { return 0; }
  EOF

configure cat> $TMPC<< EOF · line 1179

Quoted 10 lines
configure +5 -1
  for flag in $gcc_flags; do
-    if compile_prog "-Werror $flag" "" ; then
+    # Use the positive sense of the flag when testing for -Wno-wombat
+    # support (gcc will happily accept the -Wno- form of unknown
+    # warning options).
+    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
+    if compile_prog "-Werror $optflag" "" ; then
  	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
      fi
  done

Yes, that's really a very simple and working solution.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Maydell
Quoted 22 lines · Peter Maydell

gcc will silently accept unrecognized -Wno-wombat warning suppression options (it only mentions them if it has to print a compiler warning for some other reason). Since we already run a check for whether gcc recognizes the warning options we use, we can easily make this use the positive sense of the option when checking for support for the suppression option. This doesn't have any effect except that it avoids gcc emitting extra messages about unrecognized command line options when it is printing other warning messages.

---
  configure | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
configure +0 -0
index 37f712d..4c2ba06 100755
@@ -1169,7 +1169,11 @@ cat > $TMPC << EOF
  int main(void) { return 0; }
  EOF

configure cat > $TMPC << EOF · line 1179

Quoted 10 lines
configure +5 -1
  for flag in $gcc_flags; do
-    if compile_prog "-Werror $flag" "" ; then
+    # Use the positive sense of the flag when testing for -Wno-wombat
+    # support (gcc will happily accept the -Wno- form of unknown
+    # warning options).
+    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
+    if compile_prog "-Werror $optflag" "" ; then
  	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
      fi
  done
Applied
#3 lore raw
In reply to Peter Maydell

Thanks, applied.

Quoted 34 lines · Peter Maydell

gcc will silently accept unrecognized -Wno-wombat warning suppression options (it only mentions them if it has to print a compiler warning for some other reason). Since we already run a check for whether gcc recognizes the warning options we use, we can easily make this use the positive sense of the option when checking for support for the suppression option. This doesn't have any effect except that it avoids gcc emitting extra messages about unrecognized command line options when it is printing other warning messages.

---
 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure +5 -2
index 37f712d..4c2ba06 100755
@@ -1169,7 +1169,11 @@ cat > $TMPC << EOF
 int main(void) { return 0; }
 EOF
 for flag in $gcc_flags; do
-    if compile_prog "-Werror $flag" "" ; then
+    # Use the positive sense of the flag when testing for -Wno-wombat
+    # support (gcc will happily accept the -Wno- form of unknown
+    # warning options).
+    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
+    if compile_prog "-Werror $optflag" "" ; then
        QEMU_CFLAGS="$QEMU_CFLAGS $flag"
     fi
 done
--

1.7.11.4