fix: fix MSVC __VA_OPT__ error

This commit is contained in:
2025-08-13 09:24:19 +08:00
parent f65eff6edf
commit f8a696b4e8
4 changed files with 7 additions and 4 deletions

View File

@ -113,6 +113,9 @@ target_compile_options(YYCCommonplace
PUBLIC
# Order build as UTF-8 in MSVC
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
# Order preprocessor conformance mode (fix __VA_OPT__ error in MSVC)
$<$<CXX_COMPILER_ID:MSVC>:/Zc:preprocessor>
)
# Fix GCC std::stacktrace link error

View File

@ -34,7 +34,7 @@ namespace yycc::rust::panic {
* The macro parameters are the message to format and its arguments, following \c std::format syntax.
* This macro essentially calls \c std::format internally.
*/
#define RS_PANICF(msg, ...) RS_PANIC(std::format(msg __VA_OPT__(, ) __VA_ARGS__))
#define RS_PANICF(msg, ...) RS_PANIC(std::format(msg __VA_OPT__(,) __VA_ARGS__))
/**
* @brief Immediately crashes the entire program like Rust's \c panic! macro.

View File

@ -14,7 +14,7 @@ namespace yycctest::num::parse {
#define TEST_SUCCESS(type_t, expected_value, string_value, ...) \
{ \
std::u8string cache_string(string_value); \
auto rv = PARSE::parse<type_t>(cache_string __VA_OPT__(, ) __VA_ARGS__); \
auto rv = PARSE::parse<type_t>(cache_string __VA_OPT__(,) __VA_ARGS__); \
ASSERT_TRUE(rv.has_value()); \
EXPECT_EQ(rv.value(), expected_value); \
}
@ -22,7 +22,7 @@ namespace yycctest::num::parse {
#define TEST_FAIL(type_t, string_value, ...) \
{ \
std::u8string cache_string(string_value); \
auto rv = PARSE::parse<type_t>(cache_string __VA_OPT__(, ) __VA_ARGS__); \
auto rv = PARSE::parse<type_t>(cache_string __VA_OPT__(,) __VA_ARGS__); \
EXPECT_FALSE(rv.has_value()); \
}

View File

@ -11,7 +11,7 @@ namespace yycctest::num::stringify {
#define TEST_SUCCESS(type_t, value, string_value, ...) \
{ \
type_t cache = value; \
std::u8string ret = STRINGIFY::stringify<type_t>(cache __VA_OPT__(, ) __VA_ARGS__); \
std::u8string ret = STRINGIFY::stringify<type_t>(cache __VA_OPT__(,) __VA_ARGS__); \
EXPECT_EQ(ret, string_value); \
}