aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2015-03-10 07:38:57 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2015-03-10 07:38:57 +0100
commit7ccb1a11e5a8debe5689d6d149a94175c7fe9ae2 (patch)
treeaf3e28b78c0d8a3c890506ce8948602e57219233 /gcc/c
parent26d83bccd1ed42a08b5940ba73742537b81efa2b (diff)
downloadgcc-7ccb1a11e5a8debe5689d6d149a94175c7fe9ae2.zip
gcc-7ccb1a11e5a8debe5689d6d149a94175c7fe9ae2.tar.gz
gcc-7ccb1a11e5a8debe5689d6d149a94175c7fe9ae2.tar.bz2
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
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.c1
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 7b81080..c15b86f 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/65120
+ * c-typeck.c (parser_build_binary_op): Check for tcc_comparison
+ before preparing arguments to warn_logical_not_parentheses.
+
2015-03-09 Jakub Jelinek <jakub@redhat.com>
PR c/65120
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 98bff32..ebe4c73 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -3459,6 +3459,7 @@ parser_build_binary_op (location_t location, enum tree_code code,
code1, arg1.value, code2, arg2.value);
if (warn_logical_not_paren
+ && TREE_CODE_CLASS (code) == tcc_comparison
&& code1 == TRUTH_NOT_EXPR
&& code2 != TRUTH_NOT_EXPR
/* Avoid warning for !!x == y. */