This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/32061] (Wlogical-op) wording of warning of constant logicials need improvement



------- Comment #3 from manu at gcc dot gnu dot org  2009-02-11 23:04 -------
Confirmed. I have a patch for this for 4.5.

The new wording will say:

warning: logical 'or' applied to non-boolean constant.

Are you satisfied with this?

> 
> BTW, why no warning for this?
>    resp == 0 && 0
> Naturally, all the above constants will hide behind some macros which could
> indicate a real error, hence the value of the warning.

Warning for (x && 0) or (x && 1) would produce hundreds of false positives. We
shouldn't warn about your testcase either.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-02-11 23:04:41
               date|                            |
            Summary|wording of warning of       |(Wlogical-op) wording of
                   |constant logicials need     |warning of constant
                   |improvement                 |logicials need improvement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32061


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]