re PR c/65120 (Wlogical-not-parentheses should not warn about double exclamation !!)
authorJakub Jelinek <jakub@redhat.com>
Tue, 10 Mar 2015 06:38:57 +0000 (07:38 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 10 Mar 2015 06:38:57 +0000 (07:38 +0100)
commit7ccb1a11e5a8debe5689d6d149a94175c7fe9ae2
treeaf3e28b78c0d8a3c890506ce8948602e57219233
parent26d83bccd1ed42a08b5940ba73742537b81efa2b
re PR c/65120 (Wlogical-not-parentheses should not warn about double exclamation !!)

PR c/65120
* c-common.c (warn_logical_not_parentheses): Don't warn for
!x == 0 or !x != 0.

* c-typeck.c (parser_build_binary_op): Check for tcc_comparison
before preparing arguments to warn_logical_not_parentheses.

* parser.c (cp_parser_binary_expression): Check for tcc_comparison
before preparing arguments to warn_logical_not_parentheses.
Use maybe_constant_value on rhs.

* c-c++-common/pr49706.c (fn2): Don't expect warning if enumerator
on rhs is 0.
(fn4): New test.
* c-c++-common/pr65120.c: New test.

From-SVN: r221299
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr49706.c
gcc/testsuite/c-c++-common/pr65120.c [new file with mode: 0644]