OSDN Git Service

2007-07-06 Josh Conner <jconner@apple.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / cpp / strify3.c
1 /* Copyright (C) 2001 Free Software Foundation, Inc.  */
2
3 /* { dg-do run } */
4
5 /* Tests we stringify without inserting a space.  GCC 2.95.x and
6    earlier would insert a bogus space before bar in the string, simply
7    because a space was there in the invocation.
8
9    Neil Booth, 24 Sep 2001.  */
10
11 extern int strcmp (const char *, const char *);
12 extern int puts (const char *);
13 extern void abort (void);
14 #define err(str) do { puts(str); abort(); } while (0)
15
16 #define str(x) #x
17 #define xstr(x) str(x)
18 #define glibc_hack(x, y) x@y
19
20 int main (int argc, char *argv[])
21 {
22   /* The space before "bar" here is vital.  */
23   char a[] = xstr(glibc_hack(foo, bar));
24
25   if (strcmp (a, "foo@bar"))
26     err ("stringification without spaces");
27
28   return 0;
29 }