1 /* Test operation of -Wparentheses. Precedence warnings. & or ^ or +
2 or - or comparison inside |. */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-Wparentheses" } */
11 bar (int a
, int b
, int c
)
13 foo (a
& b
| c
); /* { dg-warning "parentheses" "correct warning" } */
16 foo (1 & 2 | c
); /* { dg-warning "parentheses" "correct warning" } */
19 foo (1 & 2 | 3); /* { dg-warning "parentheses" "correct warning" } */
22 foo (a
| b
& c
); /* { dg-warning "parentheses" "correct warning" } */
25 foo (1 | 2 & c
); /* { dg-warning "parentheses" "correct warning" } */
28 foo (1 | 2 & 3); /* { dg-warning "parentheses" "correct warning" } */
31 foo (a
^ b
| c
); /* { dg-warning "parentheses" "correct warning" } */
34 foo (1 ^ 2 | c
); /* { dg-warning "parentheses" "correct warning" } */
37 foo (1 ^ 2 | 3); /* { dg-warning "parentheses" "correct warning" } */
40 foo (a
| b
^ c
); /* { dg-warning "parentheses" "correct warning" } */
43 foo (1 | 2 ^ c
); /* { dg-warning "parentheses" "correct warning" } */
46 foo (1 | 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
49 foo (a
+ b
| c
); /* { dg-warning "parentheses" "correct warning" } */
52 foo (1 + 2 | c
); /* { dg-warning "parentheses" "correct warning" } */
55 foo (1 + 2 | 3); /* { dg-warning "parentheses" "correct warning" } */
58 foo (a
| b
+ c
); /* { dg-warning "parentheses" "correct warning" } */
61 foo (1 | 2 + c
); /* { dg-warning "parentheses" "correct warning" } */
64 foo (1 | 2 + 3); /* { dg-warning "parentheses" "correct warning" } */
67 foo (a
- b
| c
); /* { dg-warning "parentheses" "correct warning" } */
70 foo (1 - 2 | c
); /* { dg-warning "parentheses" "correct warning" } */
73 foo (1 - 2 | 3); /* { dg-warning "parentheses" "correct warning" } */
76 foo (a
| b
- c
); /* { dg-warning "parentheses" "correct warning" } */
79 foo (1 | 2 - c
); /* { dg-warning "parentheses" "correct warning" } */
82 foo (1 | 2 - 3); /* { dg-warning "parentheses" "correct warning" } */
85 foo (a
> b
| c
); /* { dg-warning "parentheses" "correct warning" } */
88 foo (1 > 2 | c
); /* { dg-warning "parentheses" "correct warning" } */
91 foo (1 > 2 | 3); /* { dg-warning "parentheses" "correct warning" } */
94 foo (a
| b
> c
); /* { dg-warning "parentheses" "correct warning" } */
97 foo (1 | 2 > c
); /* { dg-warning "parentheses" "correct warning" } */
100 foo (1 | 2 > 3); /* { dg-warning "parentheses" "correct warning" } */
103 foo (a
<= b
| c
); /* { dg-warning "parentheses" "correct warning" } */
106 foo (1 <= 2 | c
); /* { dg-warning "parentheses" "correct warning" } */
109 foo (1 <= 2 | 3); /* { dg-warning "parentheses" "correct warning" } */
112 foo (a
| b
<= c
); /* { dg-warning "parentheses" "correct warning" } */
115 foo (1 | 2 <= c
); /* { dg-warning "parentheses" "correct warning" } */
118 foo (1 | 2 <= 3); /* { dg-warning "parentheses" "correct warning" } */