MSVC: Avoid variadic macro bug in STATIC_ASSERT

MSVC does not handle __VA_ARGS__ as expected in STATIC_ASSERT, avoid its use
to work around it since we don't need it. The underlying issue seems to be one
of

    https://connect.microsoft.com/VisualStudio/Feedback/Details/1232378
    https://connect.microsoft.com/VisualStudio/Feedback/Details/1099052

The bug only seems to manifest when using multiple variadic macros that call
each other.
This commit is contained in:
Rui Abreu Ferreira 2016-04-20 00:26:23 +01:00
parent 3dc8cdc150
commit 2a8ceb160c

View File

@ -46,10 +46,10 @@
#define STATIC_ASSERT_PRAGMA_START
#define STATIC_ASSERT_PRAGMA_END
#define STATIC_ASSERT(...) \
#define STATIC_ASSERT(cond, msg) \
do { \
STATIC_ASSERT_PRAGMA_START \
STATIC_ASSERT_STATEMENT(__VA_ARGS__); \
STATIC_ASSERT_STATEMENT(cond, msg); \
STATIC_ASSERT_PRAGMA_END \
} while (0)