[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: [PATCH] Add -Womitted-conditional-op warning
From:       "=?ISO-8859-1?Q?Manuel_L=F3pez-Ib=E1=F1ez?=" <lopezibanez () gmail ! com>
Date:       2007-02-02 19:48:26
Message-ID: 6c33472e0702021148g7cc2fdfav8cda27e7102e0e13 () mail ! gmail ! com
[Download RAW message or body]

On 02 Feb 2007 11:30:28 -0600, Gabriel Dos Reis <gdr@cs.tamu.edu> wrote:
> Andi Kleen <ak@suse.de> writes:
>
> | Since it seems to be currently envogue to add new warnings:
>
> :-)
>
> It is really "envogue".  I'm very concerned with multiplication of
> warnings, without clear structures.
>

Actually, what is "in vogue" is to name *existing* warnings that users
want to disable but they cannot because there is no name for them, so
they cannot use -Wextra or they are forced to use "-w".

You say that you are concerned but you approve this? A whole new
switch to warn for the wrong usage of a particular GNU extension.
Great...

> | I had this one
> | lying around for quite some time. It checks for a (relatively obscure) mistake
> | in using a GCC extension that I once made. Gcc allows omitting the middle
> | operand in ?:. Now when one writes e.g.
> |
> | foo() != NULL ?: bar
>
> The warning is not about the missing conditional operator.  It is
> about the missing of the second operand to the conditional operator.
>
> Please, just call it -Wconditional.  We need to keep switches short but
> suggestive enough.
>

So are we going to put anything that has to do with conditionals under
this new switch? Great...


> Is that really the case?  The documentation says:
>
>   The middle operand in a conditional expression may be omitted.  Then
>   if the first operand is nonzero, its value is the value of the
>   conditional
>   expression.
>
> so the meaning is not "unexpected".  However, I'm fine with
>

Not unexpected. Actually, it is the expected behaviour and it is
documented. So what are we warning about? Are we going to add a switch
for every documented behaviour of every GNU extensions that may be
misused?

>    warning: missing second operand in '?:'
>    note: if the condition is a generalized 'true', it is the value
>    note: of the whole conditional expression
>
> I'm OM with those changes.

Great...  :-(

Manuel.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic