Patchwork Fix warnings suppressors to honor --disable-werror

login
register
mail settings
Submitter Markus Armbruster
Date April 16, 2013, 1:08 p.m.
Message ID <87haj6y65a.fsf@blackfin.pond.sub.org>
Download mbox | patch
Permalink /patch/236965/
State New
Headers show

Comments

Markus Armbruster - April 16, 2013, 1:08 p.m.
Eric Blake <eblake@redhat.com> writes:

> On 04/16/2013 05:51 AM, Markus Armbruster wrote:
>> Replace
>> 
>>     #pragma GCC diagnostic ignored FOO
>>     [Troublesome code...]
>>     #pragma GCC diagnostic error FOO
>> 
>> by
>> 
>>     #pragma GCC diagnostic push
>>     #pragma GCC diagnostic ignored FOO
>>     [Troublesome code...]
>>     #pragma GCC diagnostic pop
>
> Older gcc does not understand #pragma GCC diagnostic push.  Are you sure
> this solution works with all versions of gcc in common use for compiling
> qemu?

The first patch hunk should take care of the problem:


If gcc chokes on push/pop, we simply refrain from suppressing warnings.
You may have to --disable-werror then.  I prefer that over breaking
--disable-werror for everyone.

Testing with a suitably antique gcc appreciated!

Patch

diff --git a/configure b/configure
index 0788e27..41097a2 100755
--- a/configure
+++ b/configure
@@ -3244,8 +3244,10 @@  fi
 
 pragma_disable_unused_but_set=no
 cat > $TMPC << EOF
+#pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#pragma GCC diagnostic pop
 
 int main(void) {
     return 0;