|
- 3.0.1 core module.
|
Go to the documentation of this file. 1 #ifndef THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_PP_H_ 2 #define THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_PP_H_ 4 #undef GMOCK_PP_INTERNAL_USE_MSVC 6 #define GMOCK_PP_INTERNAL_USE_MSVC 0 7 #elif defined(_MSC_VER) 11 "MSVC version not supported. There is support for MSVC 14.0 and above.");
12 #define GMOCK_PP_INTERNAL_USE_MSVC 1 14 #define GMOCK_PP_INTERNAL_USE_MSVC 0 18 #define GMOCK_PP_CAT(_1, _2) GMOCK_PP_INTERNAL_CAT(_1, _2) 21 #define GMOCK_PP_STRINGIZE(...) GMOCK_PP_INTERNAL_STRINGIZE(__VA_ARGS__) 24 #define GMOCK_PP_EMPTY(...) 27 #define GMOCK_PP_COMMA(...) , 30 #define GMOCK_PP_IDENTITY(_1) _1 34 #if GMOCK_PP_INTERNAL_USE_MSVC 46 #define GMOCK_PP_NARG(...) \ 47 GMOCK_PP_INTERNAL_NARG_CAT( \ 48 GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, \ 49 8, 7, 6, 5, 4, 3, 2, 1), ) 53 #define GMOCK_PP_HAS_COMMA(...) \ 54 GMOCK_PP_INTERNAL_HAS_COMMA_CAT( \ 55 GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ 58 #define GMOCK_PP_HEAD(...) \ 59 GMOCK_PP_INTERNAL_HEAD_CAT(GMOCK_PP_INTERNAL_HEAD(__VA_ARGS__), ) 63 #define GMOCK_PP_TAIL(...) \ 64 GMOCK_PP_INTERNAL_TAIL_CAT(GMOCK_PP_INTERNAL_TAIL(__VA_ARGS__), ) 67 #define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \ 68 GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT( \ 69 GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__), ) 71 #else // GMOCK_PP_INTERNAL_USE_MSVC 73 #define GMOCK_PP_NARG(...) \ 74 GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, \ 76 #define GMOCK_PP_HAS_COMMA(...) \ 77 GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ 79 #define GMOCK_PP_HEAD(...) GMOCK_PP_INTERNAL_HEAD(__VA_ARGS__) 80 #define GMOCK_PP_TAIL(...) GMOCK_PP_INTERNAL_TAIL(__VA_ARGS__) 81 #define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \ 82 GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__) 84 #endif // GMOCK_PP_INTERNAL_USE_MSVC 114 #define GMOCK_PP_IS_EMPTY(...) \ 115 GMOCK_PP_INTERNAL_IS_EMPTY(GMOCK_PP_HAS_COMMA(__VA_ARGS__), \ 116 GMOCK_PP_HAS_COMMA(GMOCK_PP_COMMA __VA_ARGS__), \ 117 GMOCK_PP_HAS_COMMA(__VA_ARGS__()), \ 118 GMOCK_PP_HAS_COMMA(GMOCK_PP_COMMA __VA_ARGS__())) 121 #define GMOCK_PP_IF(_Cond, _Then, _Else) \ 122 GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IF_, _Cond)(_Then, _Else) 137 #define GMOCK_PP_NARG0(...) \ 138 GMOCK_PP_IF(GMOCK_PP_IS_EMPTY(__VA_ARGS__), 0, GMOCK_PP_NARG(__VA_ARGS__)) 142 #define GMOCK_PP_IS_BEGIN_PARENS(...) \ 143 GMOCK_PP_INTERNAL_ALTERNATE_HEAD( \ 144 GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_, \ 145 GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C __VA_ARGS__)) 148 #define GMOCK_PP_IS_ENCLOSED_PARENS(...) \ 149 GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(__VA_ARGS__), \ 150 GMOCK_PP_IS_EMPTY(GMOCK_PP_EMPTY __VA_ARGS__), 0) 153 #define GMOCK_PP_REMOVE_PARENS(...) GMOCK_PP_INTERNAL_REMOVE_PARENS __VA_ARGS__ 159 #define GMOCK_PP_FOR_EACH(_Macro, _Data, _Tuple) \ 160 GMOCK_PP_CAT(GMOCK_PP_INTERNAL_FOR_EACH_IMPL_, GMOCK_PP_NARG0 _Tuple) \ 161 (0, _Macro, _Data, _Tuple) 167 #define GMOCK_PP_REPEAT(_Macro, _Data, _N) \ 168 GMOCK_PP_CAT(GMOCK_PP_INTERNAL_FOR_EACH_IMPL_, _N) \ 169 (0, _Macro, _Data, GMOCK_PP_INTENRAL_EMPTY_TUPLE) 172 #define GMOCK_PP_INC(_i) GMOCK_PP_CAT(GMOCK_PP_INTERNAL_INC_, _i) 175 #define GMOCK_PP_COMMA_IF(_i) GMOCK_PP_CAT(GMOCK_PP_INTERNAL_COMMA_IF_, _i) 179 #define GMOCK_PP_INTENRAL_EMPTY_TUPLE (, , , , , , , , , , , , , , , ) 180 #define GMOCK_PP_INTERNAL_CAT(_1, _2) _1##_2 181 #define GMOCK_PP_INTERNAL_STRINGIZE(...) #__VA_ARGS__ 182 #define GMOCK_PP_INTERNAL_INTERNAL_16TH(_1, _2, _3, _4, _5, _6, _7, _8, _9, \ 183 _10, _11, _12, _13, _14, _15, _16, \ 186 #define GMOCK_PP_INTERNAL_CAT_5(_1, _2, _3, _4, _5) _1##_2##_3##_4##_5 187 #define GMOCK_PP_INTERNAL_IS_EMPTY(_1, _2, _3, _4) \ 188 GMOCK_PP_HAS_COMMA(GMOCK_PP_INTERNAL_CAT_5(GMOCK_PP_INTERNAL_IS_EMPTY_CASE_, \ 190 #define GMOCK_PP_INTERNAL_IS_EMPTY_CASE_0001 , 191 #define GMOCK_PP_INTERNAL_IF_1(_Then, _Else) _Then 192 #define GMOCK_PP_INTERNAL_IF_0(_Then, _Else) _Else 193 #define GMOCK_PP_INTERNAL_HEAD(_1, ...) _1 194 #define GMOCK_PP_INTERNAL_TAIL(_1, ...) __VA_ARGS__ 196 #if GMOCK_PP_INTERNAL_USE_MSVC 197 #define GMOCK_PP_INTERNAL_NARG_CAT(_1, _2) GMOCK_PP_INTERNAL_NARG_CAT_I(_1, _2) 198 #define GMOCK_PP_INTERNAL_HEAD_CAT(_1, _2) GMOCK_PP_INTERNAL_HEAD_CAT_I(_1, _2) 199 #define GMOCK_PP_INTERNAL_HAS_COMMA_CAT(_1, _2) \ 200 GMOCK_PP_INTERNAL_HAS_COMMA_CAT_I(_1, _2) 201 #define GMOCK_PP_INTERNAL_TAIL_CAT(_1, _2) GMOCK_PP_INTERNAL_TAIL_CAT_I(_1, _2) 202 #define GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT(_1, _2) \ 203 GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT_I(_1, _2) 204 #define GMOCK_PP_INTERNAL_NARG_CAT_I(_1, _2) _1##_2 205 #define GMOCK_PP_INTERNAL_HEAD_CAT_I(_1, _2) _1##_2 206 #define GMOCK_PP_INTERNAL_HAS_COMMA_CAT_I(_1, _2) _1##_2 207 #define GMOCK_PP_INTERNAL_TAIL_CAT_I(_1, _2) _1##_2 208 #define GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT_I(_1, _2) _1##_2 209 #define GMOCK_PP_INTERNAL_ALTERNATE_HEAD(...) \ 210 GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT(GMOCK_PP_HEAD(__VA_ARGS__), ) 211 #define GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT(_1, _2) \ 212 GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT_I(_1, _2) 213 #define GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT_I(_1, _2) _1##_2 214 #else // GMOCK_PP_INTERNAL_USE_MSVC 215 #define GMOCK_PP_INTERNAL_ALTERNATE_HEAD(...) GMOCK_PP_HEAD(__VA_ARGS__) 216 #endif // GMOCK_PP_INTERNAL_USE_MSVC 218 #define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C(...) 1 _ 219 #define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_1 1, 220 #define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C \ 222 #define GMOCK_PP_INTERNAL_REMOVE_PARENS(...) __VA_ARGS__ 223 #define GMOCK_PP_INTERNAL_INC_0 1 224 #define GMOCK_PP_INTERNAL_INC_1 2 225 #define GMOCK_PP_INTERNAL_INC_2 3 226 #define GMOCK_PP_INTERNAL_INC_3 4 227 #define GMOCK_PP_INTERNAL_INC_4 5 228 #define GMOCK_PP_INTERNAL_INC_5 6 229 #define GMOCK_PP_INTERNAL_INC_6 7 230 #define GMOCK_PP_INTERNAL_INC_7 8 231 #define GMOCK_PP_INTERNAL_INC_8 9 232 #define GMOCK_PP_INTERNAL_INC_9 10 233 #define GMOCK_PP_INTERNAL_INC_10 11 234 #define GMOCK_PP_INTERNAL_INC_11 12 235 #define GMOCK_PP_INTERNAL_INC_12 13 236 #define GMOCK_PP_INTERNAL_INC_13 14 237 #define GMOCK_PP_INTERNAL_INC_14 15 238 #define GMOCK_PP_INTERNAL_INC_15 16 239 #define GMOCK_PP_INTERNAL_COMMA_IF_0 240 #define GMOCK_PP_INTERNAL_COMMA_IF_1 , 241 #define GMOCK_PP_INTERNAL_COMMA_IF_2 , 242 #define GMOCK_PP_INTERNAL_COMMA_IF_3 , 243 #define GMOCK_PP_INTERNAL_COMMA_IF_4 , 244 #define GMOCK_PP_INTERNAL_COMMA_IF_5 , 245 #define GMOCK_PP_INTERNAL_COMMA_IF_6 , 246 #define GMOCK_PP_INTERNAL_COMMA_IF_7 , 247 #define GMOCK_PP_INTERNAL_COMMA_IF_8 , 248 #define GMOCK_PP_INTERNAL_COMMA_IF_9 , 249 #define GMOCK_PP_INTERNAL_COMMA_IF_10 , 250 #define GMOCK_PP_INTERNAL_COMMA_IF_11 , 251 #define GMOCK_PP_INTERNAL_COMMA_IF_12 , 252 #define GMOCK_PP_INTERNAL_COMMA_IF_13 , 253 #define GMOCK_PP_INTERNAL_COMMA_IF_14 , 254 #define GMOCK_PP_INTERNAL_COMMA_IF_15 , 255 #define GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, _element) \ 256 _Macro(_i, _Data, _element) 257 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_0(_i, _Macro, _Data, _Tuple) 258 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_1(_i, _Macro, _Data, _Tuple) \ 259 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) 260 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_2(_i, _Macro, _Data, _Tuple) \ 261 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 262 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_1(GMOCK_PP_INC(_i), _Macro, _Data, \ 263 (GMOCK_PP_TAIL _Tuple)) 264 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_3(_i, _Macro, _Data, _Tuple) \ 265 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 266 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_2(GMOCK_PP_INC(_i), _Macro, _Data, \ 267 (GMOCK_PP_TAIL _Tuple)) 268 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_4(_i, _Macro, _Data, _Tuple) \ 269 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 270 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_3(GMOCK_PP_INC(_i), _Macro, _Data, \ 271 (GMOCK_PP_TAIL _Tuple)) 272 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_5(_i, _Macro, _Data, _Tuple) \ 273 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 274 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_4(GMOCK_PP_INC(_i), _Macro, _Data, \ 275 (GMOCK_PP_TAIL _Tuple)) 276 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_6(_i, _Macro, _Data, _Tuple) \ 277 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 278 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_5(GMOCK_PP_INC(_i), _Macro, _Data, \ 279 (GMOCK_PP_TAIL _Tuple)) 280 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_7(_i, _Macro, _Data, _Tuple) \ 281 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 282 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_6(GMOCK_PP_INC(_i), _Macro, _Data, \ 283 (GMOCK_PP_TAIL _Tuple)) 284 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_8(_i, _Macro, _Data, _Tuple) \ 285 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 286 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_7(GMOCK_PP_INC(_i), _Macro, _Data, \ 287 (GMOCK_PP_TAIL _Tuple)) 288 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_9(_i, _Macro, _Data, _Tuple) \ 289 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 290 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_8(GMOCK_PP_INC(_i), _Macro, _Data, \ 291 (GMOCK_PP_TAIL _Tuple)) 292 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_10(_i, _Macro, _Data, _Tuple) \ 293 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 294 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_9(GMOCK_PP_INC(_i), _Macro, _Data, \ 295 (GMOCK_PP_TAIL _Tuple)) 296 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_11(_i, _Macro, _Data, _Tuple) \ 297 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 298 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_10(GMOCK_PP_INC(_i), _Macro, _Data, \ 299 (GMOCK_PP_TAIL _Tuple)) 300 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_12(_i, _Macro, _Data, _Tuple) \ 301 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 302 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_11(GMOCK_PP_INC(_i), _Macro, _Data, \ 303 (GMOCK_PP_TAIL _Tuple)) 304 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_13(_i, _Macro, _Data, _Tuple) \ 305 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 306 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_12(GMOCK_PP_INC(_i), _Macro, _Data, \ 307 (GMOCK_PP_TAIL _Tuple)) 308 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_14(_i, _Macro, _Data, _Tuple) \ 309 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 310 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_13(GMOCK_PP_INC(_i), _Macro, _Data, \ 311 (GMOCK_PP_TAIL _Tuple)) 312 #define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_15(_i, _Macro, _Data, _Tuple) \ 313 GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ 314 GMOCK_PP_INTERNAL_FOR_EACH_IMPL_14(GMOCK_PP_INC(_i), _Macro, _Data, \ 315 (GMOCK_PP_TAIL _Tuple)) 317 #endif // THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PP_H_