From 34461a626e4fcc72e2facf7dedf8c84cf13e39d2 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 22 Jan 2016 19:26:44 +0000 Subject: [MSVC Compat] Accept elided commas in macro function arguments Summary: This fixes PR25875. When the trailing comma in a macro argument list is elided, we need to treat it similarly to the case where a variadic macro misses one actual argument. Reviewers: rnk, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15670 llvm-svn: 258530 --- clang/test/Preprocessor/microsoft-ext.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/test/Preprocessor/microsoft-ext.c') diff --git a/clang/test/Preprocessor/microsoft-ext.c b/clang/test/Preprocessor/microsoft-ext.c index b03f6775429..cb3cf4f1537 100644 --- a/clang/test/Preprocessor/microsoft-ext.c +++ b/clang/test/Preprocessor/microsoft-ext.c @@ -34,3 +34,12 @@ ACTION_TEMPLATE(InvokeArgument, MAKE_FUNC(MAK, ER, int a, _COMMA, int b); // CHECK: void func(int a , int b) {} + +#define macro(a, b) (a - b) +void function(int a); +#define COMMA_ELIDER(...) \ + macro(x, __VA_ARGS__); \ + function(x, __VA_ARGS__); +COMMA_ELIDER(); +// CHECK: (x - ); +// CHECK: function(x); -- cgit v1.2.3