Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / Wparentheses-5.c
blob49c65c21a05a09d4a9a6cfd73a73dbc89dfab834
1 /* Test operation of -Wparentheses. Precedence warnings. && inside
2 ||. */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-Wparentheses" } */
8 int foo (int);
10 int
11 bar (int a, int b, int c)
13 foo (a && b || c); /* { dg-warning "parentheses" "correct warning" } */
14 foo ((a && b) || c);
15 foo (a && (b || c));
16 foo (1 && 2 || c); /* { dg-warning "parentheses" "correct warning" } */
17 foo ((1 && 2) || c);
18 foo (1 && (2 || c));
19 foo (1 && 2 || 3); /* { dg-warning "parentheses" "correct warning" } */
20 foo ((1 && 2) || 3);
21 foo (1 && (2 || 3));
22 foo (a || b && c); /* { dg-warning "parentheses" "correct warning" } */
23 foo ((a || b) && c);
24 foo (a || (b && c));
25 foo (1 || 2 && c); /* { dg-warning "parentheses" "correct warning" } */
26 foo ((1 || 2) && c);
27 foo (1 || (2 && c));
28 foo (1 || 2 && 3); /* { dg-warning "parentheses" "correct warning" } */
29 foo ((1 || 2) && 3);
30 foo (1 || (2 && 3));