| 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 |
#if DEBUG |
| 13 |
extern int puts (const char *); |
| 14 |
#else |
| 15 |
#define puts(X) |
| 16 |
#endif |
| 17 |
extern void abort (void); |
| 18 |
#define err(str) do { puts(str); abort(); } while (0) |
| 19 |
|
| 20 |
#define str(x) #x |
| 21 |
#define xstr(x) str(x) |
| 22 |
#define glibc_hack(x, y) x@y |
| 23 |
|
| 24 |
int main (int argc, char *argv[]) |
| 25 |
{ |
| 26 |
/* The space before "bar" here is vital. */ |
| 27 |
char a[] = xstr(glibc_hack(foo, bar)); |
| 28 |
|
| 29 |
if (strcmp (a, "foo@bar")) |
| 30 |
err ("stringification without spaces"); |
| 31 |
|
| 32 |
return 0; |
| 33 |
} |