Open hadrielk opened 1 year ago
We're using an older version of TANK than the current head, but it looks like the problem persists even now...
tank_client.h #includes Switch/switch.h, which #defines the following macro names:
tank_client.h
#include
Switch/switch.h
#define
#define require(x) assert(x) #define Drequire(x) assert(x) #define EXPECT(x) assert(x) #define DEXPECT(x) assert(x) ... #define sizeof_array(x) sizeof(detail::SIZEOF_ARRAY_REQUIRES_ARRAY_ARGUMENT(x)) #define STRLEN(p) (uint32_t)(sizeof(p) - 1) #define STRWITHLEN(p) (p), (uint32_t)(sizeof(p) - 1) #define LENWITHSTR(p) (uint32_t)(sizeof(p) - 1), (p) #define STRWLEN(p) STRWITHLEN(p) #define LENWSTR(p) LENWITHSTR(p) #define _S(p) STRWITHLEN(p) ... #define TOKEN_PASTE(x, y) x##y #define TOKEN_PASTE2(x, y) TOKEN_PASTE(x, y) #define DEFER(...) auto TOKEN_PASTE2(__deferred, __COUNTER__) = make_scope_guard([&] { __VA_ARGS__; });
But those are very common tokens/names, and will cause collisions with names by consuming user code, as well as other libraries.
For example boost/asio uses require() as a regular C++ function name.
boost/asio
require()
Since macro names are not namespaced, the usual thing to do is prefix them with library name. E.g., TANK_REQUIRE and TANK_EXPECT, etc.
TANK_REQUIRE
TANK_EXPECT
We're using an older version of TANK than the current head, but it looks like the problem persists even now...
tank_client.h
#include
sSwitch/switch.h
, which#define
s the following macro names:But those are very common tokens/names, and will cause collisions with names by consuming user code, as well as other libraries.
For example
boost/asio
usesrequire()
as a regular C++ function name.Since macro names are not namespaced, the usual thing to do is prefix them with library name. E.g.,
TANK_REQUIRE
andTANK_EXPECT
, etc.