diff --git a/include/libassert/assert.hpp b/include/libassert/assert.hpp index 17bb44f1..60b8fadf 100644 --- a/include/libassert/assert.hpp +++ b/include/libassert/assert.hpp @@ -1366,7 +1366,7 @@ namespace libassert::detail { #pragma warning(pop) #endif -#if LIBASSERT_IS_CLANG || LIBASSERT_IS_GCC || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL == 0) +#if LIBASSERT_IS_CLANG || LIBASSERT_IS_GCC || !LIBASSERT_NON_CONFORMANT_MSVC_PREPROCESSOR // Macro mapping utility by William Swanson https://github.com/swansontec/map-macro/blob/master/map.h #define LIBASSERT_EVAL0(...) __VA_ARGS__ #define LIBASSERT_EVAL1(...) LIBASSERT_EVAL0(LIBASSERT_EVAL0(LIBASSERT_EVAL0(__VA_ARGS__))) @@ -1719,7 +1719,7 @@ namespace libassert { // non-prefixed versions #ifndef LIBASSERT_PREFIX_ASSERTIONS - #if LIBASSERT_IS_CLANG || LIBASSERT_IS_GCC || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL == 0) + #if LIBASSERT_IS_CLANG || LIBASSERT_IS_GCC || !LIBASSERT_NON_CONFORMANT_MSVC_PREPROCESSOR #define DEBUG_ASSERT(...) LIBASSERT_DEBUG_ASSERT(__VA_ARGS__) #define ASSERT(...) LIBASSERT_ASSERT(__VA_ARGS__) #define ASSUME(...) LIBASSERT_ASSUME(__VA_ARGS__) diff --git a/include/libassert/platform.hpp b/include/libassert/platform.hpp index 45d75dfb..5a717c8d 100644 --- a/include/libassert/platform.hpp +++ b/include/libassert/platform.hpp @@ -183,13 +183,18 @@ #define LIBASSERT_GCC_ISNT_STUPID 1 #endif +#if defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL + #define LIBASSERT_NON_CONFORMANT_MSVC_PREPROCESSOR true +#else + #define LIBASSERT_NON_CONFORMANT_MSVC_PREPROCESSOR false +#endif -#if LIBASSERT_IS_GCC || LIBASSERT_STD_VER >= 20 - // __VA_OPT__ needed for GCC, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44317 - #define LIBASSERT_VA_ARGS(...) __VA_OPT__(,) __VA_ARGS__ +#if (LIBASSERT_IS_GCC || LIBASSERT_STD_VER >= 20) && !LIBASSERT_NON_CONFORMANT_MSVC_PREPROCESSOR + // __VA_OPT__ needed for GCC, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44317 + #define LIBASSERT_VA_ARGS(...) __VA_OPT__(,) __VA_ARGS__ #else - // clang properly eats the comma with ##__VA_ARGS__ - #define LIBASSERT_VA_ARGS(...) , ##__VA_ARGS__ + // clang properly eats the comma with ##__VA_ARGS__ + #define LIBASSERT_VA_ARGS(...) , ##__VA_ARGS__ #endif