[PATCH] RFA: Add a small indication to warnings that are promoted to errors

Richard Guenther richard.guenther@gmail.com
Fri Nov 20 15:46:00 GMT 2009


On Fri, Nov 20, 2009 at 4:37 PM, Simon Baldwin <simonb@google.com> wrote:
> 2009/11/20 Richard Guenther <richard.guenther@gmail.com>:
>> On Fri, Nov 20, 2009 at 4:13 PM, Simon Baldwin <simonb@google.com> wrote:
>>> This small patch adds an indication "[was warning]" to gcc diagnostics where
>>> warning messages are promoted to errors with -Werror.
>>>
>>> This helps to resolve possible confusion regarding diagnostics.  For example,
>>> if the following code is compiled with -Werror, both lines are currently
>>> flagged as errors by gcc, with no hint that the first is not a real program
>>> error:
>>>
>>>  extern int foo = 42;  // gcc error: 'foo' initialized and declared 'extern'
>>>                        // okay: ISO/IEC 9899:1999, 6.9.2-4
>>>  static int bar = foo; // gcc error: initializer element is not constant
>>>                        // error: ISO/IEC 9899:1999, 6.7.8-4
>>>
>>> Confirmed C dejagnu testsuite parity with the unpatched gcc, and verified
>>> bootstrap of C on x86_64.
>>
>> We do say
>>
>> cc1: warnings being treated as errors
>
> We say it for the overall -Werror, but not for more targeted
> -Werror=sign-conversion, or similar specific -Werror= settings in the
> absence of any overall -Werror.
>
> Also, the "warnings being treated as errors" message, I've found,
> tends to get overlooked.  Especially where there may be a lot (and
> there can be an awful lot in C++) of other diagnostics between it and
> the one of interest.
>
>
>>
>> though.  Did you consider instead of appending [was warning] to
>> simply make it print
>>
>> t.c:1: error: warning: ‘foo’ initialized and declared ‘extern’
>>
>> which would be consistent - the error is that there is a warning.
>
> I discussed this patch off-list with Gaby before sending it out, and
> this was one of my suggestions.  Gaby suggested the trailing "[was
> warning]" instead.

I don't like the suffix much - so much for the bikeshedding ;)

Richard.



More information about the Gcc-patches mailing list