Commit 7e9d002a by Richard Kenner

(parser_build_binary_op): Warn about x^y==z, etc.

From-SVN: r10473
parent c043666f
...@@ -1823,6 +1823,9 @@ parser_build_binary_op (code, arg1, arg2) ...@@ -1823,6 +1823,9 @@ parser_build_binary_op (code, arg1, arg2)
|| code2 == BIT_AND_EXPR || code2 == BIT_XOR_EXPR || code2 == BIT_AND_EXPR || code2 == BIT_XOR_EXPR
|| code2 == PLUS_EXPR || code2 == MINUS_EXPR) || code2 == PLUS_EXPR || code2 == MINUS_EXPR)
warning ("suggest parentheses around arithmetic in operand of |"); 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) if (code == BIT_XOR_EXPR)
...@@ -1832,6 +1835,9 @@ parser_build_binary_op (code, arg1, arg2) ...@@ -1832,6 +1835,9 @@ parser_build_binary_op (code, arg1, arg2)
|| code2 == BIT_AND_EXPR || code2 == BIT_AND_EXPR
|| code2 == PLUS_EXPR || code2 == MINUS_EXPR) || code2 == PLUS_EXPR || code2 == MINUS_EXPR)
warning ("suggest parentheses around arithmetic in operand of ^"); 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) if (code == BIT_AND_EXPR)
...@@ -1839,6 +1845,9 @@ parser_build_binary_op (code, arg1, arg2) ...@@ -1839,6 +1845,9 @@ parser_build_binary_op (code, arg1, arg2)
if (code1 == PLUS_EXPR || code1 == MINUS_EXPR if (code1 == PLUS_EXPR || code1 == MINUS_EXPR
|| code2 == PLUS_EXPR || code2 == MINUS_EXPR) || code2 == PLUS_EXPR || code2 == MINUS_EXPR)
warning ("suggest parentheses around + or - in operand of &"); 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 &");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment