From 7e9d002adbebf4d6ca3215779efaf7c3f2ffd153 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Wed, 18 Oct 1995 17:56:23 -0400 Subject: [PATCH] (parser_build_binary_op): Warn about x^y==z, etc. From-SVN: r10473 --- gcc/c-typeck.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 75df0837a41..e9d6b2a4196 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 &"); } } -- 2.30.2