xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/microsoft-ext.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -E -fms-compatibility %s -o %t
2*f4a2713aSLionel Sambuc // RUN: FileCheck %s < %t
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc # define M2(x, y) x + y
5*f4a2713aSLionel Sambuc # define P(x, y) {x, y}
6*f4a2713aSLionel Sambuc # define M(x, y) M2(x, P(x, y))
7*f4a2713aSLionel Sambuc M(a, b) // CHECK: a + {a, b}
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc // Regression test for PR13924
10*f4a2713aSLionel Sambuc #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
11*f4a2713aSLionel Sambuc #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc #define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc #define GMOCK_ACTION_CLASS_(name, value_params)\
16*f4a2713aSLionel Sambuc     GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc #define ACTION_TEMPLATE(name, template_params, value_params)\
19*f4a2713aSLionel Sambuc class GMOCK_ACTION_CLASS_(name, value_params) {\
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc ACTION_TEMPLATE(InvokeArgument,
23*f4a2713aSLionel Sambuc                 HAS_1_TEMPLATE_PARAMS(int, k),
24*f4a2713aSLionel Sambuc                 AND_2_VALUE_PARAMS(p0, p1));
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc // This tests compatibility with behaviour needed for type_traits in VS2012
27*f4a2713aSLionel Sambuc // Test based on _VARIADIC_EXPAND_0X macros in xstddef of VS2012
28*f4a2713aSLionel Sambuc #define _COMMA ,
29*f4a2713aSLionel Sambuc 
30*f4a2713aSLionel Sambuc #define MAKER(_arg1, _comma, _arg2)                                            \
31*f4a2713aSLionel Sambuc   void func(_arg1 _comma _arg2) {}
32*f4a2713aSLionel Sambuc #define MAKE_FUNC(_makerP1, _makerP2, _arg1, _comma, _arg2)                    \
33*f4a2713aSLionel Sambuc   _makerP1##_makerP2(_arg1, _comma, _arg2)
34*f4a2713aSLionel Sambuc 
35*f4a2713aSLionel Sambuc MAKE_FUNC(MAK, ER, int a, _COMMA, int b);
36*f4a2713aSLionel Sambuc // CHECK: void func(int a , int b) {}
37