diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-17 09:20:51 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-17 09:20:51 +0000 |
commit | 655109c8a29eb7ea5c4254f01a6367dc07d921b0 (patch) | |
tree | e4dd6ebe816e96ed4438c19008d235f68f8c19fc /gcc/c-typeck.c | |
parent | 6a4e0750ccf988d9a9684da0bf9a858f358e706c (diff) | |
download | ppe42-gcc-655109c8a29eb7ea5c4254f01a6367dc07d921b0.tar.gz ppe42-gcc-655109c8a29eb7ea5c4254f01a6367dc07d921b0.zip |
* c-typeck.c (parser_build_binary_op): Condition warnings for
X<=Y<=Z on -Wparentheses instead of -Wextra.
* doc/invoke.texi: Update. Document that most of -Wparentheses is
supported for C only.
testsuite:
* gcc.dg/Wparentheses-2.c, gcc.dg/Wparentheses-3.c,
gcc.dg/Wparentheses-4.c, Wparentheses-5.c, Wparentheses-6.c,
Wparentheses-7.c, Wparentheses-8.c, Wparentheses-9.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84860 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r-- | gcc/c-typeck.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2495550ed54..4befd126f08 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2170,12 +2170,13 @@ parser_build_binary_op (enum tree_code code, tree arg1, tree arg2) if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<') warning ("suggest parentheses around comparison in operand of &"); } - } + /* Similarly, check for cases like 1<=i<=10 that are probably errors. */ + if (TREE_CODE_CLASS (code) == '<' + && (TREE_CODE_CLASS (code1) == '<' + || TREE_CODE_CLASS (code2) == '<')) + warning ("comparisons like X<=Y<=Z do not have their mathematical meaning"); - /* Similarly, check for cases like 1<=i<=10 that are probably errors. */ - if (TREE_CODE_CLASS (code) == '<' && extra_warnings - && (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')) - warning ("comparisons like X<=Y<=Z do not have their mathematical meaning"); + } unsigned_conversion_warning (result, arg1); unsigned_conversion_warning (result, arg2); |