aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/cpp/strp2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/cpp/strp2.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/strp2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/strp2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/strp2.c
new file mode 100644
index 000000000..d1fcd9182
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/strp2.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+
+/* Test for odd corner cases in stringizing/pasting.
+ Taken more or less verbatim from C99 section 6.10.3.3. */
+
+#include <stdlib.h>
+#include <string.h>
+
+#define hash_hash # ## #
+#define mkstr(a) # a
+#define in_between(a) mkstr(a)
+#define join(c, d) in_between(c hash_hash d)
+
+const char p[] = join(x, y);
+const char q[] = "x ## y";
+
+int
+main (void)
+{
+ if (strcmp (p, q))
+ abort ();
+ return 0;
+}