From 112b4477b83bfbacac8a0ff6f80f81dc1519d54c Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 14:22:54 -0700 Subject: [PATCH 01/22] Guard `_Xtime_diff_to_millis2` with `#ifdef _CRTBLD`. --- stl/inc/xtimec.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stl/inc/xtimec.h b/stl/inc/xtimec.h index 3e77d17b0a..dc1f891ff1 100644 --- a/stl/inc/xtimec.h +++ b/stl/inc/xtimec.h @@ -19,7 +19,10 @@ _STL_DISABLE_CLANG_WARNINGS _EXTERN_C +#ifdef _CRTBLD _CRTIMP2_PURE long __cdecl _Xtime_diff_to_millis2(const _timespec64*, const _timespec64*); +#endif // _CRTBLD + _CRTIMP2_PURE long long __cdecl _Xtime_get_ticks(); #ifdef _CRTBLD From a60eb5fe098dd61b07c822bd6039f9ab3895be50 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 7 Aug 2023 14:41:17 -0700 Subject: [PATCH 02/22] Guard `_Execute_once`, `_Execute_once_fp_t` with `#ifdef _CRTBLD`. --- stl/inc/xcall_once.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stl/inc/xcall_once.h b/stl/inc/xcall_once.h index 8ea01a7d65..5b9954a0d8 100644 --- a/stl/inc/xcall_once.h +++ b/stl/inc/xcall_once.h @@ -28,12 +28,14 @@ _EXPORT_STD struct once_flag { // opaque data structure for call_once() void* _Opaque; }; +#ifdef _CRTBLD // Returns BOOL, nonzero to indicate success, zero for failure using _Execute_once_fp_t = int(__stdcall*)(void*, void*, void**); // Returns BOOL, nonzero to indicate success, zero for failure extern "C++" _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Execute_once( once_flag& _Flag, _Execute_once_fp_t _Callback, void* _Pv) noexcept; +#endif // _CRTBLD template union _Immortalizer_impl { // constructs _Ty, never destroys From 1997e41949531a160cb8d1af6725dca81f666c45 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 14:26:05 -0700 Subject: [PATCH 03/22] Style: Group `__msvc_sanitizer_annotate_container.hpp` with other unconditionally included headers. --- stl/inc/vector | 3 +-- stl/inc/xstring | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/stl/inc/vector b/stl/inc/vector index 3a402ebc81..c534d563b8 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -8,14 +8,13 @@ #include #if _STL_COMPILER_PREPROCESSOR #include <__msvc_bit_utils.hpp> +#include <__msvc_sanitizer_annotate_container.hpp> #include #if _HAS_CXX17 #include #endif // _HAS_CXX17 -#include <__msvc_sanitizer_annotate_container.hpp> - #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) diff --git a/stl/inc/xstring b/stl/inc/xstring index 6dee3cfb28..944ee89cdf 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -9,6 +9,7 @@ #define _XSTRING_ #include #if _STL_COMPILER_PREPROCESSOR +#include <__msvc_sanitizer_annotate_container.hpp> #include #include @@ -16,8 +17,6 @@ #include #endif // _HAS_CXX17 -#include <__msvc_sanitizer_annotate_container.hpp> - #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) From b4a1512374e926cdfe105b613b4e22bfd28b26c0 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 14:29:12 -0700 Subject: [PATCH 04/22] Formatting: Drop a spurious newline in a `basic_istream` constructor. --- stl/inc/istream | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stl/inc/istream b/stl/inc/istream index 2db973e085..5d5514b4ac 100644 --- a/stl/inc/istream +++ b/stl/inc/istream @@ -36,9 +36,7 @@ public: } #endif // defined(__FORCE_INSTANCE) - explicit __CLR_OR_THIS_CALL basic_istream(_Mysb* _Strbuf, bool _Isstd = false) - - : _Chcount(0) { + explicit __CLR_OR_THIS_CALL basic_istream(_Mysb* _Strbuf, bool _Isstd = false) : _Chcount(0) { _Myios::init(_Strbuf, _Isstd); } From 92495ce2a874eeacbc6a47e464567d459f74a3a0 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 14:32:56 -0700 Subject: [PATCH 05/22] Drop `_CONSTEVAL`, `_Cx_exp2()` can be plain `constexpr`. The only usage of `_Cx_exp2()` is initializing `static constexpr _Cy_t _Cy` and `static constexpr _Ty _Scale1`, so it's always being evaluated at compile-time. --- stl/inc/random | 2 +- stl/inc/yvals_core.h | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index 393b3ba7f9..9b3d5c3493 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -999,7 +999,7 @@ public: }; #if _HAS_TR1_NAMESPACE -_CONSTEVAL double _Cx_exp2(const int _Exp) noexcept { +constexpr double _Cx_exp2(const int _Exp) noexcept { double _Ret = 1.0; for (int _Count = _Exp; _Count > 0; --_Count) { _Ret *= 2.0; diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index e4ec910912..d63bc17478 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1020,12 +1020,6 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define _STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS 1 #endif // _STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS -#ifdef __cpp_consteval -#define _CONSTEVAL consteval -#else // ^^^ supports consteval / no consteval vvv -#define _CONSTEVAL constexpr -#endif // ^^^ no consteval ^^^ - // Controls whether the STL will force /fp:fast to enable vectorization of algorithms defined // in the standard as special cases; such as reduce, transform_reduce, inclusive_scan, exclusive_scan #ifndef _STD_VECTORIZE_WITH_FLOAT_CONTROL From 83c8a5a4825fe2571d0fd9a0f4ff08ec10912527 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 14:39:27 -0700 Subject: [PATCH 06/22] Style: Change unnecessarily `const _Auto_id_tag` unnamed parameters. --- stl/inc/format | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stl/inc/format b/stl/inc/format index a4bac258ed..5c9ef6efed 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -1680,7 +1680,7 @@ public: _Dynamic_specs._Dynamic_width_index = _Verify_dynamic_arg_index_in_range(_Arg_id); } - constexpr void _On_dynamic_width(const _Auto_id_tag) { + constexpr void _On_dynamic_width(_Auto_id_tag) { _Dynamic_specs._Dynamic_width_index = _Verify_dynamic_arg_index_in_range(_Parse_ctx.next_arg_id()); } @@ -1689,7 +1689,7 @@ public: _Dynamic_specs._Dynamic_precision_index = _Verify_dynamic_arg_index_in_range(_Arg_id); } - constexpr void _On_dynamic_precision(const _Auto_id_tag) { + constexpr void _On_dynamic_precision(_Auto_id_tag) { _Dynamic_specs._Dynamic_precision_index = _Verify_dynamic_arg_index_in_range(_Parse_ctx.next_arg_id()); } @@ -3975,7 +3975,7 @@ public: _Specs._Dynamic_width_index = _Verify_dynamic_arg_index_in_range(_Arg_id); } - constexpr void _On_dynamic_width(const _Auto_id_tag) { + constexpr void _On_dynamic_width(_Auto_id_tag) { _Specs._Dynamic_width_index = _Verify_dynamic_arg_index_in_range(_Parse_ctx.next_arg_id()); } From 9189ccd841c3a2c38a8b4d4f7550113d7e37c224 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 14:43:09 -0700 Subject: [PATCH 07/22] Add `explicit _Auto_id_tag() = default;` to defend against mistakes. --- stl/inc/format | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stl/inc/format b/stl/inc/format index 5c9ef6efed..9a4f3ad0d9 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -129,7 +129,9 @@ _NODISCARD constexpr bool _Is_arithmetic_fmt_type(_Basic_format_arg_type _Ty) { return _Ty > _Basic_format_arg_type::_None && _Ty <= _Basic_format_arg_type::_Long_double_type; } -struct _Auto_id_tag {}; +struct _Auto_id_tag { + explicit _Auto_id_tag() = default; +}; // clang-format off template From 8a5b549f4987aadcc782dbb8ef31cfc87c29c5c7 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 14:45:06 -0700 Subject: [PATCH 08/22] Fix citation to nonexistent N5687. --- stl/inc/xstring | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/xstring b/stl/inc/xstring index 944ee89cdf..9302c8eb14 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -683,7 +683,7 @@ template class _String_bitmap<_Elem, false> { // _String_bitmap for wchar_t/unsigned short/char16_t/char32_t/etc. types public: static_assert(is_unsigned_v<_Elem>, - "Standard char_traits is only provided for char, wchar_t, char16_t, and char32_t. See N5687 [char.traits]. " + "Standard char_traits is only provided for char, wchar_t, char16_t, and char32_t. See N4950 [char.traits]. " "Visual C++ accepts other unsigned integral types as an extension."); constexpr bool _Mark(const _Elem* _First, const _Elem* const _Last) noexcept { From cd07f06df3f7625a2fa863178475a51610c7a6ec Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 18:50:21 -0700 Subject: [PATCH 09/22] Update links: `docs.microsoft.com` => `learn.microsoft.com` This skips a domain redirection. This also updates a `support.microsoft.com` URL in the README that's being redirected. Finally, this adds specific links to `StlCompareStringA.cpp`, `StlCompareStringW.cpp`, `StlLCMapStringA.cpp`, `StlLCMapStringW.cpp`. Intentionally not changing `SECURITY.md`. --- README.md | 4 ++-- azure-devops/provision-image.ps1 | 2 +- stl/inc/complex | 2 +- stl/inc/format | 2 +- stl/src/StlCompareStringA.cpp | 3 ++- stl/src/StlCompareStringW.cpp | 3 ++- stl/src/StlLCMapStringA.cpp | 3 ++- stl/src/StlLCMapStringW.cpp | 3 ++- tests/std/tests/P0811R3_midpoint_lerp/test.cpp | 2 +- 9 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c898ffc531..07e5d847c9 100644 --- a/README.md +++ b/README.md @@ -549,5 +549,5 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception [lit]: https://llvm.org/docs/CommandGuide/lit.html [lit result codes]: https://llvm.org/docs/CommandGuide/lit.html#test-status-results [opencode@microsoft.com]: mailto:opencode@microsoft.com -[redistributables]: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads -[natvis documentation]: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects +[redistributables]: https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist +[natvis documentation]: https://learn.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index d87f5b4749..4cdd10c314 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -84,7 +84,7 @@ if ([string]::IsNullOrEmpty($AdminUserPassword)) { } else { Write-Host 'AdminUser password supplied; switching to AdminUser.' - # https://docs.microsoft.com/en-us/sysinternals/downloads/psexec + # https://learn.microsoft.com/en-us/sysinternals/downloads/psexec $PsToolsZipUrl = 'https://download.sysinternals.com/files/PSTools.zip' Write-Host "Downloading: $PsToolsZipUrl" $ExtractedPsToolsPath = DownloadAndExtractZip -Url $PsToolsZipUrl diff --git a/stl/inc/complex b/stl/inc/complex index 3ce60aa2ce..e33ac197bf 100644 --- a/stl/inc/complex +++ b/stl/inc/complex @@ -18,7 +18,7 @@ #ifdef _M_CEE_PURE // no intrinsics for /clr:pure #elif defined(_M_ARM64) || defined(_M_ARM64EC) -// https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#base-requirements +// https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#base-requirements // Both floating-point and NEON support are presumed to be present in hardware. #define _FMP_USING_STD_FMA #elif defined(__clang__) // ^^^ defined(_M_ARM64) || defined(_M_ARM64EC) ^^^ diff --git a/stl/inc/format b/stl/inc/format index 9a4f3ad0d9..2bbb3a146e 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -958,7 +958,7 @@ _NODISCARD constexpr bool _Is_execution_charset_self_synchronizing() { // We care about this because if a charset is self-synchronizing then we can search through it // for formatting control characters _without_ generally decoding the format string. switch (_MSVC_EXECUTION_CHARACTER_SET) { - // See: https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers + // See: https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers case 874: // Thai (Windows) case 1250: // ANSI Central European; Central European (Windows) case 1251: // ANSI Cyrillic; Cyrillic (Windows) diff --git a/stl/src/StlCompareStringA.cpp b/stl/src/StlCompareStringA.cpp index 81eb6e41c5..d6c3befa63 100644 --- a/stl/src/StlCompareStringA.cpp +++ b/stl/src/StlCompareStringA.cpp @@ -18,7 +18,8 @@ // // Entry: // LPCWSTR LocaleName - locale context for the comparison. -// DWORD dwCmpFlags - see docs.microsoft.com +// DWORD dwCmpFlags - see: +// https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringex // LPCSTR lpStringn - multibyte string to be compared // int cchCountn - char (byte) count (NOT including null terminator) // (-1 if null terminated) diff --git a/stl/src/StlCompareStringW.cpp b/stl/src/StlCompareStringW.cpp index 424593c03a..8fa9b68a2e 100644 --- a/stl/src/StlCompareStringW.cpp +++ b/stl/src/StlCompareStringW.cpp @@ -14,7 +14,8 @@ // // Entry: // LPCWSTR LocaleName - locale context for the comparison. -// DWORD dwCmpFlags - see docs.microsoft.com +// DWORD dwCmpFlags - see: +// https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringex // LPCWSTR lpStringn - wide string to be compared // int cchCountn - wide char (word) count (NOT including null terminator) // (-1 if null terminated) diff --git a/stl/src/StlLCMapStringA.cpp b/stl/src/StlLCMapStringA.cpp index 2ddf8258b5..54d572f488 100644 --- a/stl/src/StlLCMapStringA.cpp +++ b/stl/src/StlLCMapStringA.cpp @@ -14,7 +14,8 @@ // // Entry: // LPCWSTR LocaleName - locale context for the comparison. -// DWORD dwMapFlags - see docs.microsoft.com +// DWORD dwMapFlags - see: +// https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-lcmapstringex // LPCSTR lpSrcStr - pointer to string to be mapped // int cchSrc - wide char (word) count of input string // (including null terminator if any) diff --git a/stl/src/StlLCMapStringW.cpp b/stl/src/StlLCMapStringW.cpp index 625e8f8075..b689af81f7 100644 --- a/stl/src/StlLCMapStringW.cpp +++ b/stl/src/StlLCMapStringW.cpp @@ -12,7 +12,8 @@ // // Entry: // LPCWSTR locale_name - locale context for the comparison. -// DWORD map_flags - see docs.microsoft.com +// DWORD map_flags - see: +// https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-lcmapstringex // LPCWSTR source - pointer to string to be mapped // int source_count - wide char (word) count of input string // (including null terminator if any) diff --git a/tests/std/tests/P0811R3_midpoint_lerp/test.cpp b/tests/std/tests/P0811R3_midpoint_lerp/test.cpp index 6ee188526e..4c19a1b778 100644 --- a/tests/std/tests/P0811R3_midpoint_lerp/test.cpp +++ b/tests/std/tests/P0811R3_midpoint_lerp/test.cpp @@ -25,7 +25,7 @@ using limits = numeric_limits; #ifdef _M_FP_STRICT // According to: -// https://docs.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior +// https://learn.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior // Under the default /fp:precise mode: // The compiler generates code intended to run in the default floating-point environment and assumes that the // floating-point environment is not accessed or modified at runtime. From fe646446917d85b2f99a8ee8f5bb33b7b894fd08 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 20:14:06 -0700 Subject: [PATCH 10/22] Add space to comment. --- tests/std/tests/P2278R4_views_as_const/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/P2278R4_views_as_const/test.cpp b/tests/std/tests/P2278R4_views_as_const/test.cpp index c33e2e1b17..f2c37b9401 100644 --- a/tests/std/tests/P2278R4_views_as_const/test.cpp +++ b/tests/std/tests/P2278R4_views_as_const/test.cpp @@ -202,7 +202,7 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { STATIC_ASSERT(noexcept(as_const(rng) | views::as_const)); } - { //... with rvalue argument + { // ... with rvalue argument STATIC_ASSERT(same_as); STATIC_ASSERT(noexcept(views::as_const(move(rng)))); From 1c7472665036e9002ab4f4b98ebdba854030402e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 14:47:29 -0700 Subject: [PATCH 11/22] Style: `typename` => `class` in product code. --- stl/inc/experimental/coroutine | 8 ++++---- stl/src/xmath.hpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stl/inc/experimental/coroutine b/stl/inc/experimental/coroutine index 248c28baaf..ffd4ad27d5 100644 --- a/stl/inc/experimental/coroutine +++ b/stl/inc/experimental/coroutine @@ -59,10 +59,10 @@ namespace experimental { using promise_type = typename _Ret::promise_type; }; - template + template struct coroutine_traits : _Coroutine_traits_sfinae<_Ret> {}; - template + template struct coroutine_handle; template <> @@ -126,7 +126,7 @@ namespace experimental { _Resumable_frame_prefix* _Ptr = nullptr; }; - template + template struct coroutine_handle : coroutine_handle<> { // general form using coroutine_handle<>::coroutine_handle; @@ -226,7 +226,7 @@ namespace experimental { // _Resumable_helper_traits class isolates front-end from public surface // naming changes - template + template struct _Resumable_helper_traits { using _Traits = coroutine_traits<_Ret, _Ts...>; using _PromiseT = typename _Traits::promise_type; diff --git a/stl/src/xmath.hpp b/stl/src/xmath.hpp index e7f441d5cc..4968e40708 100644 --- a/stl/src/xmath.hpp +++ b/stl/src/xmath.hpp @@ -185,14 +185,14 @@ _END_EXTERN_C_UNLESS_PURE #pragma float_control(except, on, push) #endif -template +template [[nodiscard]] T _Xfe_overflow(const T sign) noexcept { static_assert(_STD is_floating_point_v, "Expected is_floating_point_v."); constexpr T huge = _STD numeric_limits::max(); return _STD copysign(huge, sign) * huge; } -template +template [[nodiscard]] T _Xfe_underflow(const T sign) noexcept { static_assert(_STD is_floating_point_v, "Expected is_floating_point_v."); constexpr T tiny = _STD numeric_limits::min(); From 0e27c7138162fcd4b7744bf3296ffa539c041934 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 14:51:50 -0700 Subject: [PATCH 12/22] Fuse adjacent Standard modes. --- stl/inc/algorithm | 2 -- stl/inc/type_traits | 2 -- 2 files changed, 4 deletions(-) diff --git a/stl/inc/algorithm b/stl/inc/algorithm index c72b4042ce..d97d81e767 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -4148,9 +4148,7 @@ _FwdIt2 remove_copy_if(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _P _REQUIRE_CPP17_MUTABLE_ITERATOR(_FwdIt2); return _STD remove_copy_if(_First, _Last, _Dest, _Pass_fn(_Pred)); } -#endif // _HAS_CXX17 -#if _HAS_CXX17 _EXPORT_STD template = 0> _NODISCARD_REMOVE_ALG _FwdIt remove(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last, const _Ty& _Val) noexcept; // terminates diff --git a/stl/inc/type_traits b/stl/inc/type_traits index dafb8d2991..80af986b72 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -1543,9 +1543,7 @@ struct _Fold_common_reference>, _Ty1, _Ty2 template struct common_reference<_Ty1, _Ty2, _Ty3, _Rest...> : _Fold_common_reference {}; -#endif // _HAS_CXX20 -#if _HAS_CXX20 _EXPORT_STD template struct type_identity { using type = _Ty; From 0e4c2be6e5a896e7e4b065699fa710b0b1b7bf66 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 19:02:40 -0700 Subject: [PATCH 13/22] Simplify away `_THREAD_CHECK`, `_THREAD_CHECKX`. We **never** defined `_THREAD_CHECK` in the internal or GitHub builds, so this code simply collapses to `#ifdef _DEBUG`. --- stl/src/mutex.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/stl/src/mutex.cpp b/stl/src/mutex.cpp index a63d7576bf..7ba6e22e09 100644 --- a/stl/src/mutex.cpp +++ b/stl/src/mutex.cpp @@ -19,19 +19,13 @@ extern "C" [[noreturn]] _CRTIMP2_PURE void _Thrd_abort(const char* msg) { // abo abort(); } -#if defined(_THREAD_CHECK) || defined(_DEBUG) -#define _THREAD_CHECKX 1 -#else // defined(_THREAD_CHECK) || defined(_DEBUG) -#define _THREAD_CHECKX 0 -#endif // defined(_THREAD_CHECK) || defined(_DEBUG) - -#if _THREAD_CHECKX +#ifdef _DEBUG #define _THREAD_QUOTX(x) #x #define _THREAD_QUOT(x) _THREAD_QUOTX(x) #define _THREAD_ASSERT(expr, msg) ((expr) ? (void) 0 : _Thrd_abort(__FILE__ "(" _THREAD_QUOT(__LINE__) "): " msg)) -#else // _THREAD_CHECKX +#else // defined(_DEBUG) #define _THREAD_ASSERT(expr, msg) ((void) 0) -#endif // _THREAD_CHECKX +#endif // defined(_DEBUG) // TRANSITION, ABI: preserved for binary compatibility enum class __stl_sync_api_modes_enum { normal, win7, vista, concrt }; From 6987e0e63152c452caea7336aa985395f354be51 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 19:43:27 -0700 Subject: [PATCH 14/22] Drop polluting using-declarations within `stdext`. We don't need to qualify `size_t` at all. Intentionally not attempting to make `` and `` less polluting. --- stl/inc/hash_map | 4 ++-- stl/inc/hash_set | 4 ++-- stl/inc/iterator | 2 -- stl/inc/xhash | 8 ++------ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/stl/inc/hash_map b/stl/inc/hash_map index 037d8183b5..e026e24570 100644 --- a/stl/inc/hash_map +++ b/stl/inc/hash_map @@ -108,7 +108,7 @@ namespace stdext { float _Max_buckets = 0.0F; // current maximum bucket size }; - template >, + template >, class _Alloc = allocator>> class hash_map : public _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, false>> { // hash table of {key, mapped} values, unique keys @@ -297,7 +297,7 @@ namespace stdext { return !(_Left == _Right); } - template >, + template >, class _Alloc = allocator>> class hash_multimap : public _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, true>> { // hash table of {key, mapped} values, non-unique keys diff --git a/stl/inc/hash_set b/stl/inc/hash_set index 5e68d85bcc..69c7d2965a 100644 --- a/stl/inc/hash_set +++ b/stl/inc/hash_set @@ -85,7 +85,7 @@ namespace stdext { float _Max_buckets = 0.0F; // current maximum bucket size }; - template >, class _Alloc = allocator<_Kty>> + template >, class _Alloc = allocator<_Kty>> class hash_set : public _Hash<_Hset_traits<_Kty, _Tr, _Alloc, false>> { // hash table of key values, unique keys public: using _Mybase = _Hash<_Hset_traits<_Kty, _Tr, _Alloc, false>>; @@ -230,7 +230,7 @@ namespace stdext { return !(_Left == _Right); } - template >, class _Alloc = allocator<_Kty>> + template >, class _Alloc = allocator<_Kty>> class hash_multiset : public _Hash<_Hset_traits<_Kty, _Tr, _Alloc, true>> { // hash table of key values, non-unique keys public: diff --git a/stl/inc/iterator b/stl/inc/iterator index 3d35b6dbbb..aef0c19bdb 100644 --- a/stl/inc/iterator +++ b/stl/inc/iterator @@ -1466,8 +1466,6 @@ struct iterator_traits> : iterator_traits<_Iter> { _STD_END _STDEXT_BEGIN -using _STD size_t; - template class _DEPRECATE_STDEXT_ARR_ITERS checked_array_iterator { // wrap a pointer with checking private: diff --git a/stl/inc/xhash b/stl/inc/xhash index 5cd4beb750..03c59664ee 100644 --- a/stl/inc/xhash +++ b/stl/inc/xhash @@ -32,10 +32,6 @@ _STL_DISABLE_CLANG_WARNINGS #ifdef _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS namespace stdext { - using _STD basic_string; - using _STD less; - using _STD size_t; - template _NODISCARD size_t hash_value(const _Kty& _Keyval) noexcept { if constexpr (_STD is_pointer_v<_Kty> || _STD is_null_pointer_v<_Kty>) { @@ -46,7 +42,7 @@ namespace stdext { } template - _NODISCARD size_t hash_value(const basic_string<_Elem, _Traits, _Alloc>& _Str) noexcept { + _NODISCARD size_t hash_value(const _STD basic_string<_Elem, _Traits, _Alloc>& _Str) noexcept { return _STD _Hash_array_representation(_Str.c_str(), _Str.size()); } @@ -58,7 +54,7 @@ namespace stdext { return _STD _Hash_array_representation(_Str, _CSTD wcslen(_Str)); } - template > + template > class hash_compare { // traits class for hash containers public: enum { // parameters for hash table From 55eb9fc4d358550b6cd3e6e60e08edf790e52050 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 19:57:44 -0700 Subject: [PATCH 15/22] Mark `_Big_uint128::operator<` as `_NODISCARD`. --- stl/inc/ratio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/ratio b/stl/inc/ratio index 4222fdc452..429a2b9f3e 100644 --- a/stl/inc/ratio +++ b/stl/inc/ratio @@ -181,7 +181,7 @@ struct _Big_uint128 { uint64_t _Upper; uint64_t _Lower; - constexpr bool operator<(const _Big_uint128 _Rhs) const noexcept { + _NODISCARD constexpr bool operator<(const _Big_uint128 _Rhs) const noexcept { if (_Upper != _Rhs._Upper) { return _Upper < _Rhs._Upper; } From dd020fe8acd7f0721341a7ffd1fe827d81d5f0a7 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 19:58:07 -0700 Subject: [PATCH 16/22] Mark `uncaught_exception()` and `uncaught_exceptions()` as `_NODISCARD`. It appears that we don't usually mark the definitions (but perhaps we should). --- stl/inc/exception | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stl/inc/exception b/stl/inc/exception index 16b5fac54b..34d59d74fd 100644 --- a/stl/inc/exception +++ b/stl/inc/exception @@ -21,10 +21,10 @@ _STL_DISABLE_CLANG_WARNINGS _STD_BEGIN #if _HAS_DEPRECATED_UNCAUGHT_EXCEPTION -_EXPORT_STD extern "C++" _CXX17_DEPRECATE_UNCAUGHT_EXCEPTION _CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL +_EXPORT_STD extern "C++" _CXX17_DEPRECATE_UNCAUGHT_EXCEPTION _NODISCARD _CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL uncaught_exception() noexcept; #endif // _HAS_DEPRECATED_UNCAUGHT_EXCEPTION -_EXPORT_STD extern "C++" _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL uncaught_exceptions() noexcept; +_EXPORT_STD extern "C++" _NODISCARD _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL uncaught_exceptions() noexcept; _STD_END From 21be87be3e286b1de419081309d584293c1d18d4 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 20:04:02 -0700 Subject: [PATCH 17/22] Simplify CMakeLists.txt: `MATCHES "\^(\w+)\$"` => `STREQUAL "$1"` --- CMakeLists.txt | 10 +++++----- benchmarks/CMakeLists.txt | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47f6022e0f..62756db88e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ option(STL_USE_ANALYZE "Pass the /analyze flag to MSVC" OFF) set(VCLIBS_EXPLICIT_MACHINE "") -if("${VCLIBS_TARGET_ARCHITECTURE}" MATCHES "^x86$") +if("${VCLIBS_TARGET_ARCHITECTURE}" STREQUAL "x86") set(VCLIBS_TARGET_ARCHITECTURE "x86") set(VCLIBS_I386_OR_AMD64 "i386") set(VCLIBS_X86_OR_X64 "x86") @@ -58,22 +58,22 @@ if("${VCLIBS_TARGET_ARCHITECTURE}" MATCHES "^x86$") # runtime dynamic linking by setting our own _STL_WIN32_WINNT back to Windows XP. add_compile_definitions(_X86_ _VCRT_WIN32_WINNT=0x0501 _STL_WIN32_WINNT=0x0501) add_compile_options($<$:/arch:IA32>) -elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^x64$") +elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x64") set(VCLIBS_TARGET_ARCHITECTURE "x64") set(VCLIBS_I386_OR_AMD64 "amd64") set(VCLIBS_X86_OR_X64 "x64") add_compile_definitions(_AMD64_ _VCRT_WIN32_WINNT=0x0501 _STL_WIN32_WINNT=0x0501) -elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^armv7$") +elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "armv7") set(VCLIBS_TARGET_ARCHITECTURE "arm") set(VCLIBS_I386_OR_AMD64 "arm") set(VCLIBS_X86_OR_X64 "arm") add_compile_definitions(_ARM_ _VCRT_WIN32_WINNT=0x0602 _STL_WIN32_WINNT=0x0602) -elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^arm64$") +elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64") set(VCLIBS_TARGET_ARCHITECTURE "arm64") set(VCLIBS_I386_OR_AMD64 "arm64") set(VCLIBS_X86_OR_X64 "arm64") add_compile_definitions(_ARM64_ _VCRT_WIN32_WINNT=0x0A00 _STL_WIN32_WINNT=0x0A00) -elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^arm64ec$") +elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64ec") set(VCLIBS_TARGET_ARCHITECTURE "arm64ec") set(VCLIBS_I386_OR_AMD64 "arm64ec") set(VCLIBS_X86_OR_X64 "arm64") # Yes, really: `%VCToolsInstallDir%lib\arm64ec` only contains the Link Options diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 11df4398d0..d9b35a2e68 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -19,13 +19,13 @@ if(DEFINED STL_BINARY_DIR) string(TOLOWER "${VCLIBS_TARGET_ARCHITECTURE}" VCLIBS_TARGET_ARCHITECTURE) - if("${VCLIBS_TARGET_ARCHITECTURE}" MATCHES "^x86$") + if("${VCLIBS_TARGET_ARCHITECTURE}" STREQUAL "x86") set(VCLIBS_I386_OR_AMD64 "i386") - elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^x64$") + elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x64") set(VCLIBS_I386_OR_AMD64 "amd64") - elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^armv7$") + elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "armv7") set(VCLIBS_I386_OR_AMD64 "arm") - elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^arm64$") + elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64") set(VCLIBS_I386_OR_AMD64 "arm64") else() message(FATAL_ERROR "Could not determine target architecture: VCLIBS_TARGET_ARCHITECTURE: ${VCLIBS_TARGET_ARCHITECTURE}") From 8940c3f59cc7c15bef46c9809647eb27977e78ea Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 5 Aug 2023 20:11:55 -0700 Subject: [PATCH 18/22] Simple test cleanup: After `STATIC_ASSERT(CanViewElements)`, assume it's true. --- tests/std/tests/P0896R4_views_elements/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/P0896R4_views_elements/test.cpp b/tests/std/tests/P0896R4_views_elements/test.cpp index 61a76c174f..24ad309290 100644 --- a/tests/std/tests/P0896R4_views_elements/test.cpp +++ b/tests/std/tests/P0896R4_views_elements/test.cpp @@ -50,7 +50,7 @@ constexpr bool test_one(Rng&& rng) { // ... with lvalue argument STATIC_ASSERT(CanViewElements); constexpr bool is_view = ranges::view>; - if constexpr (CanViewElements) { // Validate lvalue + { // Validate lvalue constexpr bool is_noexcept = !is_view || is_nothrow_copy_constructible_v; STATIC_ASSERT(same_as(rng)), R>); From 0cfd7fa468457fd4a493d3dc0a1c0836fc23c10f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 7 Aug 2023 14:30:24 -0700 Subject: [PATCH 19/22] ``: Decompose complicated conditional expression. This is more lines, but easier to follow. Note that the result of the compound assignment is the left operand. The if-return-else-return is deliberate. --- stl/inc/random | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stl/inc/random b/stl/inc/random index 9b3d5c3493..01a86b3f19 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -656,7 +656,13 @@ struct _Circ_buf { // holds historical values for generators } size_t _Base(size_t _Ix = 0) const noexcept { - return (_Ix += _Idx) < _Nw ? (_Ix + _Nw) : (_Ix - _Nw); + _Ix += _Idx; + + if (_Ix < _Nw) { + return _Ix + _Nw; + } else { + return _Ix - _Nw; + } } unsigned int _Idx; From bac35203385900dc64f8b2ee981625e5ec6458ee Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 7 Aug 2023 14:55:20 -0700 Subject: [PATCH 20/22] Simplify `_Cnd_internal_imp_t` size/align constants. The `stl_condition_variable_max_MEOW` constants in `primitives.hpp` were exactly identical to the `_Cnd_internal_imp_MEOW` constants in `xthreads.h`, because we use `_Aligned_storage` with no other data members. This unifies them, keeping the `xthreads.h` names but the simpler `primitives.hpp` definition technique and clearer comments. Finally, this makes the `static_assert`s in `cond.cpp` tautological, so this removes them. --- stl/inc/xthreads.h | 26 +++++++++----------------- stl/src/cond.cpp | 6 +----- stl/src/primitives.hpp | 10 ---------- 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/stl/inc/xthreads.h b/stl/inc/xthreads.h index e2bdf732c0..6fa2aa97f8 100644 --- a/stl/inc/xthreads.h +++ b/stl/inc/xthreads.h @@ -59,23 +59,15 @@ struct _Mtx_internal_imp_t { }; // Size and alignment for _Cnd_internal_imp_t -#ifdef _CRT_WINDOWS -#ifdef _WIN64 -_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 16; -_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = 8; -#else // _WIN64 -_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 8; -_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = 4; -#endif // _WIN64 -#else // _CRT_WINDOWS -#ifdef _WIN64 -_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 72; -_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = 8; -#else // _WIN64 -_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 40; -_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = 4; -#endif // _WIN64 -#endif // _CRT_WINDOWS +#if defined(_CRT_WINDOWS) // for Windows-internal code +_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 2 * sizeof(void*); +#elif defined(_WIN64) // ordinary 64-bit code +_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 72; +#else // vvv ordinary 32-bit code vvv +_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 40; +#endif // ^^^ ordinary 32-bit code ^^^ + +_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = alignof(void*); using _Mtx_t = _Mtx_internal_imp_t*; diff --git a/stl/src/cond.cpp b/stl/src/cond.cpp index 157d97577e..2b5a4f1c0f 100644 --- a/stl/src/cond.cpp +++ b/stl/src/cond.cpp @@ -12,8 +12,7 @@ #include "primitives.hpp" struct _Cnd_internal_imp_t { // condition variable implementation for ConcRT - typename std::_Aligned_storage::type cv; + typename std::_Aligned_storage<_Cnd_internal_imp_size, _Cnd_internal_imp_alignment>::type cv; [[nodiscard]] Concurrency::details::stl_condition_variable_win7* _get_cv() noexcept { // get pointer to implementation @@ -21,9 +20,6 @@ struct _Cnd_internal_imp_t { // condition variable implementation for ConcRT } }; -static_assert(sizeof(_Cnd_internal_imp_t) == _Cnd_internal_imp_size, "incorrect _Cnd_internal_imp_size"); -static_assert(alignof(_Cnd_internal_imp_t) == _Cnd_internal_imp_alignment, "incorrect _Cnd_internal_imp_alignment"); - void _Cnd_init_in_situ(const _Cnd_t cond) { // initialize condition variable in situ Concurrency::details::create_stl_condition_variable(cond->_get_cv()); } diff --git a/stl/src/primitives.hpp b/stl/src/primitives.hpp index 494eb7eb12..89d35a2c7d 100644 --- a/stl/src/primitives.hpp +++ b/stl/src/primitives.hpp @@ -51,15 +51,5 @@ namespace Concurrency { inline void create_stl_condition_variable(stl_condition_variable_win7* p) { new (p) stl_condition_variable_win7; } - -#if defined(_CRT_WINDOWS) // for Windows-internal code - const size_t stl_condition_variable_max_size = 2 * sizeof(void*); -#elif defined(_WIN64) // ordinary 64-bit code - const size_t stl_condition_variable_max_size = 72; -#else // vvv ordinary 32-bit code vvv - const size_t stl_condition_variable_max_size = 40; -#endif // ^^^ ordinary 32-bit code ^^^ - - const size_t stl_condition_variable_max_alignment = alignof(void*); } // namespace details } // namespace Concurrency From 143b2a314f0baadd59954cfd2d161d595c52e3e1 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 8 Aug 2023 13:42:44 -0700 Subject: [PATCH 21/22] Use shorter URLs to avoid wrapping. --- stl/src/StlCompareStringA.cpp | 3 +-- stl/src/StlCompareStringW.cpp | 3 +-- stl/src/StlLCMapStringA.cpp | 3 +-- stl/src/StlLCMapStringW.cpp | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/stl/src/StlCompareStringA.cpp b/stl/src/StlCompareStringA.cpp index d6c3befa63..4fe6173c7f 100644 --- a/stl/src/StlCompareStringA.cpp +++ b/stl/src/StlCompareStringA.cpp @@ -18,8 +18,7 @@ // // Entry: // LPCWSTR LocaleName - locale context for the comparison. -// DWORD dwCmpFlags - see: -// https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringex +// DWORD dwCmpFlags - see https://aka.ms/stl/comparestringex // LPCSTR lpStringn - multibyte string to be compared // int cchCountn - char (byte) count (NOT including null terminator) // (-1 if null terminated) diff --git a/stl/src/StlCompareStringW.cpp b/stl/src/StlCompareStringW.cpp index 8fa9b68a2e..25033046d5 100644 --- a/stl/src/StlCompareStringW.cpp +++ b/stl/src/StlCompareStringW.cpp @@ -14,8 +14,7 @@ // // Entry: // LPCWSTR LocaleName - locale context for the comparison. -// DWORD dwCmpFlags - see: -// https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringex +// DWORD dwCmpFlags - see https://aka.ms/stl/comparestringex // LPCWSTR lpStringn - wide string to be compared // int cchCountn - wide char (word) count (NOT including null terminator) // (-1 if null terminated) diff --git a/stl/src/StlLCMapStringA.cpp b/stl/src/StlLCMapStringA.cpp index 54d572f488..929d0f2a69 100644 --- a/stl/src/StlLCMapStringA.cpp +++ b/stl/src/StlLCMapStringA.cpp @@ -14,8 +14,7 @@ // // Entry: // LPCWSTR LocaleName - locale context for the comparison. -// DWORD dwMapFlags - see: -// https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-lcmapstringex +// DWORD dwMapFlags - see https://aka.ms/stl/lcmapstringex // LPCSTR lpSrcStr - pointer to string to be mapped // int cchSrc - wide char (word) count of input string // (including null terminator if any) diff --git a/stl/src/StlLCMapStringW.cpp b/stl/src/StlLCMapStringW.cpp index b689af81f7..14785ea370 100644 --- a/stl/src/StlLCMapStringW.cpp +++ b/stl/src/StlLCMapStringW.cpp @@ -12,8 +12,7 @@ // // Entry: // LPCWSTR locale_name - locale context for the comparison. -// DWORD map_flags - see: -// https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-lcmapstringex +// DWORD map_flags - see https://aka.ms/stl/lcmapstringex // LPCWSTR source - pointer to string to be mapped // int source_count - wide char (word) count of input string // (including null terminator if any) From 020a2b54501dc47c4397efe2ac16606f8b1d46f4 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 9 Aug 2023 17:49:18 -0700 Subject: [PATCH 22/22] Copy attributes to definitions, drop useless comments. --- stl/src/uncaught_exception.cpp | 3 ++- stl/src/uncaught_exceptions.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/stl/src/uncaught_exception.cpp b/stl/src/uncaught_exception.cpp index 4e7e413482..df21b68dcd 100644 --- a/stl/src/uncaught_exception.cpp +++ b/stl/src/uncaught_exception.cpp @@ -5,7 +5,8 @@ #include _STD_BEGIN -_CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL uncaught_exception() noexcept { // report if handling a throw +_CXX17_DEPRECATE_UNCAUGHT_EXCEPTION _NODISCARD _CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL + uncaught_exception() noexcept { return __uncaught_exception(); } diff --git a/stl/src/uncaught_exceptions.cpp b/stl/src/uncaught_exceptions.cpp index c89c45873a..2977b8e066 100644 --- a/stl/src/uncaught_exceptions.cpp +++ b/stl/src/uncaught_exceptions.cpp @@ -5,7 +5,7 @@ #include _STD_BEGIN -_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL uncaught_exceptions() noexcept { // report number of throws being handled +_NODISCARD _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL uncaught_exceptions() noexcept { return __uncaught_exceptions(); }