diff options
author | Joshua Cannon <joshdcannon@gmail.com> | 2019-10-11 17:13:15 (GMT) |
---|---|---|
committer | Joshua Cannon <joshdcannon@gmail.com> | 2019-10-11 17:13:15 (GMT) |
commit | f8961b99f4c3045d3b99618b9cb9e702770622b8 (patch) | |
tree | 46cfc17e8ad2dcb0dc481f1f81469fcb0c718cda /googlemock | |
parent | 5fe523361243b4e2d698df45e10076d89e6a992f (diff) | |
download | googletest-f8961b99f4c3045d3b99618b9cb9e702770622b8.zip googletest-f8961b99f4c3045d3b99618b9cb9e702770622b8.tar.gz googletest-f8961b99f4c3045d3b99618b9cb9e702770622b8.tar.bz2 |
Evaluate and cat NARG in different macros
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/include/gmock/internal/gmock-pp.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/googlemock/include/gmock/internal/gmock-pp.h b/googlemock/include/gmock/internal/gmock-pp.h index 2ebeadd..4298a63 100644 --- a/googlemock/include/gmock/internal/gmock-pp.h +++ b/googlemock/include/gmock/internal/gmock-pp.h @@ -26,10 +26,9 @@ // GMOCK_PP_NARG(PAIR) => 2 // // Requires: the number of arguments after expansion is at most 15. -#define GMOCK_PP_NARG(...) \ - GMOCK_PP_INTERNAL_EXPAND_WITH( \ - GMOCK_PP_INTERNAL_INTERNAL_16TH, \ - (__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)) +#define GMOCK_PP_NARG(...) \ + GMOCK_PP_INTERNAL_INTERNAL_16TH( \ + __VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1) // Returns 1 if the expansion of arguments has an unprotected comma. Otherwise // returns 0. Requires no more than 15 unprotected commas. @@ -48,10 +47,9 @@ GMOCK_PP_INTERNAL_EXPAND_WITH(GMOCK_PP_INTERNAL_TAIL, (__VA_ARGS__)) // Calls CAT(_Macro, NARG(__VA_ARGS__))(__VA_ARGS__) -#define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \ - GMOCK_PP_INTERNAL_EXPAND_WITH( \ - GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__)), \ - (__VA_ARGS__)) +#define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \ + GMOCK_PP_INTERNAL_VARIADIC_CALL( \ + _Macro, GMOCK_PP_NARG(__VA_ARGS__), (__VA_ARGS__)) // If the arguments after expansion have no tokens, evaluates to `1`. Otherwise // evaluates to `0`. @@ -165,6 +163,8 @@ // Workaround MSVC behavior of treating __VA_ARGS__ with commas as one arg // _Args must be wrapped in parenthesis #define GMOCK_PP_INTERNAL_EXPAND_WITH(_Macro, _Args) _Macro _Args +#define GMOCK_PP_INTERNAL_VARIADIC_CALL(_Macro, _N, ...) \ + GMOCK_PP_INTERNAL_EXPAND_WITH(GMOCK_PP_CAT(_Macro, _N),(__VA_ARGS__)) #define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C(...) 1 _ #define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_1 1, |