diff --git a/.vscode/settings.json b/.vscode/settings.json index 853326e4373..1b2295bc984 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,5 +30,9 @@ "./llvm-project/libcxx/utils", "./llvm-project/llvm/utils/lit", "./tests/utils" - ] + ], + "search.exclude": { + "stl/src/xcharconv_ryu_tables.cpp": true, + "tests/std/tests/P0067R5_charconv/*test_cases*.hpp": true + } } diff --git a/CMakeLists.txt b/CMakeLists.txt index d6289e713e6..4147068f9bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ option(STL_ASAN_BUILD "Build the STL with ASan enabled" OFF) set(VCLIBS_EXPLICIT_MACHINE "") -if("${VCLIBS_TARGET_ARCHITECTURE}" STREQUAL "x86") +if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x86") set(VCLIBS_TARGET_ARCHITECTURE "x86") set(VCLIBS_I386_OR_AMD64 "i386") set(VCLIBS_X86_OR_X64 "x86") diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index c5aa8ba6773..59d84e3aec0 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -19,7 +19,7 @@ if(DEFINED STL_BINARY_DIR) string(TOLOWER "${VCLIBS_TARGET_ARCHITECTURE}" VCLIBS_TARGET_ARCHITECTURE) - if("${VCLIBS_TARGET_ARCHITECTURE}" STREQUAL "x86") + if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x86") set(VCLIBS_I386_OR_AMD64 "i386") elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x64") set(VCLIBS_I386_OR_AMD64 "amd64") diff --git a/stl/inc/__msvc_bit_utils.hpp b/stl/inc/__msvc_bit_utils.hpp index 160c37d859f..46824ee80f4 100644 --- a/stl/inc/__msvc_bit_utils.hpp +++ b/stl/inc/__msvc_bit_utils.hpp @@ -113,16 +113,13 @@ _NODISCARD int _Countl_zero_bsr(const _Ty _Val) noexcept { template _NODISCARD int _Checked_x86_x64_countl_zero(const _Ty _Val) noexcept { -#ifdef __AVX2__ - return _Countl_zero_lzcnt(_Val); -#else // ^^^ defined(__AVX2__) / !defined(__AVX2__) vvv +#ifndef __AVX2__ const bool _Definitely_have_lzcnt = __isa_available >= _Stl_isa_available_avx2; - if (_Definitely_have_lzcnt) { - return _Countl_zero_lzcnt(_Val); - } else { + if (!_Definitely_have_lzcnt) { return _Countl_zero_bsr(_Val); } #endif // ^^^ !defined(__AVX2__) ^^^ + return _Countl_zero_lzcnt(_Val); } #endif // (defined(_M_IX86) && !defined(_M_HYBRID_X86_ARM64)) || (defined(_M_X64) && !defined(_M_ARM64EC)) @@ -259,16 +256,13 @@ _NODISCARD int _Countr_zero_bsf(const _Ty _Val) noexcept { template _NODISCARD int _Checked_x86_x64_countr_zero(const _Ty _Val) noexcept { -#ifdef __AVX2__ - return _Countr_zero_tzcnt(_Val); -#else // ^^^ defined(__AVX2__) / !defined(__AVX2__) vvv +#ifndef __AVX2__ const bool _Definitely_have_tzcnt = __isa_available >= _Stl_isa_available_avx2; - if (_Definitely_have_tzcnt) { - return _Countr_zero_tzcnt(_Val); - } else { + if (!_Definitely_have_tzcnt) { return _Countr_zero_bsf(_Val); } #endif // ^^^ !defined(__AVX2__) ^^^ + return _Countr_zero_tzcnt(_Val); } #endif // _HAS_TZCNT_BSF_INTRINSICS @@ -336,20 +330,17 @@ constexpr decltype(auto) _Select_countr_zero_impl(_Fn _Callback) { // TRANSITION, DevCom-1527995: Lambdas in this function ensure inlining #if _HAS_TZCNT_BSF_INTRINSICS && _HAS_CXX20 if (!_STD is_constant_evaluated()) { -#ifdef __AVX2__ - return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Countr_zero_tzcnt(_Val); }); -#else // ^^^ AVX2 / not AVX2 vvv +#ifndef __AVX2__ const bool _Definitely_have_tzcnt = __isa_available >= _Stl_isa_available_avx2; - if (_Definitely_have_tzcnt) { - return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Countr_zero_tzcnt(_Val); }); - } else { - return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Countr_zero_bsf(_Val); }); + if (!_Definitely_have_tzcnt) { + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_bsf(_Val); }); } -#endif // ^^^ not AVX2 ^^^ +#endif // ^^^ !defined(__AVX2__) ^^^ + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_tzcnt(_Val); }); } #endif // ^^^ _HAS_TZCNT_BSF_INTRINSICS && _HAS_CXX20 ^^^ // C++17 constexpr gcd() calls this function, so it should be constexpr unless we detect runtime evaluation. - return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Countr_zero_fallback(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_fallback(_Val); }); } template @@ -394,13 +385,13 @@ _CONSTEXPR20 decltype(auto) _Select_popcount_impl(_Fn _Callback) { #if !_POPCNT_INTRINSICS_ALWAYS_AVAILABLE const bool _Definitely_have_popcnt = __isa_available >= _Stl_isa_available_sse42; if (!_Definitely_have_popcnt) { - return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Popcount_fallback(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Popcount_fallback(_Val); }); } #endif // ^^^ !_POPCNT_INTRINSICS_ALWAYS_AVAILABLE ^^^ - return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Unchecked_popcount(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Unchecked_popcount(_Val); }); } #endif // ^^^ _HAS_POPCNT_INTRINSICS ^^^ - return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Popcount_fallback(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Popcount_fallback(_Val); }); } #undef _HAS_TZCNT_BSF_INTRINSICS diff --git a/stl/inc/__msvc_chrono.hpp b/stl/inc/__msvc_chrono.hpp index cdf2030242a..44a0e6a7d10 100644 --- a/stl/inc/__msvc_chrono.hpp +++ b/stl/inc/__msvc_chrono.hpp @@ -677,7 +677,7 @@ namespace chrono { _NODISCARD static time_point now() noexcept { // get current time const long long _Freq = _Query_perf_frequency(); // doesn't change after system boot const long long _Ctr = _Query_perf_counter(); - static_assert(period::num == 1, "This assumes period::num == 1."); + _STL_INTERNAL_STATIC_ASSERT(period::num == 1); // The compiler recognizes the constants for frequency and time period and uses shifts and // multiplies instead of divides to calculate the nanosecond value. constexpr long long _TenMHz = 10'000'000; @@ -686,7 +686,7 @@ namespace chrono { // 10 MHz is a very common QPC frequency on modern x86/x64 PCs. Optimizing for // this specific frequency can double the performance of this function by // avoiding the expensive frequency conversion path. - static_assert(period::den % _TenMHz == 0, "It should never fail."); + _STL_INTERNAL_STATIC_ASSERT(period::den % _TenMHz == 0); constexpr long long _Multiplier = period::den / _TenMHz; return time_point(duration(_Ctr * _Multiplier)); } else if (_Freq == _TwentyFourMHz) { @@ -695,8 +695,8 @@ namespace chrono { using _Multiplier_part = ratio; constexpr long long _Multiplier_num = _Multiplier_part::num; constexpr long long _Multiplier_den = _Multiplier_part::den; - static_assert( - _Multiplier_num <= _Multiplier_whole, "This assumes that _Ctr * _Multiplier_num doesn't overflow."); + // This assumes that _Ctr * _Multiplier_num doesn't overflow. + _STL_INTERNAL_STATIC_ASSERT(_Multiplier_num <= _Multiplier_whole); const long long _Whole = _Ctr * _Multiplier_whole; const long long _Part = _Ctr * _Multiplier_num / _Multiplier_den; return time_point(duration(_Whole + _Part)); diff --git a/stl/inc/__msvc_formatter.hpp b/stl/inc/__msvc_formatter.hpp index 8fa4c3017e4..2c8758a24b8 100644 --- a/stl/inc/__msvc_formatter.hpp +++ b/stl/inc/__msvc_formatter.hpp @@ -47,6 +47,7 @@ #include #include #include + #if _HAS_CXX23 #include #endif // _HAS_CXX23 diff --git a/stl/inc/__msvc_ranges_to.hpp b/stl/inc/__msvc_ranges_to.hpp index a36bbd6df36..0a435f91e7d 100644 --- a/stl/inc/__msvc_ranges_to.hpp +++ b/stl/inc/__msvc_ranges_to.hpp @@ -632,7 +632,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Own) { return owning_view{_STD forward<_Rng>(_Range)}; } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -1146,7 +1146,7 @@ namespace ranges { "the default-constructed object. (N5014 [range.utility.conv.to]/2.1.5)"); } } else if constexpr (input_range>) { - const auto _Xform = [](auto&& _Elem) _STATIC_LAMBDA { + const auto _Xform = [](auto&& _Elem) _STATIC_CALL_OPERATOR { return _RANGES to>(_STD forward(_Elem)); }; return _RANGES to<_Container>(views::transform(ref_view{_Range}, _Xform), _STD forward<_Types>(_Args)...); diff --git a/stl/inc/__msvc_ranges_tuple_formatter.hpp b/stl/inc/__msvc_ranges_tuple_formatter.hpp index 50098b0b365..43c6c51b5b7 100644 --- a/stl/inc/__msvc_ranges_tuple_formatter.hpp +++ b/stl/inc/__msvc_ranges_tuple_formatter.hpp @@ -426,7 +426,7 @@ auto _Format_arg_traits<_Context>::_Type_eraser() { return basic_string_view<_Char_type>{}; } else if constexpr (_Is_any_of_v, _Char_type*, const _Char_type*>) { return static_cast(nullptr); - } else if constexpr (is_void_v> || is_same_v<_Td, nullptr_t>) { + } else if constexpr (is_void_v> || is_null_pointer_v<_Td>) { return static_cast(nullptr); } else { int _Dummy{}; diff --git a/stl/inc/__msvc_string_view.hpp b/stl/inc/__msvc_string_view.hpp index bd8105e0815..587f09a142c 100644 --- a/stl/inc/__msvc_string_view.hpp +++ b/stl/inc/__msvc_string_view.hpp @@ -96,7 +96,7 @@ size_t _Find_first_of_pos_vectorized(const _Ty1* const _Haystack, const size_t _ } else if constexpr (sizeof(_Ty1) == 8) { return ::__std_find_first_of_trivial_pos_8(_Haystack, _Haystack_length, _Needle, _Needle_length); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND_FIRST_OF ^^^ @@ -111,7 +111,7 @@ size_t _Find_last_of_pos_vectorized(const _Ty1* const _Haystack, const size_t _H } else if constexpr (sizeof(_Ty1) == 2) { return ::__std_find_last_of_trivial_pos_2(_Haystack, _Haystack_length, _Needle, _Needle_length); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND_LAST_OF ^^^ @@ -128,7 +128,7 @@ const _Ty* _Find_not_ch_vectorized(const _Ty* const _First, const _Ty* const _La } else if constexpr (sizeof(_Ty) == 8) { return static_cast(::__std_find_not_ch_8(_First, _Last, static_cast(_Ch))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND ^^^ @@ -145,7 +145,7 @@ size_t _Find_last_not_ch_pos_vectorized(const _Ty* const _First, const _Ty* cons } else if constexpr (sizeof(_Ty) == 8) { return ::__std_find_last_not_ch_pos_8(_First, _Last, static_cast(_Ch)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND_LAST ^^^ @@ -160,7 +160,7 @@ size_t _Find_first_not_of_pos_vectorized(const _Ty1* const _Haystack, const size } else if constexpr (sizeof(_Ty1) == 2) { return ::__std_find_first_not_of_trivial_pos_2(_Haystack, _Haystack_length, _Needle, _Needle_length); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND_FIRST_OF ^^^ @@ -175,7 +175,7 @@ size_t _Find_last_not_of_pos_vectorized(const _Ty1* const _Haystack, const size_ } else if constexpr (sizeof(_Ty1) == 2) { return ::__std_find_last_not_of_trivial_pos_2(_Haystack, _Haystack_length, _Needle, _Needle_length); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND_LAST_OF ^^^ @@ -1961,9 +1961,7 @@ namespace ranges { template constexpr bool enable_borrowed_range> = true; } // namespace ranges -#endif // _HAS_CXX20 -#if _HAS_CXX20 _EXPORT_STD template _NODISCARD constexpr bool operator==(const basic_string_view<_Elem, _Traits> _Lhs, const type_identity_t> _Rhs) noexcept { diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 8e135290435..3fc1b239309 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -172,7 +172,7 @@ _Ty1* _Find_first_of_vectorized( return const_cast<_Ty1*>( static_cast(::__std_find_first_of_trivial_8(_First1, _Last1, _First2, _Last2))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND_FIRST_OF ^^^ @@ -189,7 +189,7 @@ __declspec(noalias) void _Reverse_copy_vectorized(const void* _First, const void } else if constexpr (_Nx == 8) { ::__std_reverse_copy_trivially_copyable_8(_First, _Last, _Dest); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_REVERSE_COPY ^^^ @@ -214,7 +214,7 @@ pair<_Ty*, _Ty*> _Minmax_element_vectorized(_Ty* const _First, _Ty* const _Last) } else if constexpr (sizeof(_Ty) == 8) { _Res = ::__std_minmax_element_8(_First, _Last, _Signed); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } return {const_cast<_Ty*>(static_cast(_Res._Min)), const_cast<_Ty*>(static_cast(_Res._Max))}; @@ -262,7 +262,7 @@ auto _Minmax_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { return ::__std_minmax_8u(_First, _Last); } } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_MINMAX ^^^ @@ -301,7 +301,7 @@ _Ty* _Is_sorted_until_vectorized(_Ty* const _First, _Ty* const _Last, const bool return const_cast<_Ty*>(static_cast(::__std_is_sorted_until_8u(_First, _Last, _Greater))); } } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_IS_SORTED_UNTIL ^^^ @@ -337,7 +337,7 @@ bool _Includes_vectorized( return ::__std_includes_less_8u(_First1, _Last1, _First2, _Last2); } } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_INCLUDES ^^^ @@ -353,7 +353,7 @@ __declspec(noalias) void _Replace_vectorized( ::__std_replace_8( _First, _Last, _STD _Find_arg_cast(_Old_val), _STD _Find_arg_cast(_New_val)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_REPLACE ^^^ @@ -374,7 +374,7 @@ _Ty* _Search_n_vectorized(_Ty* const _First, _Ty* const _Last, const size_t _Cou return const_cast<_Ty*>( static_cast(::__std_search_n_8(_First, _Last, _Count, _STD _Find_arg_cast(_Val)))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_SEARCH_N ^^^ @@ -391,7 +391,7 @@ _Ty* _Unique_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { } else if constexpr (sizeof(_Ty) == 8) { return reinterpret_cast<_Ty*>(::__std_unique_8(_First, _Last)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // Unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_UNIQUE ^^^ @@ -409,7 +409,7 @@ _Ty* _Remove_copy_vectorized( } else if constexpr (sizeof(_Ty) == 8) { return reinterpret_cast<_Ty*>(::__std_remove_copy_8(_First, _Last, _Dest, _STD _Find_arg_cast(_Val))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // Unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_REMOVE_COPY ^^^ @@ -426,7 +426,7 @@ _Ty* _Unique_copy_vectorized(const _Ty* const _First, const _Ty* const _Last, _T } else if constexpr (sizeof(_Ty) == 8) { return reinterpret_cast<_Ty*>(::__std_unique_copy_8(_First, _Last, _Dest)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // Unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_UNIQUE_COPY ^^^ @@ -749,8 +749,7 @@ namespace ranges { _EXPORT_STD template using for_each_n_result = in_fun_result<_In, _Fun>; - class _For_each_n_fn { - public: + struct _For_each_n_fn { template > _Fn> _STATIC_CALL_OPERATOR constexpr for_each_n_result<_It, _Fn> operator()( _It _First, iter_difference_t<_It> _Count, _Fn _Func, _Pj _Proj = {}) _CONST_CALL_OPERATOR { @@ -1754,8 +1753,7 @@ namespace ranges { _EXPORT_STD inline constexpr _None_of_fn none_of; #if _HAS_CXX23 - class _Contains_fn { - public: + struct _Contains_fn { template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( @@ -1778,8 +1776,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Contains_fn contains; - class _Contains_subrange_fn { - public: + struct _Contains_subrange_fn { template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> @@ -1819,8 +1816,7 @@ namespace ranges { _EXPORT_STD template using copy_n_result = in_out_result<_In, _Out>; - class _Copy_n_fn { - public: + struct _Copy_n_fn { template requires indirectly_copyable<_It, _Out> _STATIC_CALL_OPERATOR constexpr copy_n_result<_It, _Out> operator()( @@ -1854,8 +1850,7 @@ namespace ranges { _EXPORT_STD template using copy_backward_result = in_out_result<_In, _Out>; - class _Copy_backward_fn { - public: + struct _Copy_backward_fn { template _Se1, bidirectional_iterator _It2> requires indirectly_copyable<_It1, _It2> _STATIC_CALL_OPERATOR constexpr copy_backward_result<_It1, _It2> operator()( @@ -1993,8 +1988,7 @@ namespace ranges { return {_STD move(_First), _STD move(_Output)}; } - class _Move_fn { - public: + struct _Move_fn { template _Se, weakly_incrementable _Out> requires indirectly_movable<_It, _Out> _STATIC_CALL_OPERATOR constexpr move_result<_It, _Out> operator()( @@ -2048,8 +2042,7 @@ namespace ranges { return _Output; } - class _Move_backward_fn { - public: + struct _Move_backward_fn { template _Se1, bidirectional_iterator _It2> requires indirectly_movable<_It1, _It2> _STATIC_CALL_OPERATOR constexpr move_backward_result<_It1, _It2> operator()( @@ -2844,8 +2837,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Search_n_fn search_n; #if _HAS_CXX23 - class _Starts_with_fn { - public: + struct _Starts_with_fn { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> @@ -3203,8 +3195,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Fold_left_with_iter_fn fold_left_with_iter; - class _Fold_left_fn { - public: + struct _Fold_left_fn { template _Se, class _Ty, _Indirectly_binary_left_foldable<_Ty, _It> _Fn> _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( _It _First, _Se _Last, _Ty _Init, _Fn _Func) _CONST_CALL_OPERATOR { @@ -3270,8 +3261,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Fold_left_first_with_iter_fn fold_left_first_with_iter; - class _Fold_left_first_fn { - public: + struct _Fold_left_first_fn { template _Se, _Indirectly_binary_left_foldable, _It> _Fn> requires constructible_from, iter_reference_t<_It>> @@ -3308,8 +3298,7 @@ namespace ranges { } } - class _Fold_right_fn { - public: + struct _Fold_right_fn { template _Se, class _Ty, _Indirectly_binary_right_foldable<_Ty, _It> _Fn> _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( @@ -4109,8 +4098,7 @@ namespace ranges { return {_STD move(_First1), _STD move(_First2)}; } - class _Swap_ranges_fn { - public: + struct _Swap_ranges_fn { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2> requires indirectly_swappable<_It1, _It2> _STATIC_CALL_OPERATOR constexpr swap_ranges_result<_It1, _It2> operator()( @@ -4800,8 +4788,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Replace_copy_if_fn replace_copy_if; - class _Fill_fn { - public: + struct _Fill_fn { template _It, sentinel_for<_It> _Se> _STATIC_CALL_OPERATOR constexpr _It operator()(_It _First, _Se _Last, const _Ty& _Value) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); @@ -4885,8 +4872,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Generate_fn generate; - class _Generate_n_fn { - public: + struct _Generate_n_fn { template requires invocable<_Fn&> && indirectly_writable<_Out, invoke_result_t<_Fn&>> _STATIC_CALL_OPERATOR constexpr _Out operator()( @@ -5725,8 +5711,7 @@ namespace ranges { } } - class _Reverse_fn { - public: + struct _Reverse_fn { template _Se> requires permutable<_It> _STATIC_CALL_OPERATOR constexpr _It operator()(_It _First, _Se _Last) _CONST_CALL_OPERATOR { @@ -5982,8 +5967,7 @@ namespace ranges { } } - class _Rotate_fn { - public: + struct _Rotate_fn { template _Se> _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()(_It _First, _It _Mid, _Se _Last) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Mid); @@ -7544,8 +7528,7 @@ namespace ranges { _RANGES _Pop_heap_hole_unchecked(_STD move(_First), _Last, _Last, _STD move(_Val), _Pred, _Proj, _Proj); } - class _Pop_heap_fn { - public: + struct _Pop_heap_fn { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -7591,8 +7574,7 @@ namespace ranges { } } - class _Make_heap_fn { - public: + struct _Make_heap_fn { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -7716,8 +7698,7 @@ namespace ranges { return _First + _Off; } - class _Is_heap_fn { - public: + struct _Is_heap_fn { template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( @@ -7744,8 +7725,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Is_heap_fn is_heap; - class _Is_heap_until_fn { - public: + struct _Is_heap_until_fn { template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -7811,8 +7791,7 @@ namespace ranges { } } - class _Sort_heap_fn { - public: + struct _Sort_heap_fn { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -7866,8 +7845,7 @@ namespace ranges { return _First; } - class _Lower_bound_fn { - public: + struct _Lower_bound_fn { template _Se, class _Ty, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -7917,8 +7895,7 @@ namespace ranges { return _First; } - class _Upper_bound_fn { - public: + struct _Upper_bound_fn { template _Se, class _Ty, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -8071,8 +8048,7 @@ _NODISCARD _CONSTEXPR20 bool binary_search(_FwdIt _First, _FwdIt _Last, const _T #if _HAS_CXX20 namespace ranges { - class _Binary_search_fn { - public: + struct _Binary_search_fn { template _Se, class _Ty, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( @@ -11824,8 +11800,7 @@ _NODISCARD bool is_sorted(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last) noexcept / #if _HAS_CXX20 namespace ranges { - class _Is_sorted_fn { - public: + struct _Is_sorted_fn { template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( @@ -11850,8 +11825,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Is_sorted_fn is_sorted; - class _Is_sorted_until_fn { - public: + struct _Is_sorted_until_fn { template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -11914,8 +11888,7 @@ _NODISCARD constexpr const _Ty& clamp(const _Ty& _Val _MSVC_LIFETIMEBOUND, const #if _HAS_CXX20 namespace ranges { - class _Clamp_fn { - public: + struct _Clamp_fn { template > _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr const _Ty& operator()(const _Ty& _Val _MSVC_LIFETIMEBOUND, diff --git a/stl/inc/atomic b/stl/inc/atomic index a644eb571dc..831e2654d94 100644 --- a/stl/inc/atomic +++ b/stl/inc/atomic @@ -16,10 +16,11 @@ #include #include #include +#include + #if _HAS_CXX20 #include #endif // _HAS_CXX20 -#include #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -129,7 +130,7 @@ extern "C" inline void _Check_memory_order(const unsigned int _Order) noexcept { _Result = _Intrinsic(__VA_ARGS__); \ break; \ } -#endif // hardware +#endif // ^^^ defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_HYBRID_X86_ARM64) ^^^ #if _STD_ATOMIC_USE_ARM64_LDAR_STLR == 1 @@ -175,9 +176,9 @@ extern "C" inline void _Check_memory_order(const unsigned int _Order) noexcept { #else // ^^^ x86 / x64 vvv #define _ATOMIC_STORE_64_SEQ_CST(_Ptr, _Desired) _ATOMIC_STORE_SEQ_CST_X86_X64(64, (_Ptr), (_Desired)) #endif // ^^^ x64 ^^^ -#else // ^^^ x86/x64 / Unsupported hardware vvv -#error "Unsupported hardware" -#endif // ^^^ Unsupported hardware ^^^ +#else // ^^^ x86/x64 / unknown architecture vvv +#error Unknown architecture +#endif // ^^^ unknown architecture ^^^ #pragma warning(push) #pragma warning(disable : 6001) // "Using uninitialized memory '_Guard'" @@ -205,9 +206,9 @@ extern "C" inline void _Atomic_thread_fence(const unsigned int _Order) noexcept } else { _Memory_barrier(); } -#else // ^^^ ARM64/ARM64EC/HYBRID_X86_ARM64 / unsupported hardware vvv -#error Unsupported hardware -#endif // ^^^ unsupported hardware ^^^ +#else // ^^^ ARM64/ARM64EC/HYBRID_X86_ARM64 / unknown architecture vvv +#error Unknown architecture +#endif // ^^^ unknown architecture ^^^ } #pragma warning(pop) @@ -228,7 +229,7 @@ _Smtx_t* __stdcall __std_atomic_get_mutex(const void* _Key) noexcept; _STD_BEGIN #if _CMPXCHG_MASK_OUT_PADDING_BITS struct _Form_mask_t {}; -_INLINE_VAR constexpr _Form_mask_t _Form_mask{}; +inline constexpr _Form_mask_t _Form_mask{}; #endif // _CMPXCHG_MASK_OUT_PADDING_BITS template @@ -472,9 +473,9 @@ inline void _Atomic_lock_acquire(long& _Spinlock) noexcept { __yield(); } } -#else // ^^^ defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_HYBRID_X86_ARM64) ^^^ -#error Unsupported hardware -#endif +#else // ^^^ defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_HYBRID_X86_ARM64) / unknown architecture vvv +#error Unknown architecture +#endif // ^^^ unknown architecture ^^^ } inline void _Atomic_lock_release(long& _Spinlock) noexcept { diff --git a/stl/inc/bit b/stl/inc/bit index 94a5cedd990..4f7e6bdda87 100644 --- a/stl/inc/bit +++ b/stl/inc/bit @@ -71,7 +71,7 @@ _NODISCARD constexpr _Ty byteswap(const _Ty _Val) noexcept { } else if constexpr (sizeof(_Ty) == 8) { return static_cast<_Ty>(_Byteswap_uint64(static_cast(_Val))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false); // unexpected size } } #endif // _HAS_CXX23 diff --git a/stl/inc/charconv b/stl/inc/charconv index 581f194c8cb..84b87511b61 100644 --- a/stl/inc/charconv +++ b/stl/inc/charconv @@ -2295,7 +2295,6 @@ _NODISCARD to_chars_result _Floating_to_chars_hex_shortest( const _Uint_type _Mask = (_Uint_type{1} << _Number_of_bits_remaining) - 1; _Adjusted_mantissa &= _Mask; - } while (_Adjusted_mantissa != 0); } @@ -2325,7 +2324,7 @@ _NODISCARD to_chars_result _Floating_to_chars_hex_shortest( } template -_NODISCARD inline to_chars_result _Floating_to_chars_general_precision( +_NODISCARD to_chars_result _Floating_to_chars_general_precision( char* _First, char* const _Last, const _Floating _Value, int _Precision) noexcept { using _Traits = _Floating_type_traits<_Floating>; diff --git a/stl/inc/chrono b/stl/inc/chrono index 3d3a84ade9b..502f75a2ffa 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -2118,8 +2118,8 @@ namespace chrono { template _NODISCARD const _Ty* _Locate_zone_impl(const vector<_Ty>& _Vec, string_view _Name) { // N5008 [time.zone.db.tzdb]/1: "Each vector in a tzdb object is sorted to enable fast lookup." - const auto _Result = _STD lower_bound( - _Vec.begin(), _Vec.end(), _Name, [](const auto& _Tz, const auto& _Sv) { return _Tz.name() < _Sv; }); + const auto _Result = _STD lower_bound(_Vec.begin(), _Vec.end(), _Name, + [](const auto& _Tz, const auto& _Sv) _STATIC_CALL_OPERATOR { return _Tz.name() < _Sv; }); if (_Result != _Vec.end() && _Result->name() == _Name) { return &*_Result; } else { @@ -2174,7 +2174,7 @@ namespace chrono { return {_Info->_Version, _STD move(_Time_zones), _STD move(_Time_zone_links)}; } - _NODISCARD inline pair _Tzdb_generate_leap_seconds(const size_t _Current_size) { + _NODISCARD inline pair, bool> _Tzdb_generate_leap_seconds(const size_t _Current_size) { // Returns empty vector if no new leap seconds are found. static constexpr leap_second _Known_leap_seconds[]{ {sys_seconds{seconds{78796800}}, true, seconds{0}}, @@ -2225,7 +2225,7 @@ namespace chrono { } const size_t _New_size = _Pre_2018_count + _Reg_post_2018_ls_size; // total size with registry data - decltype(tzdb::leap_seconds) _Leap_sec_info; + vector _Leap_sec_info; bool _All_ls_positive = true; if (_New_size > _Current_size) { @@ -3095,7 +3095,7 @@ namespace chrono { static_assert(false, "A three-step clock time conversion is required to be unique, " "either utc-to-system or system-to-utc, but not both (N4950 [time.clock.cast.fn]/2)."); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } @@ -5452,7 +5452,7 @@ namespace chrono { } else if constexpr (_Is_specialization_v<_Ty, _Local_time_format_t>) { return _Type == 'z' || _Type == 'Z' || _Is_valid_type(_Type); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected type + static_assert(false); // unexpected type } } diff --git a/stl/inc/cmath b/stl/inc/cmath index 011068fd0f2..78e0d7cb959 100644 --- a/stl/inc/cmath +++ b/stl/inc/cmath @@ -1425,14 +1425,12 @@ _EXPORT_STD _NODISCARD inline long double sph_bessell(const unsigned int _Arg1, } _EXPORT_STD _NODISCARD inline double sph_legendre( - const unsigned int _Arg1, const unsigned int _Arg2, const double _Theta) noexcept -/* strengthened */ { + const unsigned int _Arg1, const unsigned int _Arg2, const double _Theta) noexcept /* strengthened */ { return __std_smf_sph_legendre(_Arg1, _Arg2, _Theta); } _EXPORT_STD _NODISCARD inline float sph_legendref( - const unsigned int _Arg1, const unsigned int _Arg2, const float _Theta) noexcept -/* strengthened */ { + const unsigned int _Arg1, const unsigned int _Arg2, const float _Theta) noexcept /* strengthened */ { return __std_smf_sph_legendref(_Arg1, _Arg2, _Theta); } diff --git a/stl/inc/compare b/stl/inc/compare index 09554ea1511..12edfacf18e 100644 --- a/stl/inc/compare +++ b/stl/inc/compare @@ -460,7 +460,7 @@ namespace _Strong_order { } else if constexpr (_Strat == _St::_Three) { return static_cast(compare_three_way{}(_Left, _Right)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -586,7 +586,7 @@ namespace _Weak_order { return static_cast( static_cast(strong_order(_Left, _Right))); // intentional ADL } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -671,7 +671,7 @@ namespace _Partial_order { return static_cast( static_cast(strong_order(_Left, _Right))); // intentional ADL } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -727,7 +727,7 @@ namespace _Compare_strong_order_fallback { : _Left < _Right ? strong_ordering::less : strong_ordering::greater; } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -777,7 +777,7 @@ namespace _Compare_weak_order_fallback { : _Left < _Right ? weak_ordering::less : weak_ordering::greater; } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -836,7 +836,7 @@ namespace _Compare_partial_order_fallback { : _Right < _Left ? partial_ordering::greater : partial_ordering::unordered; } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; diff --git a/stl/inc/complex b/stl/inc/complex index efdf25d1bd7..acd727f40c6 100644 --- a/stl/inc/complex +++ b/stl/inc/complex @@ -191,18 +191,13 @@ namespace _Float_multi_prec { const double _Prod0 = _Xval * _Xval; #if defined(_FMP_USING_X86_X64_INTRINSICS) - -#ifdef __AVX2__ - return {_Prod0, _Sqr_error_x86_x64_fma(_Xval, _Prod0)}; -#else // ^^^ defined(__AVX2__) / !defined(__AVX2__) vvv +#ifndef __AVX2__ const bool _Definitely_have_fma = __isa_available >= _Stl_isa_available_avx2; - if (_Definitely_have_fma) { - return {_Prod0, _Sqr_error_x86_x64_fma(_Xval, _Prod0)}; - } else { + if (!_Definitely_have_fma) { return {_Prod0, _Sqr_error_fallback(_Xval, _Prod0)}; } #endif // ^^^ !defined(__AVX2__) ^^^ - + return {_Prod0, _Sqr_error_x86_x64_fma(_Xval, _Prod0)}; #elif defined(_FMP_USING_STD_FMA) return {_Prod0, _Sqr_error_std_fma(_Xval, _Prod0)}; #else // ^^^ defined(_FMP_USING_STD_FMA) / not using intrinsics vvv diff --git a/stl/inc/condition_variable b/stl/inc/condition_variable index 44d381e4150..5fbad3755cd 100644 --- a/stl/inc/condition_variable +++ b/stl/inc/condition_variable @@ -16,6 +16,7 @@ #include #include #include + #if _HAS_CXX20 #include #endif // _HAS_CXX20 diff --git a/stl/inc/ctime b/stl/inc/ctime index 5a33180dc43..f046800e77c 100644 --- a/stl/inc/ctime +++ b/stl/inc/ctime @@ -37,42 +37,41 @@ _EXPORT_STD using _CSTD timespec; _STL_DISABLE_DEPRECATED_WARNING _EXPORT_STD template -_Check_return_ _CRT_INSECURE_DEPRECATE(ctime_s) inline char* __CRTDECL ctime(_In_ const time_t* const _Time) noexcept -/* strengthened */ { +_Check_return_ _CRT_INSECURE_DEPRECATE(ctime_s) +char* __CRTDECL ctime(_In_ const time_t* const _Time) noexcept /* strengthened */ { return _CSTD _ctime64(_Time); } _EXPORT_STD template -_Check_return_ inline double __CRTDECL difftime(_In_ const time_t _Time1, _In_ const time_t _Time2) noexcept +_Check_return_ double __CRTDECL difftime(_In_ const time_t _Time1, _In_ const time_t _Time2) noexcept /* strengthened */ { return _CSTD _difftime64(_Time1, _Time2); } _EXPORT_STD template -_Check_return_ _CRT_INSECURE_DEPRECATE(gmtime_s) inline tm* __CRTDECL gmtime(_In_ const time_t* const _Time) noexcept -/* strengthened */ { +_Check_return_ _CRT_INSECURE_DEPRECATE(gmtime_s) +tm* __CRTDECL gmtime(_In_ const time_t* const _Time) noexcept /* strengthened */ { return _CSTD _gmtime64(_Time); } _EXPORT_STD template _CRT_INSECURE_DEPRECATE(localtime_s) -inline tm* __CRTDECL localtime(_In_ const time_t* const _Time) noexcept /* strengthened */ { +tm* __CRTDECL localtime(_In_ const time_t* const _Time) noexcept /* strengthened */ { return _CSTD _localtime64(_Time); } _EXPORT_STD template -_Check_return_opt_ inline time_t __CRTDECL mktime(_Inout_ tm* const _Tm) noexcept /* strengthened */ { +_Check_return_opt_ time_t __CRTDECL mktime(_Inout_ tm* const _Tm) noexcept /* strengthened */ { return _CSTD _mktime64(_Tm); } _EXPORT_STD template -inline time_t __CRTDECL time(_Out_opt_ time_t* const _Time) noexcept /* strengthened */ { +time_t __CRTDECL time(_Out_opt_ time_t* const _Time) noexcept /* strengthened */ { return _CSTD _time64(_Time); } _EXPORT_STD template -_Check_return_ inline int __CRTDECL timespec_get(_Out_ timespec* const _Ts, _In_ const int _Base) noexcept -/* strengthened */ { +_Check_return_ int __CRTDECL timespec_get(_Out_ timespec* const _Ts, _In_ const int _Base) noexcept /* strengthened */ { return _CSTD _timespec64_get(reinterpret_cast<_timespec64*>(_Ts), _Base); } diff --git a/stl/inc/exception b/stl/inc/exception index 9cf770faff2..b7bac0003b9 100644 --- a/stl/inc/exception +++ b/stl/inc/exception @@ -68,6 +68,16 @@ _STD_END #pragma push_macro("stdext") #undef stdext +#define _STDEXT_BEGIN \ + _EXTERN_CXX_WORKAROUND \ + namespace stdext { + +#define _STDEXT_END \ + } \ + _END_EXTERN_CXX_WORKAROUND + +#define _STDEXT ::stdext:: + _STDEXT_BEGIN class _NODISCARD exception; _STDEXT_END @@ -203,6 +213,10 @@ _EXPORT_STD using _STDEXT bad_exception; _STD_END +#undef _STDEXT_BEGIN +#undef _STDEXT_END +#undef _STDEXT + #pragma pop_macro("stdext") #endif // ^^^ !_HAS_EXCEPTIONS ^^^ diff --git a/stl/inc/execution b/stl/inc/execution index fec07dbbdf2..ef98365372e 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -4464,13 +4464,13 @@ struct _Static_partitioned_exclusive_scan3 { } const auto _Chunk_number = _Key._Chunk_number; - const auto _In_range = _Basis1._Get_chunk(_Key); + const auto _In_rng = _Basis1._Get_chunk(_Key); const auto _Dest = _Basis2._Get_first(_Chunk_number, _Team._Get_chunk_offset(_Chunk_number)); // Run local exclusive_scan on this chunk const auto _Chunk = _Lookback.data() + static_cast(_Chunk_number); if (_Chunk_number == 0) { // chunk 0 is special as it has no predecessor; its local and total sums are the same _STD _Exclusive_scan_per_chunk_complete( - _In_range._First, _In_range._Last, _Dest, _Reduce_op, _Chunk->_Sum._Ref(), _Initial); + _In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Chunk->_Sum._Ref(), _Initial); _Chunk->_Store_available_state(_Sum_available); return _Cancellation_status::_Running; } @@ -4479,13 +4479,13 @@ struct _Static_partitioned_exclusive_scan3 { if (_Prev_chunk->_State.load() & _Sum_available) { // if predecessor sum already complete, we can incorporate its value directly for 1 pass _STD _Exclusive_scan_per_chunk_complete( - _In_range._First, _In_range._Last, _Dest, _Reduce_op, _Chunk->_Sum._Ref(), _Prev_chunk->_Sum._Ref()); + _In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Chunk->_Sum._Ref(), _Prev_chunk->_Sum._Ref()); _Chunk->_Store_available_state(_Sum_available); return _Cancellation_status::_Running; } // Calculate local sum and publish to other threads - const auto _Last = _STD _Exclusive_scan_per_chunk(_In_range._First, _In_range._Last, _Dest, _Reduce_op, + const auto _Last = _STD _Exclusive_scan_per_chunk(_In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Chunk->_Local._Ref(), _Intermediate_result[_Chunk_number]); _Chunk->_Store_available_state(_Local_available); @@ -4606,13 +4606,13 @@ struct _Static_partitioned_inclusive_scan3 { } const auto _Chunk_number = _Key._Chunk_number; - const auto _In_range = _Basis1._Get_chunk(_Key); + const auto _In_rng = _Basis1._Get_chunk(_Key); const auto _Dest = _Basis2._Get_first(_Chunk_number, _Team._Get_chunk_offset(_Chunk_number)); // Run local inclusive_scan on this chunk const auto _Chunk = _Lookback.data() + static_cast(_Chunk_number); if (_Chunk_number == 0) { // chunk 0 is special as it has no predecessor; its local and total sums are the same _STD _Inclusive_scan_per_chunk( - _In_range._First, _In_range._Last, _Dest, _Reduce_op, _Chunk->_Sum._Ref(), _STD move(_Initial)); + _In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Chunk->_Sum._Ref(), _STD move(_Initial)); _Chunk->_Store_available_state(_Sum_available); return _Cancellation_status::_Running; } @@ -4621,13 +4621,13 @@ struct _Static_partitioned_inclusive_scan3 { if (_Prev_chunk->_State.load() & _Sum_available) { // if predecessor sum already complete, we can incorporate its value directly for 1 pass _STD _Inclusive_scan_per_chunk( - _In_range._First, _In_range._Last, _Dest, _Reduce_op, _Chunk->_Sum._Ref(), _Prev_chunk->_Sum._Ref()); + _In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Chunk->_Sum._Ref(), _Prev_chunk->_Sum._Ref()); _Chunk->_Store_available_state(_Sum_available); return _Cancellation_status::_Running; } // Calculate local sum and publish to other threads - const auto _Last = _STD _Inclusive_scan_per_chunk(_In_range._First, _In_range._Last, _Dest, _Reduce_op, + const auto _Last = _STD _Inclusive_scan_per_chunk(_In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Chunk->_Local._Ref(), _No_init_tag{}, _Intermediate_result[_Chunk_number]); _Chunk->_Store_available_state(_Local_available); @@ -4809,13 +4809,13 @@ struct _Static_partitioned_transform_exclusive_scan3 { } const auto _Chunk_number = _Key._Chunk_number; - const auto _In_range = _Basis1._Get_chunk(_Key); + const auto _In_rng = _Basis1._Get_chunk(_Key); const auto _Dest = _Basis2._Get_first(_Chunk_number, _Team._Get_chunk_offset(_Chunk_number)); // Run local transform_exclusive_scan on this chunk const auto _Chunk = _Lookback.data() + static_cast(_Chunk_number); if (_Chunk_number == 0) { // chunk 0 is special as it has no predecessor; its local and total sums are the same _STD _Transform_exclusive_scan_per_chunk_complete( - _In_range._First, _In_range._Last, _Dest, _Reduce_op, _Transform_op, _Chunk->_Sum._Ref(), _Initial); + _In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Transform_op, _Chunk->_Sum._Ref(), _Initial); _Chunk->_Store_available_state(_Sum_available); return _Cancellation_status::_Running; } @@ -4823,15 +4823,15 @@ struct _Static_partitioned_transform_exclusive_scan3 { const auto _Prev_chunk = _STD _Prev_iter(_Chunk); if (_Prev_chunk->_State.load() & _Sum_available) { // if predecessor sum already complete, we can incorporate its value directly for 1 pass - _STD _Transform_exclusive_scan_per_chunk_complete(_In_range._First, _In_range._Last, _Dest, _Reduce_op, + _STD _Transform_exclusive_scan_per_chunk_complete(_In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Transform_op, _Chunk->_Sum._Ref(), _Prev_chunk->_Sum._Ref()); _Chunk->_Store_available_state(_Sum_available); return _Cancellation_status::_Running; } // Calculate local sum and publish to other threads - const auto _Last = _STD _Transform_exclusive_scan_per_chunk(_In_range._First, _In_range._Last, _Dest, - _Reduce_op, _Transform_op, _Chunk->_Local._Ref(), _Intermediate_result[_Chunk_number]); + const auto _Last = _STD _Transform_exclusive_scan_per_chunk(_In_rng._First, _In_rng._Last, _Dest, _Reduce_op, + _Transform_op, _Chunk->_Local._Ref(), _Intermediate_result[_Chunk_number]); _Chunk->_Store_available_state(_Local_available); // Apply the predecessor overall sum to current overall sum and elements @@ -4953,13 +4953,13 @@ struct _Static_partitioned_transform_inclusive_scan3 { } const auto _Chunk_number = _Key._Chunk_number; - const auto _In_range = _Basis1._Get_chunk(_Key); + const auto _In_rng = _Basis1._Get_chunk(_Key); const auto _Dest = _Basis2._Get_first(_Chunk_number, _Team._Get_chunk_offset(_Chunk_number)); // Run local transform_inclusive_scan on this chunk const auto _Chunk = _Lookback.data() + static_cast(_Chunk_number); if (_Chunk_number == 0) { // chunk 0 is special as it has no predecessor; its local and total sums are the same - _STD _Transform_inclusive_scan_per_chunk(_In_range._First, _In_range._Last, _Dest, _Reduce_op, - _Transform_op, _Chunk->_Sum._Ref(), _STD move(_Initial)); + _STD _Transform_inclusive_scan_per_chunk(_In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Transform_op, + _Chunk->_Sum._Ref(), _STD move(_Initial)); _Chunk->_Store_available_state(_Sum_available); return _Cancellation_status::_Running; } @@ -4967,15 +4967,15 @@ struct _Static_partitioned_transform_inclusive_scan3 { const auto _Prev_chunk = _STD _Prev_iter(_Chunk); if (_Prev_chunk->_State.load() & _Sum_available) { // if predecessor sum already complete, we can incorporate its value directly for 1 pass - _STD _Transform_inclusive_scan_per_chunk(_In_range._First, _In_range._Last, _Dest, _Reduce_op, - _Transform_op, _Chunk->_Sum._Ref(), _Prev_chunk->_Sum._Ref()); + _STD _Transform_inclusive_scan_per_chunk(_In_rng._First, _In_rng._Last, _Dest, _Reduce_op, _Transform_op, + _Chunk->_Sum._Ref(), _Prev_chunk->_Sum._Ref()); _Chunk->_Store_available_state(_Sum_available); return _Cancellation_status::_Running; } // Calculate local sum and publish to other threads - const auto _Last = _STD _Transform_inclusive_scan_per_chunk(_In_range._First, _In_range._Last, _Dest, - _Reduce_op, _Transform_op, _Chunk->_Local._Ref(), _No_init_tag{}, _Intermediate_result[_Chunk_number]); + const auto _Last = _STD _Transform_inclusive_scan_per_chunk(_In_rng._First, _In_rng._Last, _Dest, _Reduce_op, + _Transform_op, _Chunk->_Local._Ref(), _No_init_tag{}, _Intermediate_result[_Chunk_number]); _Chunk->_Store_available_state(_Local_available); // Apply the predecessor overall sum to current overall sum and elements @@ -5114,15 +5114,15 @@ struct _Static_partitioned_adjacent_difference2 { } const auto _Chunk_number = _Key._Chunk_number; - auto _In_range = _Basis1._Get_chunk(_Key); + auto _In_rng = _Basis1._Get_chunk(_Key); auto _Dest = _Basis2._Get_first(_Chunk_number, _Team._Get_chunk_offset(_Chunk_number)); - auto _Next = _In_range._First; + auto _Next = _In_rng._First; do { ++_Next; // note: steps 1 element into the following chunk - *_Dest = _Diff_op(*_Next, *_In_range._First); + *_Dest = _Diff_op(*_Next, *_In_rng._First); ++_Dest; - _In_range._First = _Next; - } while (_In_range._First != _In_range._Last); + _In_rng._First = _Next; + } while (_In_rng._First != _In_rng._Last); return _Cancellation_status::_Running; } diff --git a/stl/inc/experimental/coroutine b/stl/inc/experimental/coroutine index b0cc97a12bb..1ae46b73662 100644 --- a/stl/inc/experimental/coroutine +++ b/stl/inc/experimental/coroutine @@ -10,13 +10,14 @@ #include #if _STL_COMPILER_PREPROCESSOR +#include #include #include +#include + #if _HAS_EXCEPTIONS #include #endif -#include -#include #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) diff --git a/stl/inc/experimental/generator b/stl/inc/experimental/generator index f4ce453422f..aa03c72c228 100644 --- a/stl/inc/experimental/generator +++ b/stl/inc/experimental/generator @@ -11,6 +11,7 @@ #ifdef _CPPUNWIND #include #endif + #include #ifdef __clang__ diff --git a/stl/inc/experimental/resumable b/stl/inc/experimental/resumable index e80dcd11b6f..9195e6c22c3 100644 --- a/stl/inc/experimental/resumable +++ b/stl/inc/experimental/resumable @@ -9,14 +9,15 @@ #define _EXPERIMENTAL_RESUMABLE_ #include #if _STL_COMPILER_PREPROCESSOR +#include +#include #include #include +#include + #if _HAS_EXCEPTIONS #include #endif -#include -#include -#include #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) diff --git a/stl/inc/filesystem b/stl/inc/filesystem index 9213863b630..7e856e50d53 100644 --- a/stl/inc/filesystem +++ b/stl/inc/filesystem @@ -3394,8 +3394,7 @@ namespace filesystem { } _EXPORT_STD inline bool copy_file( - const path& _From, const path& _To, const copy_options _Options, error_code& _Ec) noexcept - /* strengthened */ { + const path& _From, const path& _To, const copy_options _Options, error_code& _Ec) noexcept /* strengthened */ { // copy a file _From -> _To according to _Options const auto _Result = __std_fs_copy_file(_From.c_str(), _To.c_str(), static_cast<__std_fs_copy_options>(_Options)); diff --git a/stl/inc/functional b/stl/inc/functional index 65ad553b2da..5b5f1747247 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -11,12 +11,14 @@ #include #include #include + #if _HAS_CXX17 #ifdef _LEGACY_CODE_ASSUMES_FUNCTIONAL_INCLUDES_MEMORY #include #endif // defined(_LEGACY_CODE_ASSUMES_FUNCTIONAL_INCLUDES_MEMORY) #include #endif // _HAS_CXX17 + #if _HAS_CXX20 #include #endif // _HAS_CXX20 @@ -2819,7 +2821,7 @@ public: } else if constexpr (_Del == _Deletion_kind::_Normal_array) { delete[] _Ptr; } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } } diff --git a/stl/inc/generator b/stl/inc/generator index 2b870f3952c..6bca2ea3dac 100644 --- a/stl/inc/generator +++ b/stl/inc/generator @@ -15,6 +15,7 @@ _EMIT_STL_WARNING(STL4038, "The contents of are available only with #include #include #include + #ifdef __cpp_lib_byte #include #endif // defined(__cpp_lib_byte) @@ -302,8 +303,8 @@ namespace _Gen_detail { _NODISCARD auto yield_value(_RANGES elements_of<_Rng, _Alloc> _Elem) { using _Nested_awaitable = _Nested_awaitable_provider<_Yielded, void, _Alloc>::_Awaitable; - auto _Lambda = [](allocator_arg_t, _Alloc, _RANGES iterator_t<_Rng> _It, - const _RANGES sentinel_t<_Rng> _Se) -> generator<_Yielded, void, _Alloc> { + auto _Lambda = [](allocator_arg_t, _Alloc, _RANGES iterator_t<_Rng> _It, const _RANGES sentinel_t<_Rng> _Se) + _STATIC_CALL_OPERATOR -> generator<_Yielded, void, _Alloc> { for (; _It != _Se; ++_It) { co_yield static_cast<_Yielded>(*_It); } diff --git a/stl/inc/memory b/stl/inc/memory index 7abee62f027..7f110c0bc5c 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -180,8 +180,7 @@ namespace ranges { _EXPORT_STD template using uninitialized_copy_n_result = in_out_result<_In, _Out>; - class _Uninitialized_copy_n_fn { - public: + struct _Uninitialized_copy_n_fn { template _OSe> requires constructible_from, iter_reference_t<_It>> _STATIC_CALL_OPERATOR uninitialized_copy_n_result<_It, _Out> operator()( @@ -253,8 +252,7 @@ _NoThrowFwdIt uninitialized_move(_ExPo&&, const _FwdIt _First, const _FwdIt _Las #if _HAS_CXX20 namespace ranges { - class _Uninitialized_move_fn { - public: + struct _Uninitialized_move_fn { template _Se, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from, iter_rvalue_reference_t<_It>> @@ -345,8 +343,7 @@ namespace ranges { _EXPORT_STD template using uninitialized_move_n_result = in_out_result<_In, _Out>; - class _Uninitialized_move_n_fn { - public: + struct _Uninitialized_move_n_fn { template _OSe> requires constructible_from, iter_rvalue_reference_t<_It>> _STATIC_CALL_OPERATOR uninitialized_move_n_result<_It, _Out> operator()( @@ -498,8 +495,7 @@ _NoThrowFwdIt uninitialized_fill_n( #if _HAS_CXX20 namespace ranges { - class _Uninitialized_fill_n_fn { - public: + struct _Uninitialized_fill_n_fn { template <_No_throw_forward_iterator _It, class _Ty> requires constructible_from, const _Ty&> _STATIC_CALL_OPERATOR _It operator()( @@ -535,8 +531,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_fill_n_fn uninitialized_fill_n; - class _Construct_at_fn { - public: + struct _Construct_at_fn { template requires requires(_Ty* _Ptr, _Types&&... _Args) { ::new (static_cast(_Ptr)) _Ty(static_cast<_Types &&>(_Args)...); // per LWG-3888 @@ -558,8 +553,7 @@ namespace ranges { requires destructible> _NODISCARD constexpr _It _Destroy_unchecked(_It _First, _Se _Last) noexcept; - class _Destroy_at_fn { - public: + struct _Destroy_at_fn { template _STATIC_CALL_OPERATOR constexpr void operator()(_Ty* const _Location) _CONST_CALL_OPERATOR noexcept { if constexpr (is_array_v<_Ty>) { @@ -607,8 +601,7 @@ namespace ranges { return _First; } - class _Destroy_fn { - public: + struct _Destroy_fn { template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se> requires destructible> _STATIC_CALL_OPERATOR constexpr _It operator()(_It _First, _Se _Last) _CONST_CALL_OPERATOR noexcept { @@ -668,8 +661,7 @@ _NoThrowFwdIt destroy_n(_ExPo&& _Exec, _NoThrowFwdIt _First, _Diff _Count_raw) n #if _HAS_CXX20 namespace ranges { - class _Destroy_n_fn { - public: + struct _Destroy_n_fn { template <_No_throw_input_iterator _It> requires destructible> _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -804,8 +796,7 @@ _NoThrowFwdIt uninitialized_default_construct_n( #if _HAS_CXX20 namespace ranges { - class _Uninitialized_default_construct_n_fn { - public: + struct _Uninitialized_default_construct_n_fn { template <_No_throw_forward_iterator _It> requires default_initializable> _STATIC_CALL_OPERATOR _It operator()(_It _First, iter_difference_t<_It> _Count) _CONST_CALL_OPERATOR { @@ -922,8 +913,7 @@ _NoThrowFwdIt uninitialized_value_construct_n( #if _HAS_CXX20 namespace ranges { - class _Uninitialized_value_construct_n_fn { - public: + struct _Uninitialized_value_construct_n_fn { template <_No_throw_forward_iterator _It> requires default_initializable> _STATIC_CALL_OPERATOR _It operator()(_It _First, iter_difference_t<_It> _Count) _CONST_CALL_OPERATOR { @@ -3532,7 +3522,7 @@ public: template = 0> constexpr unique_ptr() noexcept : _Mypair(_Zero_then_variadic_args_t{}) {} - template > + template > using _Enable_ctor_reset = enable_if_t || _Is_nullptr::value || (is_same_v && is_pointer_v<_Uty> diff --git a/stl/inc/memory_resource b/stl/inc/memory_resource index e98e9724c44..5557d86f0f8 100644 --- a/stl/inc/memory_resource +++ b/stl/inc/memory_resource @@ -553,9 +553,9 @@ namespace pmr { // find the pool from which to allocate a block with size _Bytes and alignment _Align const size_t _Size = (_STD max) (_Bytes + sizeof(void*), _Align); const auto _Log_of_size = static_cast(_Ceiling_of_log_2(_Size)); - return { - _STD lower_bound(_Pools.begin(), _Pools.end(), _Log_of_size, - [](const _Pool& _Al, const unsigned char _Log) _STATIC_LAMBDA { return _Al._Log_of_size < _Log; }), + return {_STD lower_bound(_Pools.begin(), _Pools.end(), _Log_of_size, + [](const _Pool& _Al, const unsigned char _Log) + _STATIC_CALL_OPERATOR { return _Al._Log_of_size < _Log; }), _Log_of_size}; } diff --git a/stl/inc/mutex b/stl/inc/mutex index 0deda247d62..bebb43c264e 100644 --- a/stl/inc/mutex +++ b/stl/inc/mutex @@ -471,7 +471,7 @@ public: : _MyMutexes(_Mtxes...) {} // construct but don't lock ~scoped_lock() noexcept { - _STD apply([](_Mutexes&... _Mtxes) _STATIC_LAMBDA { (..., (void) _Mtxes.unlock()); }, _MyMutexes); + _STD apply([](_Mutexes&... _Mtxes) _STATIC_CALL_OPERATOR { (..., (void) _Mtxes.unlock()); }, _MyMutexes); } scoped_lock(const scoped_lock&) = delete; diff --git a/stl/inc/new b/stl/inc/new index fa39008b308..02401e9b5dc 100644 --- a/stl/inc/new +++ b/stl/inc/new @@ -40,9 +40,9 @@ _NODISCARD_LAUNDER constexpr _Ty* launder(_Ty* _Ptr) noexcept { #if defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) _EXPORT_STD inline constexpr size_t hardware_constructive_interference_size = 64; _EXPORT_STD inline constexpr size_t hardware_destructive_interference_size = 64; -#else // ^^^ supported hardware / unsupported hardware vvv -#error Unsupported architecture -#endif // ^^^ unsupported hardware ^^^ +#else // ^^^ known architecture / unknown architecture vvv +#error Unknown architecture +#endif // ^^^ unknown architecture ^^^ #endif // _HAS_CXX17 diff --git a/stl/inc/numeric b/stl/inc/numeric index c8a6a4a4ff9..f1b22781125 100644 --- a/stl/inc/numeric +++ b/stl/inc/numeric @@ -736,7 +736,7 @@ _NODISCARD constexpr common_type_t<_Mt, _Nt> lcm(const _Mt _Mx, const _Nt _Nx) n _Common_unsigned _Result = 0; _Common_unsigned _Tmp = static_cast<_Common_unsigned>(_Mx_magnitude / _STD gcd(_Mx_magnitude, _Nx_magnitude)); - const bool _Overflow = _Mul_overflow(_Tmp, _Nx_magnitude, _Result) || !_In_range<_Common>(_Result); + const bool _Overflow = _Mul_overflow(_Tmp, _Nx_magnitude, _Result) || !_STD _In_range<_Common>(_Result); _STL_VERIFY(!_Overflow, "Preconditions: The least common multiple of |m| and |n| is representable as a value of " "type common_type_t. (N4981 [numeric.ops.lcm]/2)"); diff --git a/stl/inc/ostream b/stl/inc/ostream index bf8fb820728..db17704cfc0 100644 --- a/stl/inc/ostream +++ b/stl/inc/ostream @@ -219,7 +219,7 @@ ios_base::iostate _Print_noformat_unicode(ostream& _Ostr, const string_view _Str template ios_base::iostate _Print_newline_only_unicode(ostream& _Ostr) { - const auto _Unicode_console = [](const __std_unicode_console_handle _Console_handle) { + const auto _Unicode_console = [](const __std_unicode_console_handle _Console_handle) _STATIC_CALL_OPERATOR { return __std_print_newline_only_to_unicode_console(_Console_handle); }; diff --git a/stl/inc/queue b/stl/inc/queue index 1284d2acae8..68ebb5de475 100644 --- a/stl/inc/queue +++ b/stl/inc/queue @@ -13,6 +13,7 @@ // !defined(_LEGACY_CODE_ASSUMES_QUEUE_INCLUDES_ALGORITHM) vvv #include <__msvc_heap_algorithms.hpp> #endif // ^^^ !defined(_LEGACY_CODE_ASSUMES_QUEUE_INCLUDES_ALGORITHM) ^^^ + #include #include diff --git a/stl/inc/random b/stl/inc/random index d2948988865..f6d03829529 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -528,15 +528,13 @@ public: } _NODISCARD friend bool operator==( - const linear_congruential_engine& _Lhs, const linear_congruential_engine& _Rhs) noexcept - /* strengthened */ { + const linear_congruential_engine& _Lhs, const linear_congruential_engine& _Rhs) noexcept /* strengthened */ { return _Lhs._Prev == _Rhs._Prev; } #if !_HAS_CXX20 _NODISCARD friend bool operator!=( - const linear_congruential_engine& _Lhs, const linear_congruential_engine& _Rhs) noexcept - /* strengthened */ { + const linear_congruential_engine& _Lhs, const linear_congruential_engine& _Rhs) noexcept /* strengthened */ { return _Lhs._Prev != _Rhs._Prev; } #endif // !_HAS_CXX20 @@ -1203,15 +1201,15 @@ public: do { _Val = _Eng() - (_Engine::min) (); } while (_Val > _Yx0); - _Res = _Res << _Wx0 | (static_cast(_Val) & _Mask); + _Res = (_Res << _Wx0) | (static_cast(_Val) & _Mask); } - _Mask = _Mask << 1 | 1; + _Mask = (_Mask << 1) | 1; for (; _Idx < _Nx; ++_Idx) { // pack _Wx0+1-bit values do { _Val = _Eng() - (_Engine::min) (); } while (_Val > _Yx1); - _Res = _Res << (_Wx0 + 1) | (static_cast(_Val) & _Mask); + _Res = (_Res << (_Wx0 + 1)) | (static_cast(_Val) & _Mask); } return _Res; } diff --git a/stl/inc/ranges b/stl/inc/ranges index 897c4d19baf..81e7faf436d 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -1577,7 +1577,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_As_rvalue) { return as_rvalue_view(_STD forward<_Rng>(_Range)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -2134,7 +2134,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Reconstruct_subrange) { return subrange(_First, _First + _Count); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } } @@ -2540,7 +2540,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Reconstruct_other) { return remove_cvref_t<_Rng>(_RANGES begin(_Range) + _Count, _RANGES end(_Range)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } } @@ -3054,8 +3054,7 @@ namespace ranges { #endif // _HAS_CXX23 namespace views { - class _Join_fn : public _Pipe::_Base<_Join_fn> { - public: + struct _Join_fn : public _Pipe::_Base<_Join_fn> { template _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR noexcept(noexcept(join_view>{_STD forward<_Rng>(_Range)})) @@ -3326,7 +3325,7 @@ namespace ranges { _NODISCARD constexpr decltype(auto) operator*() const { using _Ref = common_reference_t, iter_reference_t<_PatternIter>>; - return _Visit_inner_it<_Ref>([](auto&& _It) _STATIC_LAMBDA -> _Ref { return *_It; }); + return _Visit_inner_it<_Ref>([](auto&& _It) _STATIC_CALL_OPERATOR -> _Ref { return *_It; }); } constexpr _Iterator& operator++() { @@ -4402,7 +4401,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Common) { return common_view{_STD forward<_Rng>(_Range)}; } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -4561,7 +4560,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Reverse) { return reverse_view{_STD forward<_Rng>(_Range)}; } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -4703,7 +4702,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_As_const) { return as_const_view{_STD forward<_Rng>(_Range)}; } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -5117,8 +5116,7 @@ namespace ranges { namespace views { template - class _Elements_fn : public _Pipe::_Base<_Elements_fn<_Index>> { - public: + struct _Elements_fn : public _Pipe::_Base<_Elements_fn<_Index>> { template _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR noexcept(noexcept(elements_view, _Index>{_STD forward<_Rng>(_Range)})) @@ -5459,8 +5457,7 @@ namespace ranges { constexpr auto _Compile_time_max_size> = _Compile_time_max_size; namespace views { - class _Enumerate_fn : public _Pipe::_Base<_Enumerate_fn> { - public: + struct _Enumerate_fn : public _Pipe::_Base<_Enumerate_fn> { template _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR noexcept(noexcept(enumerate_view>{_STD forward<_Rng>(_Range)})) @@ -6957,7 +6954,7 @@ namespace ranges { }; public: - constexpr explicit stride_view(_Vw _Range_, range_difference_t<_Vw> _Stride_) + constexpr explicit stride_view(_Vw _Range_, const range_difference_t<_Vw> _Stride_) noexcept(is_nothrow_move_constructible_v<_Vw>) // strengthened : _Range(_STD move(_Range_)), _Stride(_Stride_) { #if _ITERATOR_DEBUG_LEVEL != 0 @@ -7223,13 +7220,14 @@ namespace ranges { noexcept((noexcept(*(_STD declval>&>())) && ...)) /* strengthened */ { return _Tuple_transform( - [](auto& _Itr) _STATIC_LAMBDA noexcept(noexcept(*_Itr)) -> decltype(auto) { return *_Itr; }, + [](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(*_Itr)) -> decltype(auto) { return *_Itr; }, _Current); } - constexpr _Iterator& operator++() noexcept(noexcept(_Tuple_for_each( - [](auto& _Itr) _STATIC_LAMBDA noexcept(noexcept(++_Itr)) { ++_Itr; }, _Current))) /* strengthened */ { - _Tuple_for_each([](auto& _Itr) _STATIC_LAMBDA noexcept(noexcept(++_Itr)) { ++_Itr; }, _Current); + constexpr _Iterator& operator++() noexcept( + noexcept(_Tuple_for_each([](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(++_Itr)) { ++_Itr; }, + _Current))) /* strengthened */ { + _Tuple_for_each([](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(++_Itr)) { ++_Itr; }, _Current); return *this; } @@ -7248,10 +7246,10 @@ namespace ranges { } constexpr _Iterator& operator--() noexcept(noexcept(_Tuple_for_each( - [](auto& _Itr) _STATIC_LAMBDA noexcept(noexcept(--_Itr)) { --_Itr; }, _Current))) // strengthened + [](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(--_Itr)) { --_Itr; }, _Current))) // strengthened requires _All_bidirectional<_IsConst, _ViewTypes...> { - _Tuple_for_each([](auto& _Itr) _STATIC_LAMBDA noexcept(noexcept(--_Itr)) { --_Itr; }, _Current); + _Tuple_for_each([](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(--_Itr)) { --_Itr; }, _Current); return *this; } @@ -7472,7 +7470,7 @@ namespace ranges { } } - static constexpr auto _Size_closure = [](auto... _Sizes) _STATIC_LAMBDA noexcept { + static constexpr auto _Size_closure = [](auto... _Sizes) _STATIC_CALL_OPERATOR noexcept { using _Common_unsigned_type = _Make_unsigned_like_t>; return (_RANGES min) ({static_cast<_Common_unsigned_type>(_Sizes)...}); }; @@ -7556,7 +7554,7 @@ namespace ranges { constexpr auto _Compile_time_max_size> = _Zip_view_compile_time_max_size(); namespace views { - struct _Zip_fn { + class _Zip_fn { private: template _NODISCARD static consteval bool _Is_invocation_noexcept() { @@ -7902,7 +7900,7 @@ namespace ranges { _Compile_time_max_size>; namespace views { - struct _Zip_transform_fn { + class _Zip_transform_fn { private: template _NODISCARD static consteval bool _Is_invocation_noexcept() { @@ -8062,7 +8060,7 @@ namespace ranges { _NODISCARD constexpr auto operator*() const { return _RANGES _Tuple_transform( - [](auto& _It) _STATIC_LAMBDA -> decltype(auto) { return *_It; }, _Current); + [](auto& _It) _STATIC_CALL_OPERATOR -> decltype(auto) { return *_It; }, _Current); } constexpr _Iterator& operator++() noexcept(noexcept(++_Current.front())) /* strengthened */ { @@ -8368,8 +8366,7 @@ namespace ranges { namespace views { template - class _Adjacent_fn : public _Pipe::_Base<_Adjacent_fn<_Nx>> { - public: + struct _Adjacent_fn : public _Pipe::_Base<_Adjacent_fn<_Nx>> { template _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR noexcept(noexcept(adjacent_view, _Nx>{_STD forward<_Rng>(_Range)})) @@ -8711,8 +8708,7 @@ namespace ranges { namespace views { template - class _Adjacent_transform_fn { - public: + struct _Adjacent_transform_fn { template _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&&, _Fn&& _Func) _CONST_CALL_OPERATOR noexcept(noexcept(views::zip_transform(_STD forward<_Fn>(_Func)))) @@ -8989,7 +8985,7 @@ namespace ranges { _NODISCARD constexpr auto operator*() const { return _RANGES _Tuple_transform( - [](auto& _It) _STATIC_LAMBDA -> decltype(auto) { return *_It; }, _Current); + [](auto& _It) _STATIC_CALL_OPERATOR -> decltype(auto) { return *_It; }, _Current); } constexpr _Iterator& operator++() { @@ -9253,8 +9249,7 @@ namespace ranges { _Cartesian_product_view_compile_time_max_size(); namespace views { - class _Cartesian_product_fn { - public: + struct _Cartesian_product_fn { _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()() _CONST_CALL_OPERATOR noexcept { return views::single(tuple{}); } diff --git a/stl/inc/regex b/stl/inc/regex index 730a2d6cf24..95a0d2515f2 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -3933,7 +3933,7 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Match_pat(_Node_base* _N if (_Code == _Rx_unwind_ops::_After_assert) { _Next = _Frame._Node->_Next; if (_Last_capture_restore_frame != 0U) { - auto _Not_capture_restore = [](const auto& _Other_frame) _STATIC_LAMBDA { + auto _Not_capture_restore = [](const auto& _Other_frame) _STATIC_CALL_OPERATOR { return _Other_frame._Code != _Rx_unwind_ops::_Capture_restore_begin && _Other_frame._Code != _Rx_unwind_ops::_Capture_restore_end; }; diff --git a/stl/inc/system_error b/stl/inc/system_error index c5d2c63ca7d..ef4015195aa 100644 --- a/stl/inc/system_error +++ b/stl/inc/system_error @@ -13,6 +13,7 @@ #include #include #include + #ifndef _M_CEE_PURE #include #endif // !defined(_M_CEE_PURE) diff --git a/stl/inc/type_traits b/stl/inc/type_traits index 5664ce1aca4..c71b08409d1 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -2677,7 +2677,6 @@ void _Swap_trivial_arrays(_Ty (&_Left)[_Size], _Ty (&_Right)[_Size]) noexcept { *reinterpret_cast<_Buffer_type*>(_Right_ptr) = _Buffer; _Left_ptr += _Part_size_bytes; _Right_ptr += _Part_size_bytes; - } while (_Left_ptr != _Stop); } diff --git a/stl/inc/variant b/stl/inc/variant index 6cddd331a9c..f155574b6f2 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -791,7 +791,7 @@ public: _CONSTEXPR20 void _Destroy() noexcept { // destroy the contained value, if any if constexpr (!conjunction_v...>) { - _STD _Variant_raw_visit(index(), _Storage(), [](auto _Ref) noexcept { + _STD _Variant_raw_visit(index(), _Storage(), [](auto _Ref) _STATIC_CALL_OPERATOR noexcept { if constexpr (decltype(_Ref)::_Idx != variant_npos) { using _Indexed_value_type = _Remove_cvref_t; _Ref._Val.~_Indexed_value_type(); diff --git a/stl/inc/vector b/stl/inc/vector index dafac7c5933..16964a76091 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -2120,7 +2120,7 @@ private: } else if constexpr (sizeof...(_Val) == 2) { _My_data._Mylast = _STD _Uninitialized_copy(_STD forward<_Valty>(_Val)..., _My_data._Myfirst, _Al); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected number of arguments + static_assert(false, "unexpected number of arguments"); } _ASAN_VECTOR_CREATE; _Guard._Target = nullptr; @@ -2862,7 +2862,7 @@ public: _CONSTEXPR20 ~_Vb_val() noexcept { #if _ITERATOR_DEBUG_LEVEL != 0 this->_Orphan_all(); - auto _Alproxy = _STD _Get_proxy_allocator(this->_Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Delete_plain_internal(_Alproxy, _STD exchange(this->_Myproxy, nullptr)); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -3464,8 +3464,7 @@ public: return begin() + _Off; } - _CONSTEXPR20 iterator erase(const_iterator _First_arg, const_iterator _Last_arg) noexcept - /* strengthened */ { + _CONSTEXPR20 iterator erase(const_iterator _First_arg, const_iterator _Last_arg) noexcept /* strengthened */ { iterator _First = _Make_iter(_First_arg); iterator _Last = _Make_iter(_Last_arg); difference_type _Off = _First - begin(); diff --git a/stl/inc/xatomic.h b/stl/inc/xatomic.h index d8bee23f4c7..5767aeb251c 100644 --- a/stl/inc/xatomic.h +++ b/stl/inc/xatomic.h @@ -44,9 +44,9 @@ _STL_DISABLE_CLANG_WARNINGS #define _INTRIN_ACQ_REL(x) x #define _YIELD_PROCESSOR() __yield() -#else // ^^^ ARM64/ARM64EC/HYBRID_X86_ARM64 / unsupported hardware vvv -#error Unsupported hardware -#endif // hardware +#else // ^^^ ARM64/ARM64EC/HYBRID_X86_ARM64 / unknown architecture vvv +#error Unknown architecture +#endif // ^^^ unknown architecture ^^^ #define _MT_INCR(x) _INTRIN_RELAXED(_InterlockedIncrement)(reinterpret_cast(&x)) #define _MT_DECR(x) _INTRIN_ACQ_REL(_InterlockedDecrement)(reinterpret_cast(&x)) @@ -62,9 +62,9 @@ _STL_DISABLE_CLANG_WARNINGS #elif defined(_M_IX86) || defined(_M_X64) // x86/x64 hardware only emits memory barriers inside _Interlocked intrinsics #define _Compiler_or_memory_barrier() _Compiler_barrier() -#else // ^^^ x86/x64 / unsupported hardware vvv -#error Unsupported hardware -#endif // hardware +#else // ^^^ x86/x64 / unknown architecture vvv +#error Unknown architecture +#endif // ^^^ unknown architecture ^^^ _STD_BEGIN diff --git a/stl/inc/xhash b/stl/inc/xhash index 65cbb0a92df..ef3ed86bb53 100644 --- a/stl/inc/xhash +++ b/stl/inc/xhash @@ -43,10 +43,12 @@ struct _Uhash_choose_transparency<_Kty, _Hasher, _Keyeq> { // transparency selector for transparent hashed containers static constexpr bool _Has_transparent_overloads = true; +#if _HAS_CXX23 template static constexpr bool _Supports_transparency = !disjunction_v, is_convertible<_Kx, typename _Container::iterator>>; +#endif // _HAS_CXX23 }; #endif // _HAS_CXX20 diff --git a/stl/inc/xlocnum b/stl/inc/xlocnum index fca7454e0b4..d487879dbda 100644 --- a/stl/inc/xlocnum +++ b/stl/inc/xlocnum @@ -1181,7 +1181,7 @@ int _Float_put_desired_precision(const streamsize _Precision, const ios_base::fm } else if constexpr (is_same_v<_Ty, long double>) { return ((LDBL_MANT_DIG - 1) + 3) / 4; } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected type; shouldn't be float + static_assert(false, "unexpected type; shouldn't be float"); } } diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 138e2a62d1f..fcd92f799af 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -51,7 +51,7 @@ _Ty* _Remove_vectorized(_Ty* const _First, _Ty* const _Last, const _TVal _Val) n } else if constexpr (sizeof(_Ty) == 8) { return reinterpret_cast<_Ty*>(::__std_remove_8(_First, _Last, _STD _Find_arg_cast(_Val))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // Unexpected size + static_assert(false, "unexpected size"); } } _STD_END diff --git a/stl/inc/xstring b/stl/inc/xstring index 108ac5192f9..5952e6c47d7 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -1582,7 +1582,7 @@ public: return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Count, - const _Elem _Ch) _STATIC_LAMBDA { + const _Elem _Ch) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size)); _Traits::assign(_New_ptr + _Old_size, static_cast(_Count), _Ch); _Traits::assign(_New_ptr[_Old_size + _Count], _Elem()); @@ -1668,7 +1668,7 @@ public: return _Reallocate_for( _Count, - [](_Elem* const _New_ptr, const size_type _Count, const _Elem _Ch) _STATIC_LAMBDA { + [](_Elem* const _New_ptr, const size_type _Count, const _Elem _Ch) _STATIC_CALL_OPERATOR { _Traits::assign(_New_ptr, _Count, _Ch); _Traits::assign(_New_ptr[_Count], _Elem()); }, @@ -1774,7 +1774,7 @@ public: return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, - const size_type _Count, const _Elem _Ch) _STATIC_LAMBDA { + const size_type _Count, const _Elem _Ch) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Off)); _Traits::assign(_New_ptr + _Off, static_cast(_Count), _Ch); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, static_cast(_Old_size - _Off + 1)); @@ -1878,8 +1878,7 @@ public: return begin() + static_cast(_Off); } - _CONSTEXPR20 iterator erase(const const_iterator _First, const const_iterator _Last) noexcept - /* strengthened */ { + _CONSTEXPR20 iterator erase(const const_iterator _First, const const_iterator _Last) noexcept /* strengthened */ { _STD _Adl_verify_range(_First, _Last); #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_First._Getcont() == _STD addressof(_Mypair._Myval2), "string iterators incompatible"); @@ -1961,7 +1960,7 @@ public: return _Reallocate_grow_by( static_cast(_Count - _Nx), [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, - const size_type _Nx, const size_type _Count, const _Elem _Ch) _STATIC_LAMBDA { + const size_type _Nx, const size_type _Count, const _Elem _Ch) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Off)); _Traits::assign(_New_ptr + _Off, static_cast(_Count), _Ch); _Traits::copy( @@ -2184,8 +2183,7 @@ public: return _Mypair._Myval2._Myptr()[_Off]; } - _NODISCARD _CONSTEXPR20 const_reference operator[](const size_type _Off) const noexcept - /* strengthened */ { + _NODISCARD _CONSTEXPR20 const_reference operator[](const size_type _Off) const noexcept /* strengthened */ { #if _MSVC_STL_HARDENING_BASIC_STRING || _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Off <= _Mypair._Myval2._Mysize, "string subscript out of range"); #endif @@ -2216,7 +2214,7 @@ public: _Reallocate_grow_by( 1, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const _Elem _Ch) - _STATIC_LAMBDA { + _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size)); _Traits::assign(_New_ptr[_Old_size], _Ch); _Traits::assign(_New_ptr[_Old_size + 1], _Elem()); @@ -2318,7 +2316,7 @@ public: if (_Mypair._Myval2._Myres < _New_size) { _Reallocate_grow_by(static_cast(_New_size - _Mypair._Myval2._Mysize), [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) - _STATIC_LAMBDA { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size + 1)); }); + _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size + 1)); }); } else { _ASAN_STRING_MODIFY(*this, _Mypair._Myval2._Mysize, _New_size); _Mypair._Myval2._Mysize = _New_size; @@ -2360,7 +2358,7 @@ public: const size_type _Old_size = _Mypair._Myval2._Mysize; _Reallocate_grow_by(static_cast(_Newcap - _Old_size), [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) - _STATIC_LAMBDA { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size + 1)); }); + _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size + 1)); }); // `_Reallocate_grow_by` calls `_ASAN_STRING_CREATE` assuming that the string // has size (initialized memory) equal to its new capacity (allocated memory). @@ -2388,7 +2386,7 @@ public: const size_type _Old_size = _Mypair._Myval2._Mysize; _Reallocate_grow_by(static_cast(_Newcap - _Old_size), [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) - _STATIC_LAMBDA { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size + 1)); }); + _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size + 1)); }); // `_Reallocate_grow_by` calls `_ASAN_STRING_CREATE` assuming that the string // has size (initialized memory) equal to its new capacity (allocated memory). @@ -2615,8 +2613,7 @@ public: } _NODISCARD _CONSTEXPR20 size_type find_first_of( - _In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const noexcept - /* strengthened */ { + _In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const noexcept /* strengthened */ { // look for one of [_Ptr, ) at or after _Off return static_cast(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ptr, _Traits::length(_Ptr))); @@ -2695,8 +2692,7 @@ public: } _NODISCARD _CONSTEXPR20 size_type find_first_not_of( - _In_z_ const _Elem* const _Ptr, size_type _Off = 0) const noexcept - /* strengthened */ { + _In_z_ const _Elem* const _Ptr, size_type _Off = 0) const noexcept /* strengthened */ { // look for one of [_Ptr, ) at or after _Off return static_cast(_Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ptr, _Traits::length(_Ptr))); @@ -3041,7 +3037,7 @@ private: return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const _UElem* const _Ptr, - const size_type _Count) _STATIC_LAMBDA { + const size_type _Count) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size)); _STD _Traits_copy_batch<_Traits>(_New_ptr + _Old_size, _Ptr, static_cast(_Count)); _Traits::assign(_New_ptr[_Old_size + _Count], _Elem()); @@ -3067,7 +3063,7 @@ private: return _Reallocate_for( _Count, - [](_Elem* const _New_ptr, const size_type _Count, const _UElem* const _Ptr) _STATIC_LAMBDA { + [](_Elem* const _New_ptr, const size_type _Count, const _UElem* const _Ptr) _STATIC_CALL_OPERATOR { _STD _Traits_copy_batch<_Traits>(_New_ptr, _Ptr, static_cast(_Count)); _Traits::assign(_New_ptr[_Count], _Elem()); }, @@ -3085,13 +3081,9 @@ private: // We can't check for overlapping ranges when constant evaluated since comparison of pointers into string // literals is unspecified, so always reallocate and copy to the new buffer if constant evaluated. -#if _HAS_CXX20 - const bool _Check_overlap = _Count <= _Mypair._Myval2._Myres - _Old_size && !_STD is_constant_evaluated(); -#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv const bool _Check_overlap = _Count <= _Mypair._Myval2._Myres - _Old_size; -#endif // ^^^ !_HAS_CXX20 ^^^ - if (_Check_overlap) { + if (_Check_overlap && !_STD _Is_constant_evaluated()) { const auto _New_size = static_cast(_Old_size + _Count); _ASAN_STRING_MODIFY(*this, _Old_size, _New_size); _Mypair._Myval2._Mysize = _New_size; @@ -3120,7 +3112,7 @@ private: return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, - const _UElem* const _Ptr, const size_type _Count) _STATIC_LAMBDA { + const _UElem* const _Ptr, const size_type _Count) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Off)); _STD _Traits_copy_batch<_Traits>(_New_ptr + _Off, _Ptr, static_cast(_Count)); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, static_cast(_Old_size - _Off + 1)); @@ -3196,7 +3188,7 @@ private: return _Reallocate_grow_by( _Growth, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, - const size_type _Nx, const _UElem* const _Ptr, const size_type _Count) _STATIC_LAMBDA { + const size_type _Nx, const _UElem* const _Ptr, const size_type _Count) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Off)); _STD _Traits_copy_batch<_Traits>(_New_ptr + _Off, _Ptr, static_cast(_Count)); _Traits::copy( diff --git a/stl/inc/xutility b/stl/inc/xutility index e2b4083cf83..6abbcf17771 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -75,7 +75,7 @@ _STL_DISABLE_CLANG_WARNINGS #define _VECTORIZED_FOR_X64_X86_ARM64 1 #define _VECTORIZED_FOR_X64_X86_ARM64_ARM64EC 1 #else // ^^^ known architecture / unknown architecture vvv -#error Unknown architecture. +#error Unknown architecture #endif // ^^^ unknown architecture ^^^ #define _VECTORIZED_ADJACENT_FIND _VECTORIZED_FOR_X64_X86 @@ -275,7 +275,7 @@ __declspec(noalias) void _Reverse_vectorized(void* _First, void* _Last) noexcept } else if constexpr (_Nx == 8) { ::__std_reverse_trivially_swappable_8(_First, _Last); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_REVERSE ^^^ @@ -292,7 +292,7 @@ __declspec(noalias) size_t _Count_vectorized(_Ty* const _First, _Ty* const _Last } else if constexpr (sizeof(_Ty) == 8) { return ::__std_count_trivial_8(_First, _Last, _STD _Find_arg_cast(_Val)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_COUNT ^^^ @@ -313,7 +313,7 @@ _Ty* _Find_vectorized(_Ty* const _First, _Ty* const _Last, const _TVal _Val) noe return const_cast<_Ty*>( static_cast(::__std_find_trivial_8(_First, _Last, _STD _Find_arg_cast(_Val)))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND ^^^ @@ -334,7 +334,7 @@ _Ty* _Find_last_vectorized(_Ty* const _First, _Ty* const _Last, const _TVal _Val return const_cast<_Ty*>( static_cast(::__std_find_last_trivial_8(_First, _Last, _STD _Find_arg_cast(_Val)))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND_LAST ^^^ @@ -351,7 +351,7 @@ _Ty* _Adjacent_find_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { } else if constexpr (sizeof(_Ty) == 8) { return const_cast<_Ty*>(static_cast(::__std_adjacent_find_8(_First, _Last))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_ADJACENT_FIND ^^^ @@ -376,7 +376,7 @@ _Ty1* _Search_vectorized(_Ty1* const _First1, _Ty1* const _Last1, _Ty2* const _F } else if constexpr (sizeof(_Ty1) == 8) { return const_cast<_Ty1*>(static_cast(::__std_search_8(_First1, _Last1, _First2, _Count2))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_SEARCH ^^^ @@ -395,7 +395,7 @@ _Ty1* _Find_end_vectorized( } else if constexpr (sizeof(_Ty1) == 8) { return const_cast<_Ty1*>(static_cast(::__std_find_end_8(_First1, _Last1, _First2, _Count2))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_FIND_END ^^^ @@ -418,7 +418,7 @@ _Ty* _Min_element_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { } else if constexpr (sizeof(_Ty) == 8) { return const_cast<_Ty*>(static_cast(::__std_min_element_8(_First, _Last, _Signed))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } @@ -439,7 +439,7 @@ _Ty* _Max_element_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { } else if constexpr (sizeof(_Ty) == 8) { return const_cast<_Ty*>(static_cast(::__std_max_element_8(_First, _Last, _Signed))); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_MINMAX_ELEMENT ^^^ @@ -484,7 +484,7 @@ auto _Min_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { return ::__std_min_8u(_First, _Last); } } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } @@ -527,7 +527,7 @@ auto _Max_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { return ::__std_max_8u(_First, _Last); } } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size + static_assert(false, "unexpected size"); } } #endif // ^^^ _VECTORIZED_MINMAX ^^^ @@ -1005,7 +1005,7 @@ namespace ranges { return *static_cast<_Ty&&>(_Val); } } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -1329,7 +1329,7 @@ namespace ranges { *static_cast<_Ty1&&>(_Val1) = _Iter_swap::_Iter_exchange_move(static_cast<_Ty2&&>(_Val2), static_cast<_Ty1&&>(_Val1)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -2742,7 +2742,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Non_member) { return begin(_Val); // intentional ADL } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -2819,7 +2819,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Non_member) { return end(_Val); // intentional ADL } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -2955,7 +2955,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Unwrap) { return _RANGES _Unwrap_range_iter<_Ty>(_RANGES begin(_Val)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -3006,7 +3006,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Unwrap) { return _RANGES _Unwrap_range_sent<_Ty>(_RANGES end(_Val)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -3172,7 +3172,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Make_reverse) { return _STD make_reverse_iterator(_RANGES end(_Val)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -3243,7 +3243,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Make_reverse) { return _STD make_reverse_iterator(_RANGES begin(_Val)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -3388,7 +3388,7 @@ namespace ranges { const auto _Delta = _RANGES end(_Val) - _RANGES begin(_Val); return static_cast<_Make_unsigned_like_t>>(_Delta); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -3450,7 +3450,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Compare) { return static_cast(_RANGES begin(_Val) == _RANGES end(_Val)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -3505,7 +3505,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Address) { return _STD to_address(_RANGES begin(_Val)); } else { - _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy + static_assert(false); // unexpected strategy } } }; @@ -3582,8 +3582,7 @@ namespace ranges { { _RANGES data(__r) } -> same_as>>; }; - class _Advance_fn { - public: + struct _Advance_fn { template _STATIC_CALL_OPERATOR constexpr void operator()(_It& _Where, iter_difference_t<_It> _Off) _CONST_CALL_OPERATOR { if constexpr (random_access_iterator<_It>) { @@ -3750,8 +3749,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Distance_fn distance; - class _Ssize_fn { - public: + struct _Ssize_fn { template _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR noexcept(noexcept(_RANGES size(_Range))) @@ -3767,8 +3765,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Ssize_fn ssize; } - class _Next_fn { - public: + struct _Next_fn { template _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()(_It _Where) _CONST_CALL_OPERATOR { ++_Where; @@ -3798,8 +3795,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Next_fn next; - class _Prev_fn { - public: + struct _Prev_fn { template _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()(_It _Where) _CONST_CALL_OPERATOR { --_Where; @@ -5513,7 +5509,7 @@ template _NODISCARD bool _Is_all_bits_zero(const _Ty& _Val) { // checks if scalar type has all bits set to zero _STL_INTERNAL_STATIC_ASSERT(is_scalar_v<_Ty> && !is_member_pointer_v<_Ty>); - if constexpr (is_same_v<_Ty, nullptr_t>) { + if constexpr (is_null_pointer_v<_Ty>) { return true; } else { constexpr _Ty _Zero{}; @@ -5611,8 +5607,7 @@ _FwdIt fill_n(_ExPo&&, _FwdIt _Dest, _Diff _Count_raw, const _Ty& _Val) noexcept #if _HAS_CXX20 namespace ranges { - class _Fill_n_fn { - public: + struct _Fill_n_fn { template _It> _STATIC_CALL_OPERATOR constexpr _It operator()( _It _First, iter_difference_t<_It> _Count, const _Ty& _Value) _CONST_CALL_OPERATOR { @@ -5948,8 +5943,7 @@ namespace ranges { return {_STD move(_First1), _STD move(_First2)}; } - class _Mismatch_fn { - public: + struct _Mismatch_fn { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> @@ -6306,7 +6300,7 @@ constexpr bool _Vector_alg_in_find_is_safe_elem = // We're finding an (object or function) pointer in a range of pointers of the same type. conjunction, is_same<_Ty, _Elem>>, // We're finding a nullptr in a range of (object or function) pointers. - conjunction, is_pointer<_Elem>>, + conjunction, is_pointer<_Elem>>, // We're finding an object pointer in a range of object pointers, and: // - One of the pointer types is a cv void*. // - One of the pointer types is a cv1 U* and the other is a cv2 U*. @@ -6333,7 +6327,7 @@ _NODISCARD constexpr bool _Could_compare_equal_to_value_type(const _Ty& _Val) { if constexpr (disjunction_v, // If types are the same, _Val can compare equal to _Elem is_same<_Ty, bool>, // true or false can be represented in any integer type is_pointer<_Ty>, // we only compare pointers vs. other pointers with the same representation - is_same<_Ty, nullptr_t> // we only compare nullptr_t against pointers; any pointer can be null + is_null_pointer<_Ty> // we only compare nullptr_t against pointers; any pointer can be null >) { return true; } else { @@ -6541,8 +6535,7 @@ namespace ranges { return _First; } - class _Find_fn { - public: + struct _Find_fn { template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -6963,8 +6956,7 @@ namespace ranges { return _First; } - class _Find_if_fn { - public: + struct _Find_if_fn { template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -7407,8 +7399,7 @@ namespace ranges { return _Found; } - class _Max_element_fn { - public: + struct _Max_element_fn { template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -7465,8 +7456,7 @@ namespace ranges { sizeof(_It) <= 2 * sizeof(iter_value_t<_It>) && (is_trivially_copyable_v<_It> || !is_trivially_copyable_v>); - class _Max_fn { - public: + struct _Max_fn { template > _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr const _Ty& operator()(const _Ty& _Left _MSVC_LIFETIMEBOUND, @@ -7631,8 +7621,7 @@ namespace ranges { return _Found; } - class _Min_element_fn { - public: + struct _Min_element_fn { template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( @@ -7683,8 +7672,7 @@ _NODISCARD constexpr _Ty(min)(initializer_list<_Ty> _Ilist) { #if _HAS_CXX20 namespace ranges { - class _Min_fn { - public: + struct _Min_fn { template > _Pr = ranges::less> _NODISCARD _STATIC_CALL_OPERATOR constexpr const _Ty& operator()(const _Ty& _Left _MSVC_LIFETIMEBOUND, diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 5f9a98b1f8c..261cac3bbf2 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -85,7 +85,10 @@ // (for atomic) // P3503R3 Make Type-Erased Allocator Use In promise And packaged_task Consistent -// _HAS_CXX17 directly controls: +// _HAS_CXX17 controls: +// N4190 Removing auto_ptr, random_shuffle(), And Old Stuff +// P0003R5 Removing Dynamic Exception Specifications +// P0004R1 Removing Deprecated Iostreams Aliases // P0005R4 not_fn() // P0024R2 Parallel Algorithms // P0025R1 clamp() @@ -102,6 +105,7 @@ // P0154R1 hardware_destructive_interference_size, etc. // P0156R2 scoped_lock // P0163R0 shared_ptr::weak_type +// P0174R2 Deprecating Vestigial Library Parts // P0185R1 is_swappable, is_nothrow_swappable // P0209R2 make_from_tuple() // P0218R1 @@ -112,6 +116,8 @@ // P0258R2 has_unique_object_representations // P0272R1 Non-const basic_string::data() // P0295R0 gcd(), lcm() +// P0298R3 std::byte +// P0302R1 Removing Allocator Support In std::function // P0307R2 Making Optional Greater Equal Again // P0336R1 Renaming Parallel Execution Policies // P0337R0 Deleting polymorphic_allocator Assignment @@ -127,10 +133,12 @@ // P0505R0 constexpr For (Again) // P0508R0 Clarifying insert_return_type // P0510R0 Rejecting variants Of Nothing, Arrays, References, And Incomplete Types +// P0521R0 Deprecating shared_ptr::unique() // P0602R4 Propagating Copy/Move Triviality In variant/optional // P0604R0 invoke_result, is_invocable, is_nothrow_invocable // P0607R0 Inline Variables For The STL // P0608R3 Improving variant's Converting Constructor/Assignment +// P0618R0 Deprecating // P0682R1 Repairing Elementary String Conversions // P0739R0 Improving Class Template Argument Deduction For The STL // P0858R0 Constexpr Iterator Requirements @@ -146,27 +154,14 @@ // __cpp_lib_freestanding_variant) // P2517R1 Conditional noexcept For apply() // P2875R4 Undeprecate polymorphic_allocator::destroy - -// _HAS_CXX17 indirectly controls: -// N4190 Removing auto_ptr, random_shuffle(), And Old Stuff -// P0003R5 Removing Dynamic Exception Specifications -// P0004R1 Removing Deprecated Iostreams Aliases -// P0298R3 std::byte -// P0302R1 Removing Allocator Support In std::function // LWG-2385 function::assign allocator argument doesn't make sense // Enforcement of matching allocator value_types -// _HAS_CXX17 and _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS control: -// P0174R2 Deprecating Vestigial Library Parts -// P0521R0 Deprecating shared_ptr::unique() -// P0618R0 Deprecating -// Other C++17 deprecation warnings - // Implemented when char8_t is available (C++14/17 with /Zc:char8_t, C++20 without /Zc:char8_t-): // P0482R6 Library Support For char8_t // (mbrtoc8 and c8rtomb not yet implemented, see GH-2207) -// _HAS_CXX20 directly controls: +// _HAS_CXX20 controls: // P0019R8 atomic_ref // P0020R6 atomic, atomic, atomic // P0053R7 @@ -196,6 +191,7 @@ // P0591R4 Utility Functions For Uses-Allocator Construction // P0595R2 is_constant_evaluated() // P0616R0 Using move() In +// P0619R4 Removing C++17-Deprecated Features // P0631R8 Math Constants // P0645R10 Text Formatting // P0646R1 list/forward_list remove()/remove_if()/unique() Return size_type @@ -206,6 +202,7 @@ // P0718R2 atomic>, atomic> // P0753R2 osyncstream Manipulators // P0758R1 is_nothrow_convertible +// P0767R1 Deprecating is_pod // P0768R1 Library Support For The Spaceship Comparison Operator <=> // P0769R2 shift_left(), shift_right() // P0784R7 Library Support For More constexpr Containers @@ -259,6 +256,7 @@ // P1716R3 Range Comparison Algorithms Are Over-Constrained // P1739R4 Avoiding Template Bloat For Ranges // P1754R1 Rename Concepts To standard_case +// P1831R1 Deprecating volatile In The Standard Library // P1862R1 Range Adaptors For Non-Copyable Iterators // P1865R1 Adding max() To latch And barrier // P1870R1 Rename forwarding-range To borrowed_range (Was safe_range before LWG-3379) @@ -321,15 +319,7 @@ // (for atomic_ref) // P3349R1 Converting Contiguous Iterators To Pointers -// _HAS_CXX20 indirectly controls: -// P0619R4 Removing C++17-Deprecated Features - -// _HAS_CXX20 and _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS control: -// P0767R1 Deprecating is_pod -// P1831R1 Deprecating volatile In The Standard Library -// Other C++20 deprecation warnings - -// _HAS_CXX23 directly controls: +// _HAS_CXX23 controls: // P0009R18 // P0288R9 move_only_function // P0323R12 @@ -347,6 +337,7 @@ // P1223R5 ranges::find_last, ranges::find_last_if, ranges::find_last_if_not // P1272R4 byteswap() // P1328R1 constexpr type_info::operator==() +// P1413R3 Deprecate aligned_storage And aligned_union // P1425R4 Iterator Pair Constructors For stack And queue // P1467R9 Extended Floating-Point Types // (only the header; we don't support any optional extended floating-point types) @@ -396,6 +387,7 @@ // P2599R2 mdspan: index_type, size_type // P2604R0 mdspan: data_handle_type, data_handle(), exhaustive // P2613R1 mdspan: empty() +// P2614R2 Deprecating float_denorm_style, numeric_limits::has_denorm, numeric_limits::has_denorm_loss // P2652R2 Disallowing User Specialization Of allocator_traits // P2674R1 is_implicit_lifetime // P2693R1 Formatting thread::id And stacktrace @@ -410,11 +402,6 @@ // P3235R3 std::print More Types Faster With Less Memory // (partial implementation; see GH-4924) -// _HAS_CXX23 and _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS control: -// P1413R3 Deprecate aligned_storage And aligned_union -// P2614R2 Deprecating float_denorm_style, numeric_limits::has_denorm, numeric_limits::has_denorm_loss -// Other C++23 deprecation warnings - // Parallel Algorithms Notes // C++ allows an implementation to implement parallel algorithms as calls to the serial algorithms. // This implementation parallelizes several common algorithm calls, but not all. @@ -1924,19 +1911,6 @@ _EMIT_STL_ERROR(STL1013, "The STL doesn't support /RTCc because it rejects confo #define _CHRONO ::std::chrono:: #define _RANGES ::std::ranges:: -// We use the stdext (standard extension) namespace to contain non-standard extensions -#pragma push_macro("stdext") -#undef stdext -#define _STDEXT_BEGIN \ - _EXTERN_CXX_WORKAROUND \ - namespace stdext { -#define _STDEXT_END \ - } \ - _END_EXTERN_CXX_WORKAROUND - -#define _STDEXT ::stdext:: -#pragma pop_macro("stdext") - #define _CSTD :: #ifdef _M_CEE_PURE @@ -1991,11 +1965,9 @@ _EMIT_STL_ERROR(STL1013, "The STL doesn't support /RTCc because it rejects confo // TRANSITION, VSO-2397560, temporary workaround for Real World Code relying on ancient Clang versions. #define _STATIC_CALL_OPERATOR #define _CONST_CALL_OPERATOR const -#define _STATIC_LAMBDA #else // ^^^ workaround / no workaround vvv #define _STATIC_CALL_OPERATOR static #define _CONST_CALL_OPERATOR -#define _STATIC_LAMBDA static #endif // ^^^ no workaround ^^^ #ifdef __CUDACC__ // TRANSITION, CUDA 12.4 doesn't recognize MSVC __restrict; CUDA __restrict__ is not usable in C++ diff --git a/stl/modules/std.ixx b/stl/modules/std.ixx index 23fa034bf35..d582fc80db7 100644 --- a/stl/modules/std.ixx +++ b/stl/modules/std.ixx @@ -41,9 +41,6 @@ export module std; // "C++ library headers" [tab:headers.cpp] #include -#if _HAS_STATIC_RTTI -#include -#endif // _HAS_STATIC_RTTI #include #include #include @@ -60,18 +57,12 @@ export module std; #include #include #include -#if _HAS_CXX23 -#include -#endif // _HAS_CXX23 #include #include #include #include #include #include -#if _HAS_CXX23 -#include -#endif // _HAS_CXX23 #include #include #include @@ -84,9 +75,6 @@ export module std; #include #include #include -#if _HAS_CXX23 -#include -#endif // _HAS_CXX23 #include #include #include @@ -95,9 +83,6 @@ export module std; #include #include #include -#if _HAS_CXX23 -#include -#endif // _HAS_CXX23 #include #include #include @@ -109,18 +94,9 @@ export module std; #include #include #include -#if _HAS_CXX23 -#include -#endif // _HAS_CXX23 #include #include -#if _HAS_CXX23 -#include -#endif // _HAS_CXX23 #include -#if _HAS_CXX23 -#include -#endif // _HAS_CXX23 #include #include #include @@ -141,6 +117,20 @@ export module std; #include #include +#if _HAS_STATIC_RTTI +#include +#endif // _HAS_STATIC_RTTI + +#if _HAS_CXX23 +#include +#include +#include +#include +#include +#include +#include +#endif // _HAS_CXX23 + // "C++ headers for C library facilities" [tab:headers.cpp.c] #include #include diff --git a/stl/src/iosptrs.cpp b/stl/src/iosptrs.cpp index 179220547d8..c70342fa7f4 100644 --- a/stl/src/iosptrs.cpp +++ b/stl/src/iosptrs.cpp @@ -3,6 +3,10 @@ // iostream object pointers +#ifdef _M_CEE_PURE +#error This file cannot be built with /clr:pure. +#endif + #include #include @@ -10,11 +14,6 @@ #include "init_locks.hpp" _STD_BEGIN - -#if defined(_M_CEE) && !defined(_M_CEE_MIXED) -#error This file cannot be built /clr:pure, etc. because of the use of _PGLOBAL. -#endif - #pragma warning(disable : 4074) #pragma init_seg(compiler) _PGLOBAL static std::_Init_locks initlocks; diff --git a/stl/src/sharedmutex.cpp b/stl/src/sharedmutex.cpp index fac73f1e388..09d90c42426 100644 --- a/stl/src/sharedmutex.cpp +++ b/stl/src/sharedmutex.cpp @@ -66,7 +66,7 @@ namespace { return res; } -} // namespace +} // unnamed namespace // TRANSITION, ABI: preserved for compatibility _Thrd_result __stdcall _Cnd_timedwait_for(const _Cnd_t cond, const _Mtx_t mtx, const unsigned int target_ms) noexcept { diff --git a/stl/src/stacktrace.cpp b/stl/src/stacktrace.cpp index 3a67e4c9573..8aec759a08a 100644 --- a/stl/src/stacktrace.cpp +++ b/stl/src/stacktrace.cpp @@ -243,7 +243,7 @@ namespace { locked_data.uninitialize(); } -} // namespace +} // unnamed namespace extern "C" { #pragma optimize("", off) // inhibit tail call optimization to have consistent _Frames_to_skip adjustment here diff --git a/stl/src/stdhndlr.cpp b/stl/src/stdhndlr.cpp index 36faf1cb188..a57e73bc201 100644 --- a/stl/src/stdhndlr.cpp +++ b/stl/src/stdhndlr.cpp @@ -15,7 +15,7 @@ namespace { _New_handler(); return 1; } -} // namespace +} // unnamed namespace _STD_BEGIN diff --git a/stl/src/taskscheduler.cpp b/stl/src/taskscheduler.cpp index 1386a66a25e..d51d6bacbfb 100644 --- a/stl/src/taskscheduler.cpp +++ b/stl/src/taskscheduler.cpp @@ -133,7 +133,7 @@ namespace Concurrency { _Chore->_M_callback(_Chore->_M_data); _Decrement_outstanding(); } - } // namespace + } // unnamed namespace _CRTIMP2 void __cdecl _Release_chore(_Threadpool_chore* _Chore) { if (_Chore->_M_work != nullptr) { diff --git a/stl/src/vector_algorithms.cpp b/stl/src/vector_algorithms.cpp index ef43acca527..cb8bbbdbca0 100644 --- a/stl/src/vector_algorithms.cpp +++ b/stl/src/vector_algorithms.cpp @@ -194,7 +194,7 @@ __declspec(noalias) void __cdecl __std_swap_ranges_trivially_swappable_noalias( } while (_First1 != _Stop_at); } -#if defined(_M_X64) +#ifdef _WIN64 constexpr size_t _Mask_8 = ~((static_cast(1) << 3) - 1); if (_Byte_length(_First1, _Last1) >= 8) { const void* _Stop_at = _First1; @@ -210,7 +210,7 @@ __declspec(noalias) void __cdecl __std_swap_ranges_trivially_swappable_noalias( _Advance_bytes(_First2, 8); } while (_First1 != _Stop_at); } -#elif defined(_M_IX86) +#else // ^^^ 64-bit / 32-bit vvv constexpr size_t _Mask_4 = ~((static_cast(1) << 2) - 1); if (_Byte_length(_First1, _Last1) >= 4) { const void* _Stop_at = _First1; @@ -226,9 +226,7 @@ __declspec(noalias) void __cdecl __std_swap_ranges_trivially_swappable_noalias( _Advance_bytes(_First2, 4); } while (_First1 != _Stop_at); } -#else -#error Unsupported architecture -#endif +#endif // ^^^ 32-bit ^^^ #endif // ^^^ !defined(_M_ARM64EC) ^^^ auto _First1c = static_cast(_First1); @@ -395,7 +393,7 @@ namespace { } while (_First1 != _Stop_at); } -#if defined(_M_X64) +#ifdef _WIN64 constexpr size_t _Mask_8 = ~((static_cast(1) << 3) - 1); if (_Byte_length(_First1, _Last1) >= 8) { const void* _Stop_at = _First1; @@ -415,7 +413,7 @@ namespace { _Advance_bytes(_First3, 8); } while (_First1 != _Stop_at); } -#elif defined(_M_IX86) +#else // ^^^ 64-bit / 32-bit vvv constexpr size_t _Mask_4 = ~((static_cast(1) << 2) - 1); if (_Byte_length(_First1, _Last1) >= 4) { const void* _Stop_at = _First1; @@ -435,9 +433,7 @@ namespace { _Advance_bytes(_First3, 4); } while (_First1 != _Stop_at); } -#else -#error Unsupported architecture -#endif +#endif // ^^^ 32-bit ^^^ #endif // ^^^ !defined(_M_ARM64EC) ^^^ auto _First1c = static_cast(_First1); @@ -3548,18 +3544,15 @@ namespace { } if (_MskX != 0) { -#ifdef _M_IX86 +#ifdef _WIN64 + const long long _Shift = static_cast(_tzcnt_u64(_MskX)) - 32; +#else // ^^^ 64-bit / 32-bit vvv const uint32_t _MskLow = static_cast(_MskX); const int _Shift = _MskLow != 0 ? static_cast(_tzcnt_u32(_MskLow)) - 32 : static_cast(_tzcnt_u32(static_cast(_MskX >> 32))); - -#elifdef _M_X64 - const long long _Shift = static_cast(_tzcnt_u64(_MskX)) - 32; -#else -#error Unsupported architecture -#endif +#endif // ^^^ 32-bit ^^^ _Advance_bytes(_First, _Shift); return _First; } @@ -3594,18 +3587,15 @@ namespace { } if (_MskX != 0) { -#ifdef _M_IX86 +#ifdef _WIN64 + const long long _Shift = static_cast(_tzcnt_u64(_MskX)) - 32; +#else // ^^^ 64-bit / 32-bit vvv const uint32_t _MskLow = static_cast(_MskX); const int _Shift = _MskLow != 0 ? static_cast(_tzcnt_u32(_MskLow)) - 32 : static_cast(_tzcnt_u32(static_cast(_MskX >> 32))); - -#elifdef _M_X64 - const long long _Shift = static_cast(_tzcnt_u64(_MskX)) - 32; -#else -#error Unsupported architecture -#endif +#endif // ^^^ 32-bit ^^^ _Advance_bytes(_First, _Shift); return _First; } @@ -5665,7 +5655,6 @@ namespace { } _Advance_bytes(_First1, _Vec_size); - } while (_First1 != _Stop1); if (const size_t _Left1 = _Byte_length(_First1, _Last1); _Left1 >= _Size_bytes_2) { @@ -5737,7 +5726,6 @@ namespace { } _Advance_bytes(_First1, _Vec_size); - } while (_First1 <= _Stop1); return _Last1; diff --git a/stl/src/xalloc.cpp b/stl/src/xalloc.cpp index 6ee0312c4aa..619e2a08d03 100644 --- a/stl/src/xalloc.cpp +++ b/stl/src/xalloc.cpp @@ -3,7 +3,7 @@ // TRANSITION, ABI: The functions in this file are preserved for binary compatibility -#include +#include #include diff --git a/stl/src/xexp.cpp b/stl/src/xexp.cpp index 18355815a79..6b5a45ca5cb 100644 --- a/stl/src/xexp.cpp +++ b/stl/src/xexp.cpp @@ -96,7 +96,7 @@ namespace { } } } -} // namespace +} // unnamed namespace _EXTERN_C_UNLESS_PURE diff --git a/stl/src/xsinh.cpp b/stl/src/xsinh.cpp index 85d117983a7..1def63635b0 100644 --- a/stl/src/xsinh.cpp +++ b/stl/src/xsinh.cpp @@ -15,7 +15,7 @@ namespace { return y; } -} // namespace +} // unnamed namespace _EXTERN_C_UNLESS_PURE diff --git a/stl/src/xtime.cpp b/stl/src/xtime.cpp index 7499f42e19d..52ac5820b27 100644 --- a/stl/src/xtime.cpp +++ b/stl/src/xtime.cpp @@ -6,7 +6,7 @@ #include #include -#include "awint.hpp" +#include namespace { constexpr long _Nsec_per_sec = 1000000000L; @@ -42,7 +42,7 @@ namespace { } return diff; } -} // namespace +} // unnamed namespace extern "C" { diff --git a/tests/std/include/experimental_filesystem.hpp b/tests/std/include/experimental_filesystem.hpp index e9bd384243d..c1af34257b2 100644 --- a/tests/std/include/experimental_filesystem.hpp +++ b/tests/std/include/experimental_filesystem.hpp @@ -854,7 +854,7 @@ class path { // stores a pathname path& append(const basic_string<_Elem, _Traits, _Alloc>& _Str0) { // append arbitrary source string string_type _Str(_Str0.size(), L'\0'); // convert _Elem and '/' to '\' - _STD transform(_Str0.begin(), _Str0.end(), _Str.begin(), [](const _Elem _Ch) _STATIC_LAMBDA { + _STD transform(_Str0.begin(), _Str0.end(), _Str.begin(), [](const _Elem _Ch) _STATIC_CALL_OPERATOR { auto _Wch = static_cast(_Ch); if (_Wch == _FS_SLASH) { _Wch = _FS_PREF; diff --git a/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp b/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp index 203ade46b08..3ab639ebc45 100644 --- a/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp +++ b/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp @@ -6,7 +6,7 @@ #include <__msvc_all_public_headers.hpp> #include -#include "experimental_filesystem.hpp" +#include int meow(); diff --git a/tests/std/tests/Dev10_500860_overloaded_address_of/test.cpp b/tests/std/tests/Dev10_500860_overloaded_address_of/test.cpp index cb00f989db1..215909e909d 100644 --- a/tests/std/tests/Dev10_500860_overloaded_address_of/test.cpp +++ b/tests/std/tests/Dev10_500860_overloaded_address_of/test.cpp @@ -2,12 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include +#include #include #include -#ifndef _M_CEE_PURE -#include -#endif // _M_CEE_PURE -#include #include #include #include @@ -27,6 +24,10 @@ #include #include +#ifndef _M_CEE_PURE +#include +#endif // _M_CEE_PURE + using namespace std; #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) diff --git a/tests/std/tests/Dev10_851347_weak_ptr_virtual_inheritance/test.cpp b/tests/std/tests/Dev10_851347_weak_ptr_virtual_inheritance/test.cpp index 460a4d2e4a1..688f327da6f 100644 --- a/tests/std/tests/Dev10_851347_weak_ptr_virtual_inheritance/test.cpp +++ b/tests/std/tests/Dev10_851347_weak_ptr_virtual_inheritance/test.cpp @@ -4,6 +4,7 @@ #include #include #include + #ifndef _M_CEE_PURE // in /clr:pure we miss runtime coverage of weak_ptr converting constructor #include #include diff --git a/tests/std/tests/Dev11_0000000_function_crashes/test.cpp b/tests/std/tests/Dev11_0000000_function_crashes/test.cpp index 16419ffca65..2e403ac376a 100644 --- a/tests/std/tests/Dev11_0000000_function_crashes/test.cpp +++ b/tests/std/tests/Dev11_0000000_function_crashes/test.cpp @@ -2,9 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include + #ifndef _M_CEE_PURE #include #endif + using namespace std; int global = 0; diff --git a/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp b/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp index 4e09d136a00..7d708f9d02a 100644 --- a/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp +++ b/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp @@ -29,7 +29,7 @@ #include #endif // _HAS_CXX20 -#include "experimental_filesystem.hpp" +#include using namespace std; diff --git a/tests/std/tests/Dev11_0532622_minmax_element/test.cpp b/tests/std/tests/Dev11_0532622_minmax_element/test.cpp index 1a2964283d5..91ccf599855 100644 --- a/tests/std/tests/Dev11_0532622_minmax_element/test.cpp +++ b/tests/std/tests/Dev11_0532622_minmax_element/test.cpp @@ -34,7 +34,6 @@ void test_all_permutations(vector& v) { assert(min_element(v.begin(), v.end()) == first_smallest); assert(max_element(v.begin(), v.end()) == first_largest); assert(minmax_element(v.begin(), v.end()) == make_pair(first_smallest, last_largest)); - } while (next_permutation(v.begin(), v.end())); } diff --git a/tests/std/tests/Dev11_0920385_list_sort_allocator/test.cpp b/tests/std/tests/Dev11_0920385_list_sort_allocator/test.cpp index d8b35089d2d..54ee31eb0aa 100644 --- a/tests/std/tests/Dev11_0920385_list_sort_allocator/test.cpp +++ b/tests/std/tests/Dev11_0920385_list_sort_allocator/test.cpp @@ -108,7 +108,6 @@ int main() { forward_list> fl(v.begin(), v.end(), alloc); fl.sort(); assert(is_sorted(fl.begin(), fl.end())); - } while (next_permutation(v.begin(), v.end())); } diff --git a/tests/std/tests/Dev11_1066931_filesystem_rename_noop/test.cpp b/tests/std/tests/Dev11_1066931_filesystem_rename_noop/test.cpp index 7d02f077bad..51365b24cb4 100644 --- a/tests/std/tests/Dev11_1066931_filesystem_rename_noop/test.cpp +++ b/tests/std/tests/Dev11_1066931_filesystem_rename_noop/test.cpp @@ -15,7 +15,7 @@ #include #endif // _HAS_CXX17 -#include "experimental_filesystem.hpp" +#include #include using namespace std; diff --git a/tests/std/tests/Dev11_1180290_filesystem_error_code/test.cpp b/tests/std/tests/Dev11_1180290_filesystem_error_code/test.cpp index bc8b89c6320..34750036cc6 100644 --- a/tests/std/tests/Dev11_1180290_filesystem_error_code/test.cpp +++ b/tests/std/tests/Dev11_1180290_filesystem_error_code/test.cpp @@ -13,7 +13,7 @@ #include #endif // _HAS_CXX17 -#include "experimental_filesystem.hpp" +#include using namespace std; using namespace std::chrono; diff --git a/tests/std/tests/GH_000140_adl_proof_construction/test.compile.pass.cpp b/tests/std/tests/GH_000140_adl_proof_construction/test.compile.pass.cpp index a8041454dd5..dc12f057413 100644 --- a/tests/std/tests/GH_000140_adl_proof_construction/test.compile.pass.cpp +++ b/tests/std/tests/GH_000140_adl_proof_construction/test.compile.pass.cpp @@ -8,6 +8,7 @@ #include #include #include + #if _HAS_CXX17 #include #endif // _HAS_CXX17 diff --git a/tests/std/tests/GH_000952_bind_constraints/test.compile.pass.cpp b/tests/std/tests/GH_000952_bind_constraints/test.compile.pass.cpp index f481702aa99..ec5f18f7b4d 100644 --- a/tests/std/tests/GH_000952_bind_constraints/test.compile.pass.cpp +++ b/tests/std/tests/GH_000952_bind_constraints/test.compile.pass.cpp @@ -19,7 +19,7 @@ using namespace std; -void test() { // COMPILE-ONLY +void test() { { auto lambda = [](int) {}; auto f = bind(lambda, placeholders::_1); diff --git a/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp b/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp index 4d4ff4c7094..3df4b027253 100644 --- a/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp +++ b/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp @@ -4,15 +4,16 @@ #ifndef _M_CEE // TRANSITION, VSO-1659496 #include #include -#if _HAS_CXX17 -#include -#endif // _HAS_CXX17 #include #include #include #include #include +#if _HAS_CXX17 +#include +#endif // _HAS_CXX17 + template struct tagged_truth { template diff --git a/tests/std/tests/GH_001923_filesystem_long_path_support/test.cpp b/tests/std/tests/GH_001923_filesystem_long_path_support/test.cpp index eb2855a1fbb..c56252b2dd8 100644 --- a/tests/std/tests/GH_001923_filesystem_long_path_support/test.cpp +++ b/tests/std/tests/GH_001923_filesystem_long_path_support/test.cpp @@ -11,7 +11,7 @@ #include #pragma warning(pop) -#include "test_filesystem_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/GH_002030_asan_annotate_string/test.cpp b/tests/std/tests/GH_002030_asan_annotate_string/test.cpp index ab35b14f364..0d371ddcf37 100644 --- a/tests/std/tests/GH_002030_asan_annotate_string/test.cpp +++ b/tests/std/tests/GH_002030_asan_annotate_string/test.cpp @@ -20,13 +20,14 @@ #include #include #include +#include +#include -#include #if _HAS_CXX17 #include #endif // _HAS_CXX17 -#include -#include + +#include using namespace std; diff --git a/tests/std/tests/GH_002431_byte_range_find_with_unreachable_sentinel/test.cpp b/tests/std/tests/GH_002431_byte_range_find_with_unreachable_sentinel/test.cpp index 303d47ae51e..0f742004957 100644 --- a/tests/std/tests/GH_002431_byte_range_find_with_unreachable_sentinel/test.cpp +++ b/tests/std/tests/GH_002431_byte_range_find_with_unreachable_sentinel/test.cpp @@ -11,7 +11,7 @@ #include #pragma warning(pop) -#include "test_vector_algorithms_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/GH_002885_stable_sort_difference_type/test.cpp b/tests/std/tests/GH_002885_stable_sort_difference_type/test.cpp index 34fe497513c..f39c440d07b 100644 --- a/tests/std/tests/GH_002885_stable_sort_difference_type/test.cpp +++ b/tests/std/tests/GH_002885_stable_sort_difference_type/test.cpp @@ -7,7 +7,7 @@ #include #include -#include "range_algorithm_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/GH_003617_vectorized_meow_element/test.cpp b/tests/std/tests/GH_003617_vectorized_meow_element/test.cpp index 861da27e07d..44950d77e76 100644 --- a/tests/std/tests/GH_003617_vectorized_meow_element/test.cpp +++ b/tests/std/tests/GH_003617_vectorized_meow_element/test.cpp @@ -8,8 +8,8 @@ #include #include -#include "test_min_max_element_support.hpp" -#include "test_vector_algorithms_support.hpp" +#include +#include using namespace std; diff --git a/tests/std/tests/GH_003840_tellg_when_reading_lf_file_in_text_mode/test.cpp b/tests/std/tests/GH_003840_tellg_when_reading_lf_file_in_text_mode/test.cpp index 2482c9c6a1f..d34a858adc0 100644 --- a/tests/std/tests/GH_003840_tellg_when_reading_lf_file_in_text_mode/test.cpp +++ b/tests/std/tests/GH_003840_tellg_when_reading_lf_file_in_text_mode/test.cpp @@ -7,7 +7,7 @@ #include #include -#include "temp_file_name.hpp" +#include using namespace std; diff --git a/tests/std/tests/GH_004023_mdspan_fwd_prod_overflow/test.compile.pass.cpp b/tests/std/tests/GH_004023_mdspan_fwd_prod_overflow/test.compile.pass.cpp index 48095f66fe1..836e2e02d3f 100644 --- a/tests/std/tests/GH_004023_mdspan_fwd_prod_overflow/test.compile.pass.cpp +++ b/tests/std/tests/GH_004023_mdspan_fwd_prod_overflow/test.compile.pass.cpp @@ -39,7 +39,7 @@ struct layout_packed_upper { // LAPACK packed storage, VERY INCOMPLETE }; }; -int main() { +void test() { constexpr int32_t dim = 47'000; // sqrt(2^32) > dim > sqrt(2^31), dim assumed even below constexpr auto expected_size = [] { int32_t unused; @@ -74,6 +74,4 @@ int main() { static_assert(m.size() == expected_size); static_assert(m.mapping().required_span_size() == expected_req_size); } - - return 0; } diff --git a/tests/std/tests/GH_004929_internal_tag_constructors/test.cpp b/tests/std/tests/GH_004929_internal_tag_constructors/test.cpp index 9509fe13142..c8aa7a9d1d4 100644 --- a/tests/std/tests/GH_004929_internal_tag_constructors/test.cpp +++ b/tests/std/tests/GH_004929_internal_tag_constructors/test.cpp @@ -6,6 +6,7 @@ #include #include #include + #if _HAS_CXX17 #include #endif // _HAS_CXX17 diff --git a/tests/std/tests/GH_005421_vector_algorithms_integer_class_type_iterator/test.cpp b/tests/std/tests/GH_005421_vector_algorithms_integer_class_type_iterator/test.cpp index 6e54f8390a1..c2b53e59f58 100644 --- a/tests/std/tests/GH_005421_vector_algorithms_integer_class_type_iterator/test.cpp +++ b/tests/std/tests/GH_005421_vector_algorithms_integer_class_type_iterator/test.cpp @@ -8,7 +8,7 @@ #include #include -#include "range_algorithm_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/GH_005546_containers_size_type_cast/test.cpp b/tests/std/tests/GH_005546_containers_size_type_cast/test.cpp index 632889c680c..5116ee9ac55 100644 --- a/tests/std/tests/GH_005546_containers_size_type_cast/test.cpp +++ b/tests/std/tests/GH_005546_containers_size_type_cast/test.cpp @@ -484,16 +484,12 @@ CONSTEXPR20 void test_basic_string() { #if _HAS_CXX20 assert(s2 <=> s2 == strong_ordering::equal); assert(s2 <=> "EF" == strong_ordering::equal); -#endif // _HAS_CXX20 -#if _HAS_CXX20 erase(s2, 'E'); assert(s2 == "F"); erase_if(s2, [](char) { return true; }); assert(s2.empty()); -#endif // _HAS_CXX20 -#if _HAS_CXX20 if (!is_constant_evaluated()) #endif // _HAS_CXX20 { diff --git a/tests/std/tests/LWG2510_tag_classes/test.compile.pass.cpp b/tests/std/tests/LWG2510_tag_classes/test.compile.pass.cpp index 5e7efbdf073..f84a6873d27 100644 --- a/tests/std/tests/LWG2510_tag_classes/test.compile.pass.cpp +++ b/tests/std/tests/LWG2510_tag_classes/test.compile.pass.cpp @@ -59,7 +59,7 @@ STATIC_ASSERT(!implicitly_default_constructible); STATIC_ASSERT(!implicitly_default_constructible); template -void check_tag_class() { // COMPILE-ONLY +void check_tag_class() { STATIC_ASSERT(is_default_constructible_v); STATIC_ASSERT(!implicitly_default_constructible); @@ -119,7 +119,7 @@ void check_tag_class() { // COMPILE-ONLY STATIC_ASSERT(sizeof(T) == 1); } -void check_standard_tags() { // COMPILE-ONLY +void check_standard_tags() { check_tag_class(); check_tag_class(); check_tag_class(); @@ -164,7 +164,7 @@ void check_standard_tags() { // COMPILE-ONLY } // We intentionally implement internal disambiguation tag types like standard ones. -void check_implementation_details() { // COMPILE-ONLY +void check_implementation_details() { // TODO: Synchronize the check list with actual implementation details. check_tag_class<_Alloc_exact_args_t>(); check_tag_class<_Alloc_unpack_tuple_t>(); diff --git a/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/test.cpp b/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/test.cpp index eac2577ce83..a0db9c92b76 100644 --- a/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/test.cpp +++ b/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/test.cpp @@ -6,7 +6,7 @@ #include #include -#include "test_format_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/P0645R10_text_formatting_parsing/test.cpp b/tests/std/tests/P0645R10_text_formatting_parsing/test.cpp index 4fc45af263a..d98e55eae57 100644 --- a/tests/std/tests/P0645R10_text_formatting_parsing/test.cpp +++ b/tests/std/tests/P0645R10_text_formatting_parsing/test.cpp @@ -10,7 +10,7 @@ #include #include -#include "test_format_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/P0645R10_text_formatting_utf8/test.cpp b/tests/std/tests/P0645R10_text_formatting_utf8/test.cpp index bd80d6d24b2..3c2fb453cb5 100644 --- a/tests/std/tests/P0645R10_text_formatting_utf8/test.cpp +++ b/tests/std/tests/P0645R10_text_formatting_utf8/test.cpp @@ -6,7 +6,7 @@ #include #include -#include "test_format_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/P0718R2_atomic_smart_ptrs/test.cpp b/tests/std/tests/P0718R2_atomic_smart_ptrs/test.cpp index 88b8477f2bf..a5100c434ce 100644 --- a/tests/std/tests/P0718R2_atomic_smart_ptrs/test.cpp +++ b/tests/std/tests/P0718R2_atomic_smart_ptrs/test.cpp @@ -7,6 +7,7 @@ #include #include #include + #ifdef _DEBUG #include #endif // _DEBUG diff --git a/tests/std/tests/P0768R1_spaceship_cpos/test.cpp b/tests/std/tests/P0768R1_spaceship_cpos/test.cpp index 5dab6aa5265..07e13aa2835 100644 --- a/tests/std/tests/P0768R1_spaceship_cpos/test.cpp +++ b/tests/std/tests/P0768R1_spaceship_cpos/test.cpp @@ -54,7 +54,7 @@ namespace { static_assert(is_same_v, IllFormed>); // [cmp.alg]/4.1 static_assert(is_same_v, IllFormed>); // [cmp.alg]/5.1 static_assert(is_same_v, IllFormed>); // [cmp.alg]/6.1 -} // namespace +} // unnamed namespace // Test when the type isn't comparable at all. struct NotComparable {}; @@ -324,7 +324,7 @@ namespace { static_assert(is_same_v, const F<11>>, Partial>); // [cmp.alg]/6.3 static_assert(is_same_v, const F<12>>, IllFormed>); // [cmp.alg]/6.3 static_assert(is_same_v, const F<13>>, Partial>); // [cmp.alg]/6.3 -} // namespace +} // unnamed namespace // Test strengthened requirements in P2167R3: compare_*_order_fallback CPOs require return types to be boolean-testable. enum class ResultKind : bool { diff --git a/tests/std/tests/P0896R4_ranges_alg_partition_point/test.cpp b/tests/std/tests/P0896R4_ranges_alg_partition_point/test.cpp index 547402287c3..30fe241ff42 100644 --- a/tests/std/tests/P0896R4_ranges_alg_partition_point/test.cpp +++ b/tests/std/tests/P0896R4_ranges_alg_partition_point/test.cpp @@ -43,8 +43,10 @@ struct partition_point_test { int elements[200]; iota(ranges::begin(elements), ranges::end(elements), 0); - // to avoid constant expression step limits - const size_t bound = elements[0] + (is_constant_evaluated() ? 10 : ranges::size(elements)); + size_t bound = ranges::size(elements); + if (is_constant_evaluated()) { + bound = min(bound, size_t{10}); // to avoid constant expression step limits + } for (size_t i = 0; i < bound; ++i) { const R range{span{elements}.first(i)}; diff --git a/tests/std/tests/P2093R14_formatted_output/test.cpp b/tests/std/tests/P2093R14_formatted_output/test.cpp index cf7ba595827..da82393f092 100644 --- a/tests/std/tests/P2093R14_formatted_output/test.cpp +++ b/tests/std/tests/P2093R14_formatted_output/test.cpp @@ -24,7 +24,7 @@ #include #pragma warning(pop) -#include "temp_file_name.hpp" +#include using namespace std; diff --git a/tests/std/tests/P2278R4_basic_const_iterator/test.cpp b/tests/std/tests/P2278R4_basic_const_iterator/test.cpp index aa861d14580..47ebdfdc390 100644 --- a/tests/std/tests/P2278R4_basic_const_iterator/test.cpp +++ b/tests/std/tests/P2278R4_basic_const_iterator/test.cpp @@ -8,7 +8,7 @@ #include #include -#include "range_algorithm_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/P2502R2_generator/test.cpp b/tests/std/tests/P2502R2_generator/test.cpp index d7216959536..a95255cb4e6 100644 --- a/tests/std/tests/P2502R2_generator/test.cpp +++ b/tests/std/tests/P2502R2_generator/test.cpp @@ -25,7 +25,7 @@ int main() {} #include #include -#include "test_generator_support.hpp" +#include #pragma warning(disable : 28251) // Inconsistent annotation for 'new': this instance has no annotations. diff --git a/tests/std/tests/P2502R2_generator_iterator/test.cpp b/tests/std/tests/P2502R2_generator_iterator/test.cpp index 04750d134b2..e097bec6bb4 100644 --- a/tests/std/tests/P2502R2_generator_iterator/test.cpp +++ b/tests/std/tests/P2502R2_generator_iterator/test.cpp @@ -16,7 +16,7 @@ int main() {} #include #include -#include "test_generator_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/P2502R2_generator_promise/test.cpp b/tests/std/tests/P2502R2_generator_promise/test.cpp index d4893df1521..4c04550cf27 100644 --- a/tests/std/tests/P2502R2_generator_promise/test.cpp +++ b/tests/std/tests/P2502R2_generator_promise/test.cpp @@ -23,8 +23,8 @@ int main() {} #include #include -#include "range_algorithm_support.hpp" -#include "test_generator_support.hpp" +#include +#include using namespace std; diff --git a/tests/std/tests/P2693R1_text_formatting_stacktrace/test.cpp b/tests/std/tests/P2693R1_text_formatting_stacktrace/test.cpp index 7186f55df55..81fa1ca4a6a 100644 --- a/tests/std/tests/P2693R1_text_formatting_stacktrace/test.cpp +++ b/tests/std/tests/P2693R1_text_formatting_stacktrace/test.cpp @@ -13,7 +13,7 @@ #include #include -#include "test_format_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/P2693R1_text_formatting_thread_id/test.cpp b/tests/std/tests/P2693R1_text_formatting_thread_id/test.cpp index 4e6fd42c555..b1deb838d62 100644 --- a/tests/std/tests/P2693R1_text_formatting_thread_id/test.cpp +++ b/tests/std/tests/P2693R1_text_formatting_thread_id/test.cpp @@ -19,7 +19,7 @@ #include #include -#include "test_format_support.hpp" +#include #define STR(Str) TYPED_LITERAL(CharT, Str) diff --git a/tests/std/tests/VSO_0000000_initialize_everything/test.cpp b/tests/std/tests/VSO_0000000_initialize_everything/test.cpp index a41e347078a..83fe34d65b3 100644 --- a/tests/std/tests/VSO_0000000_initialize_everything/test.cpp +++ b/tests/std/tests/VSO_0000000_initialize_everything/test.cpp @@ -44,12 +44,12 @@ struct stateful_allocator { }; template -inline bool operator==(const stateful_allocator& lhs, const stateful_allocator& rhs) { +bool operator==(const stateful_allocator& lhs, const stateful_allocator& rhs) { return lhs.state == rhs.state; } template -inline bool operator!=(const stateful_allocator& lhs, const stateful_allocator& rhs) { +bool operator!=(const stateful_allocator& lhs, const stateful_allocator& rhs) { return lhs.state != rhs.state; } diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_16_difference_type_1/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_16_difference_type_1/test.compile.pass.cpp index 059c6cccfeb..d7621ec5c58 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_16_difference_type_1/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_16_difference_type_1/test.compile.pass.cpp @@ -4,7 +4,6 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_op_deref.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 1 using test_difference_type = short; #include diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_16_difference_type_2/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_16_difference_type_2/test.compile.pass.cpp index 0c5e21a4248..d58e69f0374 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_16_difference_type_2/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_16_difference_type_2/test.compile.pass.cpp @@ -4,7 +4,6 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_op_deref.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 2 using test_difference_type = short; #include diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_32_difference_type_1/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_32_difference_type_1/test.compile.pass.cpp index 33b02ceba83..decd736ccd8 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_32_difference_type_1/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_32_difference_type_1/test.compile.pass.cpp @@ -4,7 +4,6 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_op_deref.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 1 using test_difference_type = int; #include diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_32_difference_type_2/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_32_difference_type_2/test.compile.pass.cpp index 1ac43efad6f..b01ba7f9fe4 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_32_difference_type_2/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_32_difference_type_2/test.compile.pass.cpp @@ -4,7 +4,6 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_op_deref.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 2 using test_difference_type = int; #include diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_64_difference_type_1/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_64_difference_type_1/test.compile.pass.cpp index 2258355408e..35de75dc87a 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_64_difference_type_1/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_64_difference_type_1/test.compile.pass.cpp @@ -4,7 +4,6 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_op_deref.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 1 using test_difference_type = long long; #include diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_64_difference_type_2/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_64_difference_type_2/test.compile.pass.cpp index 94a2ca95e8c..523d0de7dc1 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_64_difference_type_2/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_64_difference_type_2/test.compile.pass.cpp @@ -4,7 +4,6 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_op_deref.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 2 using test_difference_type = long long; #include diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_int_1/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_int_1/test.compile.pass.cpp index f843000ebcf..5f6d5cb848a 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_int_1/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_int_1/test.compile.pass.cpp @@ -4,6 +4,5 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_int.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 1 #include diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_int_2/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_int_2/test.compile.pass.cpp index 8dbb223bbd3..45e374db38c 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_int_2/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_int_2/test.compile.pass.cpp @@ -4,6 +4,5 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_int.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 2 #include diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_nontrivial_1/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_nontrivial_1/test.compile.pass.cpp index 590bfe829a8..0be14e5d7de 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_nontrivial_1/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_nontrivial_1/test.compile.pass.cpp @@ -4,6 +4,5 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_nontrivial.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 1 #include diff --git a/tests/std/tests/VSO_0000000_instantiate_algorithms_nontrivial_2/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_algorithms_nontrivial_2/test.compile.pass.cpp index a9c977fd323..f36e24de7bc 100644 --- a/tests/std/tests/VSO_0000000_instantiate_algorithms_nontrivial_2/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_algorithms_nontrivial_2/test.compile.pass.cpp @@ -4,6 +4,5 @@ // The instantiate_algorithm* tests take too long individually, so must be split into two parts. // instantiate_algorithms_nontrivial.hpp contains the common test code. -#define _USE_NAMED_IDL_NAMESPACE 1 #define INSTANTIATE_ALGORITHMS_SPLIT_MODE 2 #include diff --git a/tests/std/tests/VSO_0000000_instantiate_containers/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_containers/test.compile.pass.cpp index cd8fc908e36..d42c4edd184 100644 --- a/tests/std/tests/VSO_0000000_instantiate_containers/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_containers/test.compile.pass.cpp @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#define _USE_NAMED_IDL_NAMESPACE 1 #include #include #include @@ -748,7 +747,7 @@ void extended_math_functions_test(T value) { namespace std { template - inline const T* cbegin(valarray& arr) { + const T* cbegin(valarray& arr) { return begin(arr); // unqualified } } // namespace std diff --git a/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp index a59a6ad78df..6e393730da0 100644 --- a/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp @@ -19,7 +19,6 @@ #define _SILENCE_CXX20_U8PATH_DEPRECATION_WARNING #define _SILENCE_CXX20_VOLATILE_DEPRECATION_WARNING #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING -#define _USE_NAMED_IDL_NAMESPACE 1 #include #include @@ -104,7 +103,7 @@ #include #endif // _M_CEE_PURE -#include "experimental_filesystem.hpp" +#include #include diff --git a/tests/std/tests/VSO_0000000_instantiate_type_traits/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_type_traits/test.compile.pass.cpp index 7d2d946555f..d18bf106ce8 100644 --- a/tests/std/tests/VSO_0000000_instantiate_type_traits/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_type_traits/test.compile.pass.cpp @@ -7,7 +7,6 @@ #define _SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING #define _SILENCE_CXX20_IS_POD_DEPRECATION_WARNING #define _SILENCE_CXX23_ALIGNED_UNION_DEPRECATION_WARNING -#define _USE_NAMED_IDL_NAMESPACE 1 #include #include diff --git a/tests/std/tests/VSO_0000000_path_stream_parameter/test.cpp b/tests/std/tests/VSO_0000000_path_stream_parameter/test.cpp index 2fda85579c9..eb527204e22 100644 --- a/tests/std/tests/VSO_0000000_path_stream_parameter/test.cpp +++ b/tests/std/tests/VSO_0000000_path_stream_parameter/test.cpp @@ -8,7 +8,7 @@ #include #include -#include "experimental_filesystem.hpp" +#include #include using namespace std; diff --git a/tests/std/tests/VSO_0000000_type_traits/test.cpp b/tests/std/tests/VSO_0000000_type_traits/test.compile.pass.cpp similarity index 97% rename from tests/std/tests/VSO_0000000_type_traits/test.cpp rename to tests/std/tests/VSO_0000000_type_traits/test.compile.pass.cpp index a1f817152dd..bf1bb415909 100644 --- a/tests/std/tests/VSO_0000000_type_traits/test.cpp +++ b/tests/std/tests/VSO_0000000_type_traits/test.compile.pass.cpp @@ -1175,6 +1175,16 @@ template void test_VSO_707437_i(T, type_identity_t*) {} #endif // _HAS_CXX20 +void test_VSO_707437() { + test_VSO_707437_c(11L, nullptr); + test_VSO_707437_v(11L, nullptr); + test_VSO_707437_cv(11L, nullptr); + +#if _HAS_CXX20 + test_VSO_707437_i(11L, nullptr); +#endif // _HAS_CXX20 +} + // VSO-781535 "[RWC][Regression][prod/fe] WebKit failed with error C2938" // The compiler can't track that the type __underlying_type(T) is dependent on T, and so will diagnose this definition // as ill-formed ("'std::enable_if_t' : Failed to specialize alias template") if we expose the intrinsic @@ -1246,19 +1256,6 @@ STATIC_ASSERT(!HasUnderlyingTypeAlias::value); STATIC_ASSERT(!HasUnderlyingTypeAlias::value); STATIC_ASSERT(!HasUnderlyingTypeAlias::value); - -int main() { - test_all_function_types(); - - test_VSO_707437_c(11L, nullptr); - test_VSO_707437_v(11L, nullptr); - test_VSO_707437_cv(11L, nullptr); - -#if _HAS_CXX20 - test_VSO_707437_i(11L, nullptr); -#endif // _HAS_CXX20 -} - #if _HAS_CXX20 // Test the P0898R3 changes to : // * Addition of common_reference and basic_common_reference diff --git a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp index 5cbc73d076c..eeff29a4bfa 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp @@ -26,9 +26,9 @@ #include #endif // _HAS_CXX20 -#include "test_is_sorted_until_support.hpp" -#include "test_min_max_element_support.hpp" -#include "test_vector_algorithms_support.hpp" +#include +#include +#include using namespace std; diff --git a/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp index ba8f7e80277..3bc87390378 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp @@ -8,9 +8,9 @@ #include #include -#include "test_is_sorted_until_support.hpp" -#include "test_min_max_element_support.hpp" -#include "test_vector_algorithms_support.hpp" +#include +#include +#include using namespace std; diff --git a/tests/std/tests/VSO_0000000_vector_algorithms_mismatch_and_lex_compare/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms_mismatch_and_lex_compare/test.cpp index fcac0f772e0..f1c2580b72f 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms_mismatch_and_lex_compare/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms_mismatch_and_lex_compare/test.cpp @@ -15,7 +15,7 @@ #include #endif // _HAS_CXX20 -#include "test_vector_algorithms_support.hpp" +#include using namespace std; diff --git a/tests/std/tests/VSO_0000000_vector_algorithms_search_n/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms_search_n/test.cpp index 08b825855f2..da5e91a2323 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms_search_n/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms_search_n/test.cpp @@ -10,7 +10,7 @@ #include #include -#include "test_vector_algorithms_support.hpp" +#include #pragma warning(disable : 4984) // if constexpr is a C++17 language extension #ifdef __clang__ diff --git a/tests/std/tests/VSO_0121275_filesystem_canonical_should_handle_many_double_dots/test.cpp b/tests/std/tests/VSO_0121275_filesystem_canonical_should_handle_many_double_dots/test.cpp index 17517082f0b..96480450ae5 100644 --- a/tests/std/tests/VSO_0121275_filesystem_canonical_should_handle_many_double_dots/test.cpp +++ b/tests/std/tests/VSO_0121275_filesystem_canonical_should_handle_many_double_dots/test.cpp @@ -11,7 +11,7 @@ #include #include -#include "experimental_filesystem.hpp" +#include using namespace std; namespace fs = std::experimental::filesystem; diff --git a/tests/std/tests/VSO_2252142_wrong_C5046/test.compile.pass.cpp b/tests/std/tests/VSO_2252142_wrong_C5046/test.compile.pass.cpp index 52462f3aa22..2a3c829c9d2 100644 --- a/tests/std/tests/VSO_2252142_wrong_C5046/test.compile.pass.cpp +++ b/tests/std/tests/VSO_2252142_wrong_C5046/test.compile.pass.cpp @@ -33,7 +33,7 @@ constexpr bool has_emplace_front #include -#include "experimental_filesystem.hpp" +#include #define TMP_NAME(suf) "tmp_name" suf #define CHECK_TBL(str, field) CHECK_STRING(native_to_char(str), fix_bslash(STD string(field))) diff --git a/tests/utils/stl/util.py b/tests/utils/stl/util.py index 74f0918a15c..20aaf4d9fde 100644 --- a/tests/utils/stl/util.py +++ b/tests/utils/stl/util.py @@ -6,42 +6,12 @@ # #===----------------------------------------------------------------------===## -from contextlib import contextmanager -from pathlib import Path -import os import platform import signal import subprocess -import sys -import tempfile import threading -@contextmanager -def guardedTempFilename(suffix='', prefix='', dir=None): - # Creates and yields a temporary filename within a with statement. The file - # is removed upon scope exit. - handle, name = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir) - os.close(handle) - yield name - Path(name).unlink(True) - - -@contextmanager -def guardedFilename(name): - # Yields a filename within a with statement. The file is removed upon scope - # exit. - yield name - Path(name).unlink(True) - - -@contextmanager -def nullContext(value): - # Yields a variable within a with statement. No action is taken upon scope - # exit. - yield value - - def makeReport(cmd, out, err, rc): report = "Command: \"%s\"\n" % "\" \"".join(cmd) report += f"Exit Code: {rc} (0x{rc:X})\n" @@ -155,25 +125,14 @@ def killProcessAndChildren(pid): using the psutil module which provides a simple platform neutral implementation. """ - if platform.system() == 'AIX': - subprocess.call('kill -kill $(ps -o pid= -L{})'.format(pid), - shell=True) - else: - import psutil - try: - psutilProc = psutil.Process(pid) - # Handle the different psutil API versions + import psutil + try: + psutilProc = psutil.Process(pid) + for child in psutilProc.children(recursive=True): try: - # psutil >= 2.x - children_iterator = psutilProc.children(recursive=True) - except AttributeError: - # psutil 1.x - children_iterator = psutilProc.get_children(recursive=True) - for child in children_iterator: - try: - child.kill() - except psutil.NoSuchProcess: - pass - psutilProc.kill() - except psutil.NoSuchProcess: - pass + child.kill() + except psutil.NoSuchProcess: + pass + psutilProc.kill() + except psutil.NoSuchProcess: + pass diff --git a/tools/validate/validate.cpp b/tools/validate/validate.cpp index 55ed9a2d266..28645155d65 100644 --- a/tools/validate/validate.cpp +++ b/tools/validate/validate.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include