Should a disabled warning be allowed to be promoted to an error(Bugzilla PR 70275)?

Martin Sebor msebor@gmail.com
Fri Apr 1 03:39:00 GMT 2016


On 03/31/2016 10:30 AM, Segher Boessenkool wrote:
> On Mon, Mar 28, 2016 at 04:32:50PM -0600, Martin Sebor wrote:
>> On 03/28/2016 01:56 PM, Florian Weimer wrote:
>>>> In Bugzilla PR # 70275, Manuel López-Ibáñez reports that even though
>>>> he provides the "-Werror=return-type" option, the compiler doesn't
>>>> flag the warning/error about a control reaching the end of a non-void
>>>> function, due to the presence of the "-w" option.  He points out that
>>>> clang++ wtill flags the promoted warning even though warnings are
>>>> inhibited.
>>>
>>> I think -w is ordered with respect to the other warning obtions, and
>>> -w inhibits previously requested warnings, and future -W flags may
>>> enable other warnings.  With this in mind, I agree that the current
>>> GCC behavior is consistent and probably not a bug.
>>
>> The general rule of thumb documented in the manual is that more
>> specific options take precedence over more general ones, regardless
>> of where they appear on the command line:
>
> Currently, -w is a nice easy quick way of shutting up all warnings
> whenever they are getting in the way.  Let's keep it that way.

I agree that having a knob to suppress all warnings can be useful.

At the same time, having the ability to do what PR 70275 asks for
(i.e., suppress only warnings that have not be been explicitly
enabled or elevated to errors) can be handy as well.  If it's
preferable to keep -w unchanged, providing a new option to do it
might be worth considering.

Martin



More information about the Gcc mailing list