[Bug c/32061] (Wlogical-op) wording of warning of constant logicials need improvement
--- Comment #7 from manu at gcc dot gnu dot org 2009-04-19 11:06 --- FIXED in GCC 4.5 -- manu at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32061
[Bug c/32061] (Wlogical-op) wording of warning of constant logicials need improvement
--- Comment #6 from manu at gcc dot gnu dot org 2009-04-19 11:04 --- Subject: Bug 32061 Author: manu Date: Sun Apr 19 11:04:13 2009 New Revision: 146344 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146344 Log: 2009-04-19 Manuel López-Ibáñez PR c/32061 PR c++/36954 * doc/invoke.texi: Add -Wlogical-op to -Wextra. * common.opt (Wlogical-op): Move from here... * c.opt (Wlogical-op): ... to here. * c-typeck.c (parser_build_binary_op): Update call to warn_logical_operator. * c-opts.c (c_common_post_options): Enable warn_logical_op with extra_warnings. * c-common.c (warn_logical_op): Update. * c-common.h (warn_logical_op): Update declaration. cp/ * call.c (build_new_op): Save the original codes of operands before folding. testsuite/ * gcc.dg/pr32061.c: New. * gcc.dg/Wlogical-op-1.c: Update. * g++.dg/warn/Wlogical-op-1.C: Update. * g++.dg/warn/pr36954.C: New. Added: trunk/gcc/testsuite/g++.dg/warn/pr36954.C trunk/gcc/testsuite/gcc.dg/pr32061.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-common.c trunk/gcc/c-common.h trunk/gcc/c-opts.c trunk/gcc/c-typeck.c trunk/gcc/c.opt trunk/gcc/common.opt trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/doc/invoke.texi trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/warn/Wlogical-op-1.C trunk/gcc/testsuite/gcc.dg/Wlogical-op-1.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32061
[Bug c/32061] (Wlogical-op) wording of warning of constant logicials need improvement
--- Comment #5 from manu at gcc dot gnu dot org 2009-02-18 13:13 --- Patch submitted: http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00824.html -- manu at gcc dot gnu dot org changed: What|Removed |Added URL||http://gcc.gnu.org/ml/gcc- ||patches/2009- ||02/msg00824.html Keywords||patch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32061
[Bug c/32061] (Wlogical-op) wording of warning of constant logicials need improvement
--- Comment #4 from eyal at eyal dot emu dot id dot au 2009-02-12 08:28 --- (In reply to comment #3) > 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? Great, thanks. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32061
[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|-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