diff --git a/stl/inc/xthreads.h b/stl/inc/xthreads.h index 26302f0aea3..7f78cec33f9 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/inc/yvals.h b/stl/inc/yvals.h index 8702c037e2a..9f337dad050 100644 --- a/stl/inc/yvals.h +++ b/stl/inc/yvals.h @@ -275,14 +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_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) - #ifndef _CRTIMP2_IMPORT #if defined(CRTDLL2) && defined(_CRTBLD) #define _CRTIMP2_IMPORT __declspec(dllexport) @@ -449,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/awint.hpp b/stl/src/awint.hpp index acb1667e736..24052ffefa4 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 diff --git a/stl/src/cerr.cpp b/stl/src/cerr.cpp index a8db79602ce..3a5f23ce49d 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 68fec6a6e55..6c7b4679817 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 6ae37572e27..e29b72ec85c 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/cond.cpp b/stl/src/cond.cpp index 01d964ef6f3..fa094b04407 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/cout.cpp b/stl/src/cout.cpp index 60f8445c732..02ab1f7eb27 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/mutex.cpp b/stl/src/mutex.cpp index ba8c2de344f..98cf98d1cdf 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 /* diff --git a/stl/src/wcerr.cpp b/stl/src/wcerr.cpp index c2ff56b6ec8..41537b600b8 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 f5c7a1a5e70..bc5008776d9 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 513f7b9105a..3ac05b10172 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 fc574d689c3..c9693987eb9 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 diff --git a/stl/src/xmtx.hpp b/stl/src/xmtx.hpp index f36af7acfcd..2d5b7d1df5b 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;