So I have this macro that takes a varying number of arguments and calls another macro based upon the number of arguments
#define VA_NARGS_IMPL(_1, _2, _3, _4, N, ...) BENCHMARK##N
#define VA_NARGS(...) VA_NARGS_IMPL(__VA_ARGS__, 4, 3, 2, 1)
#define BENCHMARK(...) VA_NARGS(__VA_ARGS__)( __VA_ARGS__ )
so BENCHMARK( T, 1)
becomes BENCHMARK2(T, 1)
which is ...
#define BENCHMARK2( test, description ) \
BENCHMARK_INTERNAL( test, 0, 0, description ) // NOLINT
which becomes (Only providing a snippet) ...
#define BENCHMARK_INTERNAL(test, lb, ub, d) \
struct test : public Test { \
public: ... \
Clang is evaluating the MACROS as I would expect, here is a snippet from that expansion ...
struct T : public Test { public: ...
but when windows preprocesses this file I get ...
struct T, 1 : public Test { public: ...
However, if I directly call BENCHMARK2 ... BENCHMARK2( T, 1)
everything works as I would expect.
Does windows handle variadic macros differently? Is there a cross platform solution for my scenario?
I'm using MSVC's x64 compiler (version 14.28.29333)