summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/test/Preprocessor/macro_paste_hashhash.c7
-rw-r--r--clang/test/Preprocessor/macro_rescan.c9
2 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/macro_paste_hashhash.c b/clang/test/Preprocessor/macro_paste_hashhash.c
new file mode 100644
index 00000000000..4ebf55e41f3
--- /dev/null
+++ b/clang/test/Preprocessor/macro_paste_hashhash.c
@@ -0,0 +1,7 @@
+// RUN: clang -E %s | grep '^"x ## y";$'
+#define hash_hash # ## #
+#define mkstr(a) # a
+#define in_between(a) mkstr(a)
+#define join(c, d) in_between(c hash_hash d)
+join(x, y);
+
diff --git a/clang/test/Preprocessor/macro_rescan.c b/clang/test/Preprocessor/macro_rescan.c
new file mode 100644
index 00000000000..d9171b98469
--- /dev/null
+++ b/clang/test/Preprocessor/macro_rescan.c
@@ -0,0 +1,9 @@
+// RUN: clang -E %s | grep 'ei_1 = (17+1);' &&
+// RUN: clang -E %s | grep 'ei_2 = (M1)(17);'
+
+#define M1(a) (a+1)
+#define M2(b) b
+
+int ei_1 = M2(M1)(17); /* becomes int ei_1 = (17+1); */
+int ei_2 = (M2(M1))(17); /* becomes int ei_2 = (M1)(17); */
+
OpenPOWER on IntegriCloud