| 1 |
/* Copyright (C) 2002 Free Software Foundation, Inc. */ |
| 2 |
|
| 3 |
/* { dg-do preprocess } */ |
| 4 |
|
| 5 |
/* Source: Neil Booth, 26 Feb 2002. |
| 6 |
|
| 7 |
Test that we allow directives in macro arguments. */ |
| 8 |
|
| 9 |
/* { dg-do run } */ |
| 10 |
/* { dg-options "" } */ |
| 11 |
|
| 12 |
#define f(x) x |
| 13 |
extern void abort (void); |
| 14 |
|
| 15 |
int main () |
| 16 |
{ |
| 17 |
if (f ( |
| 18 |
#if f(1) /* True. */ |
| 19 |
0)) /* False. */ |
| 20 |
#else |
| 21 |
1)) |
| 22 |
#endif |
| 23 |
abort (); |
| 24 |
|
| 25 |
/* Outer f expands to original definition, f in argument expands |
| 26 |
to new definition, so result is: if (1 != 2 - 1). */ |
| 27 |
if (1 != f(2 |
| 28 |
#undef f |
| 29 |
#define f - 1 |
| 30 |
f)) |
| 31 |
abort (); |
| 32 |
|
| 33 |
return 0; |
| 34 |
} |