diff --git a/include/bx/macros.h b/include/bx/macros.h index f8a793c..6219780 100644 --- a/include/bx/macros.h +++ b/include/bx/macros.h @@ -10,17 +10,7 @@ #ifndef BX_MACROS_H_HEADER_GUARD #define BX_MACROS_H_HEADER_GUARD -/// -#if BX_COMPILER_MSVC && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL) -// Workaround MSVS bug... -# define BX_VA_ARGS_PASS(...) BX_VA_ARGS_PASS_1_ __VA_ARGS__ BX_VA_ARGS_PASS_2_ -# define BX_VA_ARGS_PASS_1_ ( -# define BX_VA_ARGS_PASS_2_ ) -#else -# define BX_VA_ARGS_PASS(...) (__VA_ARGS__) -#endif // BX_COMPILER_MSVC - -#define BX_VA_ARGS_COUNT(...) BX_VA_ARGS_COUNT_ BX_VA_ARGS_PASS(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) +#define BX_VA_ARGS_COUNT(...) BX_VA_ARGS_COUNT_(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) #define BX_VA_ARGS_COUNT_(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10, _a11, _a12, _a13, _a14, _a15, _a16, _last, ...) _last /// @@ -137,12 +127,7 @@ #define BX_UNUSED_11(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10, _a11) BX_UNUSED_10(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10); BX_UNUSED_1(_a11) #define BX_UNUSED_12(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10, _a11, _a12) BX_UNUSED_11(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10, _a11); BX_UNUSED_1(_a12) -#if BX_COMPILER_MSVC && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL) -// Workaround MSVS bug... -# define BX_UNUSED(...) BX_MACRO_DISPATCHER(BX_UNUSED_, __VA_ARGS__) BX_VA_ARGS_PASS(__VA_ARGS__) -#else -# define BX_UNUSED(...) BX_MACRO_DISPATCHER(BX_UNUSED_, __VA_ARGS__)(__VA_ARGS__) -#endif // BX_COMPILER_MSVC +#define BX_UNUSED(...) BX_MACRO_DISPATCHER(BX_UNUSED_, __VA_ARGS__)(__VA_ARGS__) /// #if BX_COMPILER_CLANG @@ -217,12 +202,7 @@ #define BX_CLASS_2(_class, _a1, _a2) BX_CLASS_1(_class, _a1); BX_CLASS_1(_class, _a2) #define BX_CLASS_3(_class, _a1, _a2, _a3) BX_CLASS_2(_class, _a1, _a2); BX_CLASS_1(_class, _a3) #define BX_CLASS_4(_class, _a1, _a2, _a3, _a4) BX_CLASS_3(_class, _a1, _a2, _a3); BX_CLASS_1(_class, _a4) - -#if BX_COMPILER_MSVC && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL) -# define BX_CLASS(_class, ...) BX_MACRO_DISPATCHER(BX_CLASS_, __VA_ARGS__) BX_VA_ARGS_PASS(_class, __VA_ARGS__) -#else -# define BX_CLASS(_class, ...) BX_MACRO_DISPATCHER(BX_CLASS_, __VA_ARGS__)(_class, __VA_ARGS__) -#endif // BX_COMPILER_MSVC +#define BX_CLASS(_class, ...) BX_MACRO_DISPATCHER(BX_CLASS_, __VA_ARGS__)(_class, __VA_ARGS__) #ifndef BX_ASSERT # if BX_CONFIG_DEBUG diff --git a/include/bx/platform.h b/include/bx/platform.h index 66f15f9..0989ec4 100644 --- a/include/bx/platform.h +++ b/include/bx/platform.h @@ -471,6 +471,10 @@ # define BX_CPP_NAME "C++Unknown" #endif // defined(__cplusplus) +#if BX_COMPILER_MSVC && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL) +# error "When using MSVC you must set /Zc:preprocessor compiler option." +#endif // BX_COMPILER_MSVC && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL) + #if BX_PLATFORM_OSX && BX_PLATFORM_OSX < 130000 //#error "Minimum supported macOS version is 13.00.\n" #elif BX_PLATFORM_IOS && BX_PLATFORM_IOS < 160000 diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index ffb772c..d2bdd65 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -545,7 +545,9 @@ function toolchain(_buildDir, _libDir) "/wd4201", -- warning C4201: nonstandard extension used: nameless struct/union "/wd4324", -- warning C4324: '': structure was padded due to alignment specifier "/Ob2", -- The Inline Function Expansion - "/Zc:__cplusplus", -- Enable updated __cplusplus macro + + "/Zc:__cplusplus", -- Enable updated __cplusplus macro. + "/Zc:preprocessor", -- Enable preprocessor conformance mode. } linkoptions { "/ignore:4221", -- LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library