| 1 |
/* Copyright (C) 2000 Free Software Foundation, Inc. */ |
| 2 |
|
| 3 |
/* { dg-do preprocess } */ |
| 4 |
/* { dg-options -pedantic } */ |
| 5 |
|
| 6 |
/* Tests general directive syntax, and directive error recovery. */ |
| 7 |
|
| 8 |
|
| 9 |
/* Test directive name is not expanded. */ |
| 10 |
#define foo define |
| 11 |
#foo EMPTY /* { dg-error "invalid" } */ |
| 12 |
|
| 13 |
/* Test # must be first on line. */ |
| 14 |
EMPTY #define bar |
| 15 |
#ifdef bar |
| 16 |
#error bar is defined |
| 17 |
#endif |
| 18 |
|
| 19 |
/* Test form feed and vertical tab warn pedantically, see 6.10 |
| 20 |
paragraph 5. Tab is OK. */ |
| 21 |
#define something /* { dg-warning "form feed" } */ |
| 22 |
#define something_else /* { dg-warning "vertical tab" } */ |
| 23 |
#define some thing /* Tab OK, as is form feed before #. */ |
| 24 |
|
| 25 |
/* Our friend the null directive OK? */ |
| 26 |
# |
| 27 |
|
| 28 |
/* Check newlines end directives, even in function-like macro |
| 29 |
invocations. 6.10 paragraph 1. |
| 30 |
|
| 31 |
Note that the #if is still treated as a conditional, so there |
| 32 |
should be no errors about #endif without #if. */ |
| 33 |
#define func(x) x |
| 34 |
#if func ( /* { dg-error "unterminated argument" } */ |
| 35 |
#endif |