From a5d7849619bbb30f21f13fa896d9de3fe5a862db Mon Sep 17 00:00:00 2001 From: achabense <60953653+achabense@users.noreply.github.com> Date: Mon, 14 Aug 2023 08:16:47 +0800 Subject: [PATCH 1/7] relocate _Mtx_clear_owner and _Mtx_reset_owner --- stl/inc/xthreads.h | 5 ----- stl/src/cond.cpp | 12 ++++++++++++ stl/src/mutex.cpp | 10 ---------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/stl/inc/xthreads.h b/stl/inc/xthreads.h index 26302f0aea..7f78cec33f 100644 --- a/stl/inc/xthreads.h +++ b/stl/inc/xthreads.h @@ -107,11 +107,6 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_lock(_Mtx_t); _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_trylock(_Mtx_t); _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_unlock(_Mtx_t); // TRANSITION, ABI: Always succeeds -#ifdef _CRTBLD -_CRTIMP2_PURE void __cdecl _Mtx_clear_owner(_Mtx_t); -_CRTIMP2_PURE void __cdecl _Mtx_reset_owner(_Mtx_t); -#endif // _CRTBLD - // shared mutex // these declarations must be in sync with those in sharedmutex.cpp void __cdecl _Smtx_lock_exclusive(_Smtx_t*); diff --git a/stl/src/cond.cpp b/stl/src/cond.cpp index 01d964ef6f..fa094b0440 100644 --- a/stl/src/cond.cpp +++ b/stl/src/cond.cpp @@ -48,6 +48,18 @@ _CRTIMP2_PURE void __cdecl _Cnd_destroy(const _Cnd_t cond) { // clean up } } +// TRANSITION, ABI: should be static; dllexported for binary compatibility +_CRTIMP2_PURE void __cdecl _Mtx_clear_owner(_Mtx_t mtx) { // set owner to nobody + mtx->_Thread_id = -1; + --mtx->_Count; +} + +// TRANSITION, ABI: should be static; dllexported for binary compatibility +_CRTIMP2_PURE void __cdecl _Mtx_reset_owner(_Mtx_t mtx) { // set owner to current thread + mtx->_Thread_id = static_cast(GetCurrentThreadId()); + ++mtx->_Count; +} + _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_wait(const _Cnd_t cond, const _Mtx_t mtx) { // wait until signaled const auto cs = &mtx->_Critical_section; _Mtx_clear_owner(mtx); diff --git a/stl/src/mutex.cpp b/stl/src/mutex.cpp index ba8c2de344..98cf98d1cd 100644 --- a/stl/src/mutex.cpp +++ b/stl/src/mutex.cpp @@ -189,16 +189,6 @@ _CRTIMP2_PURE void* __cdecl _Mtx_getconcrtcs(_Mtx_t mtx) { // get internal cs im return &mtx->_Critical_section; } -_CRTIMP2_PURE void __cdecl _Mtx_clear_owner(_Mtx_t mtx) { // set owner to nobody - mtx->_Thread_id = -1; - --mtx->_Count; -} - -_CRTIMP2_PURE void __cdecl _Mtx_reset_owner(_Mtx_t mtx) { // set owner to current thread - mtx->_Thread_id = static_cast(GetCurrentThreadId()); - ++mtx->_Count; -} - _END_EXTERN_C /* From 1a4e1f2cc90c0e8e27ba42e88a706bfdd332d811 Mon Sep 17 00:00:00 2001 From: achabense <60953653+achabense@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:36:17 +0800 Subject: [PATCH 2/7] remove `_Mtx/Cnd_init/destroy` from --- stl/inc/xthreads.h | 8 -------- stl/src/cond.cpp | 2 ++ stl/src/cthread.cpp | 6 ++++++ stl/src/mutex.cpp | 2 ++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/stl/inc/xthreads.h b/stl/inc/xthreads.h index 7f78cec33f..a34afd85e4 100644 --- a/stl/inc/xthreads.h +++ b/stl/inc/xthreads.h @@ -96,10 +96,6 @@ enum { // mutex types _Mtx_recursive = 0x100 }; -#ifdef _CRTBLD -_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t*, int); -_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t); -#endif // _CRTBLD _CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t, int); _CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t); _CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t); @@ -117,10 +113,6 @@ void __cdecl _Smtx_unlock_exclusive(_Smtx_t*); void __cdecl _Smtx_unlock_shared(_Smtx_t*); // condition variables -#ifdef _CRTBLD -_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t*); -_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t); -#endif // _CRTBLD _CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(_Cnd_t); _CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t); _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_wait(_Cnd_t, _Mtx_t); // TRANSITION, ABI: Always succeeds diff --git a/stl/src/cond.cpp b/stl/src/cond.cpp index fa094b0440..ea61d15575 100644 --- a/stl/src/cond.cpp +++ b/stl/src/cond.cpp @@ -28,6 +28,7 @@ _CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(const _Cnd_t cond) { // initialize _CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t) {} // destroy condition variable in situ +// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t* const pcond) { // initialize *pcond = nullptr; @@ -41,6 +42,7 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t* const pcond) { // initializ return _Thrd_result::_Success; } +// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility _CRTIMP2_PURE void __cdecl _Cnd_destroy(const _Cnd_t cond) { // clean up if (cond) { // something to do, do it _Cnd_destroy_in_situ(cond); diff --git a/stl/src/cthread.cpp b/stl/src/cthread.cpp index 618037bbfd..2fb7df1301 100644 --- a/stl/src/cthread.cpp +++ b/stl/src/cthread.cpp @@ -109,6 +109,12 @@ _CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency() { // return numb return info.dwNumberOfProcessors; } +// TRANSITION, ABI: these functions are used only by _Thrd_create() +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t*, int); +_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t); +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t*); +_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t); + // TRANSITION, ABI: _Thrd_create() is preserved for binary compatibility _CRTIMP2_PURE _Thrd_result __cdecl _Thrd_create(_Thrd_t* thr, _Thrd_start_t func, void* d) { // create thread _Thrd_result res; diff --git a/stl/src/mutex.cpp b/stl/src/mutex.cpp index 98cf98d1cd..1aeb9e038d 100644 --- a/stl/src/mutex.cpp +++ b/stl/src/mutex.cpp @@ -50,6 +50,7 @@ _CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t mtx) { // destroy mutex i (void) mtx; } +// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t* mtx, int type) { // initialize mutex *mtx = nullptr; @@ -65,6 +66,7 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t* mtx, int type) { // initial return _Thrd_result::_Success; } +// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility _CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t mtx) { // destroy mutex if (mtx) { // something to do, do it _Mtx_destroy_in_situ(mtx); From 1d60f34134f7e9ee4cabb3f9e514786fb3a526ba Mon Sep 17 00:00:00 2001 From: achabense <60953653+achabense@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:02:24 +0800 Subject: [PATCH 3/7] drop usage of `_cpp_std(in|out|err)` --- stl/inc/yvals.h | 3 --- stl/src/cerr.cpp | 2 +- stl/src/cin.cpp | 2 +- stl/src/clog.cpp | 2 +- stl/src/cout.cpp | 2 +- stl/src/wcerr.cpp | 2 +- stl/src/wcin.cpp | 2 +- stl/src/wclog.cpp | 2 +- stl/src/wcout.cpp | 2 +- 9 files changed, 8 insertions(+), 11 deletions(-) diff --git a/stl/inc/yvals.h b/stl/inc/yvals.h index 8702c037e2..87e75317f0 100644 --- a/stl/inc/yvals.h +++ b/stl/inc/yvals.h @@ -277,9 +277,6 @@ _EMIT_STL_WARNING(STL4001, "/clr:pure is deprecated and will be REMOVED."); #ifdef _CRTBLD // These functions are for enabling STATIC_CPPLIB functionality -#define _cpp_stdin (__acrt_iob_func(0)) -#define _cpp_stdout (__acrt_iob_func(1)) -#define _cpp_stderr (__acrt_iob_func(2)) #define _cpp_isleadbyte(c) (__pctype_func()[static_cast(c)] & _LEADBYTE) #endif // defined(_CRTBLD) diff --git a/stl/src/cerr.cpp b/stl/src/cerr.cpp index a8db79602c..3a5f23ce49 100644 --- a/stl/src/cerr.cpp +++ b/stl/src/cerr.cpp @@ -14,7 +14,7 @@ static std::_Init_locks initlocks; _STD_BEGIN -__PURE_APPDOMAIN_GLOBAL static filebuf ferr(_cpp_stderr); +__PURE_APPDOMAIN_GLOBAL static filebuf ferr(stderr); #if defined(_M_CEE_PURE) __PURE_APPDOMAIN_GLOBAL extern ostream cerr(&ferr); diff --git a/stl/src/cin.cpp b/stl/src/cin.cpp index 68fec6a6e5..6c7b467981 100644 --- a/stl/src/cin.cpp +++ b/stl/src/cin.cpp @@ -14,7 +14,7 @@ static std::_Init_locks initlocks; _STD_BEGIN -__PURE_APPDOMAIN_GLOBAL static filebuf fin(_cpp_stdin); +__PURE_APPDOMAIN_GLOBAL static filebuf fin(stdin); #if defined(_M_CEE_PURE) __PURE_APPDOMAIN_GLOBAL extern istream cin(&fin); diff --git a/stl/src/clog.cpp b/stl/src/clog.cpp index 6ae37572e2..e29b72ec85 100644 --- a/stl/src/clog.cpp +++ b/stl/src/clog.cpp @@ -16,7 +16,7 @@ static std::_Init_locks initlocks; _STD_BEGIN -__PURE_APPDOMAIN_GLOBAL static filebuf flog(_cpp_stderr); +__PURE_APPDOMAIN_GLOBAL static filebuf flog(stderr); #if defined(_M_CEE_PURE) __PURE_APPDOMAIN_GLOBAL extern ostream clog(&flog); diff --git a/stl/src/cout.cpp b/stl/src/cout.cpp index 60f8445c73..02ab1f7eb2 100644 --- a/stl/src/cout.cpp +++ b/stl/src/cout.cpp @@ -14,7 +14,7 @@ static std::_Init_locks initlocks; _STD_BEGIN -__PURE_APPDOMAIN_GLOBAL static filebuf fout(_cpp_stdout); +__PURE_APPDOMAIN_GLOBAL static filebuf fout(stdout); #if defined(_M_CEE_PURE) __PURE_APPDOMAIN_GLOBAL extern ostream cout(&fout); diff --git a/stl/src/wcerr.cpp b/stl/src/wcerr.cpp index c2ff56b6ec..41537b600b 100644 --- a/stl/src/wcerr.cpp +++ b/stl/src/wcerr.cpp @@ -14,7 +14,7 @@ static std::_Init_locks initlocks; _STD_BEGIN -__PURE_APPDOMAIN_GLOBAL static wfilebuf wferr(_cpp_stderr); +__PURE_APPDOMAIN_GLOBAL static wfilebuf wferr(stderr); #if defined(_M_CEE_PURE) __PURE_APPDOMAIN_GLOBAL extern wostream wcerr(&wferr); #else diff --git a/stl/src/wcin.cpp b/stl/src/wcin.cpp index f5c7a1a5e7..bc5008776d 100644 --- a/stl/src/wcin.cpp +++ b/stl/src/wcin.cpp @@ -14,7 +14,7 @@ static std::_Init_locks initlocks; _STD_BEGIN -__PURE_APPDOMAIN_GLOBAL static wfilebuf wfin(_cpp_stdin); +__PURE_APPDOMAIN_GLOBAL static wfilebuf wfin(stdin); #if defined(_M_CEE_PURE) __PURE_APPDOMAIN_GLOBAL extern wistream wcin(&wfin); #else diff --git a/stl/src/wclog.cpp b/stl/src/wclog.cpp index 513f7b9105..3ac05b1017 100644 --- a/stl/src/wclog.cpp +++ b/stl/src/wclog.cpp @@ -14,7 +14,7 @@ static std::_Init_locks initlocks; _STD_BEGIN -__PURE_APPDOMAIN_GLOBAL static wfilebuf wflog(_cpp_stderr); +__PURE_APPDOMAIN_GLOBAL static wfilebuf wflog(stderr); #if defined(_M_CEE_PURE) __PURE_APPDOMAIN_GLOBAL extern wostream wclog(&wflog); #else diff --git a/stl/src/wcout.cpp b/stl/src/wcout.cpp index fc574d689c..c9693987eb 100644 --- a/stl/src/wcout.cpp +++ b/stl/src/wcout.cpp @@ -14,7 +14,7 @@ static std::_Init_locks initlocks; _STD_BEGIN -__PURE_APPDOMAIN_GLOBAL static wfilebuf wfout(_cpp_stdout); +__PURE_APPDOMAIN_GLOBAL static wfilebuf wfout(stdout); #if defined(_M_CEE_PURE) __PURE_APPDOMAIN_GLOBAL extern wostream wcout(&wfout); #else From d622df95fbe5509c92e567b937ded3956b52df67 Mon Sep 17 00:00:00 2001 From: achabense <60953653+achabense@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:07:08 +0800 Subject: [PATCH 4/7] relocate `_cpp_isleadbyte` --- stl/inc/yvals.h | 5 ----- stl/src/_tolower.cpp | 2 ++ stl/src/_toupper.cpp | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/stl/inc/yvals.h b/stl/inc/yvals.h index 87e75317f0..18808df45e 100644 --- a/stl/inc/yvals.h +++ b/stl/inc/yvals.h @@ -275,11 +275,6 @@ _EMIT_STL_WARNING(STL4001, "/clr:pure is deprecated and will be REMOVED."); #endif #endif // _CRTIMP2_PURE -#ifdef _CRTBLD -// These functions are for enabling STATIC_CPPLIB functionality -#define _cpp_isleadbyte(c) (__pctype_func()[static_cast(c)] & _LEADBYTE) -#endif // defined(_CRTBLD) - #ifndef _CRTIMP2_IMPORT #if defined(CRTDLL2) && defined(_CRTBLD) #define _CRTIMP2_IMPORT __declspec(dllexport) diff --git a/stl/src/_tolower.cpp b/stl/src/_tolower.cpp index 16bec174d3..2f342bcc36 100644 --- a/stl/src/_tolower.cpp +++ b/stl/src/_tolower.cpp @@ -17,6 +17,8 @@ #undef _tolower #undef tolower +#define _cpp_isleadbyte(c) (__pctype_func()[static_cast(c)] & _LEADBYTE) + _EXTERN_C_UNLESS_PURE // int _Tolower(c) - convert character to lower case diff --git a/stl/src/_toupper.cpp b/stl/src/_toupper.cpp index 70ef52d7c7..fcf5686f84 100644 --- a/stl/src/_toupper.cpp +++ b/stl/src/_toupper.cpp @@ -16,6 +16,8 @@ #undef _toupper #undef toupper +#define _cpp_isleadbyte(c) (__pctype_func()[static_cast(c)] & _LEADBYTE) + _EXTERN_C_UNLESS_PURE // int _Toupper(c) - convert character to uppercase From 171cc3b84af591520a7d5e9fcf12eaf00be13141 Mon Sep 17 00:00:00 2001 From: achabense <60953653+achabense@users.noreply.github.com> Date: Sat, 19 Aug 2023 11:50:45 +0800 Subject: [PATCH 5/7] relocate `_RELIABILITY_CONTRACT` --- stl/inc/yvals.h | 13 ------------- stl/src/xmtx.hpp | 9 +++++++++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/stl/inc/yvals.h b/stl/inc/yvals.h index 18808df45e..9f337dad05 100644 --- a/stl/inc/yvals.h +++ b/stl/inc/yvals.h @@ -441,19 +441,6 @@ class _CRTIMP2_PURE_IMPORT _EmptyLockit { // empty lock class used for bin compa #define _END_LOCINFO() } #endif // ^^^ !defined(_M_CEE) ^^^ -#ifdef _CRTBLD - -#ifdef _M_CEE -#define _RELIABILITY_CONTRACT \ - [System::Runtime::ConstrainedExecution::ReliabilityContract( \ - System::Runtime::ConstrainedExecution::Consistency::WillNotCorruptState, \ - System::Runtime::ConstrainedExecution::Cer::Success)] -#else // ^^^ defined(_M_CEE) / !defined(_M_CEE) vvv -#define _RELIABILITY_CONTRACT -#endif // ^^^ !defined(_M_CEE) ^^^ - -#endif // defined(_CRTBLD) - #if _HAS_EXCEPTIONS #define _TRY_BEGIN try { #define _CATCH(x) \ diff --git a/stl/src/xmtx.hpp b/stl/src/xmtx.hpp index f36af7acfc..2d5b7d1df5 100644 --- a/stl/src/xmtx.hpp +++ b/stl/src/xmtx.hpp @@ -9,6 +9,15 @@ #include +#ifdef _M_CEE +#define _RELIABILITY_CONTRACT \ + [System::Runtime::ConstrainedExecution::ReliabilityContract( \ + System::Runtime::ConstrainedExecution::Consistency::WillNotCorruptState, \ + System::Runtime::ConstrainedExecution::Cer::Success)] +#else // ^^^ defined(_M_CEE) / !defined(_M_CEE) vvv +#define _RELIABILITY_CONTRACT +#endif // ^^^ !defined(_M_CEE) ^^^ + _EXTERN_C_UNLESS_PURE using _Rmtx = CRITICAL_SECTION; From b018de93b25fff20e94411a15f24967e7eeb6ad8 Mon Sep 17 00:00:00 2001 From: achabense <60953653+achabense@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:25:27 +0800 Subject: [PATCH 6/7] Revert "remove `_Mtx/Cnd_init/destroy` from " This reverts commit 1a4e1f2cc90c0e8e27ba42e88a706bfdd332d811. --- stl/inc/xthreads.h | 8 ++++++++ stl/src/cond.cpp | 2 -- stl/src/cthread.cpp | 6 ------ stl/src/mutex.cpp | 2 -- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/stl/inc/xthreads.h b/stl/inc/xthreads.h index a34afd85e4..7f78cec33f 100644 --- a/stl/inc/xthreads.h +++ b/stl/inc/xthreads.h @@ -96,6 +96,10 @@ enum { // mutex types _Mtx_recursive = 0x100 }; +#ifdef _CRTBLD +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t*, int); +_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t); +#endif // _CRTBLD _CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t, int); _CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t); _CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t); @@ -113,6 +117,10 @@ void __cdecl _Smtx_unlock_exclusive(_Smtx_t*); void __cdecl _Smtx_unlock_shared(_Smtx_t*); // condition variables +#ifdef _CRTBLD +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t*); +_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t); +#endif // _CRTBLD _CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(_Cnd_t); _CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t); _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_wait(_Cnd_t, _Mtx_t); // TRANSITION, ABI: Always succeeds diff --git a/stl/src/cond.cpp b/stl/src/cond.cpp index ea61d15575..fa094b0440 100644 --- a/stl/src/cond.cpp +++ b/stl/src/cond.cpp @@ -28,7 +28,6 @@ _CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(const _Cnd_t cond) { // initialize _CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t) {} // destroy condition variable in situ -// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t* const pcond) { // initialize *pcond = nullptr; @@ -42,7 +41,6 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t* const pcond) { // initializ return _Thrd_result::_Success; } -// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility _CRTIMP2_PURE void __cdecl _Cnd_destroy(const _Cnd_t cond) { // clean up if (cond) { // something to do, do it _Cnd_destroy_in_situ(cond); diff --git a/stl/src/cthread.cpp b/stl/src/cthread.cpp index 2fb7df1301..618037bbfd 100644 --- a/stl/src/cthread.cpp +++ b/stl/src/cthread.cpp @@ -109,12 +109,6 @@ _CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency() { // return numb return info.dwNumberOfProcessors; } -// TRANSITION, ABI: these functions are used only by _Thrd_create() -_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t*, int); -_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t); -_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t*); -_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t); - // TRANSITION, ABI: _Thrd_create() is preserved for binary compatibility _CRTIMP2_PURE _Thrd_result __cdecl _Thrd_create(_Thrd_t* thr, _Thrd_start_t func, void* d) { // create thread _Thrd_result res; diff --git a/stl/src/mutex.cpp b/stl/src/mutex.cpp index 1aeb9e038d..98cf98d1cd 100644 --- a/stl/src/mutex.cpp +++ b/stl/src/mutex.cpp @@ -50,7 +50,6 @@ _CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t mtx) { // destroy mutex i (void) mtx; } -// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t* mtx, int type) { // initialize mutex *mtx = nullptr; @@ -66,7 +65,6 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t* mtx, int type) { // initial return _Thrd_result::_Success; } -// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility _CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t mtx) { // destroy mutex if (mtx) { // something to do, do it _Mtx_destroy_in_situ(mtx); From 10b017d3ae72e516cbe1aa7e832bc632b239e758 Mon Sep 17 00:00:00 2001 From: achabense <60953653+achabense@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:49:43 +0800 Subject: [PATCH 7/7] Move `_cpp_isleadbyte` to `"awint.hpp"` --- stl/src/_tolower.cpp | 2 -- stl/src/_toupper.cpp | 2 -- stl/src/awint.hpp | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/stl/src/_tolower.cpp b/stl/src/_tolower.cpp index 2f342bcc36..16bec174d3 100644 --- a/stl/src/_tolower.cpp +++ b/stl/src/_tolower.cpp @@ -17,8 +17,6 @@ #undef _tolower #undef tolower -#define _cpp_isleadbyte(c) (__pctype_func()[static_cast(c)] & _LEADBYTE) - _EXTERN_C_UNLESS_PURE // int _Tolower(c) - convert character to lower case diff --git a/stl/src/_toupper.cpp b/stl/src/_toupper.cpp index fcf5686f84..70ef52d7c7 100644 --- a/stl/src/_toupper.cpp +++ b/stl/src/_toupper.cpp @@ -16,8 +16,6 @@ #undef _toupper #undef toupper -#define _cpp_isleadbyte(c) (__pctype_func()[static_cast(c)] & _LEADBYTE) - _EXTERN_C_UNLESS_PURE // int _Toupper(c) - convert character to uppercase diff --git a/stl/src/awint.hpp b/stl/src/awint.hpp index acb1667e73..24052ffefa 100644 --- a/stl/src/awint.hpp +++ b/stl/src/awint.hpp @@ -10,6 +10,8 @@ #include +#define _cpp_isleadbyte(c) (__pctype_func()[static_cast(c)] & _LEADBYTE) + _CRT_BEGIN_C_HEADER #if _STL_WIN32_WINNT >= _WIN32_WINNT_WIN8