qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
@ 2012-10-14 20:00 Peter Maydell
  2012-10-14 20:15 ` Blue Swirl
  2012-10-27 16:51 ` Blue Swirl
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Maydell @ 2012-10-14 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Stefan Weil, patches

Disable clang's initializer-overrides warnings, as QEMU makes significant
use of the pattern of initializing an array with a range-based default
entry like
    [0 ... 0x1ff] = { GPIO_NONE, 0 }
followed by specific entries which override that default, and clang
would otherwise warn "initializer overrides prior initialization of
this subobject" when it encountered the specific entry.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This is basically a judgement that our coding style is legitimate
and the compiler is being overly alarmist. I don't think we would
benefit from trying to silence the warnings and I can't think of
a clean way of doing so...

NB that gcc will happily ignore -Wno-wombat warnings that it doesn't
happen to recognize. (For compilers that don't accept-and-ignore the flag
configure will identify this and not use it.)

Blue Swirl previously submitted a patch which enabled this flag
(among others):
http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg04203.html

I haven't found the other two flags in that patch to be required.

 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 353d788..f78cfc5 100755
--- a/configure
+++ b/configure
@@ -1187,6 +1187,7 @@ gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
 gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
+gcc_flags="-Wno-initializer-overrides $gcc_flags"
 # Note that we do not add -Werror to gcc_flags here, because that would
 # enable it for all configure tests. If a configure test failed due
 # to -Werror this would just silently disable some features,
-- 
1.7.11.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-14 20:00 [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings Peter Maydell
@ 2012-10-14 20:15 ` Blue Swirl
  2012-10-14 20:24   ` Peter Maydell
  2012-10-27 16:51 ` Blue Swirl
  1 sibling, 1 reply; 12+ messages in thread
From: Blue Swirl @ 2012-10-14 20:15 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Stefan Weil, qemu-devel, patches

On Sun, Oct 14, 2012 at 8:00 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Disable clang's initializer-overrides warnings, as QEMU makes significant
> use of the pattern of initializing an array with a range-based default
> entry like
>     [0 ... 0x1ff] = { GPIO_NONE, 0 }
> followed by specific entries which override that default, and clang
> would otherwise warn "initializer overrides prior initialization of
> this subobject" when it encountered the specific entry.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> This is basically a judgement that our coding style is legitimate
> and the compiler is being overly alarmist. I don't think we would
> benefit from trying to silence the warnings and I can't think of
> a clean way of doing so...
>
> NB that gcc will happily ignore -Wno-wombat warnings that it doesn't
> happen to recognize. (For compilers that don't accept-and-ignore the flag
> configure will identify this and not use it.)
>
> Blue Swirl previously submitted a patch which enabled this flag
> (among others):
> http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg04203.html

In my version, Clang flags were separate from GCC flags. I think it
would be better to run different tests for each compiler in the
future, that lets GCC avoid Clang flag -ffoobar which does not have
desirable effect to GCC and vice versa. I'd also like to handle flags
for sparse checker the same way.

>
> I haven't found the other two flags in that patch to be required.
>
>  configure | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configure b/configure
> index 353d788..f78cfc5 100755
> --- a/configure
> +++ b/configure
> @@ -1187,6 +1187,7 @@ gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
>  gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
>  gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
>  gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
> +gcc_flags="-Wno-initializer-overrides $gcc_flags"
>  # Note that we do not add -Werror to gcc_flags here, because that would
>  # enable it for all configure tests. If a configure test failed due
>  # to -Werror this would just silently disable some features,
> --
> 1.7.11.4
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-14 20:15 ` Blue Swirl
@ 2012-10-14 20:24   ` Peter Maydell
  2012-10-16 20:20     ` Stefan Weil
  2012-10-24 12:31     ` Peter Maydell
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Maydell @ 2012-10-14 20:24 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Stefan Weil, qemu-devel, patches

On 14 October 2012 21:15, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Sun, Oct 14, 2012 at 8:00 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> Blue Swirl previously submitted a patch which enabled this flag
>> (among others):
>> http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg04203.html
>
> In my version, Clang flags were separate from GCC flags. I think it
> would be better to run different tests for each compiler in the
> future, that lets GCC avoid Clang flag -ffoobar which does not have
> desirable effect to GCC and vice versa.

Mmm, but at the moment it's entirely fine to pass both compilers
the same flags, and moreover we actually pass all these flags
to the compiler without checking if it's gcc or not; we just
ask if the compiler will run OK with the flag passed. (I'm not
even sure how you'd determine whether your compiler was gcc
or clang or gcc-llvm or whatever...)

> I'd also like to handle flags for sparse checker the same way.

I agree that those bits of configure could be cleaner.

-- PMM

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-14 20:24   ` Peter Maydell
@ 2012-10-16 20:20     ` Stefan Weil
  2012-10-16 21:19       ` Peter Maydell
  2012-10-24 12:31     ` Peter Maydell
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Weil @ 2012-10-16 20:20 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Blue Swirl, qemu-devel, patches

Am 14.10.2012 22:24, schrieb Peter Maydell:
> On 14 October 2012 21:15, Blue Swirl<blauwirbel@gmail.com>  wrote:
>> On Sun, Oct 14, 2012 at 8:00 PM, Peter Maydell<peter.maydell@linaro.org>  wrote:
>>> Blue Swirl previously submitted a patch which enabled this flag
>>> (among others):
>>> http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg04203.html
>>
>> In my version, Clang flags were separate from GCC flags. I think it
>> would be better to run different tests for each compiler in the
>> future, that lets GCC avoid Clang flag -ffoobar which does not have
>> desirable effect to GCC and vice versa.
>
> Mmm, but at the moment it's entirely fine to pass both compilers
> the same flags, and moreover we actually pass all these flags
> to the compiler without checking if it's gcc or not; we just
> ask if the compiler will run OK with the flag passed. (I'm not
> even sure how you'd determine whether your compiler was gcc
> or clang or gcc-llvm or whatever...)
>
>> I'd also like to handle flags for sparse checker the same way.
>
> I agree that those bits of configure could be cleaner.
>
> -- PMM
>

Hi Peter, hi Blue,

gcc uses a different flag -Wno-override-init to disable initializer 
override warnings.

I tested the following patch which uses -Wextra with gcc-4.4 and gcc-4.7.
It allows compilation of QEMU without warnings.

A test with those flags and clang still has to be done.

Regards

Stefan W.


diff --git a/configure b/configure
index 359e453..0818eda 100755
--- a/configure
+++ b/configure
@@ -267,6 +267,8 @@ sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
  QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
  QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes 
$QEMU_CFLAGS"
  QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
+QEMU_CFLAGS="-Wextra -Wno-missing-field-initializers $QEMU_CFLAGS"
+QEMU_CFLAGS="-Wno-override-init -Wno-sign-compare -Wno-unused-parameter 
$QEMU_CFLAGS"
  QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
$QEMU_CFLAGS"
  QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
  if test "$debug_info" = "yes"; then

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-16 20:20     ` Stefan Weil
@ 2012-10-16 21:19       ` Peter Maydell
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Maydell @ 2012-10-16 21:19 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Blue Swirl, qemu-devel, patches

On 16 October 2012 21:20, Stefan Weil <sw@weilnetz.de> wrote:
> Hi Peter, hi Blue,
>
> gcc uses a different flag -Wno-override-init to disable initializer override
> warnings.
>
> I tested the following patch which uses -Wextra with gcc-4.4 and gcc-4.7.
> It allows compilation of QEMU without warnings.
>
> A test with those flags and clang still has to be done.

For clang the options have to be ordered so that -Wextra comes before
the -Wno-* options that disable bits of -Wextra, as clang processes
the options in comandline order. (See this clang bug
http://llvm.org/bugs/show_bug.cgi?id=13077 pointing out the difference
between clang and gcc and closed as "expected behaviour" :-( )
Alternatively, rather than enabling 12 warnings with -Wextra
and then disabling 4 with -Wno-*, we could just enable the
8 warnings we want.

clang still needs -Wno-initializer-overrides in any case, so this
is distinct from my patch.

I also note that you've put your options in a different bit of
configure from the part my patch touched. I think it would
probably be clearer if all the warning options went in the "try
this and use if compiler accepts it" list, even for ones that
presumably have worked for every gcc ever. (ie move some of the
options currently in the 'always use this' list).

-- PMM

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-14 20:24   ` Peter Maydell
  2012-10-16 20:20     ` Stefan Weil
@ 2012-10-24 12:31     ` Peter Maydell
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Maydell @ 2012-10-24 12:31 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Stefan Weil, qemu-devel, patches

On 14 October 2012 21:24, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 14 October 2012 21:15, Blue Swirl <blauwirbel@gmail.com> wrote:
>> On Sun, Oct 14, 2012 at 8:00 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> Blue Swirl previously submitted a patch which enabled this flag
>>> (among others):
>>> http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg04203.html
>>
>> In my version, Clang flags were separate from GCC flags. I think it
>> would be better to run different tests for each compiler in the
>> future, that lets GCC avoid Clang flag -ffoobar which does not have
>> desirable effect to GCC and vice versa.
>
> Mmm, but at the moment it's entirely fine to pass both compilers
> the same flags, and moreover we actually pass all these flags
> to the compiler without checking if it's gcc or not; we just
> ask if the compiler will run OK with the flag passed. (I'm not
> even sure how you'd determine whether your compiler was gcc
> or clang or gcc-llvm or whatever...)

This discussion seems to have got stalled. Do you really want to
try to add a mechanism for detecting which compiler is being
used and applyng different flags for each, given that we don't
actually need to do that in this case?

-- PMM

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-14 20:00 [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings Peter Maydell
  2012-10-14 20:15 ` Blue Swirl
@ 2012-10-27 16:51 ` Blue Swirl
  2012-10-27 20:32   ` Igor Mitsyanko
  1 sibling, 1 reply; 12+ messages in thread
From: Blue Swirl @ 2012-10-27 16:51 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Stefan Weil, qemu-devel, patches

Thanks, applied.

On Sun, Oct 14, 2012 at 8:00 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Disable clang's initializer-overrides warnings, as QEMU makes significant
> use of the pattern of initializing an array with a range-based default
> entry like
>     [0 ... 0x1ff] = { GPIO_NONE, 0 }
> followed by specific entries which override that default, and clang
> would otherwise warn "initializer overrides prior initialization of
> this subobject" when it encountered the specific entry.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> This is basically a judgement that our coding style is legitimate
> and the compiler is being overly alarmist. I don't think we would
> benefit from trying to silence the warnings and I can't think of
> a clean way of doing so...
>
> NB that gcc will happily ignore -Wno-wombat warnings that it doesn't
> happen to recognize. (For compilers that don't accept-and-ignore the flag
> configure will identify this and not use it.)
>
> Blue Swirl previously submitted a patch which enabled this flag
> (among others):
> http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg04203.html
>
> I haven't found the other two flags in that patch to be required.
>
>  configure | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configure b/configure
> index 353d788..f78cfc5 100755
> --- a/configure
> +++ b/configure
> @@ -1187,6 +1187,7 @@ gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
>  gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
>  gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
>  gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
> +gcc_flags="-Wno-initializer-overrides $gcc_flags"
>  # Note that we do not add -Werror to gcc_flags here, because that would
>  # enable it for all configure tests. If a configure test failed due
>  # to -Werror this would just silently disable some features,
> --
> 1.7.11.4
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-27 16:51 ` Blue Swirl
@ 2012-10-27 20:32   ` Igor Mitsyanko
  2012-10-27 21:12     ` Peter Maydell
  2012-10-27 21:24     ` Stefan Weil
  0 siblings, 2 replies; 12+ messages in thread
From: Igor Mitsyanko @ 2012-10-27 20:32 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Blue Swirl, Stefan Weil, qemu-devel, patches

On 10/27/2012 8:51 PM, Blue Swirl wrote:
> Thanks, applied.
>
> On Sun, Oct 14, 2012 at 8:00 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> Disable clang's initializer-overrides warnings, as QEMU makes significant
>> use of the pattern of initializing an array with a range-based default
>> entry like
>>      [0 ... 0x1ff] = { GPIO_NONE, 0 }
>> followed by specific entries which override that default, and clang
>> would otherwise warn "initializer overrides prior initialization of
>> this subobject" when it encountered the specific entry.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> This is basically a judgement that our coding style is legitimate
>> and the compiler is being overly alarmist. I don't think we would
>> benefit from trying to silence the warnings and I can't think of
>> a clean way of doing so...
>>
>> NB that gcc will happily ignore -Wno-wombat warnings that it doesn't
>> happen to recognize. (For compilers that don't accept-and-ignore the flag
>> configure will identify this and not use it.)
>>

I encountered strange behavior of latest mingw gcc, it ignores 
unrecognized -Wno-wombat options only in case if no other warnings are 
issued (configure gccflags test doesn't issue any), otherwise I get this:

cc1.exe: warning: unrecognized command line option 
"-Wno-initializer-overrides" [enabled by default]

This is probably a bug in mingw GCC (or perhaps I'm using it wrong), but 
anyway, this makes QEMU mingw build output very noisy.

>> Blue Swirl previously submitted a patch which enabled this flag
>> (among others):
>> http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg04203.html
>>
>> I haven't found the other two flags in that patch to be required.
>>
>>   configure | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/configure b/configure
>> index 353d788..f78cfc5 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1187,6 +1187,7 @@ gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
>>   gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
>>   gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
>>   gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
>> +gcc_flags="-Wno-initializer-overrides $gcc_flags"
>>   # Note that we do not add -Werror to gcc_flags here, because that would
>>   # enable it for all configure tests. If a configure test failed due
>>   # to -Werror this would just silently disable some features,
>> --
>> 1.7.11.4
>>
>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-27 20:32   ` Igor Mitsyanko
@ 2012-10-27 21:12     ` Peter Maydell
  2012-10-27 21:24     ` Stefan Weil
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Maydell @ 2012-10-27 21:12 UTC (permalink / raw)
  To: Igor Mitsyanko; +Cc: Blue Swirl, Stefan Weil, qemu-devel, patches

On 27 October 2012 21:32, Igor Mitsyanko <i.mitsyanko@gmail.com> wrote:
> I encountered strange behavior of latest mingw gcc, it ignores unrecognized
> -Wno-wombat options only in case if no other warnings are issued (configure
> gccflags test doesn't issue any), otherwise I get this:
>
> cc1.exe: warning: unrecognized command line option
> "-Wno-initializer-overrides" [enabled by default]
>
> This is probably a bug in mingw GCC (or perhaps I'm using it wrong), but
> anyway, this makes QEMU mingw build output very noisy.

It should only warn about that in the case where it's also emitting
some other warning message (in which case the idea is to say "and
hey maybe this unrecognised no-wombat warning was supposed to
suppress this?"), so the build isn't noisy unless it was noisy
anyway because of other compile warnings.

If we want to actually only pass -Wno-wombat when the gcc knows
about it the right approach is to test whether gcc accepts
-Wwombat. This is a two-liner patch to configure if we want to
do it -- will send a patch in a moment.

-- PMM

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-27 20:32   ` Igor Mitsyanko
  2012-10-27 21:12     ` Peter Maydell
@ 2012-10-27 21:24     ` Stefan Weil
  2012-10-27 21:35       ` Peter Maydell
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Weil @ 2012-10-27 21:24 UTC (permalink / raw)
  To: Igor Mitsyanko; +Cc: Blue Swirl, Peter Maydell, qemu-devel, patches

Am 27.10.2012 22:32, schrieb Igor Mitsyanko:
> On 10/27/2012 8:51 PM, Blue Swirl wrote:
>> Thanks, applied.
>>
>> On Sun, Oct 14, 2012 at 8:00 PM, Peter Maydell 
>> <peter.maydell@linaro.org> wrote:
>>> Disable clang's initializer-overrides warnings, as QEMU makes 
>>> significant
>>> use of the pattern of initializing an array with a range-based default
>>> entry like
>>>      [0 ... 0x1ff] = { GPIO_NONE, 0 }
>>> followed by specific entries which override that default, and clang
>>> would otherwise warn "initializer overrides prior initialization of
>>> this subobject" when it encountered the specific entry.
>>>
>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>>> ---
>>> This is basically a judgement that our coding style is legitimate
>>> and the compiler is being overly alarmist. I don't think we would
>>> benefit from trying to silence the warnings and I can't think of
>>> a clean way of doing so...
>>>
>>> NB that gcc will happily ignore -Wno-wombat warnings that it doesn't
>>> happen to recognize. (For compilers that don't accept-and-ignore the 
>>> flag
>>> configure will identify this and not use it.)
>>>
>
> I encountered strange behavior of latest mingw gcc, it ignores 
> unrecognized -Wno-wombat options only in case if no other warnings are 
> issued (configure gccflags test doesn't issue any), otherwise I get this:
>
> cc1.exe: warning: unrecognized command line option 
> "-Wno-initializer-overrides" [enabled by default]
>
> This is probably a bug in mingw GCC (or perhaps I'm using it wrong), 
> but anyway, this makes QEMU mingw build output very noisy.

This "feature" of gcc is not restricted to MinGW nor to a special 
version of gcc
but can also occur on Linux.
Normally, you don't see it there because QEMU compiles without warnings 
on Linux
while there are more or less warnings on MinGW.

It looks like we need a better test for compiler options.
Here are several possible solutions for this test:

* Run the compiler with all compiler options + at least one unsupported 
option.
   It will complain and list all invalid options. Remove those from the 
list.
   This solution needs a fallback to the current solution if the compiler's
   error output does not include the invalid options.

* Run $cc --help=warnings and look for each warning option in the 
resulting list.
   -fstack-protector-all is not a warning option and needs special handling.
   This solution needs a fallback to the current solution if the 
compiler does
   not support --help=warning (clang does not).

* Get the compiler and its version and set the options according to the 
specification.
   This is more work than the other two solutions.

A nice side effect of the first two solutions would be that they can 
reduce the
time needed for configure in the usual environment with gcc (but not 
with clang).

Regards

Stefan Weil

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-27 21:24     ` Stefan Weil
@ 2012-10-27 21:35       ` Peter Maydell
  2012-10-27 21:46         ` Stefan Weil
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Maydell @ 2012-10-27 21:35 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Igor Mitsyanko, Blue Swirl, qemu-devel, patches

On 27 October 2012 22:24, Stefan Weil <sw@weilnetz.de> wrote:
> Am 27.10.2012 22:32, schrieb Igor Mitsyanko:
>> I encountered strange behavior of latest mingw gcc, it ignores
>> unrecognized -Wno-wombat options only in case if no other warnings are
>> issued (configure gccflags test doesn't issue any), otherwise I get this:
>>
>> cc1.exe: warning: unrecognized command line option
>> "-Wno-initializer-overrides" [enabled by default]
>>
>> This is probably a bug in mingw GCC (or perhaps I'm using it wrong), but
>> anyway, this makes QEMU mingw build output very noisy.

> This "feature" of gcc is not restricted to MinGW nor to a special version of
> gcc but can also occur on Linux.

Incidentally, I was tangentially involved in getting gcc to adopt
this behaviour. The rationale is that it allows you to write
straightforward makefiles which use -Werror and also some -Wno-*
options without having to add some configure-like step to test
whether gcc supports the -Wno-*. If the gcc version you're using
doesn't support detecting the presence of wombats in your source
code then it will never produce warnings about them, so it's
safe for it to treat -Wno-wombat as a no-op. The reason for
printing the message if some other warning is also emitted is
so the user can spot the case where they accidentally typo'd
the -Wno-* option they meant to use to suppress the warning.

-- PMM

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings
  2012-10-27 21:35       ` Peter Maydell
@ 2012-10-27 21:46         ` Stefan Weil
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Weil @ 2012-10-27 21:46 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Igor Mitsyanko, Blue Swirl, qemu-devel, patches

Am 27.10.2012 23:35, schrieb Peter Maydell:
> On 27 October 2012 22:24, Stefan Weil<sw@weilnetz.de>  wrote:
>> Am 27.10.2012 22:32, schrieb Igor Mitsyanko:
>>> I encountered strange behavior of latest mingw gcc, it ignores
>>> unrecognized -Wno-wombat options only in case if no other warnings are
>>> issued (configure gccflags test doesn't issue any), otherwise I get this:
>>>
>>> cc1.exe: warning: unrecognized command line option
>>> "-Wno-initializer-overrides" [enabled by default]
>>>
>>> This is probably a bug in mingw GCC (or perhaps I'm using it wrong), but
>>> anyway, this makes QEMU mingw build output very noisy.
>> This "feature" of gcc is not restricted to MinGW nor to a special version of
>> gcc but can also occur on Linux.
>
> Incidentally, I was tangentially involved in getting gcc to adopt
> this behaviour. The rationale is that it allows you to write
> straightforward makefiles which use -Werror and also some -Wno-*
> options without having to add some configure-like step to test
> whether gcc supports the -Wno-*. If the gcc version you're using
> doesn't support detecting the presence of wombats in your source
> code then it will never produce warnings about them, so it's
> safe for it to treat -Wno-wombat as a no-op. The reason for
> printing the message if some other warning is also emitted is
> so the user can spot the case where they accidentally typo'd
> the -Wno-* option they meant to use to suppress the warning.
>
> -- PMM

Nice. Thanks for that explanation.

Are there plans to add wombat detection to gcc? :-)

Here is the spec:
http://upload.wikimedia.org/wikipedia/commons/1/18/Vombatus_ursinus_-Maria_Island_National_Park.jpg

Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-10-27 21:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-14 20:00 [Qemu-devel] [PATCH] configure: Disable (clang) initializer-overrides warnings Peter Maydell
2012-10-14 20:15 ` Blue Swirl
2012-10-14 20:24   ` Peter Maydell
2012-10-16 20:20     ` Stefan Weil
2012-10-16 21:19       ` Peter Maydell
2012-10-24 12:31     ` Peter Maydell
2012-10-27 16:51 ` Blue Swirl
2012-10-27 20:32   ` Igor Mitsyanko
2012-10-27 21:12     ` Peter Maydell
2012-10-27 21:24     ` Stefan Weil
2012-10-27 21:35       ` Peter Maydell
2012-10-27 21:46         ` Stefan Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).