diff --git a/msvc/ucxxrt.test.vcxproj b/msvc/ucxxrt.test.vcxproj index 3403320..632cbb3 100644 --- a/msvc/ucxxrt.test.vcxproj +++ b/msvc/ucxxrt.test.vcxproj @@ -37,13 +37,13 @@ ucxxrt.test - Windows10 + Windows7 false true WindowsKernelModeDriver10.0 Driver WDM - Universal + Desktop Spectre diff --git a/src/crt/stl/xlock.cpp b/src/crt/stl/xlock.cpp index c1d74c0..09a1df9 100644 --- a/src/crt/stl/xlock.cpp +++ b/src/crt/stl/xlock.cpp @@ -8,6 +8,8 @@ #include #include +//#pragma message(_CRT_STRINGIZE(_MSC_VER)) + #if _MSC_VER >= 1936 // 17.6 #include "init_locks.hpp" #endif diff --git a/src/crt/stl/xmtx.hpp b/src/crt/stl/xmtx.hpp index 602e203..b1479a2 100644 --- a/src/crt/stl/xmtx.hpp +++ b/src/crt/stl/xmtx.hpp @@ -10,6 +10,10 @@ //#include +#ifndef _RELIABILITY_CONTRACT +#define _RELIABILITY_CONTRACT +#endif + #pragma pack(push, _CRT_PACKING) #pragma warning(push, 3) #pragma push_macro("new") diff --git a/src/crt/stl/xnotify.cpp b/src/crt/stl/xnotify.cpp index 543dfe8..9c832ab 100644 --- a/src/crt/stl/xnotify.cpp +++ b/src/crt/stl/xnotify.cpp @@ -8,6 +8,10 @@ //#include +#if _MSC_VER < 1936 // 17.6 +#define noexcept +#endif + constexpr int _Nitems = 20; namespace { @@ -33,7 +37,7 @@ void _Lock_at_thread_exit_mutex(); void _Unlock_at_thread_exit_mutex(); void __cdecl _Cnd_register_at_thread_exit( - _Cnd_t cnd, _Mtx_t mtx, int* p) { // register condition variable and mutex for cleanup at thread exit + _Cnd_t cnd, _Mtx_t mtx, int* p) noexcept { // register condition variable and mutex for cleanup at thread exit // find block with available space _At_thread_exit_block* block = &_Thread_exit_data; @@ -62,7 +66,7 @@ void __cdecl _Cnd_register_at_thread_exit( _Unlock_at_thread_exit_mutex(); } -void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t mtx) { // unregister condition variable/mutex for cleanup at thread exit +void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t mtx) noexcept { // unregister condition variable/mutex for cleanup at thread exit // find condition variables waiting for this thread to exit _At_thread_exit_block* block = &_Thread_exit_data; @@ -80,7 +84,7 @@ void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t mtx) { // unregister conditio _Unlock_at_thread_exit_mutex(); } -void __cdecl _Cnd_do_broadcast_at_thread_exit() { // notify condition variables waiting for this thread to exit +void __cdecl _Cnd_do_broadcast_at_thread_exit() noexcept { // notify condition variables waiting for this thread to exit // find condition variables waiting for this thread to exit _At_thread_exit_block* block = &_Thread_exit_data; const unsigned int currentThreadId = _Thrd_id(); diff --git a/src/crt/stl/xtime.cpp b/src/crt/stl/xtime.cpp index 6157a43..8c9f3ee 100644 --- a/src/crt/stl/xtime.cpp +++ b/src/crt/stl/xtime.cpp @@ -8,6 +8,10 @@ // #include "awint.hpp" +#if _MSC_VER < 1936 // 17.6 +#define noexcept +#endif + constexpr long _Nsec_per_sec = 1000000000L; constexpr long _Nsec_per_msec = 1000000L; constexpr int _Msec_per_sec = 1000; @@ -48,27 +52,28 @@ constexpr long _Nsec100_per_sec = _Nsec_per_sec / 100; _EXTERN_C -_CRTIMP2_PURE long long __cdecl _Xtime_get_ticks() { // get system time in 100-nanosecond intervals since the epoch +_CRTIMP2_PURE long long __cdecl _Xtime_get_ticks() noexcept { // get system time in 100-nanosecond intervals since the epoch LARGE_INTEGER li; - KeQuerySystemTimePrecise(&li); + KeQuerySystemTime(&li); + //KeQuerySystemTimePrecise(&li); return ((static_cast(li.HighPart)) << 32) + static_cast(li.LowPart) - _Epoch; } // Used by several src files, but not dllexported. -void _Timespec64_get_sys(_timespec64* xt) { // get system time with nanosecond resolution +void _Timespec64_get_sys(_timespec64* xt) noexcept { // get system time with nanosecond resolution unsigned long long now = _Xtime_get_ticks(); xt->tv_sec = static_cast<__time64_t>(now / _Nsec100_per_sec); xt->tv_nsec = static_cast(now % _Nsec100_per_sec) * 100; } // convert time to milliseconds -_CRTIMP2_PURE long __cdecl _Xtime_diff_to_millis2(const _timespec64* xt1, const _timespec64* xt2) { +_CRTIMP2_PURE long __cdecl _Xtime_diff_to_millis2(const _timespec64* xt1, const _timespec64* xt2) noexcept { _timespec64 diff = _timespec64_diff(xt1, xt2); return static_cast(diff.tv_sec * _Msec_per_sec + (diff.tv_nsec + _Nsec_per_msec - 1) / _Nsec_per_msec); } // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE long __cdecl _Xtime_diff_to_millis(const _timespec64* xt) { // convert time to milliseconds +_CRTIMP2_PURE long __cdecl _Xtime_diff_to_millis(const _timespec64* xt) noexcept { // convert time to milliseconds _timespec64 now; _Timespec64_get_sys(&now); return _Xtime_diff_to_millis2(xt, &now); @@ -86,13 +91,13 @@ _CRTIMP2_PURE int __cdecl xtime_get(_timespec64* xt, int type) { // get current return type; } -_CRTIMP2_PURE long long __cdecl _Query_perf_counter() { // get current value of performance counter +_CRTIMP2_PURE long long __cdecl _Query_perf_counter() noexcept { // get current value of performance counter LARGE_INTEGER li; KeQueryPerformanceCounter(&li); // always succeeds return li.QuadPart; } -_CRTIMP2_PURE long long __cdecl _Query_perf_frequency() { // get frequency of performance counter +_CRTIMP2_PURE long long __cdecl _Query_perf_frequency() noexcept { // get frequency of performance counter static std::atomic freq_cached{ 0 }; long long freq = freq_cached.load(std::memory_order_relaxed); if (freq == 0) {