PR c/65120
commit16f958b3663cfcb8624e6b360c5142b5ba6979a4
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Mar 2015 06:38:57 +0000 (10 06:38 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Mar 2015 06:38:57 +0000 (10 06:38 +0000)
treeaf3e28b78c0d8a3c890506ce8948602e57219233
parentbfaa965e614207a13f7d5c44069c4d174888ed01
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221299 138bc75d-0d04-0410-961f-82ee72b054a4
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]