This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/32061] (Wlogical-op) wording of warning of constant logicials need improvement
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Feb 2009 23:04:42 -0000
- Subject: [Bug c/32061] (Wlogical-op) wording of warning of constant logicials need improvement
- References: <bug-32061-828@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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