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/testsuite/gcc.dg/Wparentheses-5.c | |
parent | 6a4e0750ccf988d9a9684da0bf9a858f358e706c (diff) | |
download | gcc-655109c8a29eb7ea5c4254f01a6367dc07d921b0.tar.gz |
* 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/testsuite/gcc.dg/Wparentheses-5.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/Wparentheses-5.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wparentheses-5.c b/gcc/testsuite/gcc.dg/Wparentheses-5.c new file mode 100644 index 00000000000..be12f73f1c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wparentheses-5.c @@ -0,0 +1,31 @@ +/* Test operation of -Wparentheses. Precedence warnings. && inside + ||. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ + +/* { dg-do compile } */ +/* { dg-options "-Wparentheses" } */ + +int foo (int); + +int +bar (int a, int b, int c) +{ + foo (a && b || c); /* { dg-warning "parentheses" "correct warning" } */ + foo ((a && b) || c); + foo (a && (b || c)); + foo (1 && 2 || c); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ + foo ((1 && 2) || c); + foo (1 && (2 || c)); + foo (1 && 2 || 3); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ + foo ((1 && 2) || 3); + foo (1 && (2 || 3)); + foo (a || b && c); /* { dg-warning "parentheses" "correct warning" } */ + foo ((a || b) && c); + foo (a || (b && c)); + foo (1 || 2 && c); /* { dg-warning "parentheses" "correct warning" } */ + foo ((1 || 2) && c); + foo (1 || (2 && c)); + foo (1 || 2 && 3); /* { dg-warning "parentheses" "correct warning" } */ + foo ((1 || 2) && 3); + foo (1 || (2 && 3)); +} |