summaryrefslogtreecommitdiffstats
path: root/test/Preprocessor/macro_fn_comma_swallow.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Preprocessor/macro_fn_comma_swallow.c')
-rw-r--r--test/Preprocessor/macro_fn_comma_swallow.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Preprocessor/macro_fn_comma_swallow.c b/test/Preprocessor/macro_fn_comma_swallow.c
new file mode 100644
index 0000000..e985138
--- /dev/null
+++ b/test/Preprocessor/macro_fn_comma_swallow.c
@@ -0,0 +1,21 @@
+// Test the GNU comma swallowing extension.
+// RUN: clang-cc %s -E | grep 'foo{A, }' &&
+// RUN: clang-cc %s -E | grep 'fo2{A,}' &&
+// RUN: clang-cc %s -E | grep '{foo}'
+
+#define X(Y) foo{A, Y}
+X()
+
+#define X2(Y) fo2{A,##Y}
+X2()
+
+// should eat the comma.
+#define X3(b, ...) {b, ## __VA_ARGS__}
+X3(foo)
+
+
+
+// RUN: clang-cc %s -E | grep 'AA BB'
+// PR3880
+#define X4(...) AA , ## __VA_ARGS__ BB
+X4()
OpenPOWER on IntegriCloud