| 1 |
/* Copyright (C) 2000 Free Software Foundation, Inc. */ |
| 2 |
|
| 3 |
/* { dg-do preprocess } */ |
| 4 |
/* { dg-options -C } */ |
| 5 |
|
| 6 |
/* Test -C doesn't fail with #define. #define is the tricky case, |
| 7 |
being the only directive that remembers its comments. |
| 8 |
|
| 9 |
-C treats comments as tokens in their own right, so e.g. comment at |
| 10 |
the beginning of a directive turns it into a non-directive. */ |
| 11 |
|
| 12 |
#define simple no comments |
| 13 |
|
| 14 |
#define/**/obj_like/**/(some)/**/thing/**/ |
| 15 |
#define fun_like(/**/x/**/,/**/y/**/)/**/ |
| 16 |
/**/#define not_a_macro |
| 17 |
|
| 18 |
#if !defined simple || !defined obj_like || !defined fun_like |
| 19 |
#error Missed some macros with -C |
| 20 |
#endif |
| 21 |
|
| 22 |
#ifdef not_a_macro |
| 23 |
#error not_a_macro is! |
| 24 |
#endif |
| 25 |
|
| 26 |
/* Check obj_like doesn't expect arguments, and fun_like does. */ |
| 27 |
obj_like |
| 28 |
fun_like (foo, bar) |
| 29 |
|
| 30 |
/* Check OK to redefine fun_like without comments in the params. */ |
| 31 |
#define fun_like(x, y)/**/ |
| 32 |
|
| 33 |
/* Check comments in macros in directives are OK. */ |
| 34 |
#define ZERO 0 /* A trailing comment. */ |
| 35 |
|
| 36 |
#if ZERO |
| 37 |
#endif |