aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Cannon <joshdcannon@gmail.com>2019-10-11 12:13:15 -0500
committerJoshua Cannon <joshdcannon@gmail.com>2019-10-11 12:13:15 -0500
commitf8961b99f4c3045d3b99618b9cb9e702770622b8 (patch)
tree46cfc17e8ad2dcb0dc481f1f81469fcb0c718cda
parent5fe523361243b4e2d698df45e10076d89e6a992f (diff)
downloadgoogletest-f8961b99f4c3045d3b99618b9cb9e702770622b8.tar.gz
googletest-f8961b99f4c3045d3b99618b9cb9e702770622b8.tar.bz2
googletest-f8961b99f4c3045d3b99618b9cb9e702770622b8.zip
Evaluate and cat NARG in different macros
-rw-r--r--googlemock/include/gmock/internal/gmock-pp.h16
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 2ebeaddc..4298a63e 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,