Commit 001af587 by Richard Stallman

(parser_build_binary_op): Warn about expressions like `1<=i<=N'.

From-SVN: r1794
parent b5c52586
...@@ -2136,6 +2136,11 @@ parser_build_binary_op (code, arg1, arg2) ...@@ -2136,6 +2136,11 @@ parser_build_binary_op (code, arg1, arg2)
class = TREE_CODE_CLASS (TREE_CODE (result)); class = TREE_CODE_CLASS (TREE_CODE (result));
/* Similarly, check for cases like 1<=i<=10 that are probably errors. */
if (class == '<' && extra_warnings
&& (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<'))
warning ("comparisons like X<=Y<=Z do not have their mathematical meaning");
/* Record the code that was specified in the source, /* Record the code that was specified in the source,
for the sake of warnings about confusing nesting. */ for the sake of warnings about confusing nesting. */
if (class == 'e' || class == '1' if (class == 'e' || class == '1'
......
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