PR c/56980
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / cmdlne-C.c
blob2dafec253ecb429a5b90864e5ce2d661a43aa1fa
1 /* Copyright (C) 2000 Free Software Foundation, Inc. */
3 /* { dg-do preprocess } */
4 /* { dg-options -C } */
6 /* Test -C doesn't fail with #define. #define is the tricky case,
7 being the only directive that remembers its comments.
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. */
12 #define simple no comments
14 #define/**/obj_like/**/(some)/**/thing/**/
15 #define fun_like(/**/x/**/,/**/y/**/)/**/
16 /**/#define not_a_macro
18 #if !defined simple || !defined obj_like || !defined fun_like
19 #error Missed some macros with -C
20 #endif
22 #ifdef not_a_macro
23 #error not_a_macro is!
24 #endif
26 /* Check obj_like doesn't expect arguments, and fun_like does. */
27 obj_like
28 fun_like (foo, bar)
30 /* Check OK to redefine fun_like without comments in the params. */
31 #define fun_like(x, y)/**/
33 /* Check comments in macros in directives are OK. */
34 #define ZERO 0 /* A trailing comment. */
36 #if ZERO
37 #endif