-Wparentheses lumps too much together

Paolo Bonzini bonzini@gnu.org
Sat Jan 12 11:23:00 GMT 2008


Andreas Schwab wrote:
> Ian Lance Taylor <iant@google.com> writes:
> 
>> I'm inclined to approve this if -Wprecedence stays in -Wall, but I'd
>> like to hear if anybody else has anything to say.
> 
> The name of the option is rather poor, IMHO.  -Wparentheses warns about
> precedences, so what is the difference to -Wprecedence?

-Wparentheses warns in general about things that the GCS prefer to be 
parenthesized.  I would prefer something like

int warn_precedence = 2;

...

if (warn_precedence == 2)
   warn_precedence = warn_parentheses;

that is, we have

   -Wparentheses remains as is now, and is enabled by -Wall
   -Wparentheses -Wno-precedence only warns about things like a = b = c
                                 for bool b and non-bool a

Paolo



More information about the Gcc mailing list