1 |
693 |
jeremybenn |
// { dg-do compile }
|
2 |
|
|
// { dg-options "-Wparentheses" }
|
3 |
|
|
|
4 |
|
|
// C++ copy of gcc.dg/Wparentheses-4.c
|
5 |
|
|
|
6 |
|
|
int foo (int);
|
7 |
|
|
|
8 |
|
|
int
|
9 |
|
|
bar (int a, int b, int c)
|
10 |
|
|
{
|
11 |
|
|
foo (a + b << c); // { dg-warning "parentheses" "correct warning" }
|
12 |
|
|
foo ((a + b) << c);
|
13 |
|
|
foo (a + (b << c));
|
14 |
|
|
foo (1 + 2 << c); // { dg-warning "parentheses" "correct warning" }
|
15 |
|
|
foo ((1 + 2) << c);
|
16 |
|
|
foo (1 + (2 << c));
|
17 |
|
|
foo (1 + 2 << 3); // { dg-warning "parentheses" "correct warning" }
|
18 |
|
|
foo ((1 + 2) << 3);
|
19 |
|
|
foo (1 + (2 << 3));
|
20 |
|
|
foo (a << b + c); // { dg-warning "parentheses" "correct warning" }
|
21 |
|
|
foo ((a << b) + c);
|
22 |
|
|
foo (a << (b + c));
|
23 |
|
|
foo (1 << 2 + c); // { dg-warning "parentheses" "correct warning" }
|
24 |
|
|
foo ((1 << 2) + c);
|
25 |
|
|
foo (1 << (2 + c));
|
26 |
|
|
foo (1 << 2 + 3); // { dg-warning "parentheses" "correct warning" }
|
27 |
|
|
foo ((1 << 2) + 3);
|
28 |
|
|
foo (1 << (2 + 3));
|
29 |
|
|
foo (a + b >> c); // { dg-warning "parentheses" "correct warning" }
|
30 |
|
|
foo ((a + b) >> c);
|
31 |
|
|
foo (a + (b >> c));
|
32 |
|
|
foo (1 + 2 >> c); // { dg-warning "parentheses" "correct warning" }
|
33 |
|
|
foo ((1 + 2) >> c);
|
34 |
|
|
foo (1 + (2 >> c));
|
35 |
|
|
foo (1 + 2 >> 3); // { dg-warning "parentheses" "correct warning" }
|
36 |
|
|
foo ((1 + 2) >> 3);
|
37 |
|
|
foo (1 + (2 >> 3));
|
38 |
|
|
foo (a >> b + c); // { dg-warning "parentheses" "correct warning" }
|
39 |
|
|
foo ((a >> b) + c);
|
40 |
|
|
foo (a >> (b + c));
|
41 |
|
|
foo (1 >> 2 + c); // { dg-warning "parentheses" "correct warning" }
|
42 |
|
|
foo ((1 >> 2) + c);
|
43 |
|
|
foo (1 >> (2 + c));
|
44 |
|
|
foo (1 >> 2 + 3); // { dg-warning "parentheses" "correct warning" }
|
45 |
|
|
foo ((1 >> 2) + 3);
|
46 |
|
|
foo (1 >> (2 + 3));
|
47 |
|
|
foo (a - b << c); // { dg-warning "parentheses" "correct warning" }
|
48 |
|
|
foo ((a - b) << c);
|
49 |
|
|
foo (a - (b << c));
|
50 |
|
|
foo (6 - 5 << c); // { dg-warning "parentheses" "correct warning" }
|
51 |
|
|
foo ((6 - 5) << c);
|
52 |
|
|
foo (6 - (5 << c));
|
53 |
|
|
foo (6 - 5 << 4); // { dg-warning "parentheses" "correct warning" }
|
54 |
|
|
foo ((6 - 5) << 4);
|
55 |
|
|
foo (6 - (5 << 4));
|
56 |
|
|
foo (a << b - c); // { dg-warning "parentheses" "correct warning" }
|
57 |
|
|
foo ((a << b) - c);
|
58 |
|
|
foo (a << (b - c));
|
59 |
|
|
foo (6 << 5 - c); // { dg-warning "parentheses" "correct warning" }
|
60 |
|
|
foo ((6 << 5) - c);
|
61 |
|
|
foo (6 << (5 - c));
|
62 |
|
|
foo (6 << 5 - 4); // { dg-warning "parentheses" "correct warning" }
|
63 |
|
|
foo ((6 << 5) - 4);
|
64 |
|
|
foo (6 << (5 - 4));
|
65 |
|
|
foo (a - b >> c); // { dg-warning "parentheses" "correct warning" }
|
66 |
|
|
foo ((a - b) >> c);
|
67 |
|
|
foo (a - (b >> c));
|
68 |
|
|
foo (6 - 5 >> c); // { dg-warning "parentheses" "correct warning" }
|
69 |
|
|
foo ((6 - 5) >> c);
|
70 |
|
|
foo (6 - (5 >> c));
|
71 |
|
|
foo (6 - 5 >> 4); // { dg-warning "parentheses" "correct warning" }
|
72 |
|
|
foo ((6 - 5) >> 4);
|
73 |
|
|
foo (6 - (5 >> 4));
|
74 |
|
|
foo (a >> b - c); // { dg-warning "parentheses" "correct warning" }
|
75 |
|
|
foo ((a >> b) - c);
|
76 |
|
|
foo (a >> (b - c));
|
77 |
|
|
foo (6 >> 5 - c); // { dg-warning "parentheses" "correct warning" }
|
78 |
|
|
foo ((6 >> 5) - c);
|
79 |
|
|
foo (6 >> (5 - c));
|
80 |
|
|
foo (6 >> 5 - 4); // { dg-warning "parentheses" "correct warning" }
|
81 |
|
|
foo ((6 >> 5) - 4);
|
82 |
|
|
foo (6 >> (5 - 4));
|
83 |
|
|
}
|