From 398edf1a6203161b53224771888e5411ac967053 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Tue, 25 Jul 2023 09:56:56 -0700 Subject: [PATCH 1/5] make `extern "C"` functions explicitly `noexcept` Excludes (with explanatory comment) the redeclarations of `locale.h` functions in `xlocinfo` to avoid clashing with the primary declarations. Drive-by in `mutex.cpp`: Indicate that `_Thrd_abort` is exported for ABI only; there are no callers outside this file. --- .../__msvc_sanitizer_annotate_container.hpp | 2 +- stl/inc/execution | 2 +- stl/inc/experimental/coroutine | 24 +++---- stl/inc/experimental/filesystem | 59 +++++++++--------- stl/inc/memory | 4 +- stl/inc/xlocinfo | 40 ++++++------ stl/inc/xlocnum | 9 +-- stl/inc/xthreads.h | 62 +++++++++---------- stl/inc/xtimec.h | 10 +-- stl/src/StlCompareStringA.cpp | 2 +- stl/src/StlCompareStringW.cpp | 2 +- stl/src/StlLCMapStringA.cpp | 2 +- stl/src/StlLCMapStringW.cpp | 2 +- stl/src/_tolower.cpp | 4 +- stl/src/_toupper.cpp | 2 +- stl/src/atomic.cpp | 4 +- stl/src/awint.hpp | 10 +-- stl/src/cond.cpp | 20 +++--- stl/src/cthread.cpp | 24 +++---- stl/src/dllmain.cpp | 5 +- stl/src/dllmain_satellite.cpp | 2 +- stl/src/excptptr.cpp | 2 +- stl/src/filesys.cpp | 56 ++++++++--------- stl/src/filesystem.cpp | 4 +- stl/src/locale0.cpp | 4 +- stl/src/mutex.cpp | 30 ++++----- stl/src/pplerror.cpp | 2 +- stl/src/ppltasks.cpp | 4 +- stl/src/sharedmutex.cpp | 12 ++-- stl/src/stdhndlr.cpp | 2 +- stl/src/vector_algorithms.cpp | 9 +-- stl/src/winapinls.cpp | 6 +- stl/src/winapisupp.cpp | 52 ++++++++-------- stl/src/xdateord.cpp | 2 +- stl/src/xexp.cpp | 4 +- stl/src/xfexp.cpp | 4 +- stl/src/xgetwctype.cpp | 13 ++-- stl/src/xlcosh.cpp | 4 +- stl/src/xlexp.cpp | 4 +- stl/src/xlock.cpp | 4 +- stl/src/xmath.hpp | 2 +- stl/src/xmbtowc.cpp | 9 +-- stl/src/xnotify.cpp | 10 +-- stl/src/xstod.cpp | 4 +- stl/src/xstof.cpp | 4 +- stl/src/xstol.cpp | 6 +- stl/src/xstold.cpp | 4 +- stl/src/xstoll.cpp | 10 +-- stl/src/xstoul.cpp | 6 +- stl/src/xstoull.cpp | 6 +- stl/src/xstrcoll.cpp | 4 +- stl/src/xstrxfrm.cpp | 2 +- stl/src/xtime.cpp | 15 ++--- stl/src/xtowlower.cpp | 6 +- stl/src/xtowupper.cpp | 6 +- stl/src/xwcscoll.cpp | 6 +- stl/src/xwcsxfrm.cpp | 4 +- stl/src/xwctomb.cpp | 10 +-- stl/src/xwstod.cpp | 4 +- stl/src/xwstof.cpp | 4 +- stl/src/xwstold.cpp | 4 +- stl/src/xwstopfx.cpp | 2 +- stl/src/xxxdtent.hpp | 3 +- stl/src/xxxprec.hpp | 2 +- 64 files changed, 330 insertions(+), 312 deletions(-) diff --git a/stl/inc/__msvc_sanitizer_annotate_container.hpp b/stl/inc/__msvc_sanitizer_annotate_container.hpp index f0b27e0638..511c5243ab 100644 --- a/stl/inc/__msvc_sanitizer_annotate_container.hpp +++ b/stl/inc/__msvc_sanitizer_annotate_container.hpp @@ -130,7 +130,7 @@ extern const bool _Asan_string_should_annotate; #if defined(_INSERT_VECTOR_ANNOTATION) || defined(_INSERT_STRING_ANNOTATION) extern "C" { void __cdecl __sanitizer_annotate_contiguous_container( - const void* _First, const void* _End, const void* _Old_last, const void* _New_last); + const void* _First, const void* _End, const void* _Old_last, const void* _New_last) noexcept; } #ifdef _M_ARM64EC diff --git a/stl/inc/execution b/stl/inc/execution index a421a2f756..c7c85cb8f9 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -45,7 +45,7 @@ using __std_PTP_CALLBACK_ENVIRON = __std_TP_CALLBACK_ENVIRON*; _NODISCARD unsigned int __stdcall __std_parallel_algorithms_hw_threads() noexcept; using __std_PTP_WORK_CALLBACK = void(__stdcall*)( - _Inout_ __std_PTP_CALLBACK_INSTANCE, _Inout_opt_ void*, _Inout_ __std_PTP_WORK); + _Inout_ __std_PTP_CALLBACK_INSTANCE, _Inout_opt_ void*, _Inout_ __std_PTP_WORK) _NOEXCEPT_FNPTR; _NODISCARD __std_PTP_WORK __stdcall __std_create_threadpool_work( _In_ __std_PTP_WORK_CALLBACK, _Inout_opt_ void*, _In_opt_ __std_PTP_CALLBACK_ENVIRON) noexcept; diff --git a/stl/inc/experimental/coroutine b/stl/inc/experimental/coroutine index f31a4381ef..4bf7bec477 100644 --- a/stl/inc/experimental/coroutine +++ b/stl/inc/experimental/coroutine @@ -36,9 +36,9 @@ headers do not support Clang, but the C++20 header does. #endif // defined(__cpp_impl_coroutine) // intrinsics used in implementation of coroutine_handle -extern "C" size_t _coro_resume(void*); -extern "C" void _coro_destroy(void*); -extern "C" size_t _coro_done(void*); +extern "C" size_t _coro_resume(void*) noexcept; +extern "C" void _coro_destroy(void*) noexcept; +extern "C" size_t _coro_done(void*) noexcept; #pragma intrinsic(_coro_resume) #pragma intrinsic(_coro_destroy) #pragma intrinsic(_coro_done) @@ -262,15 +262,15 @@ _STD_END // resumable functions support intrinsics -extern "C" size_t _coro_frame_size(); -extern "C" void* _coro_frame_ptr(); -extern "C" void _coro_init_block(); -extern "C" void* _coro_resume_addr(); -extern "C" void _coro_init_frame(void*); -extern "C" void _coro_save(size_t); -extern "C" void _coro_suspend(size_t); -extern "C" void _coro_cancel(); -extern "C" void _coro_resume_block(); +extern "C" size_t _coro_frame_size() noexcept; +extern "C" void* _coro_frame_ptr() noexcept; +extern "C" void _coro_init_block() noexcept; +extern "C" void* _coro_resume_addr() noexcept; +extern "C" void _coro_init_frame(void*) noexcept; +extern "C" void _coro_save(size_t) noexcept; +extern "C" void _coro_suspend(size_t) noexcept; +extern "C" void _coro_cancel() noexcept; +extern "C" void _coro_resume_block() noexcept; #pragma intrinsic(_coro_frame_size) #pragma intrinsic(_coro_frame_ptr) diff --git a/stl/inc/experimental/filesystem b/stl/inc/experimental/filesystem index 63a3446615..bfc138fff7 100644 --- a/stl/inc/experimental/filesystem +++ b/stl/inc/experimental/filesystem @@ -161,33 +161,34 @@ struct space_info { // space information for a file }; // wide filenames -_FS_DLL void* __CLRCALL_PURE_OR_CDECL _Open_dir(wchar_t (&)[_MAX_FILESYS_NAME], const wchar_t*, int&, file_type&); -_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Read_dir(wchar_t (&)[_MAX_FILESYS_NAME], void*, file_type&); -_FS_DLL void __CLRCALL_PURE_OR_CDECL _Close_dir(void*); -_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_get(wchar_t (&)[_MAX_FILESYS_NAME]); -_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_set(const wchar_t*); -_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Symlink_get(wchar_t (&)[_MAX_FILESYS_NAME], const wchar_t*); -_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Temp_get(wchar_t (&)[_MAX_FILESYS_NAME]); - -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Make_dir(const wchar_t*, const wchar_t*); -_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Remove_dir(const wchar_t*); - -_FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Stat(const wchar_t*, perms*); -_FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Lstat(const wchar_t*, perms*); -_FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _File_size(const wchar_t*); -_FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _Hard_links(const wchar_t*); -_FS_DLL int64_t __CLRCALL_PURE_OR_CDECL _Last_write_time(const wchar_t*); -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Set_last_write_time(const wchar_t*, int64_t); -_FS_DLL space_info __CLRCALL_PURE_OR_CDECL _Statvfs(const wchar_t*); -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Equivalent(const wchar_t*, const wchar_t*); - -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Link(const wchar_t*, const wchar_t*); -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Symlink(const wchar_t*, const wchar_t*); -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Rename(const wchar_t*, const wchar_t*); -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Resize(const wchar_t*, uintmax_t); -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Unlink(const wchar_t*); -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Copy_file(const wchar_t*, const wchar_t*); -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Chmod(const wchar_t*, perms); +_FS_DLL void* __CLRCALL_PURE_OR_CDECL _Open_dir( + wchar_t (&)[_MAX_FILESYS_NAME], const wchar_t*, int&, file_type&) noexcept; +_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Read_dir(wchar_t (&)[_MAX_FILESYS_NAME], void*, file_type&) noexcept; +_FS_DLL void __CLRCALL_PURE_OR_CDECL _Close_dir(void*) noexcept; +_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_get(wchar_t (&)[_MAX_FILESYS_NAME]) noexcept; +_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_set(const wchar_t*) noexcept; +_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Symlink_get(wchar_t (&)[_MAX_FILESYS_NAME], const wchar_t*) noexcept; +_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Temp_get(wchar_t (&)[_MAX_FILESYS_NAME]) noexcept; + +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Make_dir(const wchar_t*, const wchar_t*) noexcept; +_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Remove_dir(const wchar_t*) noexcept; + +_FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Stat(const wchar_t*, perms*) noexcept; +_FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Lstat(const wchar_t*, perms*) noexcept; +_FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _File_size(const wchar_t*) noexcept; +_FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _Hard_links(const wchar_t*) noexcept; +_FS_DLL int64_t __CLRCALL_PURE_OR_CDECL _Last_write_time(const wchar_t*) noexcept; +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Set_last_write_time(const wchar_t*, int64_t) noexcept; +_FS_DLL space_info __CLRCALL_PURE_OR_CDECL _Statvfs(const wchar_t*) noexcept; +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Equivalent(const wchar_t*, const wchar_t*) noexcept; + +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Link(const wchar_t*, const wchar_t*) noexcept; +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Symlink(const wchar_t*, const wchar_t*) noexcept; +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Rename(const wchar_t*, const wchar_t*) noexcept; +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Resize(const wchar_t*, uintmax_t) noexcept; +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Unlink(const wchar_t*) noexcept; +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Copy_file(const wchar_t*, const wchar_t*) noexcept; +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Chmod(const wchar_t*, perms) noexcept; template , class _Outalloc = allocator<_Outchar>> @@ -266,8 +267,8 @@ struct _Path_cvt struct _Path_cvt= 0) int __cdecl _Mbrtowc( - _When_(_Max_multibyte != 0, _Out_) wchar_t*, const char*, size_t _Max_multibyte, mbstate_t*, const _Cvtvec*); +_MRTIMP2 _Success_(return >= 0) int __cdecl _Mbrtowc(_When_(_Max_multibyte != 0, _Out_) wchar_t*, const char*, + size_t _Max_multibyte, mbstate_t*, const _Cvtvec*) noexcept; #endif // ^^^ !defined(_M_CEE_PURE) ^^^ -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Strcoll(const char*, const char*, const char*, const char*, const _Collvec*); +_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Strcoll( + const char*, const char*, const char*, const char*, const _Collvec*) noexcept; _CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Strxfrm(_Out_writes_(_End1 - _String1) _Post_readable_size_(return) char* _String1, - _In_z_ char* _End1, const char*, const char*, const _Collvec*); -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Tolower(int, const _Ctypevec*); -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Toupper(int, const _Ctypevec*); + _In_z_ char* _End1, const char*, const char*, const _Collvec*) noexcept; +_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Tolower(int, const _Ctypevec*) noexcept; +_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Toupper(int, const _Ctypevec*) noexcept; _CRTIMP2_PURE _Success_(return != -1) int __CLRCALL_PURE_OR_CDECL - _Wcrtomb(_Out_ char*, wchar_t, mbstate_t*, const _Cvtvec*); + _Wcrtomb(_Out_ char*, wchar_t, mbstate_t*, const _Cvtvec*) noexcept; _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Wcscoll( - const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const _Collvec*); + const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const _Collvec*) noexcept; _CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Wcsxfrm(_Out_writes_(_End1 - _String1) _Post_readable_size_(return) wchar_t* _String1, - _In_z_ wchar_t* _End1, const wchar_t*, const wchar_t*, const _Collvec*); + _In_z_ wchar_t* _End1, const wchar_t*, const wchar_t*, const _Collvec*) noexcept; -_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _Getwctype(wchar_t, const _Ctypevec*); +_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _Getwctype(wchar_t, const _Ctypevec*) noexcept; _CRTIMP2_PURE const wchar_t* __CLRCALL_PURE_OR_CDECL _Getwctypes( - const wchar_t*, const wchar_t*, short*, const _Ctypevec*); -_CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towlower(wchar_t, const _Ctypevec*); -_CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towupper(wchar_t, const _Ctypevec*); + const wchar_t*, const wchar_t*, short*, const _Ctypevec*) noexcept; +_CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towlower(wchar_t, const _Ctypevec*) noexcept; +_CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towupper(wchar_t, const _Ctypevec*) noexcept; _END_EXTERN_C_UNLESS_PURE _EXTERN_C +// These _should_ be explicitly `noexcept` but cannot be made so here because +// the primary declaration in the C runtime headers is not. + _Success_(return != 0) _Ret_z_ _ACRTIMP char* __cdecl _Getdays(); _Success_(return != 0) _Ret_z_ _ACRTIMP char* __cdecl _Getmonths(); diff --git a/stl/inc/xlocnum b/stl/inc/xlocnum index 30e53bdcbc..afe27df46d 100644 --- a/stl/inc/xlocnum +++ b/stl/inc/xlocnum @@ -23,13 +23,14 @@ _STL_DISABLE_CLANG_WARNINGS _EXTERN_C_UNLESS_PURE -_CRTIMP2_PURE long __CLRCALL_PURE_OR_CDECL _Stolx(const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*); +_CRTIMP2_PURE long __CLRCALL_PURE_OR_CDECL _Stolx( + const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*) noexcept; _CRTIMP2_PURE unsigned long __CLRCALL_PURE_OR_CDECL _Stoulx( - const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*); + const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*) noexcept; _CRTIMP2_PURE long long __CLRCALL_PURE_OR_CDECL _Stollx( - const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*); + const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*) noexcept; _CRTIMP2_PURE unsigned long long __CLRCALL_PURE_OR_CDECL _Stoullx( - const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*); + const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*) noexcept; _END_EXTERN_C_UNLESS_PURE diff --git a/stl/inc/xthreads.h b/stl/inc/xthreads.h index 7f78cec33f..fd7309d53f 100644 --- a/stl/inc/xthreads.h +++ b/stl/inc/xthreads.h @@ -81,12 +81,12 @@ using _Cnd_t = _Cnd_internal_imp_t*; enum class _Thrd_result : int { _Success, _Nomem, _Timedout, _Busy, _Error }; // threads -_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_detach(_Thrd_t); -_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_join(_Thrd_t, int*); -_CRTIMP2_PURE void __cdecl _Thrd_sleep(const _timespec64*); -_CRTIMP2_PURE void __cdecl _Thrd_yield(); -_CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency(); -_CRTIMP2_PURE _Thrd_id_t __cdecl _Thrd_id(); +_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_detach(_Thrd_t) noexcept; +_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_join(_Thrd_t, int*) noexcept; +_CRTIMP2_PURE void __cdecl _Thrd_sleep(const _timespec64*) noexcept; +_CRTIMP2_PURE void __cdecl _Thrd_yield() noexcept; +_CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency() noexcept; +_CRTIMP2_PURE _Thrd_id_t __cdecl _Thrd_id() noexcept; // mutexes enum { // mutex types @@ -97,39 +97,39 @@ enum { // mutex types }; #ifdef _CRTBLD -_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t*, int); -_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t); +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t*, int) noexcept; +_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t) noexcept; #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); -_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 +_CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t, int) noexcept; +_CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t) noexcept; +_CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t) noexcept; +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_lock(_Mtx_t) noexcept; +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_trylock(_Mtx_t) noexcept; +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_unlock(_Mtx_t) noexcept; // TRANSITION, ABI: Always succeeds // shared mutex // these declarations must be in sync with those in sharedmutex.cpp -void __cdecl _Smtx_lock_exclusive(_Smtx_t*); -void __cdecl _Smtx_lock_shared(_Smtx_t*); -int __cdecl _Smtx_try_lock_exclusive(_Smtx_t*); -int __cdecl _Smtx_try_lock_shared(_Smtx_t*); -void __cdecl _Smtx_unlock_exclusive(_Smtx_t*); -void __cdecl _Smtx_unlock_shared(_Smtx_t*); +void __cdecl _Smtx_lock_exclusive(_Smtx_t*) noexcept; +void __cdecl _Smtx_lock_shared(_Smtx_t*) noexcept; +int __cdecl _Smtx_try_lock_exclusive(_Smtx_t*) noexcept; +int __cdecl _Smtx_try_lock_shared(_Smtx_t*) noexcept; +void __cdecl _Smtx_unlock_exclusive(_Smtx_t*) noexcept; +void __cdecl _Smtx_unlock_shared(_Smtx_t*) noexcept; // condition variables #ifdef _CRTBLD -_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t*); -_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t); +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t*) noexcept; +_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t) noexcept; #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 -_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_timedwait(_Cnd_t, _Mtx_t, const _timespec64*); -_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_broadcast(_Cnd_t); // TRANSITION, ABI: Always succeeds -_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_signal(_Cnd_t); // TRANSITION, ABI: Always succeeds -_CRTIMP2_PURE void __cdecl _Cnd_register_at_thread_exit(_Cnd_t, _Mtx_t, int*); -_CRTIMP2_PURE void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t); -_CRTIMP2_PURE void __cdecl _Cnd_do_broadcast_at_thread_exit(); +_CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(_Cnd_t) noexcept; +_CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t) noexcept; +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_wait(_Cnd_t, _Mtx_t) noexcept; // TRANSITION, ABI: Always succeeds +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_timedwait(_Cnd_t, _Mtx_t, const _timespec64*) noexcept; +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_broadcast(_Cnd_t) noexcept; // TRANSITION, ABI: Always succeeds +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_signal(_Cnd_t) noexcept; // TRANSITION, ABI: Always succeeds +_CRTIMP2_PURE void __cdecl _Cnd_register_at_thread_exit(_Cnd_t, _Mtx_t, int*) noexcept; +_CRTIMP2_PURE void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t) noexcept; +_CRTIMP2_PURE void __cdecl _Cnd_do_broadcast_at_thread_exit() noexcept; _END_EXTERN_C _STD_BEGIN diff --git a/stl/inc/xtimec.h b/stl/inc/xtimec.h index 5b36daa8aa..a2b5e7f157 100644 --- a/stl/inc/xtimec.h +++ b/stl/inc/xtimec.h @@ -20,18 +20,18 @@ _STL_DISABLE_CLANG_WARNINGS _EXTERN_C #ifdef _CRTBLD -_CRTIMP2_PURE long __cdecl _Xtime_diff_to_millis2(const _timespec64*, const _timespec64*); +_CRTIMP2_PURE long __cdecl _Xtime_diff_to_millis2(const _timespec64*, const _timespec64*) noexcept; #endif // _CRTBLD -_CRTIMP2_PURE long long __cdecl _Xtime_get_ticks(); +_CRTIMP2_PURE long long __cdecl _Xtime_get_ticks() noexcept; #ifdef _CRTBLD // Used by several src files, but not dllexported. -void _Timespec64_get_sys(_timespec64*); +void _Timespec64_get_sys(_timespec64*) noexcept; #endif // defined(_CRTBLD) -_CRTIMP2_PURE long long __cdecl _Query_perf_counter(); -_CRTIMP2_PURE long long __cdecl _Query_perf_frequency(); +_CRTIMP2_PURE long long __cdecl _Query_perf_counter() noexcept; +_CRTIMP2_PURE long long __cdecl _Query_perf_frequency() noexcept; _END_EXTERN_C diff --git a/stl/src/StlCompareStringA.cpp b/stl/src/StlCompareStringA.cpp index e8f2758f66..041a0efe9d 100644 --- a/stl/src/StlCompareStringA.cpp +++ b/stl/src/StlCompareStringA.cpp @@ -31,7 +31,7 @@ // Failure: 0 extern "C" _CRTIMP2 int __cdecl __crtCompareStringA(_In_z_ LPCWSTR LocaleName, _In_ DWORD dwCmpFlags, _In_reads_(cchCount1) LPCSTR lpString1, _In_ int cchCount1, _In_reads_(cchCount2) LPCSTR lpString2, - _In_ int cchCount2, _In_ int code_page) { + _In_ int cchCount2, _In_ int code_page) noexcept { // CompareString will compare past null terminator. Must find null terminator if in string before cchCountn chars. if (cchCount1 > 0) { cchCount1 = static_cast(__strncnt(lpString1, cchCount1)); diff --git a/stl/src/StlCompareStringW.cpp b/stl/src/StlCompareStringW.cpp index fc1838cbd1..88df2dbbe9 100644 --- a/stl/src/StlCompareStringW.cpp +++ b/stl/src/StlCompareStringW.cpp @@ -26,7 +26,7 @@ // Failure: 0 extern "C" _CRTIMP2 int __cdecl __crtCompareStringW(_In_z_ LPCWSTR LocaleName, _In_ DWORD dwCmpFlags, _In_reads_(cchCount1) LPCWSTR lpString1, _In_ int cchCount1, _In_reads_(cchCount2) LPCWSTR lpString2, - _In_ int cchCount2) { + _In_ int cchCount2) noexcept { // CompareString will compare past null terminator. Must find null terminator if in string before cchCountn wide // characters. if (cchCount1 > 0) { diff --git a/stl/src/StlLCMapStringA.cpp b/stl/src/StlLCMapStringA.cpp index 80568b3de2..79cb518dc1 100644 --- a/stl/src/StlLCMapStringA.cpp +++ b/stl/src/StlLCMapStringA.cpp @@ -30,7 +30,7 @@ // Failure: 0 extern "C" _CRTIMP2 int __cdecl __crtLCMapStringA(_In_opt_z_ LPCWSTR LocaleName, _In_ DWORD dwMapFlags, _In_reads_(cchSrc) LPCSTR lpSrcStr, _In_ int cchSrc, _Out_writes_opt_(cchDest) char* lpDestStr, _In_ int cchDest, - _In_ int code_page, _In_ BOOL bError) { + _In_ int code_page, _In_ BOOL bError) noexcept { // LCMapString will map past the null terminator. We must find the null // terminator if it occurs in the string before cchSrc characters // and cap the number of characters to be considered. diff --git a/stl/src/StlLCMapStringW.cpp b/stl/src/StlLCMapStringW.cpp index da2c43cd2f..67ffdb12f0 100644 --- a/stl/src/StlLCMapStringW.cpp +++ b/stl/src/StlLCMapStringW.cpp @@ -32,7 +32,7 @@ // Failure: 0 extern "C" _CRTIMP2 int __cdecl __crtLCMapStringW(_In_opt_z_ LPCWSTR const locale_name, _In_ DWORD const map_flags, _In_reads_(source_count) LPCWSTR const source, _In_ int source_count, - _Out_writes_opt_(destination_count) wchar_t* const destination, _In_ int const destination_count) { + _Out_writes_opt_(destination_count) wchar_t* const destination, _In_ int const destination_count) noexcept { // LCMapString will map past the null terminator. We must find the null terminator if it occurs in the string // before source_count characters and cap the number of characters to be considered. if (source_count > 0) { diff --git a/stl/src/_tolower.cpp b/stl/src/_tolower.cpp index 16bec174d3..a589212c09 100644 --- a/stl/src/_tolower.cpp +++ b/stl/src/_tolower.cpp @@ -33,7 +33,7 @@ _EXTERN_C_UNLESS_PURE // // Exceptions: // None. -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Tolower(int c, const _Ctypevec* ploc) { +_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Tolower(int c, const _Ctypevec* ploc) noexcept { int size; unsigned char inbuffer[3]; unsigned char outbuffer[3]; @@ -98,7 +98,7 @@ _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Tolower(int c, const _Ctypevec* ploc) } } -_CRTIMP2_PURE _Ctypevec __CLRCALL_PURE_OR_CDECL _Getctype() { +_CRTIMP2_PURE _Ctypevec __CLRCALL_PURE_OR_CDECL _Getctype() noexcept { // get ctype info for current locale _Ctypevec ctype; diff --git a/stl/src/_toupper.cpp b/stl/src/_toupper.cpp index 70ef52d7c7..61f6a9b482 100644 --- a/stl/src/_toupper.cpp +++ b/stl/src/_toupper.cpp @@ -32,7 +32,7 @@ _EXTERN_C_UNLESS_PURE // // Exceptions: // None. -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Toupper(int c, const _Ctypevec* ploc) { +_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Toupper(int c, const _Ctypevec* ploc) noexcept { int size; unsigned char inbuffer[3]; unsigned char outbuffer[3]; diff --git a/stl/src/atomic.cpp b/stl/src/atomic.cpp index 3bdbf72540..f5a82afea1 100644 --- a/stl/src/atomic.cpp +++ b/stl/src/atomic.cpp @@ -13,11 +13,11 @@ namespace { _EXTERN_C -_CRTIMP2_PURE void __cdecl _Lock_shared_ptr_spin_lock() { // TRANSITION, ABI: "spin_lock" name is outdated +_CRTIMP2_PURE void __cdecl _Lock_shared_ptr_spin_lock() noexcept { // TRANSITION, ABI: "spin_lock" name is outdated AcquireSRWLockExclusive(&_Shared_ptr_lock); } -_CRTIMP2_PURE void __cdecl _Unlock_shared_ptr_spin_lock() { // release previously obtained lock +_CRTIMP2_PURE void __cdecl _Unlock_shared_ptr_spin_lock() noexcept { // release previously obtained lock _Analysis_assume_lock_held_(_Shared_ptr_lock); ReleaseSRWLockExclusive(&_Shared_ptr_lock); } diff --git a/stl/src/awint.hpp b/stl/src/awint.hpp index 24052ffefa..da1e26e470 100644 --- a/stl/src/awint.hpp +++ b/stl/src/awint.hpp @@ -21,24 +21,24 @@ _CRT_BEGIN_C_HEADER #else // ^^^ _STL_WIN32_WINNT >= _WIN32_WINNT_WIN8 / _STL_WIN32_WINNT < _WIN32_WINNT_WIN8 vvv -_CRTIMP2 void __cdecl __crtGetSystemTimePreciseAsFileTime(_Out_ LPFILETIME lpSystemTimeAsFileTime); +_CRTIMP2 void __cdecl __crtGetSystemTimePreciseAsFileTime(_Out_ LPFILETIME lpSystemTimeAsFileTime) noexcept; #endif // ^^^ _STL_WIN32_WINNT < _WIN32_WINNT_WIN8 ^^^ _CRTIMP2 int __cdecl __crtCompareStringA(_In_z_ LPCWSTR _LocaleName, _In_ DWORD _DwCmpFlags, _In_reads_(_CchCount1) LPCSTR _LpString1, _In_ int _CchCount1, _In_reads_(_CchCount2) LPCSTR _LpString2, - _In_ int _CchCount2, _In_ int _CodePage); + _In_ int _CchCount2, _In_ int _CodePage) noexcept; _CRTIMP2 int __cdecl __crtCompareStringW(_In_z_ LPCWSTR _LocaleName, _In_ DWORD _DwCmpFlags, _In_reads_(_CchCount1) LPCWSTR _LpString1, _In_ int _CchCount1, _In_reads_(_CchCount2) LPCWSTR _LpString2, - _In_ int _CchCount2); + _In_ int _CchCount2) noexcept; _CRTIMP2 int __cdecl __crtLCMapStringA(_In_opt_z_ LPCWSTR _LocaleName, _In_ DWORD _DwMapFlag, _In_reads_(_CchSrc) LPCSTR _LpSrcStr, _In_ int _CchSrc, _Out_writes_opt_(_CchDest) char* _LpDestStr, - _In_ int _CchDest, _In_ int _CodePage, _In_ BOOL _BError); + _In_ int _CchDest, _In_ int _CodePage, _In_ BOOL _BError) noexcept; _CRTIMP2 int __cdecl __crtLCMapStringW(_In_opt_z_ LPCWSTR _LocaleName, _In_ DWORD _DWMapFlag, _In_reads_(_CchSrc) LPCWSTR _LpSrcStr, _In_ int _CchSrc, _Out_writes_opt_(_CchDest) wchar_t* _LpDestStr, - _In_ int _CchDest); + _In_ int _CchDest) noexcept; _CRT_END_C_HEADER diff --git a/stl/src/cond.cpp b/stl/src/cond.cpp index fa094b0440..db5ca83dc6 100644 --- a/stl/src/cond.cpp +++ b/stl/src/cond.cpp @@ -22,13 +22,13 @@ struct _Cnd_internal_imp_t { // condition variable implementation for ConcRT } }; -_CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(const _Cnd_t cond) { // initialize condition variable in situ +_CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(const _Cnd_t cond) noexcept { // initialize condition variable in situ Concurrency::details::create_stl_condition_variable(cond->_get_cv()); } -_CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t) {} // destroy condition variable in situ +_CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t) noexcept {} // destroy condition variable in situ -_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t* const pcond) { // initialize +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t* const pcond) noexcept { // initialize *pcond = nullptr; const auto cond = static_cast<_Cnd_t>(_calloc_crt(1, sizeof(_Cnd_internal_imp_t))); @@ -41,7 +41,7 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t* const pcond) { // initializ return _Thrd_result::_Success; } -_CRTIMP2_PURE void __cdecl _Cnd_destroy(const _Cnd_t cond) { // clean up +_CRTIMP2_PURE void __cdecl _Cnd_destroy(const _Cnd_t cond) noexcept { // clean up if (cond) { // something to do, do it _Cnd_destroy_in_situ(cond); _free_crt(cond); @@ -49,18 +49,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 +_CRTIMP2_PURE void __cdecl _Mtx_clear_owner(_Mtx_t mtx) noexcept { // 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 +_CRTIMP2_PURE void __cdecl _Mtx_reset_owner(_Mtx_t mtx) noexcept { // 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 +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_wait(const _Cnd_t cond, const _Mtx_t mtx) noexcept { // wait until signaled const auto cs = &mtx->_Critical_section; _Mtx_clear_owner(mtx); cond->_get_cv()->wait(cs); @@ -70,7 +70,7 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_wait(const _Cnd_t cond, const _Mtx_t mtx // wait until signaled or timeout _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_timedwait( - const _Cnd_t cond, const _Mtx_t mtx, const _timespec64* const target) { + const _Cnd_t cond, const _Mtx_t mtx, const _timespec64* const target) noexcept { _Thrd_result res = _Thrd_result::_Success; const auto cs = &mtx->_Critical_section; if (target == nullptr) { // no target time specified, wait on mutex @@ -92,12 +92,12 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_timedwait( return res; } -_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_signal(const _Cnd_t cond) { // release one waiting thread +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_signal(const _Cnd_t cond) noexcept { // release one waiting thread cond->_get_cv()->notify_one(); return _Thrd_result::_Success; // TRANSITION, ABI: Always succeeds } -_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_broadcast(const _Cnd_t cond) { // release all waiting threads +_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_broadcast(const _Cnd_t cond) noexcept { // release all waiting threads cond->_get_cv()->notify_all(); return _Thrd_result::_Success; // TRANSITION, ABI: Always succeeds } diff --git a/stl/src/cthread.cpp b/stl/src/cthread.cpp index 3ab8f0998f..5bc6b941d2 100644 --- a/stl/src/cthread.cpp +++ b/stl/src/cthread.cpp @@ -40,17 +40,18 @@ namespace { _EXTERN_C // TRANSITION, ABI: _Thrd_exit() is preserved for binary compatibility -[[noreturn]] _CRTIMP2_PURE void __cdecl _Thrd_exit(int res) { // terminate execution of calling thread +[[noreturn]] _CRTIMP2_PURE void __cdecl _Thrd_exit(int res) noexcept { // terminate execution of calling thread _endthreadex(res); } // TRANSITION, ABI: _Thrd_start() is preserved for binary compatibility -_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_start(_Thrd_t* thr, _Thrd_callback_t func, void* b) { // start a thread +_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_start(_Thrd_t* thr, _Thrd_callback_t func, void* b) noexcept { + // start a thread thr->_Hnd = reinterpret_cast(_beginthreadex(nullptr, 0, func, b, 0, &thr->_Id)); return thr->_Hnd == nullptr ? _Thrd_result::_Error : _Thrd_result::_Success; } -_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_join(_Thrd_t thr, int* code) { // returns when thread terminates +_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_join(_Thrd_t thr, int* code) noexcept { // returns when thread terminates if (WaitForSingleObjectEx(thr._Hnd, INFINITE, FALSE) == WAIT_FAILED) { return _Thrd_result::_Error; } @@ -66,12 +67,12 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Thrd_join(_Thrd_t thr, int* code) { // retur return CloseHandle(thr._Hnd) ? _Thrd_result::_Success : _Thrd_result::_Error; } -_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_detach(_Thrd_t thr) { +_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_detach(_Thrd_t thr) noexcept { // tell OS to release thread's resources when it terminates return CloseHandle(thr._Hnd) ? _Thrd_result::_Success : _Thrd_result::_Error; } -_CRTIMP2_PURE void __cdecl _Thrd_sleep(const _timespec64* xt) { // suspend thread until time xt +_CRTIMP2_PURE void __cdecl _Thrd_sleep(const _timespec64* xt) noexcept { // suspend thread until time xt _timespec64 now; _Timespec64_get_sys(&now); do { // sleep and check time @@ -80,35 +81,36 @@ _CRTIMP2_PURE void __cdecl _Thrd_sleep(const _timespec64* xt) { // suspend threa } while (now.tv_sec < xt->tv_sec || now.tv_sec == xt->tv_sec && now.tv_nsec < xt->tv_nsec); } -_CRTIMP2_PURE void __cdecl _Thrd_yield() { // surrender remainder of timeslice +_CRTIMP2_PURE void __cdecl _Thrd_yield() noexcept { // surrender remainder of timeslice SwitchToThread(); } // TRANSITION, ABI: _Thrd_equal() is preserved for binary compatibility -_CRTIMP2_PURE int __cdecl _Thrd_equal(_Thrd_t thr0, _Thrd_t thr1) { // return 1 if thr0 and thr1 identify same thread +_CRTIMP2_PURE int __cdecl _Thrd_equal(_Thrd_t thr0, _Thrd_t thr1) noexcept { + // return 1 if thr0 and thr1 identify same thread return thr0._Id == thr1._Id; } // TRANSITION, ABI: _Thrd_current() is preserved for binary compatibility -_CRTIMP2_PURE _Thrd_t __cdecl _Thrd_current() { // return _Thrd_t identifying current thread +_CRTIMP2_PURE _Thrd_t __cdecl _Thrd_current() noexcept { // return _Thrd_t identifying current thread _Thrd_t result; result._Hnd = nullptr; result._Id = GetCurrentThreadId(); return result; } -_CRTIMP2_PURE _Thrd_id_t __cdecl _Thrd_id() { // return unique id for current thread +_CRTIMP2_PURE _Thrd_id_t __cdecl _Thrd_id() noexcept { // return unique id for current thread return GetCurrentThreadId(); } -_CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency() { // return number of processors +_CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency() noexcept { // return number of processors SYSTEM_INFO info; GetNativeSystemInfo(&info); return info.dwNumberOfProcessors; } // 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 +_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_create(_Thrd_t* thr, _Thrd_start_t func, void* d) noexcept { // create thread _Thrd_result res; _Thrd_binder b; int started = 0; diff --git a/stl/src/dllmain.cpp b/stl/src/dllmain.cpp index 23968536e8..4535e331f3 100644 --- a/stl/src/dllmain.cpp +++ b/stl/src/dllmain.cpp @@ -7,10 +7,11 @@ #ifdef _CRT_APP // free static resource used by causality -extern "C" void __cdecl __crtCleanupCausalityStaticFactories(); +extern "C" void __cdecl __crtCleanupCausalityStaticFactories() noexcept; #endif // defined(_CRT_APP) -extern "C" BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD ul_reason_for_call, [[maybe_unused]] LPVOID lpReserved) { +extern "C" BOOL APIENTRY DllMain( + HMODULE /* hModule */, DWORD ul_reason_for_call, [[maybe_unused]] LPVOID lpReserved) noexcept { if (ul_reason_for_call == DLL_PROCESS_DETACH) { #ifdef _CRT_APP if (lpReserved == nullptr) { // only when the process is not terminating diff --git a/stl/src/dllmain_satellite.cpp b/stl/src/dllmain_satellite.cpp index af2e024c1f..8e8f8451eb 100644 --- a/stl/src/dllmain_satellite.cpp +++ b/stl/src/dllmain_satellite.cpp @@ -5,7 +5,7 @@ // DllMain for 'satellite' DLLs which don't need TLS. -extern "C" BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID) { +extern "C" BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID) noexcept { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { if (!DisableThreadLibraryCalls(hModule)) { return FALSE; diff --git a/stl/src/excptptr.cpp b/stl/src/excptptr.cpp index b36a2cf699..40fff9f9f8 100644 --- a/stl/src/excptptr.cpp +++ b/stl/src/excptptr.cpp @@ -32,7 +32,7 @@ // V4 and later managed exception code #define MANAGED_EXCEPTION_CODE_V4 0XE0434352 -extern "C" _CRTIMP2 void* __cdecl __AdjustPointer(void*, const PMD&); // defined in frame.cpp +extern "C" _CRTIMP2 void* __cdecl __AdjustPointer(void*, const PMD&) noexcept; // defined in frame.cpp using namespace std; diff --git a/stl/src/filesys.cpp b/stl/src/filesys.cpp index 8c8b0eeaef..0bebdc1603 100644 --- a/stl/src/filesys.cpp +++ b/stl/src/filesys.cpp @@ -18,8 +18,8 @@ #ifdef _M_CEE_PURE #define __crtGetTempPath2W(BufferLength, Buffer) GetTempPathW(BufferLength, Buffer) #else // vvv !defined(_M_CEE_PURE) vvv -extern "C" _Success_(return > 0 && return < BufferLength) DWORD - __stdcall __crtGetTempPath2W(_In_ DWORD BufferLength, _Out_writes_to_opt_(BufferLength, return +1) LPWSTR Buffer); +extern "C" _Success_(return > 0 && return < BufferLength) DWORD __stdcall __crtGetTempPath2W( + _In_ DWORD BufferLength, _Out_writes_to_opt_(BufferLength, return +1) LPWSTR Buffer) noexcept; #endif // ^^^ !defined(_M_CEE_PURE) ^^^ _FS_BEGIN @@ -38,7 +38,7 @@ static file_type _Map_mode(int _Mode) { // map Windows file attributes to file_s } } -_FS_DLL void __CLRCALL_PURE_OR_CDECL _Close_dir(void* _Handle) { // close a directory +_FS_DLL void __CLRCALL_PURE_OR_CDECL _Close_dir(void* _Handle) noexcept { // close a directory FindClose(_Handle); } @@ -62,7 +62,7 @@ static HANDLE _FilesysOpenFile(const wchar_t* _Fname, DWORD _Desired_access, DWO } _FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Read_dir( - wchar_t (&_Dest)[_MAX_FILESYS_NAME], void* _Handle, file_type& _Ftype) { // read a directory entry + wchar_t (&_Dest)[_MAX_FILESYS_NAME], void* _Handle, file_type& _Ftype) noexcept { // read a directory entry WIN32_FIND_DATAW _Dentry; while (FindNextFileW(_Handle, &_Dentry)) { @@ -91,18 +91,18 @@ static unsigned int _Filesys_code_page() { // determine appropriate code page #endif // ^^^ !defined(_ONECORE) ^^^ } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _To_wide(const char* _Bsrc, wchar_t* _Wdest) { +_FS_DLL int __CLRCALL_PURE_OR_CDECL _To_wide(const char* _Bsrc, wchar_t* _Wdest) noexcept { // return nonzero on success return MultiByteToWideChar(_Filesys_code_page(), 0, _Bsrc, -1, _Wdest, _MAX_FILESYS_NAME); } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _To_byte(const wchar_t* _Wsrc, char* _Bdest) { +_FS_DLL int __CLRCALL_PURE_OR_CDECL _To_byte(const wchar_t* _Wsrc, char* _Bdest) noexcept { // return nonzero on success return WideCharToMultiByte(_Filesys_code_page(), 0, _Wsrc, -1, _Bdest, _MAX_FILESYS_NAME, nullptr, nullptr); } _FS_DLL void* __CLRCALL_PURE_OR_CDECL _Open_dir( - wchar_t (&_Dest)[_MAX_FILESYS_NAME], const wchar_t* _Dirname, int& _Errno, file_type& _Ftype) { + wchar_t (&_Dest)[_MAX_FILESYS_NAME], const wchar_t* _Dirname, int& _Errno, file_type& _Ftype) noexcept { // open a directory for reading WIN32_FIND_DATAW _Dentry; wstring _Wildname(_Dirname); @@ -138,7 +138,7 @@ _FS_DLL void* __CLRCALL_PURE_OR_CDECL _Open_dir( return _Handle; } -_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_get(wchar_t (&_Dest)[_MAX_FILESYS_NAME]) { +_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_get(wchar_t (&_Dest)[_MAX_FILESYS_NAME]) noexcept { // get current working directory _Strcpy(_Dest, L""); #ifdef _CRT_APP @@ -148,7 +148,7 @@ _FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_get(wchar_t (&_Dest)[_MAX_FILESYS_ #endif // ^^^ !defined(_CRT_APP) ^^^ } -_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_set(const wchar_t* _Dirname) { +_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_set(const wchar_t* _Dirname) noexcept { // set current working directory #ifdef _CRT_APP (void) _Dirname; @@ -158,19 +158,19 @@ _FS_DLL bool __CLRCALL_PURE_OR_CDECL _Current_set(const wchar_t* _Dirname) { #endif // ^^^ !defined(_CRT_APP) ^^^ } -_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Symlink_get(wchar_t (&_Dest)[_MAX_FILESYS_NAME], const wchar_t*) { +_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Symlink_get(wchar_t (&_Dest)[_MAX_FILESYS_NAME], const wchar_t*) noexcept { // get symlink -- DUMMY _Dest[0] = L'\0'; return _Dest; } -_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Temp_get(wchar_t (&_Dest)[_MAX_FILESYS_NAME]) { +_FS_DLL wchar_t* __CLRCALL_PURE_OR_CDECL _Temp_get(wchar_t (&_Dest)[_MAX_FILESYS_NAME]) noexcept { // get temp directory wchar_t _Dentry[MAX_PATH]; return _Strcpy(_Dest, __crtGetTempPath2W(MAX_PATH, _Dentry) != 0 ? _Dentry : L"."); } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Make_dir(const wchar_t* _Fname, const wchar_t*) { +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Make_dir(const wchar_t* _Fname, const wchar_t*) noexcept { // make a new directory (ignore attributes) if (CreateDirectoryW(_Fname, nullptr)) { return 1; @@ -181,11 +181,11 @@ _FS_DLL int __CLRCALL_PURE_OR_CDECL _Make_dir(const wchar_t* _Fname, const wchar } } -_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Remove_dir(const wchar_t* _Fname) { // remove a directory +_FS_DLL bool __CLRCALL_PURE_OR_CDECL _Remove_dir(const wchar_t* _Fname) noexcept { // remove a directory return _wrmdir(_Fname) != -1; } -_FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Stat(const wchar_t* _Fname, perms* _Pmode) { // get file status +_FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Stat(const wchar_t* _Fname, perms* _Pmode) noexcept { // get file status WIN32_FILE_ATTRIBUTE_DATA _Data; if (GetFileAttributesExW(_Fname, GetFileExInfoStandard, &_Data)) { @@ -215,12 +215,12 @@ _FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Stat(const wchar_t* _Fname, perms* _P } } -_FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Lstat(const wchar_t* _Fname, perms* _Pmode) { +_FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Lstat(const wchar_t* _Fname, perms* _Pmode) noexcept { // get symlink file status return _Stat(_Fname, _Pmode); // symlink not supported } -_FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _Hard_links(const wchar_t* _Fname) { +_FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _Hard_links(const wchar_t* _Fname) noexcept { // get hard link count HANDLE _Handle = _FilesysOpenFile(_Fname, FILE_READ_ATTRIBUTES, FILE_FLAG_BACKUP_SEMANTICS); @@ -245,7 +245,7 @@ _FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _Hard_links(const wchar_t* _Fname) { #endif // ^^^ !defined(_CRT_APP) ^^^ } -_FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _File_size(const wchar_t* _Fname) { // get file size +_FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _File_size(const wchar_t* _Fname) noexcept { // get file size WIN32_FILE_ATTRIBUTE_DATA _Data; if (GetFileAttributesExW(_Fname, GetFileExInfoStandard, &_Data)) { @@ -266,7 +266,7 @@ _FS_DLL uintmax_t __CLRCALL_PURE_OR_CDECL _File_size(const wchar_t* _Fname) { // constexpr uint64_t _Win_ticks_per_second = 10000000ULL; constexpr uint64_t _Win_ticks_from_epoch = ((1970 - 1601) * 365 + 3 * 24 + 17) * 86400ULL * _Win_ticks_per_second; -_FS_DLL int64_t __CLRCALL_PURE_OR_CDECL _Last_write_time(const wchar_t* _Fname) { // get last write time +_FS_DLL int64_t __CLRCALL_PURE_OR_CDECL _Last_write_time(const wchar_t* _Fname) noexcept { // get last write time WIN32_FILE_ATTRIBUTE_DATA _Data; if (!GetFileAttributesExW(_Fname, GetFileExInfoStandard, &_Data)) { @@ -279,7 +279,7 @@ _FS_DLL int64_t __CLRCALL_PURE_OR_CDECL _Last_write_time(const wchar_t* _Fname) return static_cast(_Wtime - _Win_ticks_from_epoch); } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Set_last_write_time(const wchar_t* _Fname, int64_t _When) { +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Set_last_write_time(const wchar_t* _Fname, int64_t _When) noexcept { // set last write time HANDLE _Handle = _FilesysOpenFile(_Fname, FILE_WRITE_ATTRIBUTES, FILE_FLAG_BACKUP_SEMANTICS); @@ -297,7 +297,7 @@ _FS_DLL int __CLRCALL_PURE_OR_CDECL _Set_last_write_time(const wchar_t* _Fname, return _Result; } -_FS_DLL space_info __CLRCALL_PURE_OR_CDECL _Statvfs(const wchar_t* _Fname) { +_FS_DLL space_info __CLRCALL_PURE_OR_CDECL _Statvfs(const wchar_t* _Fname) noexcept { // get space information for volume space_info _Ans = {static_cast(-1), static_cast(-1), static_cast(-1)}; wstring _Devname = _Fname; @@ -319,7 +319,7 @@ _FS_DLL space_info __CLRCALL_PURE_OR_CDECL _Statvfs(const wchar_t* _Fname) { } _FS_DLL int __CLRCALL_PURE_OR_CDECL _Equivalent( - const wchar_t* _Fname1, const wchar_t* _Fname2) { // test for equivalent file names + const wchar_t* _Fname1, const wchar_t* _Fname2) noexcept { // test for equivalent file names #ifdef _CRT_APP _FILE_ID_INFO _Info1 = {0}; _FILE_ID_INFO _Info2 = {0}; @@ -376,7 +376,7 @@ _FS_DLL int __CLRCALL_PURE_OR_CDECL _Equivalent( #endif // ^^^ !defined(_CRT_APP) ^^^ } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Link(const wchar_t* _Fname1, const wchar_t* _Fname2) { +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Link(const wchar_t* _Fname1, const wchar_t* _Fname2) noexcept { // link _Fname2 to _Fname1 #ifdef _CRT_APP (void) _Fname1; @@ -387,7 +387,7 @@ _FS_DLL int __CLRCALL_PURE_OR_CDECL _Link(const wchar_t* _Fname1, const wchar_t* #endif // ^^^ !defined(_CRT_APP) ^^^ } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Symlink(const wchar_t* _Fname1, const wchar_t* _Fname2) { +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Symlink(const wchar_t* _Fname1, const wchar_t* _Fname2) noexcept { // link _Fname2 to _Fname1 #ifdef _CRT_APP (void) _Fname1; @@ -398,12 +398,12 @@ _FS_DLL int __CLRCALL_PURE_OR_CDECL _Symlink(const wchar_t* _Fname1, const wchar #endif // ^^^ !defined(_CRT_APP) ^^^ } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Rename(const wchar_t* _Fname1, const wchar_t* _Fname2) { +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Rename(const wchar_t* _Fname1, const wchar_t* _Fname2) noexcept { // rename _Fname1 as _Fname2 return _wrename(_Fname1, _Fname2) == 0 ? 0 : GetLastError(); } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Resize(const wchar_t* _Fname, uintmax_t _Newsize) { // change file size +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Resize(const wchar_t* _Fname, uintmax_t _Newsize) noexcept { // change file size HANDLE _Handle = _FilesysOpenFile(_Fname, FILE_GENERIC_WRITE, 0); @@ -420,11 +420,11 @@ _FS_DLL int __CLRCALL_PURE_OR_CDECL _Resize(const wchar_t* _Fname, uintmax_t _Ne return _Ok ? 0 : GetLastError(); } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Unlink(const wchar_t* _Fname) { // unlink _Fname +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Unlink(const wchar_t* _Fname) noexcept { // unlink _Fname return _wremove(_Fname) == 0 ? 0 : GetLastError(); } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Copy_file(const wchar_t* _Fname1, const wchar_t* _Fname2) { +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Copy_file(const wchar_t* _Fname1, const wchar_t* _Fname2) noexcept { // copy _Fname1 to _Fname2 #if defined(_ONECORE) COPYFILE2_EXTENDED_PARAMETERS _Params = {0}; @@ -443,7 +443,7 @@ _FS_DLL int __CLRCALL_PURE_OR_CDECL _Copy_file(const wchar_t* _Fname1, const wch #endif // ^^^ !defined(_ONECORE) ^^^ } -_FS_DLL int __CLRCALL_PURE_OR_CDECL _Chmod(const wchar_t* _Fname, perms _Newmode) { +_FS_DLL int __CLRCALL_PURE_OR_CDECL _Chmod(const wchar_t* _Fname, perms _Newmode) noexcept { // change file mode to _Newmode WIN32_FILE_ATTRIBUTE_DATA _Data; diff --git a/stl/src/filesystem.cpp b/stl/src/filesystem.cpp index 65fa38acca..54ab771603 100644 --- a/stl/src/filesystem.cpp +++ b/stl/src/filesystem.cpp @@ -786,8 +786,8 @@ _Success_(return == __std_win_error::_Success) __std_win_error } namespace { - _Success_(return > 0 && return < nBufferLength) DWORD WINAPI - _Stl_GetTempPath2W(_In_ DWORD nBufferLength, _Out_writes_to_opt_(nBufferLength, return +1) LPWSTR lpBuffer) { + _Success_(return > 0 && return < nBufferLength) DWORD WINAPI _Stl_GetTempPath2W( + _In_ DWORD nBufferLength, _Out_writes_to_opt_(nBufferLength, return +1) LPWSTR lpBuffer) noexcept { // See GH-3011: This is intentionally not attempting to cache the function pointer. // TRANSITION, ABI: This should use __crtGetTempPath2W after this code is moved into the STL's DLL. using _Fun_ptr = decltype(&::GetTempPath2W); diff --git a/stl/src/locale0.cpp b/stl/src/locale0.cpp index cf38ea29b3..1fc42d4eb5 100644 --- a/stl/src/locale0.cpp +++ b/stl/src/locale0.cpp @@ -80,7 +80,7 @@ _STD_END _EXTERN_C -void __CLRCALL_OR_CDECL _Deletegloballocale(void* ptr) { // delete a global locale reference +void __CLRCALL_OR_CDECL _Deletegloballocale(void* ptr) noexcept { // delete a global locale reference std::locale::_Locimp* locptr = *static_cast(ptr); if (locptr != nullptr) { delete locptr->_Decref(); @@ -89,7 +89,7 @@ void __CLRCALL_OR_CDECL _Deletegloballocale(void* ptr) { // delete a global loca __PURE_APPDOMAIN_GLOBAL static std::locale::_Locimp* global_locale = nullptr; // pointer to current locale -static void __CLRCALL_PURE_OR_CDECL tidy_global() { // delete static global locale reference +static void __CLRCALL_PURE_OR_CDECL tidy_global() noexcept { // delete static global locale reference _BEGIN_LOCK(_LOCK_LOCALE) // prevent double delete _Deletegloballocale(&global_locale); global_locale = nullptr; diff --git a/stl/src/mutex.cpp b/stl/src/mutex.cpp index 98cf98d1cd..08ae332009 100644 --- a/stl/src/mutex.cpp +++ b/stl/src/mutex.cpp @@ -15,7 +15,8 @@ _EXTERN_C -[[noreturn]] _CRTIMP2_PURE void __cdecl _Thrd_abort(const char* msg) { // abort on precondition failure +// TRANSITION, ABI: exported only for ABI compat +[[noreturn]] _CRTIMP2_PURE void __cdecl _Thrd_abort(const char* msg) noexcept { // abort on precondition failure fputs(msg, stderr); fputc('\n', stderr); abort(); @@ -31,26 +32,26 @@ _EXTERN_C // TRANSITION, ABI: preserved for binary compatibility enum class __stl_sync_api_modes_enum { normal, win7, vista, concrt }; -_CRTIMP2 void __cdecl __set_stl_sync_api_mode(__stl_sync_api_modes_enum) {} +_CRTIMP2 void __cdecl __set_stl_sync_api_mode(__stl_sync_api_modes_enum) noexcept {} -[[nodiscard]] static PSRWLOCK get_srw_lock(_Mtx_t mtx) { +[[nodiscard]] static PSRWLOCK get_srw_lock(_Mtx_t mtx) noexcept { return reinterpret_cast(&mtx->_Critical_section._M_srw_lock); } // TRANSITION, only used when constexpr mutex constructor is not enabled -_CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t mtx, int type) { // initialize mutex in situ +_CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t mtx, int type) noexcept { // initialize mutex in situ Concurrency::details::create_stl_critical_section(&mtx->_Critical_section); mtx->_Thread_id = -1; mtx->_Type = type; mtx->_Count = 0; } -_CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t mtx) { // destroy mutex in situ +_CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t mtx) noexcept { // destroy mutex in situ _THREAD_ASSERT(mtx->_Count == 0, "mutex destroyed while busy"); (void) mtx; } -_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t* mtx, int type) { // initialize mutex +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t* mtx, int type) noexcept { // initialize mutex *mtx = nullptr; _Mtx_t mutex = static_cast<_Mtx_t>(_calloc_crt(1, sizeof(_Mtx_internal_imp_t))); @@ -65,14 +66,14 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t* mtx, int type) { // initial return _Thrd_result::_Success; } -_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t mtx) { // destroy mutex +_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t mtx) noexcept { // destroy mutex if (mtx) { // something to do, do it _Mtx_destroy_in_situ(mtx); _free_crt(mtx); } } -static _Thrd_result mtx_do_lock(_Mtx_t mtx, const _timespec64* target) { // lock mutex +static _Thrd_result mtx_do_lock(_Mtx_t mtx, const _timespec64* target) noexcept { // lock mutex // TRANSITION, ABI: the use of `const _timespec64*` is preserved for `_Mtx_timedlock` const auto current_thread_id = static_cast(GetCurrentThreadId()); if ((mtx->_Type & ~_Mtx_recursive) == _Mtx_plain) { // set the lock @@ -145,7 +146,7 @@ static _Thrd_result mtx_do_lock(_Mtx_t mtx, const _timespec64* target) { // lock } } -_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_unlock(_Mtx_t mtx) { // unlock mutex +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_unlock(_Mtx_t mtx) noexcept { // unlock mutex _THREAD_ASSERT( 1 <= mtx->_Count && mtx->_Thread_id == static_cast(GetCurrentThreadId()), "unlock of unowned mutex"); @@ -159,11 +160,11 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_unlock(_Mtx_t mtx) { // unlock mutex return _Thrd_result::_Success; // TRANSITION, ABI: Always succeeds } -_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_lock(_Mtx_t mtx) { // lock mutex +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_lock(_Mtx_t mtx) noexcept { // lock mutex return mtx_do_lock(mtx, nullptr); } -_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_trylock(_Mtx_t mtx) { // attempt to lock try_mutex +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_trylock(_Mtx_t mtx) noexcept { // attempt to lock try_mutex _timespec64 xt; _THREAD_ASSERT((mtx->_Type & (_Mtx_try | _Mtx_timed)) != 0, "trylock not supported by mutex"); xt.tv_sec = 0; @@ -172,7 +173,8 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_trylock(_Mtx_t mtx) { // attempt to lock } // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_timedlock(_Mtx_t mtx, const _timespec64* xt) { // attempt to lock timed mutex +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_timedlock( + _Mtx_t mtx, const _timespec64* xt) noexcept { // attempt to lock timed mutex _Thrd_result res; _THREAD_ASSERT((mtx->_Type & _Mtx_timed) != 0, "timedlock not supported by mutex"); @@ -180,12 +182,12 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_timedlock(_Mtx_t mtx, const _timespec64* return res == _Thrd_result::_Busy ? _Thrd_result::_Timedout : res; } -_CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t mtx) { // test if current thread owns mutex +_CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t mtx) noexcept { // test if current thread owns mutex return mtx->_Count != 0 && mtx->_Thread_id == static_cast(GetCurrentThreadId()); } // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE void* __cdecl _Mtx_getconcrtcs(_Mtx_t mtx) { // get internal cs impl +_CRTIMP2_PURE void* __cdecl _Mtx_getconcrtcs(_Mtx_t mtx) noexcept { // get internal cs impl return &mtx->_Critical_section; } diff --git a/stl/src/pplerror.cpp b/stl/src/pplerror.cpp index 32fd0714c3..3d003996f8 100644 --- a/stl/src/pplerror.cpp +++ b/stl/src/pplerror.cpp @@ -11,7 +11,7 @@ #include #include -extern "C" void* __GetPlatformExceptionInfo(int*); +extern "C" void* __GetPlatformExceptionInfo(int*) noexcept; namespace Concurrency { namespace details { diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index c0bbdad466..2f83abd577 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -29,7 +29,7 @@ static GUID const Local_IID_ICallbackWithNoReentrancyToApplicationSTA = { #if defined(_CRT_APP) && defined(_DEBUG) extern "C" NTSYSAPI _Success_(return != 0) WORD NTAPI RtlCaptureStackBackTrace(_In_ DWORD FramesToSkip, _In_ DWORD FramesToCapture, - _Out_writes_to_(FramesToCapture, return) PVOID* BackTrace, _Out_opt_ PDWORD BackTraceHash); + _Out_writes_to_(FramesToCapture, return) PVOID* BackTrace, _Out_opt_ PDWORD BackTraceHash) noexcept; #endif namespace Concurrency { @@ -350,7 +350,7 @@ namespace Concurrency { } // namespace Concurrency #ifdef _CRT_APP -extern "C" void __cdecl __crtCleanupCausalityStaticFactories() { +extern "C" void __cdecl __crtCleanupCausalityStaticFactories() noexcept { Concurrency::details::asyncCausalityTracer.release(); } #endif diff --git a/stl/src/sharedmutex.cpp b/stl/src/sharedmutex.cpp index 6cfcc63cf4..bf41cc5743 100644 --- a/stl/src/sharedmutex.cpp +++ b/stl/src/sharedmutex.cpp @@ -12,28 +12,28 @@ extern "C" { static_assert(sizeof(_Smtx_t) == sizeof(SRWLOCK), "_Smtx_t must be the same size as SRWLOCK."); static_assert(alignof(_Smtx_t) == alignof(SRWLOCK), "_Smtx_t must be the same alignment as SRWLOCK."); -void __cdecl _Smtx_lock_exclusive(_Smtx_t* smtx) { // lock shared mutex exclusively +void __cdecl _Smtx_lock_exclusive(_Smtx_t* smtx) noexcept { // lock shared mutex exclusively AcquireSRWLockExclusive(reinterpret_cast(smtx)); } -void __cdecl _Smtx_lock_shared(_Smtx_t* smtx) { // lock shared mutex non-exclusively +void __cdecl _Smtx_lock_shared(_Smtx_t* smtx) noexcept { // lock shared mutex non-exclusively AcquireSRWLockShared(reinterpret_cast(smtx)); } -int __cdecl _Smtx_try_lock_exclusive(_Smtx_t* smtx) { // try to lock shared mutex exclusively +int __cdecl _Smtx_try_lock_exclusive(_Smtx_t* smtx) noexcept { // try to lock shared mutex exclusively return TryAcquireSRWLockExclusive(reinterpret_cast(smtx)); } -int __cdecl _Smtx_try_lock_shared(_Smtx_t* smtx) { // try to lock shared mutex non-exclusively +int __cdecl _Smtx_try_lock_shared(_Smtx_t* smtx) noexcept { // try to lock shared mutex non-exclusively return TryAcquireSRWLockShared(reinterpret_cast(smtx)); } -void __cdecl _Smtx_unlock_exclusive(_Smtx_t* smtx) { // unlock exclusive shared mutex +void __cdecl _Smtx_unlock_exclusive(_Smtx_t* smtx) noexcept { // unlock exclusive shared mutex _Analysis_assume_lock_held_(*reinterpret_cast(smtx)); ReleaseSRWLockExclusive(reinterpret_cast(smtx)); } -void __cdecl _Smtx_unlock_shared(_Smtx_t* smtx) { // unlock non-exclusive shared mutex +void __cdecl _Smtx_unlock_shared(_Smtx_t* smtx) noexcept { // unlock non-exclusive shared mutex ReleaseSRWLockShared(reinterpret_cast(smtx)); } } diff --git a/stl/src/stdhndlr.cpp b/stl/src/stdhndlr.cpp index af55e61873..7742c08a29 100644 --- a/stl/src/stdhndlr.cpp +++ b/stl/src/stdhndlr.cpp @@ -7,7 +7,7 @@ using new_hand = int(__cdecl*)(size_t); -extern "C" new_hand __cdecl _set_new_handler(new_hand); +extern "C" new_hand __cdecl _set_new_handler(new_hand) noexcept; _STD_BEGIN static new_handler _New_handler; diff --git a/stl/src/vector_algorithms.cpp b/stl/src/vector_algorithms.cpp index 9f9e43fab1..2739fee071 100644 --- a/stl/src/vector_algorithms.cpp +++ b/stl/src/vector_algorithms.cpp @@ -800,7 +800,7 @@ namespace { #ifndef _M_ARM64EC static constexpr bool _Has_portion_max = false; - static __m128i _Sign_correction(const __m128i _Val, const bool _Sign) { + static __m128i _Sign_correction(const __m128i _Val, const bool _Sign) noexcept { alignas(16) static constexpr _Unsigned_t _Sign_corrections[2][2] = { 0x8000'0000'0000'0000ULL, 0x8000'0000'0000'0000ULL, {}}; return _mm_sub_epi64(_Val, _mm_load_si128(reinterpret_cast(_Sign_corrections[_Sign]))); @@ -1126,7 +1126,7 @@ _Min_max_element_t __stdcall __std_minmax_element_8( namespace { template - const void* _Find_trivial_unsized_fallback(const void* _First, _Ty _Val) { + const void* _Find_trivial_unsized_fallback(const void* _First, _Ty _Val) noexcept { auto _Ptr = static_cast(_First); while (*_Ptr != _Val) { ++_Ptr; @@ -1135,7 +1135,7 @@ namespace { } template - const void* _Find_trivial_tail(const void* _First, const void* _Last, _Ty _Val) { + const void* _Find_trivial_tail(const void* _First, const void* _Last, _Ty _Val) noexcept { auto _Ptr = static_cast(_First); while (_Ptr != _Last && *_Ptr != _Val) { ++_Ptr; @@ -1144,7 +1144,8 @@ namespace { } template - __declspec(noalias) size_t _Count_trivial_tail(const void* _First, const void* _Last, size_t _Current, _Ty _Val) { + __declspec(noalias) size_t + _Count_trivial_tail(const void* _First, const void* _Last, size_t _Current, _Ty _Val) noexcept { auto _Ptr = static_cast(_First); for (; _Ptr != _Last; ++_Ptr) { if (*_Ptr == _Val) { diff --git a/stl/src/winapinls.cpp b/stl/src/winapinls.cpp index 4b5209826d..e118cf604c 100644 --- a/stl/src/winapinls.cpp +++ b/stl/src/winapinls.cpp @@ -12,20 +12,20 @@ // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 int __cdecl __crtCompareStringEx(_In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwCmpFlags, _In_NLS_string_(cchCount1) LPCWSTR lpString1, _In_ int cchCount1, _In_NLS_string_(cchCount2) LPCWSTR lpString2, - _In_ int cchCount2) { + _In_ int cchCount2) noexcept { return CompareStringEx(lpLocaleName, dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2, nullptr, nullptr, 0); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 int __cdecl __crtLCMapStringEx(_In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwMapFlags, _In_reads_(cchSrc) LPCWSTR lpSrcStr, _In_ int cchSrc, _Out_writes_opt_(cchDest) LPWSTR lpDestStr, - _In_ int cchDest) { + _In_ int cchDest) noexcept { return LCMapStringEx(lpLocaleName, dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest, nullptr, nullptr, 0); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 int __cdecl __crtGetLocaleInfoEx(_In_opt_ LPCWSTR const lpLocaleName, _In_ LCTYPE const LCType, - _Out_writes_opt_(cchData) LPWSTR const lpLCData, _In_ int const cchData) { + _Out_writes_opt_(cchData) LPWSTR const lpLCData, _In_ int const cchData) noexcept { return GetLocaleInfoEx(lpLocaleName, LCType, lpLCData, cchData); } diff --git a/stl/src/winapisupp.cpp b/stl/src/winapisupp.cpp index 9949df6eb9..db3e8484f1 100644 --- a/stl/src/winapisupp.cpp +++ b/stl/src/winapisupp.cpp @@ -66,7 +66,7 @@ namespace { using HMODULEHandle = Microsoft::WRL::Wrappers::HandleT; } // unnamed namespace -extern "C" int __crt_IsPackagedAppHelper() { +extern "C" int __crt_IsPackagedAppHelper() noexcept { static wchar_t const* const possible_apisets[] = { L"api-ms-win-appmodel-runtime-l1-1-1.dll", // Windows 8.1+ APISet L"ext-ms-win-kernel32-package-current-l1-1-0.dll", // Legacy APISet @@ -100,7 +100,7 @@ extern "C" int __crt_IsPackagedAppHelper() { #else // ^^^ defined(_ONECORE) / !defined(_ONECORE) vvv -extern "C" int __crt_IsPackagedAppHelper() { +extern "C" int __crt_IsPackagedAppHelper() noexcept { LONG retValue = APPMODEL_ERROR_NO_PACKAGE; UINT32 bufferLength = 0; @@ -135,7 +135,7 @@ extern "C" int __crt_IsPackagedAppHelper() { // Exit: // TRUE if Packaged app, FALSE if not. // TRANSITION, ABI: preserved for binary compatibility -extern "C" _CRTIMP2 BOOL __cdecl __crtIsPackagedApp() { +extern "C" _CRTIMP2 BOOL __cdecl __crtIsPackagedApp() noexcept { #ifdef _CRT_APP return TRUE; #else // ^^^ defined(_CRT_APP) / !defined(_CRT_APP) vvv @@ -155,94 +155,94 @@ extern "C" _CRTIMP2 BOOL __cdecl __crtIsPackagedApp() { #if _STL_WIN32_WINNT < _WIN32_WINNT_VISTA // TRANSITION, ABI: preserved for binary compatibility -extern "C" _CRTIMP2 ULONGLONG __cdecl __crtGetTickCount64() { +extern "C" _CRTIMP2 ULONGLONG __cdecl __crtGetTickCount64() noexcept { return GetTickCount64(); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 BOOL __cdecl __crtInitializeCriticalSectionEx( - _Out_ LPCRITICAL_SECTION const lpCriticalSection, _In_ DWORD const dwSpinCount, _In_ DWORD const Flags) { + _Out_ LPCRITICAL_SECTION const lpCriticalSection, _In_ DWORD const dwSpinCount, _In_ DWORD const Flags) noexcept { return InitializeCriticalSectionEx(lpCriticalSection, dwSpinCount, Flags); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 BOOL __cdecl __crtInitOnceExecuteOnce(_Inout_ PINIT_ONCE const InitOnce, - _In_ PINIT_ONCE_FN const InitFn, _Inout_opt_ PVOID const Parameter, LPVOID* const Context) { + _In_ PINIT_ONCE_FN const InitFn, _Inout_opt_ PVOID const Parameter, LPVOID* const Context) noexcept { return InitOnceExecuteOnce(InitOnce, InitFn, Parameter, Context); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 HANDLE __cdecl __crtCreateEventExW(_In_opt_ LPSECURITY_ATTRIBUTES const lpEventAttributes, - _In_opt_ LPCWSTR const lpName, _In_ DWORD const dwFlags, _In_ DWORD const dwDesiredAccess) { + _In_opt_ LPCWSTR const lpName, _In_ DWORD const dwFlags, _In_ DWORD const dwDesiredAccess) noexcept { return CreateEventExW(lpEventAttributes, lpName, dwFlags, dwDesiredAccess); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 HANDLE __cdecl __crtCreateSemaphoreExW(_In_opt_ LPSECURITY_ATTRIBUTES const lpSemaphoreAttributes, _In_ LONG const lInitialCount, _In_ LONG const lMaximumCount, _In_opt_ LPCWSTR const lpName, - _Reserved_ DWORD const dwFlags, _In_ DWORD const dwDesiredAccess) { + _Reserved_ DWORD const dwFlags, _In_ DWORD const dwDesiredAccess) noexcept { return CreateSemaphoreExW(lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName, dwFlags, dwDesiredAccess); } // TRANSITION, ABI: preserved for binary compatibility -extern "C" _CRTIMP2 PTP_TIMER __cdecl __crtCreateThreadpoolTimer( - _In_ PTP_TIMER_CALLBACK const pfnti, _Inout_opt_ PVOID const pv, _In_opt_ PTP_CALLBACK_ENVIRON const pcbe) { +extern "C" _CRTIMP2 PTP_TIMER __cdecl __crtCreateThreadpoolTimer(_In_ PTP_TIMER_CALLBACK const pfnti, + _Inout_opt_ PVOID const pv, _In_opt_ PTP_CALLBACK_ENVIRON const pcbe) noexcept { return CreateThreadpoolTimer(pfnti, pv, pcbe); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 VOID __cdecl __crtSetThreadpoolTimer(_Inout_ PTP_TIMER const pti, - _In_opt_ PFILETIME const pftDueTime, _In_ DWORD const msPeriod, _In_ DWORD const msWindowLength) { + _In_opt_ PFILETIME const pftDueTime, _In_ DWORD const msPeriod, _In_ DWORD const msWindowLength) noexcept { SetThreadpoolTimer(pti, pftDueTime, msPeriod, msWindowLength); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 VOID __cdecl __crtWaitForThreadpoolTimerCallbacks( - _Inout_ PTP_TIMER const pti, _In_ BOOL const fCancelPendingCallbacks) { + _Inout_ PTP_TIMER const pti, _In_ BOOL const fCancelPendingCallbacks) noexcept { WaitForThreadpoolTimerCallbacks(pti, fCancelPendingCallbacks); } // TRANSITION, ABI: preserved for binary compatibility -extern "C" _CRTIMP2 VOID __cdecl __crtCloseThreadpoolTimer(_Inout_ PTP_TIMER const pti) { +extern "C" _CRTIMP2 VOID __cdecl __crtCloseThreadpoolTimer(_Inout_ PTP_TIMER const pti) noexcept { CloseThreadpoolTimer(pti); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 PTP_WAIT __cdecl __crtCreateThreadpoolWait( - _In_ PTP_WAIT_CALLBACK const pfnwa, _Inout_opt_ PVOID const pv, _In_opt_ PTP_CALLBACK_ENVIRON const pcbe) { + _In_ PTP_WAIT_CALLBACK const pfnwa, _Inout_opt_ PVOID const pv, _In_opt_ PTP_CALLBACK_ENVIRON const pcbe) noexcept { return CreateThreadpoolWait(pfnwa, pv, pcbe); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 VOID __cdecl __crtSetThreadpoolWait( - _Inout_ PTP_WAIT const pwa, _In_opt_ HANDLE const h, _In_opt_ PFILETIME const pftTimeout) { + _Inout_ PTP_WAIT const pwa, _In_opt_ HANDLE const h, _In_opt_ PFILETIME const pftTimeout) noexcept { SetThreadpoolWait(pwa, h, pftTimeout); } // TRANSITION, ABI: preserved for binary compatibility -extern "C" _CRTIMP2 VOID __cdecl __crtCloseThreadpoolWait(_Inout_ PTP_WAIT const pwa) { +extern "C" _CRTIMP2 VOID __cdecl __crtCloseThreadpoolWait(_Inout_ PTP_WAIT const pwa) noexcept { CloseThreadpoolWait(pwa); } // TRANSITION, ABI: preserved for binary compatibility -extern "C" _CRTIMP2 VOID __cdecl __crtFlushProcessWriteBuffers() { +extern "C" _CRTIMP2 VOID __cdecl __crtFlushProcessWriteBuffers() noexcept { FlushProcessWriteBuffers(); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 VOID __cdecl __crtFreeLibraryWhenCallbackReturns( - _Inout_ PTP_CALLBACK_INSTANCE const pci, _In_ HMODULE const mod) { + _Inout_ PTP_CALLBACK_INSTANCE const pci, _In_ HMODULE const mod) noexcept { FreeLibraryWhenCallbackReturns(pci, mod); } // TRANSITION, ABI: preserved for binary compatibility -extern "C" _CRTIMP2 DWORD __cdecl __crtGetCurrentProcessorNumber() { +extern "C" _CRTIMP2 DWORD __cdecl __crtGetCurrentProcessorNumber() noexcept { return GetCurrentProcessorNumber(); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 BOOLEAN __cdecl __crtCreateSymbolicLinkW( - _In_ LPCWSTR const lpSymlinkFileName, _In_ LPCWSTR const lpTargetFileName, _In_ DWORD const dwFlags) { + _In_ LPCWSTR const lpSymlinkFileName, _In_ LPCWSTR const lpTargetFileName, _In_ DWORD const dwFlags) noexcept { #ifdef _CRT_APP (void) lpSymlinkFileName; (void) lpTargetFileName; @@ -257,21 +257,21 @@ extern "C" _CRTIMP2 BOOLEAN __cdecl __crtCreateSymbolicLinkW( // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 _Success_(return) BOOL __cdecl __crtGetFileInformationByHandleEx(_In_ HANDLE const hFile, _In_ FILE_INFO_BY_HANDLE_CLASS const FileInformationClass, - _Out_writes_bytes_(dwBufferSize) LPVOID const lpFileInformation, _In_ DWORD const dwBufferSize) { + _Out_writes_bytes_(dwBufferSize) LPVOID const lpFileInformation, _In_ DWORD const dwBufferSize) noexcept { return GetFileInformationByHandleEx(hFile, FileInformationClass, lpFileInformation, dwBufferSize); } // TRANSITION, ABI: preserved for binary compatibility extern "C" _CRTIMP2 BOOL __cdecl __crtSetFileInformationByHandle(_In_ HANDLE const hFile, _In_ FILE_INFO_BY_HANDLE_CLASS const FileInformationClass, - _In_reads_bytes_(dwBufferSize) LPVOID const lpFileInformation, _In_ DWORD const dwBufferSize) { + _In_reads_bytes_(dwBufferSize) LPVOID const lpFileInformation, _In_ DWORD const dwBufferSize) noexcept { return SetFileInformationByHandle(hFile, FileInformationClass, lpFileInformation, dwBufferSize); } #endif // _STL_WIN32_WINNT < _WIN32_WINNT_VISTA #if _STL_WIN32_WINNT < _WIN32_WINNT_WIN8 -extern "C" _CRTIMP2 void __cdecl __crtGetSystemTimePreciseAsFileTime(_Out_ LPFILETIME lpSystemTimeAsFileTime) { +extern "C" _CRTIMP2 void __cdecl __crtGetSystemTimePreciseAsFileTime(_Out_ LPFILETIME lpSystemTimeAsFileTime) noexcept { // use GetSystemTimePreciseAsFileTime if it is available (only on Windows 8+)... IFDYNAMICGETCACHEDFUNCTION(GetSystemTimePreciseAsFileTime) { pfGetSystemTimePreciseAsFileTime(lpSystemTimeAsFileTime); @@ -284,8 +284,8 @@ extern "C" _CRTIMP2 void __cdecl __crtGetSystemTimePreciseAsFileTime(_Out_ LPFIL #endif // _STL_WIN32_WINNT < _WIN32_WINNT_WIN8 -extern "C" _Success_(return > 0 && return < BufferLength) DWORD - __stdcall __crtGetTempPath2W(_In_ DWORD BufferLength, _Out_writes_to_opt_(BufferLength, return +1) LPWSTR Buffer) { +extern "C" _Success_(return > 0 && return < BufferLength) DWORD __stdcall __crtGetTempPath2W( + _In_ DWORD BufferLength, _Out_writes_to_opt_(BufferLength, return +1) LPWSTR Buffer) noexcept { #if !defined(_ONECORE) // use GetTempPath2W if it is available (only on Windows 11+)... IFDYNAMICGETCACHEDFUNCTION(GetTempPath2W) { @@ -305,7 +305,7 @@ extern "C" _Success_(return > 0 && return < BufferLength) DWORD #else // ^^^ defined(_ONECORE) / !defined(_ONECORE) vvv -static int __cdecl initialize_pointers() { +static int __cdecl initialize_pointers() noexcept { HINSTANCE hKernel32 = GetModuleHandleW(L"kernel32.dll"); _Analysis_assume_(hKernel32); diff --git a/stl/src/xdateord.cpp b/stl/src/xdateord.cpp index 3e2f26c99b..fbf8239fbc 100644 --- a/stl/src/xdateord.cpp +++ b/stl/src/xdateord.cpp @@ -9,7 +9,7 @@ _EXTERN_C_UNLESS_PURE -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Getdateorder() { // return date order for current locale +_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Getdateorder() noexcept { // return date order for current locale wchar_t buf[2] = {0}; GetLocaleInfoEx(___lc_locale_name_func()[LC_TIME], LOCALE_ILDATE, buf, static_cast(std::size(buf))); diff --git a/stl/src/xexp.cpp b/stl/src/xexp.cpp index 8d20f0976d..4c359b0ca2 100644 --- a/stl/src/xexp.cpp +++ b/stl/src/xexp.cpp @@ -15,8 +15,8 @@ static const double c2 = 1.4286068203094172321214581765680755e-6; static const double hugexp = HUGE_EXP; static const double invln2 = 1.4426950408889634073599246810018921; -_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _Exp( - double* px, double y, short eoff) noexcept { // compute y * e^(*px), (*px) finite, |y| not huge +_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _Exp(double* px, double y, short eoff) noexcept { + // compute y * e^(*px), (*px) finite, |y| not huge if (y == 0.0) { // zero *px = y; return 0; diff --git a/stl/src/xfexp.cpp b/stl/src/xfexp.cpp index 64dbe51e10..ffc990b530 100644 --- a/stl/src/xfexp.cpp +++ b/stl/src/xfexp.cpp @@ -14,8 +14,8 @@ static const float c2 = 1.4286068203094172321214581765680755e-6F; static const float hugexp = FHUGE_EXP; static const float invln2 = 1.4426950408889634073599246810018921F; -_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _FExp( - float* px, float y, short eoff) noexcept { // compute y * e^(*px), (*px) finite, |y| not huge +_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _FExp(float* px, float y, short eoff) noexcept { + // compute y * e^(*px), (*px) finite, |y| not huge if (y == 0.0F) { // zero *px = y; return 0; diff --git a/stl/src/xgetwctype.cpp b/stl/src/xgetwctype.cpp index 3e8c6b591d..f39b0f3e12 100644 --- a/stl/src/xgetwctype.cpp +++ b/stl/src/xgetwctype.cpp @@ -12,27 +12,28 @@ _EXTERN_C_UNLESS_PURE -_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _Getwctype(wchar_t _Ch, - const _Ctypevec* _Ctype) { // return character classification flags for _Ch +_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _Getwctype(wchar_t _Ch, const _Ctypevec* _Ctype) noexcept { + // return character classification flags for _Ch _CRT_UNUSED(_Ctype); short _Mask; return static_cast(GetStringTypeW(CT_CTYPE1, &_Ch, 1, reinterpret_cast(&_Mask)) == 0 ? 0 : _Mask); } -_CRTIMP2_PURE const wchar_t* __CLRCALL_PURE_OR_CDECL _Getwctypes(const wchar_t* _First, const wchar_t* _Last, - short* _Dest, const _Ctypevec* _Ctype) { // get mask sequence for elements in [_First, _Last) +_CRTIMP2_PURE const wchar_t* __CLRCALL_PURE_OR_CDECL _Getwctypes( + const wchar_t* _First, const wchar_t* _Last, short* _Dest, const _Ctypevec* _Ctype) noexcept { + // get mask sequence for elements in [_First, _Last) _CRT_UNUSED(_Ctype); GetStringTypeW(CT_CTYPE1, _First, static_cast(_Last - _First), reinterpret_cast(_Dest)); return _Last; } #ifdef MRTDLL -_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _Getwctype(unsigned short _Ch, const _Ctypevec* _Ctype) { +_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _Getwctype(unsigned short _Ch, const _Ctypevec* _Ctype) noexcept { return _Getwctype(static_cast(_Ch), _Ctype); } _CRTIMP2_PURE const unsigned short* __CLRCALL_PURE_OR_CDECL _Getwctypes( - const unsigned short* _First, const unsigned short* _Last, short* _Dest, const _Ctypevec* _Ctype) { + const unsigned short* _First, const unsigned short* _Last, short* _Dest, const _Ctypevec* _Ctype) noexcept { return reinterpret_cast( _Getwctypes(reinterpret_cast(_First), reinterpret_cast(_Last), _Dest, _Ctype)); } diff --git a/stl/src/xlcosh.cpp b/stl/src/xlcosh.cpp index 253960a3c5..d713795dd1 100644 --- a/stl/src/xlcosh.cpp +++ b/stl/src/xlcosh.cpp @@ -7,8 +7,8 @@ _EXTERN_C_UNLESS_PURE -_CRTIMP2_PURE long double __CLRCALL_PURE_OR_CDECL _LCosh( - long double x, long double y) noexcept { // compute y * cosh(x), |y| <= 1 +_CRTIMP2_PURE long double __CLRCALL_PURE_OR_CDECL _LCosh(long double x, long double y) noexcept { + // compute y * cosh(x), |y| <= 1 switch (_LDtest(&x)) { // test for special codes case _NANCODE: case _INFCODE: diff --git a/stl/src/xlexp.cpp b/stl/src/xlexp.cpp index d016fb0c60..1d4788be6f 100644 --- a/stl/src/xlexp.cpp +++ b/stl/src/xlexp.cpp @@ -16,8 +16,8 @@ static const long double c2 = 1.4286068203094172321214581765680755e-6L; static const long double hugexp = LHUGE_EXP; static const long double invln2 = 1.4426950408889634073599246810018921L; -_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _LExp( - long double* px, long double y, short eoff) noexcept { // compute y * e^(*px), (*px) finite, |y| not huge +_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _LExp(long double* px, long double y, short eoff) noexcept { + // compute y * e^(*px), (*px) finite, |y| not huge if (y == 0.0L) { // zero *px = y; return 0; diff --git a/stl/src/xlock.cpp b/stl/src/xlock.cpp index 30fe16dc95..fdad45dd53 100644 --- a/stl/src/xlock.cpp +++ b/stl/src/xlock.cpp @@ -123,10 +123,10 @@ void __cdecl _Lockit::_Lockit_dtor(int kind) noexcept { // unlock the mutex } _EXTERN_C -void _Lock_at_thread_exit_mutex() { // lock the at-thread-exit mutex +void _Lock_at_thread_exit_mutex() noexcept { // lock the at-thread-exit mutex _Mtxlock(&mtx[_LOCK_AT_THREAD_EXIT]); } -void _Unlock_at_thread_exit_mutex() { // unlock the at-thread-exit mutex +void _Unlock_at_thread_exit_mutex() noexcept { // unlock the at-thread-exit mutex _Mtxunlock(&mtx[_LOCK_AT_THREAD_EXIT]); } _END_EXTERN_C diff --git a/stl/src/xmath.hpp b/stl/src/xmath.hpp index 4968e40708..325c9417f9 100644 --- a/stl/src/xmath.hpp +++ b/stl/src/xmath.hpp @@ -89,7 +89,7 @@ _In_range_(0, maxsig) int _Stoflt( const char*, const char*, char**, _Out_writes_(maxsig) long[], _In_range_(1, 4) int maxsig) noexcept; _In_range_(0, maxsig) int _Stoxflt( const char*, const char*, char**, _Out_writes_(maxsig) long[], _In_range_(1, 4) int maxsig) noexcept; -int _WStopfx(const wchar_t**, wchar_t**); +int _WStopfx(const wchar_t**, wchar_t**) noexcept; _In_range_(0, maxsig) int _WStoflt( const wchar_t*, const wchar_t*, wchar_t**, _Out_writes_(maxsig) long[], _In_range_(1, 4) int maxsig) noexcept; _In_range_(0, maxsig) int _WStoxflt( diff --git a/stl/src/xmbtowc.cpp b/stl/src/xmbtowc.cpp index bcfb7d7814..2cc7f8766c 100644 --- a/stl/src/xmbtowc.cpp +++ b/stl/src/xmbtowc.cpp @@ -14,7 +14,7 @@ _EXTERN_C_UNLESS_PURE -static int _Utf8_trailing_byte_count(unsigned long* partialCh, unsigned char ch) { +static int _Utf8_trailing_byte_count(unsigned long* partialCh, unsigned char ch) noexcept { if ((ch & 0x80u) == 0x00u) { // high bit unset, plain ASCII return 0; } @@ -37,7 +37,7 @@ static int _Utf8_trailing_byte_count(unsigned long* partialCh, unsigned char ch) return INT_MAX; } -static int _Decode_utf8_trailing_byte(unsigned long* partialCh, unsigned char ch) { +static int _Decode_utf8_trailing_byte(unsigned long* partialCh, unsigned char ch) noexcept { if ((ch & 0xC0) == 0x80) { *partialCh <<= 6; *partialCh |= ch & 0x3Fu; @@ -66,7 +66,7 @@ static int _Decode_utf8_trailing_byte(unsigned long* partialCh, unsigned char ch // -2 (if partial conversion) // number of bytes comprising converted mbc _MRTIMP2 _Success_(return >= 0) int __cdecl _Mbrtowc( - _When_(n != 0, _Out_) wchar_t* pwc, const char* s, size_t n, mbstate_t* pst, const _Cvtvec* ploc) { + _When_(n != 0, _Out_) wchar_t* pwc, const char* s, size_t n, mbstate_t* pst, const _Cvtvec* ploc) noexcept { (void) pst; if (n == 0) { // indicate do not have state-dependent encodings, handle zero length string return 0; @@ -155,7 +155,8 @@ _MRTIMP2 _Success_(return >= 0) int __cdecl _Mbrtowc( } #ifdef MRTDLL -_MRTIMP2 int __cdecl _Mbrtowc(unsigned short* pwc, const char* s, size_t n, mbstate_t* pst, const _Cvtvec* ploc) { +_MRTIMP2 int __cdecl _Mbrtowc( + unsigned short* pwc, const char* s, size_t n, mbstate_t* pst, const _Cvtvec* ploc) noexcept { return _Mbrtowc(reinterpret_cast(pwc), s, n, pst, ploc); } #endif // defined(MRTDLL) diff --git a/stl/src/xnotify.cpp b/stl/src/xnotify.cpp index 9d44df6875..f6dd4d5095 100644 --- a/stl/src/xnotify.cpp +++ b/stl/src/xnotify.cpp @@ -29,10 +29,10 @@ namespace { _EXTERN_C -void _Lock_at_thread_exit_mutex(); -void _Unlock_at_thread_exit_mutex(); +void _Lock_at_thread_exit_mutex() noexcept; +void _Unlock_at_thread_exit_mutex() noexcept; -_CRTIMP2_PURE void __cdecl _Cnd_register_at_thread_exit(_Cnd_t cnd, _Mtx_t mtx, int* p) { +_CRTIMP2_PURE void __cdecl _Cnd_register_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 @@ -63,7 +63,7 @@ _CRTIMP2_PURE void __cdecl _Cnd_register_at_thread_exit(_Cnd_t cnd, _Mtx_t mtx, _Unlock_at_thread_exit_mutex(); } -_CRTIMP2_PURE void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t mtx) { +_CRTIMP2_PURE 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 @@ -83,7 +83,7 @@ _CRTIMP2_PURE void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t mtx) { _Unlock_at_thread_exit_mutex(); } -_CRTIMP2_PURE void __cdecl _Cnd_do_broadcast_at_thread_exit() { +_CRTIMP2_PURE 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 diff --git a/stl/src/xstod.cpp b/stl/src/xstod.cpp index 0fbd1ebd80..7b1ef59544 100644 --- a/stl/src/xstod.cpp +++ b/stl/src/xstod.cpp @@ -14,12 +14,12 @@ _EXTERN_C_UNLESS_PURE // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _Stodx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) +_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _Stodx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) noexcept #include "xxstod.hpp" // TRANSITION, ABI: preserved for binary compatibility _CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL - _Stod(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code + _Stod(const CTYPE* s, CTYPE** endptr, long pten) noexcept { // convert string, discard error code return _Stodx(s, endptr, pten, nullptr); } diff --git a/stl/src/xstof.cpp b/stl/src/xstof.cpp index 2124ee2673..be415f597e 100644 --- a/stl/src/xstof.cpp +++ b/stl/src/xstof.cpp @@ -14,12 +14,12 @@ _EXTERN_C_UNLESS_PURE // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _Stofx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) +_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _Stofx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) noexcept #include "xxstod.hpp" // TRANSITION, ABI: preserved for binary compatibility _CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL - _Stof(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code + _Stof(const CTYPE* s, CTYPE** endptr, long pten) noexcept { // convert string, discard error code return _Stofx(s, endptr, pten, nullptr); } diff --git a/stl/src/xstol.cpp b/stl/src/xstol.cpp index 5971a54ef6..c6ca2a4e7b 100644 --- a/stl/src/xstol.cpp +++ b/stl/src/xstol.cpp @@ -12,10 +12,10 @@ _EXTERN_C_UNLESS_PURE -_CRTIMP2_PURE unsigned long __CLRCALL_PURE_OR_CDECL _Stoulx(const char*, char**, int, int*); +_CRTIMP2_PURE unsigned long __CLRCALL_PURE_OR_CDECL _Stoulx(const char*, char**, int, int*) noexcept; -_CRTIMP2_PURE long __CLRCALL_PURE_OR_CDECL _Stolx( - const char* s, char** endptr, int base, int* perr) { // convert string to long, with checking +_CRTIMP2_PURE long __CLRCALL_PURE_OR_CDECL _Stolx(const char* s, char** endptr, int base, int* perr) noexcept { + // convert string to long, with checking const char* sc; char* se; char sign; diff --git a/stl/src/xstold.cpp b/stl/src/xstold.cpp index d40e6f14cb..38834756ed 100644 --- a/stl/src/xstold.cpp +++ b/stl/src/xstold.cpp @@ -14,12 +14,12 @@ _EXTERN_C_UNLESS_PURE // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _Stoldx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) +_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _Stoldx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) noexcept #include "xxstod.hpp" // TRANSITION, ABI: preserved for binary compatibility _CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL - _Stold(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code + _Stold(const CTYPE* s, CTYPE** endptr, long pten) noexcept { // convert string, discard error code return _Stoldx(s, endptr, pten, nullptr); } diff --git a/stl/src/xstoll.cpp b/stl/src/xstoll.cpp index a952bb9760..5843f626c7 100644 --- a/stl/src/xstoll.cpp +++ b/stl/src/xstoll.cpp @@ -12,10 +12,10 @@ _EXTERN_C_UNLESS_PURE -_CRTIMP2_PURE unsigned long long __CLRCALL_PURE_OR_CDECL _Stoullx(const char*, char**, int, int*); +_CRTIMP2_PURE unsigned long long __CLRCALL_PURE_OR_CDECL _Stoullx(const char*, char**, int, int*) noexcept; -_CRTIMP2_PURE long long __CLRCALL_PURE_OR_CDECL _Stollx( - const char* s, char** endptr, int base, int* perr) { // convert string to long long, with checking +_CRTIMP2_PURE long long __CLRCALL_PURE_OR_CDECL _Stollx(const char* s, char** endptr, int base, int* perr) noexcept { + // convert string to long long, with checking const char* sc; char* se; char sign; @@ -48,8 +48,8 @@ _CRTIMP2_PURE long long __CLRCALL_PURE_OR_CDECL _Stollx( return static_cast(sign == '-' ? 0 - x : x); } -_CRTIMP2_PURE long long(__CLRCALL_PURE_OR_CDECL _Stoll)( - const char* s, char** endptr, int base) { // convert string, discard error code +_CRTIMP2_PURE long long(__CLRCALL_PURE_OR_CDECL _Stoll)(const char* s, char** endptr, int base) noexcept { + // convert string, discard error code return _Stollx(s, endptr, base, nullptr); } diff --git a/stl/src/xstoul.cpp b/stl/src/xstoul.cpp index 9dd8385b8d..272a6f4db0 100644 --- a/stl/src/xstoul.cpp +++ b/stl/src/xstoul.cpp @@ -24,7 +24,7 @@ static const char ndigs[_Base_max + 1] = {0, 0, 33, 21, 17, 14, 13, 12, 11, 11, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; _CRTIMP2_PURE unsigned long __CLRCALL_PURE_OR_CDECL _Stoulx( - const char* s, char** endptr, int base, int* perr) { // convert string to unsigned long, with checking + const char* s, char** endptr, int base, int* perr) noexcept { // convert string to unsigned long, with checking const char* sc; const char* sd; const char* s1; @@ -109,8 +109,8 @@ _CRTIMP2_PURE unsigned long __CLRCALL_PURE_OR_CDECL _Stoulx( return x; } -_CRTIMP2_PURE unsigned long __CLRCALL_PURE_OR_CDECL _Stoul( - const char* s, char** endptr, int base) { // convert string, discard error code +_CRTIMP2_PURE unsigned long __CLRCALL_PURE_OR_CDECL _Stoul(const char* s, char** endptr, int base) noexcept { + // convert string, discard error code return _Stoulx(s, endptr, base, nullptr); } diff --git a/stl/src/xstoull.cpp b/stl/src/xstoull.cpp index 3deaf903e6..6a7a11af55 100644 --- a/stl/src/xstoull.cpp +++ b/stl/src/xstoull.cpp @@ -24,7 +24,7 @@ static const char ndigs[_Base_max + 1] = {0, 0, 65, 41, 33, 28, 25, 23, 22, 21, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13}; _CRTIMP2_PURE unsigned long long __CLRCALL_PURE_OR_CDECL _Stoullx( - const char* s, char** endptr, int base, int* perr) { // convert string to unsigned long long, with checking + const char* s, char** endptr, int base, int* perr) noexcept { // convert string to unsigned long long, with checking const char* sc; const char* sd; const char* s1; @@ -107,8 +107,8 @@ _CRTIMP2_PURE unsigned long long __CLRCALL_PURE_OR_CDECL _Stoullx( return x; } -_CRTIMP2_PURE unsigned long long __CLRCALL_PURE_OR_CDECL _Stoull( - const char* s, char** endptr, int base) { // convert string, discard error code +_CRTIMP2_PURE unsigned long long __CLRCALL_PURE_OR_CDECL _Stoull(const char* s, char** endptr, int base) noexcept { + // convert string, discard error code return _Stoullx(s, endptr, base, nullptr); } diff --git a/stl/src/xstrcoll.cpp b/stl/src/xstrcoll.cpp index 389813b220..5d6e0eedab 100644 --- a/stl/src/xstrcoll.cpp +++ b/stl/src/xstrcoll.cpp @@ -39,7 +39,7 @@ _EXTERN_C_UNLESS_PURE // _NLSCMPERROR = error // errno = EINVAL _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Strcoll( - const char* string1, const char* end1, const char* string2, const char* end2, const _Collvec* ploc) { + const char* string1, const char* end1, const char* string2, const char* end2, const _Collvec* ploc) noexcept { int ret = 0; UINT codepage; int n1 = static_cast(end1 - string1); @@ -72,7 +72,7 @@ _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Strcoll( } // _Collvec _Getcoll() - get collation info for current locale -_CRTIMP2_PURE _Collvec __CLRCALL_PURE_OR_CDECL _Getcoll() { +_CRTIMP2_PURE _Collvec __CLRCALL_PURE_OR_CDECL _Getcoll() noexcept { _Collvec coll; coll._Page = ___lc_collate_cp_func(); diff --git a/stl/src/xstrxfrm.cpp b/stl/src/xstrxfrm.cpp index df11d084b7..193d957df2 100644 --- a/stl/src/xstrxfrm.cpp +++ b/stl/src/xstrxfrm.cpp @@ -53,7 +53,7 @@ _EXTERN_C_UNLESS_PURE // Non-standard: if OM/API error, return INT_MAX. _CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Strxfrm(_Out_writes_(end1 - string1) _Post_readable_size_(return) char* string1, - _In_z_ char* end1, const char* string2, const char* end2, const _Collvec* ploc) { + _In_z_ char* end1, const char* string2, const char* end2, const _Collvec* ploc) noexcept { size_t n1 = end1 - string1; size_t n2 = end2 - string2; size_t retval = static_cast(-1); // NON-ANSI: default if OM or API error diff --git a/stl/src/xtime.cpp b/stl/src/xtime.cpp index 2832b9202b..d6285c0f7a 100644 --- a/stl/src/xtime.cpp +++ b/stl/src/xtime.cpp @@ -47,34 +47,35 @@ 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 FILETIME ft; __crtGetSystemTimePreciseAsFileTime(&ft); return ((static_cast(ft.dwHighDateTime)) << 32) + static_cast(ft.dwLowDateTime) - _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); } // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE int __cdecl xtime_get(_timespec64* xt, int type) { // get current time +_CRTIMP2_PURE int __cdecl xtime_get(_timespec64* xt, int type) noexcept { // get current time if (type != TIME_UTC || xt == nullptr) { type = 0; } else { @@ -84,13 +85,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; QueryPerformanceCounter(&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) { diff --git a/stl/src/xtowlower.cpp b/stl/src/xtowlower.cpp index d5c525d340..3e6f8de403 100644 --- a/stl/src/xtowlower.cpp +++ b/stl/src/xtowlower.cpp @@ -10,8 +10,8 @@ _EXTERN_C_UNLESS_PURE -_CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towlower( - wchar_t _Ch, const _Ctypevec* _Ctype) { // convert element to lower case +_CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towlower(wchar_t _Ch, const _Ctypevec* _Ctype) noexcept { + // convert element to lower case wchar_t _Res = _Ch; if (_Ch != WEOF) { if (_Ctype->_LocaleName == nullptr && _Ch < 256) { // handle ASCII character in C locale @@ -27,7 +27,7 @@ _CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towlower( } #ifdef MRTDLL -_CRTIMP2_PURE unsigned short __CLRCALL_PURE_OR_CDECL _Towlower(unsigned short _Ch, const _Ctypevec* _Ctype) { +_CRTIMP2_PURE unsigned short __CLRCALL_PURE_OR_CDECL _Towlower(unsigned short _Ch, const _Ctypevec* _Ctype) noexcept { return _Towlower(static_cast(_Ch), _Ctype); } #endif diff --git a/stl/src/xtowupper.cpp b/stl/src/xtowupper.cpp index 9a5d55d192..382d8c1c06 100644 --- a/stl/src/xtowupper.cpp +++ b/stl/src/xtowupper.cpp @@ -10,8 +10,8 @@ _EXTERN_C_UNLESS_PURE -_CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towupper( - wchar_t _Ch, const _Ctypevec* _Ctype) { // convert element to upper case +_CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towupper(wchar_t _Ch, const _Ctypevec* _Ctype) noexcept { + // convert element to upper case wchar_t _Res = _Ch; if (_Ch != WEOF) { if (_Ctype->_LocaleName == nullptr && _Ch < 256) { // handle ASCII character in C locale @@ -27,7 +27,7 @@ _CRTIMP2_PURE wchar_t __CLRCALL_PURE_OR_CDECL _Towupper( } #ifdef MRTDLL -_CRTIMP2_PURE unsigned short __CLRCALL_PURE_OR_CDECL _Towupper(unsigned short _Ch, const _Ctypevec* _Ctype) { +_CRTIMP2_PURE unsigned short __CLRCALL_PURE_OR_CDECL _Towupper(unsigned short _Ch, const _Ctypevec* _Ctype) noexcept { return _Towupper(static_cast(_Ch), _Ctype); } #endif diff --git a/stl/src/xwcscoll.cpp b/stl/src/xwcscoll.cpp index ab3fb060f7..9cfdc5df11 100644 --- a/stl/src/xwcscoll.cpp +++ b/stl/src/xwcscoll.cpp @@ -35,8 +35,8 @@ _EXTERN_C_UNLESS_PURE // Exceptions: // _NLSCMPERROR = error // errno = EINVAL -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Wcscoll( - const wchar_t* string1, const wchar_t* end1, const wchar_t* string2, const wchar_t* end2, const _Collvec* ploc) { +_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Wcscoll(const wchar_t* string1, const wchar_t* end1, const wchar_t* string2, + const wchar_t* end2, const _Collvec* ploc) noexcept { int n1 = static_cast(end1 - string1); int n2 = static_cast(end2 - string2); int ret = 0; @@ -67,7 +67,7 @@ _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Wcscoll( #ifdef MRTDLL _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Wcscoll(const unsigned short* string1, const unsigned short* end1, - const unsigned short* string2, const unsigned short* end2, const _Collvec* ploc) { + const unsigned short* string2, const unsigned short* end2, const _Collvec* ploc) noexcept { return _Wcscoll(reinterpret_cast(string1), reinterpret_cast(end1), reinterpret_cast(string2), reinterpret_cast(end2), ploc); } diff --git a/stl/src/xwcsxfrm.cpp b/stl/src/xwcsxfrm.cpp index f103ca7987..175677cd91 100644 --- a/stl/src/xwcsxfrm.cpp +++ b/stl/src/xwcsxfrm.cpp @@ -46,7 +46,7 @@ _EXTERN_C_UNLESS_PURE // Non-standard: if OM/API error, return INT_MAX. _CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Wcsxfrm(_Out_writes_(end1 - string1) _Post_readable_size_(return) wchar_t* string1, - _In_z_ wchar_t* end1, const wchar_t* string2, const wchar_t* end2, const _Collvec* ploc) { + _In_z_ wchar_t* end1, const wchar_t* string2, const wchar_t* end2, const _Collvec* ploc) noexcept { size_t n1 = end1 - string1; size_t n2 = end2 - string2; size_t size = static_cast(-1); @@ -100,7 +100,7 @@ _CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Wcsxfrm(_Out_writes_(end1 - string #ifdef MRTDLL _CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Wcsxfrm(unsigned short* string1, unsigned short* end1, - const unsigned short* string2, const unsigned short* end2, const _Collvec* ploc) { + const unsigned short* string2, const unsigned short* end2, const _Collvec* ploc) noexcept { return _Wcsxfrm(reinterpret_cast(string1), reinterpret_cast(end1), reinterpret_cast(string2), reinterpret_cast(end2), ploc); } diff --git a/stl/src/xwctomb.cpp b/stl/src/xwctomb.cpp index 1e1b339a3e..e1a87fba4e 100644 --- a/stl/src/xwctomb.cpp +++ b/stl/src/xwctomb.cpp @@ -16,7 +16,7 @@ _EXTERN_C_UNLESS_PURE -_CRTIMP2_PURE _Cvtvec __CLRCALL_PURE_OR_CDECL _Getcvt() { // get conversion info for current locale +_CRTIMP2_PURE _Cvtvec __CLRCALL_PURE_OR_CDECL _Getcvt() noexcept { // get conversion info for current locale _Cvtvec _Cvt = {0}; _Cvt._Page = ___lc_codepage_func(); @@ -56,7 +56,7 @@ _CRTIMP2_PURE _Cvtvec __CLRCALL_PURE_OR_CDECL _Getcvt() { // get conversion info // None. _CRTIMP2_PURE _Success_(return != -1) int __CLRCALL_PURE_OR_CDECL - _Wcrtomb(_Out_ char* s, wchar_t wchar, mbstate_t* pst, const _Cvtvec* ploc) { + _Wcrtomb(_Out_ char* s, wchar_t wchar, mbstate_t* pst, const _Cvtvec* ploc) noexcept { _CRT_UNUSED(pst); if (ploc->_Isclocale) { if (wchar > 255) { // validate high byte @@ -86,13 +86,15 @@ _CRTIMP2_PURE _Success_(return != -1) int __CLRCALL_PURE_OR_CDECL } #ifdef MRTDLL -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Wcrtomb(char* s, unsigned short wchar, mbstate_t* pst, const _Cvtvec* ploc) { +_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Wcrtomb( + char* s, unsigned short wchar, mbstate_t* pst, const _Cvtvec* ploc) noexcept { return _Wcrtomb(s, static_cast(wchar), pst, ploc); } #endif // defined(MRTDLL) // TRANSITION, ABI: __Wcrtomb_lk() is preserved for binary compatibility -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL __Wcrtomb_lk(char* s, wchar_t wchar, mbstate_t* pst, const _Cvtvec* ploc) { +_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL __Wcrtomb_lk( + char* s, wchar_t wchar, mbstate_t* pst, const _Cvtvec* ploc) noexcept { return _Wcrtomb(s, wchar, pst, ploc); } diff --git a/stl/src/xwstod.cpp b/stl/src/xwstod.cpp index e5e494738b..01b98439a5 100644 --- a/stl/src/xwstod.cpp +++ b/stl/src/xwstod.cpp @@ -13,12 +13,12 @@ _EXTERN_C_UNLESS_PURE // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _WStodx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) +_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _WStodx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) noexcept #include "xxstod.hpp" // TRANSITION, ABI: preserved for binary compatibility _CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL - _WStod(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code + _WStod(const CTYPE* s, CTYPE** endptr, long pten) noexcept { // convert string, discard error code return _WStodx(s, endptr, pten, nullptr); } diff --git a/stl/src/xwstof.cpp b/stl/src/xwstof.cpp index 36ac55a2bb..cfed6e8a3c 100644 --- a/stl/src/xwstof.cpp +++ b/stl/src/xwstof.cpp @@ -12,12 +12,12 @@ _EXTERN_C_UNLESS_PURE // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _WStofx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) +_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _WStofx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) noexcept #include "xxstod.hpp" // TRANSITION, ABI: preserved for binary compatibility _CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL - _WStof(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code + _WStof(const CTYPE* s, CTYPE** endptr, long pten) noexcept { // convert string, discard error code return _WStofx(s, endptr, pten, nullptr); } diff --git a/stl/src/xwstold.cpp b/stl/src/xwstold.cpp index d4751b82e8..be483a7cbc 100644 --- a/stl/src/xwstold.cpp +++ b/stl/src/xwstold.cpp @@ -12,12 +12,12 @@ _EXTERN_C_UNLESS_PURE // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _WStoldx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) +_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _WStoldx(const CTYPE* s, CTYPE** endptr, long pten, int* perr) noexcept #include "xxstod.hpp" // TRANSITION, ABI: preserved for binary compatibility _CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL - _WStold(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code + _WStold(const CTYPE* s, CTYPE** endptr, long pten) noexcept { // convert string, discard error code return _WStoldx(s, endptr, pten, nullptr); } diff --git a/stl/src/xwstopfx.cpp b/stl/src/xwstopfx.cpp index a9447bca09..c2f52b9d59 100644 --- a/stl/src/xwstopfx.cpp +++ b/stl/src/xwstopfx.cpp @@ -9,7 +9,7 @@ _EXTERN_C_UNLESS_PURE -int _WStopfx(const wchar_t** ps, wchar_t** endptr) { // parse prefix of floating-point field +int _WStopfx(const wchar_t** ps, wchar_t** endptr) noexcept { // parse prefix of floating-point field const wchar_t* s = *ps; int code = 0; while (iswspace(*s)) { diff --git a/stl/src/xxxdtent.hpp b/stl/src/xxxdtent.hpp index 88c5ff4290..f4713fb492 100644 --- a/stl/src/xxxdtent.hpp +++ b/stl/src/xxxdtent.hpp @@ -41,7 +41,7 @@ static const FTYPE tenth[] = { #error Unexpected value for FBITS #endif // ^^^ FBITS != 24 && FBITS != 53 ^^^ -FTYPE FNAME(Dtento)(FTYPE* xpx, long n, int* perr) { // compute *px * 10**n +FTYPE FNAME(Dtento)(FTYPE* xpx, long n, int* perr) noexcept { // compute *px * 10**n FTYPE xpf[ACSIZE]; FTYPE x; @@ -87,6 +87,7 @@ FTYPE FNAME(Dtento)(FTYPE* xpx, long n, int* perr) { // compute *px * 10**n } return x; } + #if !defined(MRTDLL) _END_EXTERN_C #endif // !defined(MRTDLL) diff --git a/stl/src/xxxprec.hpp b/stl/src/xxxprec.hpp index 31b6d3661f..e1fccb5159 100644 --- a/stl/src/xxxprec.hpp +++ b/stl/src/xxxprec.hpp @@ -29,7 +29,7 @@ _EXTERN_C #if 0 #include -static void printit(const char* s, FTYPE* p, int n) { // print xp array +static void printit(const char* s, FTYPE* p, int n) noexcept { // print xp array int i; printf(s); for (i = 0; i < n && (p[i] != FLIT(0.0) || i == 0); ++i) { From 7b49bf7dc1e901d8c3b035eac7abecd732553a2c Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Tue, 24 Oct 2023 12:45:10 -0700 Subject: [PATCH 2/5] STL's review comments --- stl/inc/xlocinfo | 2 +- stl/src/excptptr.cpp | 2 +- stl/src/mutex.cpp | 4 ++-- stl/src/parallel_algorithms.cpp | 2 +- stl/src/pplerror.cpp | 2 +- stl/src/ppltasks.cpp | 2 +- stl/src/stdhndlr.cpp | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stl/inc/xlocinfo b/stl/inc/xlocinfo index 77e0e6d491..26cf765441 100644 --- a/stl/inc/xlocinfo +++ b/stl/inc/xlocinfo @@ -83,7 +83,7 @@ _END_EXTERN_C_UNLESS_PURE _EXTERN_C // These _should_ be explicitly `noexcept` but cannot be made so here because -// the primary declaration in the C runtime headers is not. +// the primary declarations in the C runtime headers are not. _Success_(return != 0) _Ret_z_ _ACRTIMP char* __cdecl _Getdays(); diff --git a/stl/src/excptptr.cpp b/stl/src/excptptr.cpp index 40fff9f9f8..b36a2cf699 100644 --- a/stl/src/excptptr.cpp +++ b/stl/src/excptptr.cpp @@ -32,7 +32,7 @@ // V4 and later managed exception code #define MANAGED_EXCEPTION_CODE_V4 0XE0434352 -extern "C" _CRTIMP2 void* __cdecl __AdjustPointer(void*, const PMD&) noexcept; // defined in frame.cpp +extern "C" _CRTIMP2 void* __cdecl __AdjustPointer(void*, const PMD&); // defined in frame.cpp using namespace std; diff --git a/stl/src/mutex.cpp b/stl/src/mutex.cpp index 08ae332009..1cac06ce31 100644 --- a/stl/src/mutex.cpp +++ b/stl/src/mutex.cpp @@ -173,8 +173,8 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_trylock(_Mtx_t mtx) noexcept { // attemp } // TRANSITION, ABI: preserved for binary compatibility -_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_timedlock( - _Mtx_t mtx, const _timespec64* xt) noexcept { // attempt to lock timed mutex +_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_timedlock(_Mtx_t mtx, const _timespec64* xt) noexcept { + // attempt to lock timed mutex _Thrd_result res; _THREAD_ASSERT((mtx->_Type & _Mtx_timed) != 0, "timedlock not supported by mutex"); diff --git a/stl/src/parallel_algorithms.cpp b/stl/src/parallel_algorithms.cpp index 03802bc7f8..58c3e961b4 100644 --- a/stl/src/parallel_algorithms.cpp +++ b/stl/src/parallel_algorithms.cpp @@ -21,7 +21,7 @@ extern "C" { } [[nodiscard]] PTP_WORK __stdcall __std_create_threadpool_work( - PTP_WORK_CALLBACK _Callback, void* _Context, PTP_CALLBACK_ENVIRON _Callback_environ) noexcept { + __std_PTP_WORK_CALLBACK _Callback, void* _Context, PTP_CALLBACK_ENVIRON _Callback_environ) noexcept { return CreateThreadpoolWork(_Callback, _Context, _Callback_environ); } diff --git a/stl/src/pplerror.cpp b/stl/src/pplerror.cpp index 3d003996f8..32fd0714c3 100644 --- a/stl/src/pplerror.cpp +++ b/stl/src/pplerror.cpp @@ -11,7 +11,7 @@ #include #include -extern "C" void* __GetPlatformExceptionInfo(int*) noexcept; +extern "C" void* __GetPlatformExceptionInfo(int*); namespace Concurrency { namespace details { diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index 2f83abd577..e09ad967fb 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -29,7 +29,7 @@ static GUID const Local_IID_ICallbackWithNoReentrancyToApplicationSTA = { #if defined(_CRT_APP) && defined(_DEBUG) extern "C" NTSYSAPI _Success_(return != 0) WORD NTAPI RtlCaptureStackBackTrace(_In_ DWORD FramesToSkip, _In_ DWORD FramesToCapture, - _Out_writes_to_(FramesToCapture, return) PVOID* BackTrace, _Out_opt_ PDWORD BackTraceHash) noexcept; + _Out_writes_to_(FramesToCapture, return) PVOID* BackTrace, _Out_opt_ PDWORD BackTraceHash); #endif namespace Concurrency { diff --git a/stl/src/stdhndlr.cpp b/stl/src/stdhndlr.cpp index 7742c08a29..af55e61873 100644 --- a/stl/src/stdhndlr.cpp +++ b/stl/src/stdhndlr.cpp @@ -7,7 +7,7 @@ using new_hand = int(__cdecl*)(size_t); -extern "C" new_hand __cdecl _set_new_handler(new_hand) noexcept; +extern "C" new_hand __cdecl _set_new_handler(new_hand); _STD_BEGIN static new_handler _New_handler; From 0d79e570a01cf3d807132a5cde58a068bd208f68 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Tue, 24 Oct 2023 13:06:48 -0700 Subject: [PATCH 3/5] Revert PTP_WORK_CALLBACK change --- stl/inc/execution | 2 +- stl/src/parallel_algorithms.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stl/inc/execution b/stl/inc/execution index c7c85cb8f9..a421a2f756 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -45,7 +45,7 @@ using __std_PTP_CALLBACK_ENVIRON = __std_TP_CALLBACK_ENVIRON*; _NODISCARD unsigned int __stdcall __std_parallel_algorithms_hw_threads() noexcept; using __std_PTP_WORK_CALLBACK = void(__stdcall*)( - _Inout_ __std_PTP_CALLBACK_INSTANCE, _Inout_opt_ void*, _Inout_ __std_PTP_WORK) _NOEXCEPT_FNPTR; + _Inout_ __std_PTP_CALLBACK_INSTANCE, _Inout_opt_ void*, _Inout_ __std_PTP_WORK); _NODISCARD __std_PTP_WORK __stdcall __std_create_threadpool_work( _In_ __std_PTP_WORK_CALLBACK, _Inout_opt_ void*, _In_opt_ __std_PTP_CALLBACK_ENVIRON) noexcept; diff --git a/stl/src/parallel_algorithms.cpp b/stl/src/parallel_algorithms.cpp index 58c3e961b4..03802bc7f8 100644 --- a/stl/src/parallel_algorithms.cpp +++ b/stl/src/parallel_algorithms.cpp @@ -21,7 +21,7 @@ extern "C" { } [[nodiscard]] PTP_WORK __stdcall __std_create_threadpool_work( - __std_PTP_WORK_CALLBACK _Callback, void* _Context, PTP_CALLBACK_ENVIRON _Callback_environ) noexcept { + PTP_WORK_CALLBACK _Callback, void* _Context, PTP_CALLBACK_ENVIRON _Callback_environ) noexcept { return CreateThreadpoolWork(_Callback, _Context, _Callback_environ); } From b84ab40178956a417ac4e3396fe970129689b0c2 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 24 Oct 2023 14:42:25 -0700 Subject: [PATCH 4/5] Avoid changing vector_algorithms.cpp functions that GH 4113 is removing. --- stl/src/vector_algorithms.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/stl/src/vector_algorithms.cpp b/stl/src/vector_algorithms.cpp index 9872db015c..b69472b72f 100644 --- a/stl/src/vector_algorithms.cpp +++ b/stl/src/vector_algorithms.cpp @@ -1136,7 +1136,7 @@ _Min_max_element_t __stdcall __std_minmax_element_8( namespace { template - const void* _Find_trivial_unsized_fallback(const void* _First, _Ty _Val) noexcept { + const void* _Find_trivial_unsized_fallback(const void* _First, _Ty _Val) { auto _Ptr = static_cast(_First); while (*_Ptr != _Val) { ++_Ptr; @@ -1145,7 +1145,7 @@ namespace { } template - const void* _Find_trivial_tail(const void* _First, const void* _Last, _Ty _Val) noexcept { + const void* _Find_trivial_tail(const void* _First, const void* _Last, _Ty _Val) { auto _Ptr = static_cast(_First); while (_Ptr != _Last && *_Ptr != _Val) { ++_Ptr; @@ -1154,8 +1154,7 @@ namespace { } template - const void* _Find_trivial_last_tail( - const void* _First, const void* _Last, const void* _Real_last, _Ty _Val) noexcept { + const void* _Find_trivial_last_tail(const void* _First, const void* _Last, const void* _Real_last, _Ty _Val) { auto _Ptr = static_cast(_Last); for (;;) { if (_Ptr == _First) { @@ -1169,8 +1168,7 @@ namespace { } template - __declspec(noalias) size_t - _Count_trivial_tail(const void* _First, const void* _Last, size_t _Current, _Ty _Val) noexcept { + __declspec(noalias) size_t _Count_trivial_tail(const void* _First, const void* _Last, size_t _Current, _Ty _Val) { auto _Ptr = static_cast(_First); for (; _Ptr != _Last; ++_Ptr) { if (*_Ptr == _Val) { From 122aa5d30fd5ba4bbed4ccb4bc8022922da7142a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 24 Oct 2023 14:44:32 -0700 Subject: [PATCH 5/5] Avoid changing dllmain.cpp and ppltasks.cpp functions that GH 4106 is removing or nearly so. --- stl/src/dllmain.cpp | 5 ++--- stl/src/ppltasks.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/stl/src/dllmain.cpp b/stl/src/dllmain.cpp index 4535e331f3..23968536e8 100644 --- a/stl/src/dllmain.cpp +++ b/stl/src/dllmain.cpp @@ -7,11 +7,10 @@ #ifdef _CRT_APP // free static resource used by causality -extern "C" void __cdecl __crtCleanupCausalityStaticFactories() noexcept; +extern "C" void __cdecl __crtCleanupCausalityStaticFactories(); #endif // defined(_CRT_APP) -extern "C" BOOL APIENTRY DllMain( - HMODULE /* hModule */, DWORD ul_reason_for_call, [[maybe_unused]] LPVOID lpReserved) noexcept { +extern "C" BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD ul_reason_for_call, [[maybe_unused]] LPVOID lpReserved) { if (ul_reason_for_call == DLL_PROCESS_DETACH) { #ifdef _CRT_APP if (lpReserved == nullptr) { // only when the process is not terminating diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index e09ad967fb..c0bbdad466 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -350,7 +350,7 @@ namespace Concurrency { } // namespace Concurrency #ifdef _CRT_APP -extern "C" void __cdecl __crtCleanupCausalityStaticFactories() noexcept { +extern "C" void __cdecl __crtCleanupCausalityStaticFactories() { Concurrency::details::asyncCausalityTracer.release(); } #endif