|
1 | | -// RUN: %clang_cc1 -std=c23 %s -E -verify |
| 1 | +// RUN: split-file %s %t |
| 2 | +// RUN: %clang_cc1 -std=c23 -E -verify %t/test1.c |
| 3 | +// RUN: %clang_cc1 -std=c23 -E -verify %t/test2.c |
| 4 | +// RUN: %clang_cc1 -std=c23 -E -verify %t/test3.c |
| 5 | +// RUN: %clang_cc1 -std=c23 -E -verify %t/test4.c |
| 6 | +// RUN: %clang_cc1 -std=c23 -E -verify %t/test5.c |
| 7 | +// RUN: %clang_cc1 -std=c23 -E -verify %t/test6.c |
| 8 | + |
| 9 | +//--- test1.c |
2 | 10 |
|
3 | 11 | // Test the parsing behavior for __has_embed and all of its parameters to ensure we |
4 | 12 | // recover from failures gracefully. |
|
251 | 259 | #if __has_embed("") // expected-error {{empty filename}} |
252 | 260 | #endif |
253 | 261 |
|
254 | | -// expected-error@+9 {{unterminated conditional directive}} |
255 | | -// expected-error@+13 {{unterminated conditional directive}} |
256 | | -// expected-error@+17 {{unterminated conditional directive}} |
257 | | -// expected-error@+21 {{unterminated conditional directive}} |
258 | | -// expected-error@+25 {{unterminated conditional directive}} |
259 | | - |
260 | | -// expected-error@+3 {{missing ')' after '__has_embed'}} \ |
261 | | - expected-error@+3 {{expected value in expression}} \ |
262 | | - expected-note@+3 {{to match this '('}} |
| 262 | +//--- test2.c |
| 263 | +// expected-error@+4 {{missing ')' after '__has_embed'}} \ |
| 264 | + expected-error@+4 {{expected value in expression}} \ |
| 265 | + expected-note@+4 {{to match this '('}} \ |
| 266 | + expected-error@+4 {{unterminated conditional directive}} |
263 | 267 | #if __has_embed (__FILE__ foo limit(1) |
264 | 268 |
|
265 | | -// expected-error@+3 {{missing ')' after '__has_embed'}} \ |
266 | | - expected-error@+3 {{expected value in expression}} \ |
267 | | - expected-note@+3 {{to match this '('}} |
| 269 | +//--- test3.c |
| 270 | +// expected-error@+4 {{missing ')' after '__has_embed'}} \ |
| 271 | + expected-error@+4 {{expected value in expression}} \ |
| 272 | + expected-note@+4 {{to match this '('}} \ |
| 273 | + expected-error@+4 {{unterminated conditional directive}} |
268 | 274 | #if __has_embed (__FILE__ foo |
269 | 275 |
|
270 | | -// expected-error@+3 {{missing ')' after '__has_embed'}} \ |
271 | | - expected-error@+3 {{expected value in expression}} \ |
272 | | - expected-note@+3 {{to match this '('}} |
| 276 | +//--- test4.c |
| 277 | +// expected-error@+4 {{missing ')' after '__has_embed'}} \ |
| 278 | + expected-error@+4 {{expected value in expression}} \ |
| 279 | + expected-note@+4 {{to match this '('}} \ |
| 280 | + expected-error@+4 {{unterminated conditional directive}} |
273 | 281 | #if __has_embed ("a" foo() |
274 | 282 |
|
275 | | -// expected-error@+3 {{missing ')' after '__has_embed'}} \ |
276 | | - expected-error@+3 {{expected value in expression}} \ |
277 | | - expected-note@+3 {{to match this '('}} |
| 283 | +//--- test5.c |
| 284 | +// expected-error@+4 {{missing ')' after '__has_embed'}} \ |
| 285 | + expected-error@+4 {{expected value in expression}} \ |
| 286 | + expected-note@+4 {{to match this '('}} \ |
| 287 | + expected-error@+4 {{unterminated conditional directive}} |
278 | 288 | #if __has_embed ("a" bar() foo |
279 | 289 |
|
280 | | -// expected-error@+3 {{missing ')' after '__has_embed'}} \ |
281 | | - expected-error@+3 {{expected value in expression}} \ |
282 | | - expected-note@+3 {{to match this '('}} |
| 290 | +//--- test6.c |
| 291 | +// expected-error@+4 {{missing ')' after '__has_embed'}} \ |
| 292 | + expected-error@+4 {{expected value in expression}} \ |
| 293 | + expected-note@+4 {{to match this '('}} \ |
| 294 | + expected-error@+4 {{unterminated conditional directive}} |
283 | 295 | #if __has_embed (__FILE__ limit(1) foo |
284 | 296 | int a = __has_embed (__FILE__); |
0 commit comments