2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / mac-dir-1.c
blob002c47f5f2bf05c66c9f3da3fca2799ef7b65985
1 /* Copyright (C) 2002 Free Software Foundation, Inc. */
3 /* { dg-do preprocess } */
5 /* Source: Neil Booth, 26 Feb 2002.
7 Test that we allow directives in macro arguments. */
9 /* { dg-do run } */
10 /* { dg-options "" } */
12 #define f(x) x
13 extern void abort (void);
15 int main ()
17 if (f (
18 #if f(1) /* True. */
19 0)) /* False. */
20 #else
21 1))
22 #endif
23 abort ();
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 ();
33 return 0;