Compare commits
3 Commits
f65eff6edf
...
0ab470367c
Author | SHA1 | Date | |
---|---|---|---|
0ab470367c | |||
c4d441f5fa | |||
f8a696b4e8 |
@ -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
|
||||
|
@ -393,6 +393,15 @@ namespace yycc::carton::pycodec {
|
||||
#endif
|
||||
}
|
||||
|
||||
// YYC MARK:
|
||||
// Define a macro for following class ctor
|
||||
// We only need initialize member if we are in Iconv environment.
|
||||
#if defined(YYCC_PYCODEC_WIN32_BACKEND)
|
||||
#define CTOR_INITLIST_TYPE1
|
||||
#else
|
||||
#define CTOR_INITLIST_TYPE1 : inner()
|
||||
#endif
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Char -> UTF8
|
||||
@ -447,7 +456,7 @@ namespace yycc::carton::pycodec {
|
||||
|
||||
#pragma region WChar -> UTF8
|
||||
|
||||
WcharToUtf8::WcharToUtf8() : inner() {}
|
||||
WcharToUtf8::WcharToUtf8() CTOR_INITLIST_TYPE1 {}
|
||||
|
||||
WcharToUtf8::~WcharToUtf8() {}
|
||||
|
||||
@ -463,7 +472,7 @@ namespace yycc::carton::pycodec {
|
||||
|
||||
#pragma region UTF8 -> WChar
|
||||
|
||||
Utf8ToWchar::Utf8ToWchar() : inner() {}
|
||||
Utf8ToWchar::Utf8ToWchar() CTOR_INITLIST_TYPE1 {}
|
||||
|
||||
Utf8ToWchar::~Utf8ToWchar() {}
|
||||
|
||||
@ -479,7 +488,7 @@ namespace yycc::carton::pycodec {
|
||||
|
||||
#pragma region UTF8 -> UTF16
|
||||
|
||||
Utf8ToUtf16::Utf8ToUtf16() : inner() {}
|
||||
Utf8ToUtf16::Utf8ToUtf16() CTOR_INITLIST_TYPE1 {}
|
||||
|
||||
Utf8ToUtf16::~Utf8ToUtf16() {}
|
||||
|
||||
@ -495,7 +504,7 @@ namespace yycc::carton::pycodec {
|
||||
|
||||
#pragma region UTF16 -> UTF8
|
||||
|
||||
Utf16ToUtf8::Utf16ToUtf8() : inner() {}
|
||||
Utf16ToUtf8::Utf16ToUtf8() CTOR_INITLIST_TYPE1 {}
|
||||
|
||||
Utf16ToUtf8::~Utf16ToUtf8() {}
|
||||
|
||||
@ -511,7 +520,7 @@ namespace yycc::carton::pycodec {
|
||||
|
||||
#pragma region UTF8 -> UTF32
|
||||
|
||||
Utf8ToUtf32::Utf8ToUtf32() : inner() {}
|
||||
Utf8ToUtf32::Utf8ToUtf32() CTOR_INITLIST_TYPE1 {}
|
||||
|
||||
Utf8ToUtf32::~Utf8ToUtf32() {}
|
||||
|
||||
@ -527,7 +536,7 @@ namespace yycc::carton::pycodec {
|
||||
|
||||
#pragma region UTF32 -> UTF8
|
||||
|
||||
Utf32ToUtf8::Utf32ToUtf8() : inner() {}
|
||||
Utf32ToUtf8::Utf32ToUtf8() CTOR_INITLIST_TYPE1 {}
|
||||
|
||||
Utf32ToUtf8::~Utf32ToUtf8() {}
|
||||
|
||||
|
@ -17,6 +17,11 @@
|
||||
|
||||
// Import essential header if we are using Windows function family.
|
||||
#if defined(YYCC_HARDWARE_OVERFLOW_WIN32_FNS)
|
||||
// YYC MARK:
|
||||
// This macro is crucial for including "intsafe.h"
|
||||
// Without this, "intsafe.h" will not enable signed integral operations.
|
||||
#define ENABLE_INTSAFE_SIGNED_FUNCTIONS
|
||||
|
||||
#include "../windows/import_guard_head.hpp"
|
||||
#include <intsafe.h>
|
||||
#include "../windows/import_guard_tail.hpp"
|
||||
|
@ -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.
|
||||
|
@ -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()); \
|
||||
}
|
||||
|
||||
|
@ -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); \
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user