aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-10-18 17:56:23 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-10-18 17:56:23 -0400
commit7e9d002adbebf4d6ca3215779efaf7c3f2ffd153 (patch)
treef5d343fa89973c40a3e812742063a1873d6a6bee
parentc043666f5cdcf4a266ef4e780daf15209c730c93 (diff)
downloadgcc-7e9d002adbebf4d6ca3215779efaf7c3f2ffd153.zip
gcc-7e9d002adbebf4d6ca3215779efaf7c3f2ffd153.tar.gz
gcc-7e9d002adbebf4d6ca3215779efaf7c3f2ffd153.tar.bz2
(parser_build_binary_op): Warn about x^y==z, etc.
From-SVN: r10473
-rw-r--r--gcc/c-typeck.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 75df083..e9d6b2a 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1823,6 +1823,9 @@ parser_build_binary_op (code, arg1, arg2)
|| code2 == BIT_AND_EXPR || code2 == BIT_XOR_EXPR
|| code2 == PLUS_EXPR || code2 == MINUS_EXPR)
warning ("suggest parentheses around arithmetic in operand of |");
+ /* Check cases like x|y==z */
+ if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')
+ warning ("suggest parentheses around comparison in operand of |");
}
if (code == BIT_XOR_EXPR)
@@ -1832,6 +1835,9 @@ parser_build_binary_op (code, arg1, arg2)
|| code2 == BIT_AND_EXPR
|| code2 == PLUS_EXPR || code2 == MINUS_EXPR)
warning ("suggest parentheses around arithmetic in operand of ^");
+ /* Check cases like x^y==z */
+ if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')
+ warning ("suggest parentheses around comparison in operand of ^");
}
if (code == BIT_AND_EXPR)
@@ -1839,6 +1845,9 @@ parser_build_binary_op (code, arg1, arg2)
if (code1 == PLUS_EXPR || code1 == MINUS_EXPR
|| code2 == PLUS_EXPR || code2 == MINUS_EXPR)
warning ("suggest parentheses around + or - in operand of &");
+ /* Check cases like x&y==z */
+ if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')
+ warning ("suggest parentheses around comparison in operand of &");
}
}