mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Support for GCC/Clang of MOCK_PP_FOR_EACH
Some compilers support detection of an empty variadic macro element in which case `BOOST_PP_VARIADIC_SIZE` returns "0" so `BOOST_PP_OVERLOAD` calls the `macro_0` overload. An empty variadic element should be considered as a single empty value. So add that overload with this in mind.
This commit is contained in:
parent
2880b24116
commit
59d531282e
1 changed files with 3 additions and 0 deletions
|
|
@ -27,6 +27,9 @@
|
|||
# define MOCK_PP_FOR_EACH(macro, data, ...) BOOST_PP_OVERLOAD(MOCK_PP_INVOKE_, __VA_ARGS__)(macro, data, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
// When the compiler supports detection of empty variadic element (e.g. Clang & GCC) Boost.PP returns a size of zero.
|
||||
// However an empty variadic is a valid case: A single invocation with an empty element.
|
||||
#define MOCK_PP_INVOKE_0(macro, data, x) macro(data, x)
|
||||
#define MOCK_PP_INVOKE_1(macro, data, x) macro(data, x)
|
||||
#define MOCK_PP_INVOKE_2(macro, data, x, ...) macro(data, x) MOCK_PP_INVOKE_1(macro, data, __VA_ARGS__)
|
||||
#define MOCK_PP_INVOKE_3(macro, data, x, ...) macro(data, x) MOCK_PP_INVOKE_2(macro, data, __VA_ARGS__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue