summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/microsoft-ext.c
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2013-06-26 17:16:08 +0000
committerReid Kleckner <reid@kleckner.net>2013-06-26 17:16:08 +0000
commit596b85cc234d8f5c2fcdb23ade14535a33789c5c (patch)
tree2cd0adbca30804d2a66e33e822f6338103503fd1 /clang/test/Preprocessor/microsoft-ext.c
parentb3f550e8cd5ff1d2304582e95dd494bf955f27d3 (diff)
downloadbcm5719-llvm-596b85cc234d8f5c2fcdb23ade14535a33789c5c.tar.gz
bcm5719-llvm-596b85cc234d8f5c2fcdb23ade14535a33789c5c.zip
Match MSVC's handling of commas during macro argument expansion
This allows clang to parse the type_traits header in Visual Studio 2012, which is included widely in practice. This is a rework of r163022 by João Matos. The original patch broke preprocessing of gtest headers, which this patch addresses. Patch by Will Wilson! llvm-svn: 184968
Diffstat (limited to 'clang/test/Preprocessor/microsoft-ext.c')
-rw-r--r--clang/test/Preprocessor/microsoft-ext.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/microsoft-ext.c b/clang/test/Preprocessor/microsoft-ext.c
index ec10374a1d6..b03f6775429 100644
--- a/clang/test/Preprocessor/microsoft-ext.c
+++ b/clang/test/Preprocessor/microsoft-ext.c
@@ -22,3 +22,15 @@ class GMOCK_ACTION_CLASS_(name, value_params) {\
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_2_VALUE_PARAMS(p0, p1));
+
+// This tests compatibility with behaviour needed for type_traits in VS2012
+// Test based on _VARIADIC_EXPAND_0X macros in xstddef of VS2012
+#define _COMMA ,
+
+#define MAKER(_arg1, _comma, _arg2) \
+ void func(_arg1 _comma _arg2) {}
+#define MAKE_FUNC(_makerP1, _makerP2, _arg1, _comma, _arg2) \
+ _makerP1##_makerP2(_arg1, _comma, _arg2)
+
+MAKE_FUNC(MAK, ER, int a, _COMMA, int b);
+// CHECK: void func(int a , int b) {}
OpenPOWER on IntegriCloud