1 /* Test operation of -Wparentheses. Precedence warnings. + or -
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 (6 - 5 << c
); /* { dg-warning "parentheses" "correct warning" } */
55 foo (6 - 5 << 4); /* { dg-warning "parentheses" "correct warning" } */
58 foo (a
<< b
- c
); /* { dg-warning "parentheses" "correct warning" } */
61 foo (6 << 5 - c
); /* { dg-warning "parentheses" "correct warning" } */
64 foo (6 << 5 - 4); /* { dg-warning "parentheses" "correct warning" } */
67 foo (a
- b
>> c
); /* { dg-warning "parentheses" "correct warning" } */
70 foo (6 - 5 >> c
); /* { dg-warning "parentheses" "correct warning" } */
73 foo (6 - 5 >> 4); /* { dg-warning "parentheses" "correct warning" } */
76 foo (a
>> b
- c
); /* { dg-warning "parentheses" "correct warning" } */
79 foo (6 >> 5 - c
); /* { dg-warning "parentheses" "correct warning" } */
82 foo (6 >> 5 - 4); /* { dg-warning "parentheses" "correct warning" } */