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