Compare commits

3 Commits

Author SHA1 Message Date
0ab470367c fix: fix safe num overflow ops issue under MSVC 2025-08-13 09:51:40 +08:00
c4d441f5fa fix: fix pycodec MSVC error 2025-08-13 09:36:21 +08:00
f8a696b4e8 fix: fix MSVC __VA_OPT__ error 2025-08-13 09:24:19 +08:00
6 changed files with 27 additions and 10 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

@ -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() {}

View File

@ -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"