Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
f8961b99
Commit
f8961b99
authored
Oct 11, 2019
by
Joshua Cannon
Browse files
Evaluate and cat NARG in different macros
parent
5fe52336
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
googlemock/include/gmock/internal/gmock-pp.h
googlemock/include/gmock/internal/gmock-pp.h
+8
-8
No files found.
googlemock/include/gmock/internal/gmock-pp.h
View file @
f8961b99
...
@@ -27,9 +27,8 @@
...
@@ -27,9 +27,8 @@
//
//
// Requires: the number of arguments after expansion is at most 15.
// Requires: the number of arguments after expansion is at most 15.
#define GMOCK_PP_NARG(...) \
#define GMOCK_PP_NARG(...) \
GMOCK_PP_INTERNAL_EXPAND_WITH( \
GMOCK_PP_INTERNAL_INTERNAL_16TH( \
GMOCK_PP_INTERNAL_INTERNAL_16TH, \
__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
(__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 1 if the expansion of arguments has an unprotected comma. Otherwise
// returns 0. Requires no more than 15 unprotected commas.
// returns 0. Requires no more than 15 unprotected commas.
...
@@ -49,9 +48,8 @@
...
@@ -49,9 +48,8 @@
// Calls CAT(_Macro, NARG(__VA_ARGS__))(__VA_ARGS__)
// Calls CAT(_Macro, NARG(__VA_ARGS__))(__VA_ARGS__)
#define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \
#define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \
GMOCK_PP_INTERNAL_EXPAND_WITH( \
GMOCK_PP_INTERNAL_VARIADIC_CALL( \
GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__)), \
_Macro, GMOCK_PP_NARG(__VA_ARGS__), (__VA_ARGS__))
(__VA_ARGS__))
// If the arguments after expansion have no tokens, evaluates to `1`. Otherwise
// If the arguments after expansion have no tokens, evaluates to `1`. Otherwise
// evaluates to `0`.
// evaluates to `0`.
...
@@ -165,6 +163,8 @@
...
@@ -165,6 +163,8 @@
// Workaround MSVC behavior of treating __VA_ARGS__ with commas as one arg
// Workaround MSVC behavior of treating __VA_ARGS__ with commas as one arg
// _Args must be wrapped in parenthesis
// _Args must be wrapped in parenthesis
#define GMOCK_PP_INTERNAL_EXPAND_WITH(_Macro, _Args) _Macro _Args
#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_C(...) 1 _
#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_1 1,
#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_1 1,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment