OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [Wparentheses-25.C] - Blame information for rev 701

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* PR 7543. Test operation of -Wparentheses.  Precedence warnings.
2
   !a | b and !a & b. */
3
/* { dg-do compile } */
4
/* { dg-options "-Wparentheses" } */
5
// C++ version of Wparentheses-11.c
6
int foo (int);
7
 
8
int
9
bar (int a, int b, int c)
10
{
11
  foo (!a & b); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
12
  foo (!a & (b < c));
13
  foo (!a & (b > c));
14
  foo (!a & (b == c));
15
  foo (!a & (b != c));
16
  foo (!a & (b <= c));
17
  foo (!a & (b >= c));
18
  foo (!a & (b && c));
19
  foo (!a & (b || c));
20
  foo (!a & !b);
21
  foo (!(a & b));
22
  foo ((!a) & b);
23
  foo (!a & 2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
24
  foo (!a & (2 < c));
25
  foo (!a & (2 > c));
26
  foo (!a & (2 == c));
27
  foo (!a & (2 != c));
28
  foo (!a & (2 <= c));
29
  foo (!a & (2 >= c));
30
  foo (!a & (2 && c));
31
  foo (!a & (2 || c));
32
  foo (!a & !2);
33
  foo (!(a & 2));
34
  foo ((!a) & 2);
35
  foo (!1 & 2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
36
  foo (!1 & (2 < c));
37
  foo (!1 & (2 > c));
38
  foo (!1 & (2 == c));
39
  foo (!1 & (2 != c));
40
  foo (!1 & (2 <= c));
41
  foo (!1 & (2 >= c));
42
  foo (!1 & (2 && c));
43
  foo (!1 & (2 || c));
44
  foo (!1 & !2);
45
  foo (!(1 & 2));
46
 
47
  foo (!a | b); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
48
  foo (!a | (b < c));
49
  foo (!a | (b > c));
50
  foo (!a | (b == c));
51
  foo (!a | (b != c));
52
  foo (!a | (b <= c));
53
  foo (!a | (b >= c));
54
  foo (!a | (b && c));
55
  foo (!a | (b || c));
56
  foo (!a | !b);
57
  foo (!(a | b));
58
  foo ((!a) | b);
59
  foo (!a | 2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
60
  foo (!a | (2 < c));
61
  foo (!a | (2 > c));
62
  foo (!a | (2 == c));
63
  foo (!a | (2 != c));
64
  foo (!a | (2 <= c));
65
  foo (!a | (2 >= c));
66
  foo (!a | (2 && c));
67
  foo (!a | (2 || c));
68
  foo (!a | !2);
69
  foo (!(a | 2));
70
  foo ((!a) | 2);
71
  foo (!1 | 2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
72
  foo (!1 | (2 < c));
73
  foo (!1 | (2 > c));
74
  foo (!1 | (2 == c));
75
  foo (!1 | (2 != c));
76
  foo (!1 | (2 <= c));
77
  foo (!1 | (2 >= c));
78
  foo (!1 | (2 && c));
79
  foo (!1 | (2 || c));
80
  foo (!1 | !2);
81
  foo (!(1 | 2));
82
  foo ((!1) | 2);
83
 
84
  foo (b & !a); /* { dg-bogus "parentheses" "bogus warning" } */
85
  foo ((b < c) & !a);
86
  foo ((b > c) & !a);
87
  foo ((b == c) & !a);
88
  foo ((b != c) & !a);
89
  foo ((b <= c) & !a);
90
  foo ((b >= c) & !a);
91
  foo ((b && c) & !a);
92
  foo ((b || c) & !a);
93
  foo (!b & !a);
94
  foo (!(b & a));
95
  foo (b & (!a));
96
  foo (2 & !a); /* { dg-bogus "parentheses" "correct warning" } */
97
  foo ((2 < c) & !a);
98
  foo ((2 > c) & !a);
99
  foo ((2 == c) & !a);
100
  foo ((2 != c) & !a);
101
  foo ((2 <= c) & !a);
102
  foo ((2 >= c) & !a);
103
  foo ((2 && c) & !a);
104
  foo ((2 || c) & !a);
105
  foo (!2 & !a);
106
  foo (!(2 & a));
107
  foo (2 & (!a));
108
  foo (2 & !1); /* { dg-bogus "parentheses" "correct warning" } */
109
  foo ((2 < c) & !1);
110
  foo ((2 > c) & !1);
111
  foo ((2 == c) & !1);
112
  foo ((2 != c) & !1);
113
  foo ((2 <= c) & !1);
114
  foo ((2 >= c) & !1);
115
  foo ((2 && c) & !1);
116
  foo ((2 || c) & !1);
117
  foo (!2 & !1);
118
  foo (!(2 & 1));
119
 
120
  foo (b | !a); /* { dg-bogus "parentheses" "correct warning" } */
121
  foo ((b < c) | !a);
122
  foo ((b > c) | !a);
123
  foo ((b == c) | !a);
124
  foo ((b != c) | !a);
125
  foo ((b <= c) | !a);
126
  foo ((b >= c) | !a);
127
  foo ((b && c) | !a);
128
  foo ((b || c) | !a);
129
  foo (!b | !a);
130
  foo (!(b | a));
131
  foo (b | (!a));
132
  foo (2 | !a); /* { dg-bogus "parentheses" "correct warning" } */
133
  foo ((2 < c) | !a);
134
  foo ((2 > c) | !a);
135
  foo ((2 == c) | !a);
136
  foo ((2 != c) | !a);
137
  foo ((2 <= c) | !a);
138
  foo ((2 >= c) | !a);
139
  foo ((2 && c) | !a);
140
  foo ((2 || c) | !a);
141
  foo (!2 | !a);
142
  foo (!(2 | a));
143
  foo (2 | (!a));
144
  foo (2 | !1); /* { dg-bogus "parentheses" "correct warning" } */
145
  foo ((2 < c) | !1);
146
  foo ((2 > c) | !1);
147
  foo ((2 == c) | !1);
148
  foo ((2 != c) | !1);
149
  foo ((2 <= c) | !1);
150
  foo ((2 >= c) | !1);
151
  foo ((2 && c) | !1);
152
  foo ((2 || c) | !1);
153
  foo (!2 | !1);
154
  foo (!(2 | 1));
155
  foo (2 | (!1));
156
}
157
 
158
 
159
int
160
baz (int a, int b, int c)
161
{
162
  foo (!a & (b << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
163
  foo (!a & (b >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
164
  foo (!a & (b + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
165
  foo (!a & (b - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
166
  foo (!a & (b = c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
167
  foo (!a & ~b);      /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
168
  foo (!a & (b & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
169
  foo (!a & (b | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
170
  foo (!a & 2);       /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
171
  foo (!a & (2 << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
172
  foo (!a & (2 >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
173
  foo (!a & (2 + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
174
  foo (!a & (2 - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
175
  foo (!a & (c = 2)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
176
  foo (!a & ~2);      /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
177
  foo (!a & (2 & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
178
  foo (!a & (2 | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
179
  foo (!1 & (2 << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
180
  foo (!1 & (2 >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
181
  foo (!1 & (2 + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
182
  foo (!1 & (2 - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
183
  foo (!1 & (c = 2)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
184
  foo (!1 & ~2);      /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
185
  foo (!1 & (2 & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
186
  foo (!1 & (2 | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
187
  foo (!a | (b << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
188
  foo (!a | (b >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
189
  foo (!a | (b + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
190
  foo (!a | (b - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
191
  foo (!a | (b = c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
192
  foo (!a | ~b);      /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
193
  foo (!a | (b & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
194
  foo (!a | (b | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
195
  foo (!a | (2 << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
196
  foo (!a | (2 >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
197
  foo (!a | (2 + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
198
  foo (!a | (2 - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
199
  foo (!a | (c = 2)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
200
  foo (!a | ~2);      /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
201
  foo (!a | (2 & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
202
  foo (!a | (2 | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
203
  foo (!1 | (2 << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
204
  foo (!1 | (2 >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
205
  foo (!1 | (2 + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
206
  foo (!1 | (2 - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
207
  foo (!1 | (c = 2)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
208
  foo (!1 | ~2);      /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
209
  foo (!1 | (2 & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
210
  foo (!1 | (2 | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */
211
  foo ((b << c) & !a);
212
  foo ((b >> c) & !a);
213
  foo ((b + c) & !a);
214
  foo ((b - c) & !a);
215
  foo ((b = c) & !a);
216
  foo (~b & !a);
217
  foo ((b & c) & !a);
218
  foo ((b | c) & !a);
219
  foo ((2 << c) & !a);
220
  foo ((2 >> c) & !a);
221
  foo ((2 + c) & !a);
222
  foo ((2 - c) & !a);
223
  foo ((c = 2) & !a);
224
  foo (~2 & !a);
225
  foo ((2 & c) & !a);
226
  foo ((2 | c) & !a);
227
  foo ((2 << c) & !1);
228
  foo ((2 >> c) & !1);
229
  foo ((2 + c) & !1);
230
  foo ((2 - c) & !1);
231
  foo ((c = 2) & !1);
232
  foo (~2 & !1);
233
  foo ((2 & c) & !1);
234
  foo ((2 | c) & !1);
235
  foo ((b << c) | !a);
236
  foo ((b >> c) | !a);
237
  foo ((b + c) | !a);
238
  foo ((b - c) | !a);
239
  foo ((b = c) | !a);
240
  foo (~b | !a);
241
  foo ((b & c) | !a);
242
  foo ((b | c) | !a);
243
  foo ((2 << c) | !a);
244
  foo ((2 >> c) | !a);
245
  foo ((2 + c) | !a);
246
  foo ((2 - c) | !a);
247
  foo ((c = 2) | !a);
248
  foo (~2 | !a);
249
  foo ((2 & c) | !a);
250
  foo ((2 | c) | !a);
251
  foo ((2 << c) | !1);
252
  foo ((2 >> c) | !1);
253
  foo ((2 + c) | !1);
254
  foo ((2 - c) | !1);
255
  foo ((c = 2) | !1);
256
  foo (~2 | !1);
257
  foo ((2 & c) | !1);
258
  foo ((2 | c) | !1);
259
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.