From 0209afa260ad8643e28e0dc86611eb00743da9be Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 3 Feb 2022 20:37:51 -0800 Subject: [PATCH 01/25] ranges: Use extended friend syntax. --- stl/inc/ranges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/ranges b/stl/inc/ranges index 32e81b6c5d..149f8cf9a1 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -3878,7 +3878,7 @@ namespace ranges { class _Iterator { private: - friend class _Sentinel; + friend _Sentinel; split_view* _Parent = nullptr; iterator_t<_Vw> _Current = {}; From ada6364dadce2a2eddf3cae56eb7d0c5ced8a42e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 3 Feb 2022 20:55:43 -0800 Subject: [PATCH 02/25] Add newlines between non-chained if statements. --- stl/inc/algorithm | 2 ++ stl/inc/chrono | 7 +++++++ stl/inc/experimental/filesystem | 1 + stl/inc/regex | 2 ++ 4 files changed, 12 insertions(+) diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 686a476b2a..3a059e9cc3 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -9428,6 +9428,7 @@ constexpr pair<_FwdIt, _FwdIt> _Minmax_element_unchecked(_FwdIt _First, _FwdIt _ if (_DEBUG_LT_PRED(_Pred, *_Next, *_Found.first)) { _Found.first = _Next; } + if (!_DEBUG_LT_PRED(_Pred, *_First, *_Found.second)) { _Found.second = _First; } @@ -9435,6 +9436,7 @@ constexpr pair<_FwdIt, _FwdIt> _Minmax_element_unchecked(_FwdIt _First, _FwdIt _ if (_DEBUG_LT_PRED(_Pred, *_First, *_Found.first)) { _Found.first = _First; } + if (!_DEBUG_LT_PRED(_Pred, *_Next, *_Found.second)) { _Found.second = _Next; } diff --git a/stl/inc/chrono b/stl/inc/chrono index 60cf2ea867..f7a59fa4e9 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -3648,24 +3648,31 @@ namespace chrono { if (_Second || _Subsecond) { _Ret |= _F_sec; } + if (_Minute) { _Ret |= _F_min; } + if (_Hour_24) { _Ret |= _F_hr; } + if (_Day) { _Ret |= _F_day; } + if (_Weekday) { _Ret |= _F_wkday; } + if (_Month) { _Ret |= _F_mon; } + if (_Day_of_year) { _Ret |= _F_doy; } + if (_Two_dig_year && _Century) { _Ret |= _F_year; } diff --git a/stl/inc/experimental/filesystem b/stl/inc/experimental/filesystem index 43f40ebfac..fd8ca463a2 100644 --- a/stl/inc/experimental/filesystem +++ b/stl/inc/experimental/filesystem @@ -1914,6 +1914,7 @@ inline void copy(const path& _Oldpval, const path& _Newpval, copy_options _Opts, _Oldstat = status(_Oldpval); _Newstat = status(_Newpval); } + if (!exists(_Oldstat) || equivalent(_Oldpval, _Newpval, _Code2) || is_other(_Oldstat) || is_other(_Newstat) || (is_directory(_Oldstat) && is_regular_file(_Newstat))) { _Code = make_error_code(errc::operation_not_permitted); diff --git a/stl/inc/regex b/stl/inc/regex index a2fae5d4f6..3ff01717b1 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -2080,6 +2080,7 @@ _OutIt _Format_default(const match_results<_BidIt, _Alloc>& _Match, _OutIt _Out, _Num *= 10; _Num += static_cast(*_First++ - '0'); } + if (_Num == 0) { // preserve $0, $00 *_Out++ = '$'; *_Out++ = '0'; @@ -4091,6 +4092,7 @@ void _Parser<_FwdIt, _Elem, _RxTraits>::_CharacterClass() { // add bracket expre _Nfa._Negate(); _Next(); } + if ((_L_flags & _L_brk_rstr) && _Mchar == _Meta_rsq) { // insert initial ] when not special _Nfa._Add_char_to_class(_Meta_rsq); _Next(); From 8246c6e90e346b1bdc12aca84c395b41be9b8c42 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 3 Feb 2022 21:08:03 -0800 Subject: [PATCH 03/25] Rename to GH_001411_core_headers/test.compile.pass.cpp. --- .../GH_001411_core_headers/{test.cpp => test.compile.pass.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/std/tests/GH_001411_core_headers/{test.cpp => test.compile.pass.cpp} (100%) diff --git a/tests/std/tests/GH_001411_core_headers/test.cpp b/tests/std/tests/GH_001411_core_headers/test.compile.pass.cpp similarity index 100% rename from tests/std/tests/GH_001411_core_headers/test.cpp rename to tests/std/tests/GH_001411_core_headers/test.compile.pass.cpp From 372887d05e4f13c5c3114df4fadef6e837237bb5 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 3 Feb 2022 21:38:39 -0800 Subject: [PATCH 04/25] Fix an unpaired `// clang-format off` after `_Generate_n_fn`. --- stl/inc/algorithm | 1 - 1 file changed, 1 deletion(-) diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 3a059e9cc3..7369d58601 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -3604,7 +3604,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template requires invocable<_Fn&> && indirectly_writable<_Out, invoke_result_t<_Fn&>> constexpr _Out operator()(_Out _First, iter_difference_t<_Out> _Count, _Fn _Gen) const { From d2d8e4e790fba4e850a7bf660c91859d8a92b990 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 3 Feb 2022 22:15:51 -0800 Subject: [PATCH 05/25] Enable clang-format with zero-to-minor changes. --- stl/inc/algorithm | 133 ++++++---------------------------------------- stl/inc/format | 4 -- stl/inc/ranges | 40 +------------- stl/inc/xutility | 10 ---- 4 files changed, 18 insertions(+), 169 deletions(-) diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 7369d58601..eb350f90fe 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -1333,7 +1333,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template requires indirectly_copyable<_It, _Out> constexpr copy_n_result<_It, _Out> operator()(_It _First, iter_difference_t<_It> _Count, _Out _Result) const { @@ -1341,7 +1340,7 @@ namespace ranges { if constexpr (_Iter_copy_cat::_Bitcopy_assignable) { if (!_STD is_constant_evaluated()) { auto _Final = _UFirst + _Count; - _Result = _Copy_memmove(_STD move(_UFirst), _Final, _STD move(_Result)); + _Result = _Copy_memmove(_STD move(_UFirst), _Final, _STD move(_Result)); _Seek_wrapped(_First, _STD move(_Final)); return {_STD move(_First), _STD move(_Result)}; } @@ -1354,7 +1353,6 @@ namespace ranges { _Seek_wrapped(_First, _STD move(_UFirst)); return {_STD move(_First), _STD move(_Result)}; } - // clang-format on }; inline constexpr _Copy_n_fn copy_n{_Not_quite_object::_Construct_tag{}}; @@ -1366,7 +1364,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, bidirectional_iterator _It2> requires indirectly_copyable<_It1, _It2> constexpr copy_backward_result<_It1, _It2> operator()(_It1 _First, _Se1 _Last, _It2 _Result) const { @@ -1385,7 +1382,6 @@ namespace ranges { _Result = _Copy_backward_unchecked(_Ubegin(_Range), _ULast, _STD move(_Result)); return {_Rewrap_iterator(_Range, _STD move(_ULast)), _STD move(_Result)}; } - // clang-format on }; inline constexpr _Copy_backward_fn copy_backward{_Not_quite_object::_Construct_tag{}}; @@ -1429,7 +1425,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_copyable<_It, _Out> @@ -1453,7 +1448,6 @@ namespace ranges { _Seek_wrapped(_First, _STD move(_UResult.in)); return {_STD move(_First), _STD move(_UResult.out)}; } - // clang-format on private: template @@ -1480,11 +1474,9 @@ namespace ranges { template using move_result = in_out_result<_In, _Out>; - // clang-format off template _Se, weakly_incrementable _Out> requires indirectly_movable<_It, _Out> constexpr move_result<_It, _Out> _Move_unchecked(_It _First, _Se _Last, _Out _Result) { - // clang-format on if constexpr (_Iter_move_cat<_It, _Out>::_Bitcopy_assignable) { if (!_STD is_constant_evaluated()) { auto _Final = _RANGES next(_First, _STD move(_Last)); @@ -1504,11 +1496,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out> requires indirectly_movable<_It, _Out> constexpr move_result<_It, _Out> operator()(_It _First, _Se _Last, _Out _Result) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UResult = _RANGES _Move_unchecked( _Get_unwrapped(_STD move(_First)), _Get_unwrapped(_STD move(_Last)), _STD move(_Result)); @@ -1517,11 +1507,9 @@ namespace ranges { return {_STD move(_First), _STD move(_UResult.out)}; } - // clang-format off template requires indirectly_movable, _Out> constexpr move_result, _Out> operator()(_Rng&& _Range, _Out _Result) const { - // clang-format on auto _First = _RANGES begin(_Range); auto _UResult = _RANGES _Move_unchecked(_Get_unwrapped(_STD move(_First)), _Uend(_Range), _STD move(_Result)); @@ -1536,7 +1524,6 @@ namespace ranges { template using move_backward_result = in_out_result<_In, _Out>; - // clang-format off // concept-constrained for strict enforcement as it is used by several algorithms template requires indirectly_movable<_It1, _It2> @@ -1553,13 +1540,11 @@ namespace ranges { return _Result; } - // clang-format on class _Move_backward_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, bidirectional_iterator _It2> requires indirectly_movable<_It1, _It2> constexpr move_backward_result<_It1, _It2> operator()(_It1 _First, _Se1 _Last, _It2 _Result) const { @@ -1578,7 +1563,6 @@ namespace ranges { _Result = _Move_backward_common(_Ubegin(_Range), _ULast, _STD move(_Result)); return {_Rewrap_iterator(_Range, _STD move(_ULast)), _STD move(_Result)}; } - // clang-format on }; inline constexpr _Move_backward_fn move_backward{_Not_quite_object::_Construct_tag{}}; @@ -1630,7 +1614,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out1, weakly_incrementable _Out2, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_copyable<_It, _Out1> && indirectly_copyable<_It, _Out2> @@ -1660,7 +1643,7 @@ namespace ranges { _Seek_wrapped(_Dest_false, _STD move(_UResult.out2)); return {_STD move(_First), _STD move(_Dest_true), _STD move(_Dest_false)}; } - // clang-format on + private: template _NODISCARD static constexpr partition_copy_result<_It, _Out1, _Out2> _Partition_copy_unchecked( @@ -2912,7 +2895,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2> requires indirectly_swappable<_It1, _It2> constexpr swap_ranges_result<_It1, _It2> operator()( @@ -2943,7 +2925,7 @@ namespace ranges { _Seek_wrapped(_First2, _STD move(_UResult.in2)); return {_STD move(_First1), _STD move(_First2)}; } - // clang-format on + private: template _NODISCARD static constexpr swap_ranges_result<_It1, _It2> _Swap_ranges_unchecked( @@ -3077,7 +3059,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out, copy_constructible _Fn, class _Pj = identity> requires indirectly_writable<_Out, indirect_result_t<_Fn&, projected<_It, _Pj>>> @@ -3122,8 +3103,8 @@ namespace ranges { template - requires indirectly_writable<_Out, indirect_result_t<_Fn&, projected, _Pj1>, - projected, _Pj2>>> + requires indirectly_writable<_Out, + indirect_result_t<_Fn&, projected, _Pj1>, projected, _Pj2>>> constexpr binary_transform_result, borrowed_iterator_t<_Rng2>, _Out> operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Fn _Func, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { auto _First1 = _RANGES begin(_Range1); @@ -3136,7 +3117,6 @@ namespace ranges { _Seek_wrapped(_First2, _STD move(_UResult.in2)); return {_STD move(_First1), _STD move(_First2), _STD move(_UResult.out)}; } - // clang-format on private: template @@ -3461,7 +3441,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Ty, output_iterator _Out, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_copyable<_It, _Out> @@ -3487,7 +3466,7 @@ namespace ranges { _Seek_wrapped(_First, _STD move(_UResult.in)); return {_STD move(_First), _STD move(_UResult.out)}; } - // clang-format on + private: template _NODISCARD static constexpr replace_copy_if_result<_It, _Out> _Replace_copy_if_unchecked( @@ -3562,7 +3541,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, copy_constructible _Fn> requires invocable<_Fn&> && indirectly_writable<_Out, invoke_result_t<_Fn&>> constexpr _Out operator()(_Out _First, _Se _Last, _Fn _Gen) const { @@ -3580,7 +3558,7 @@ namespace ranges { _First, _Generate_unchecked(_Get_unwrapped(_STD move(_First)), _Uend(_Range), _Pass_fn(_Gen))); return _First; } - // clang-format on + private: template _NODISCARD static constexpr _Out _Generate_unchecked(_Out _First, const _Se _Last, _Fn _Gen) { @@ -3913,7 +3891,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_copyable<_It, _Out> @@ -3942,7 +3919,7 @@ namespace ranges { _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First), _STD move(_Result)}; } - // clang-format on + private: template _NODISCARD static constexpr remove_copy_if_result<_It, _Out> _Remove_copy_if_unchecked( @@ -4188,7 +4165,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out, class _Pj = identity, indirect_equivalence_relation> _Pr = ranges::equal_to> requires indirectly_copyable<_It, _Out> && _Can_reread_or_store<_It, _Out> @@ -4216,7 +4192,7 @@ namespace ranges { _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First), _STD move(_Result)}; } - // clang-format on + private: template _NODISCARD static constexpr unique_copy_result<_It, _Out> _Unique_copy_unchecked( @@ -4277,7 +4253,6 @@ namespace ranges { inline constexpr _Unique_copy_fn unique_copy{_Not_quite_object::_Construct_tag{}}; - // clang-format off // concept-constrained for strict enforcement as it is used by several algorithms template requires permutable<_It> @@ -4314,13 +4289,11 @@ namespace ranges { _RANGES iter_swap(_First, _Last); } } - // clang-format on class _Reverse_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se> requires permutable<_It> constexpr _It operator()(_It _First, _Se _Last) const { @@ -4339,7 +4312,6 @@ namespace ranges { _Reverse_common(_Ubegin(_Range), _ULast); return _Rewrap_iterator(_Range, _STD move(_ULast)); } - // clang-format on }; inline constexpr _Reverse_fn reverse{_Not_quite_object::_Construct_tag{}}; @@ -4411,11 +4383,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out> requires indirectly_copyable<_It, _Out> constexpr reverse_copy_result<_It, _Out> operator()(_It _First, _Se _Last, _Out _Result) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_STD move(_First)); auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -4424,11 +4394,9 @@ namespace ranges { return {_STD move(_First), _STD move(_Result)}; } - // clang-format off template requires indirectly_copyable, _Out> constexpr reverse_copy_result, _Out> operator()(_Rng&& _Range, _Out _Result) const { - // clang-format on if constexpr (common_range<_Rng>) { _Result = _Reverse_copy_common(_Ubegin(_Range), _Uend(_Range), _STD move(_Result)); return {_RANGES end(_Range), _STD move(_Result)}; @@ -4583,11 +4551,9 @@ namespace ranges { return _Rewrap_subrange>(_First, _STD move(_UResult)); } - // clang-format off template requires permutable> constexpr borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, iterator_t<_Rng> _Mid) const { - // clang-format on _Adl_verify_range(_RANGES begin(_Range), _Mid); _Adl_verify_range(_Mid, _RANGES end(_Range)); auto _UResult = _RANGES _Rotate_unchecked(_Ubegin(_Range), _Get_unwrapped(_STD move(_Mid)), _Uend(_Range)); @@ -4632,11 +4598,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out> requires indirectly_copyable<_It, _Out> constexpr rotate_copy_result<_It, _Out> operator()(_It _First, _It _Mid, _Se _Last, _Out _Result) const { - // clang-format on _Adl_verify_range(_First, _Mid); _Adl_verify_range(_Mid, _Last); auto _UResult = _Rotate_copy_unchecked(_Get_unwrapped(_STD move(_First)), _Get_unwrapped(_STD move(_Mid)), @@ -4646,12 +4610,10 @@ namespace ranges { return {_STD move(_First), _STD move(_UResult.out)}; } - // clang-format off template requires indirectly_copyable, _Out> constexpr rotate_copy_result, _Out> operator()( _Rng&& _Range, iterator_t<_Rng> _Mid, _Out _Result) const { - // clang-format on _Adl_verify_range(_RANGES begin(_Range), _Mid); _Adl_verify_range(_Mid, _RANGES end(_Range)); auto _UResult = _Rotate_copy_unchecked( @@ -5196,7 +5158,6 @@ namespace ranges { return _Rewrap_subrange>(_First, _STD move(_UResult)); } - // clang-format off template , _Pj>> _Pr> requires permutable> @@ -5204,7 +5165,7 @@ namespace ranges { auto _UResult = _Partition_unchecked(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); return _Rewrap_subrange>(_Range, _STD move(_UResult)); } - // clang-format on + private: template _NODISCARD static constexpr subrange<_It> _Partition_unchecked(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj) { @@ -5701,13 +5662,12 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); _Seek_wrapped(_First, _ULast); _Push_heap_unchecked(_STD move(_UFirst), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); return _First; @@ -5725,7 +5685,7 @@ namespace ranges { return _Rewrap_iterator(_Range, _STD move(_ULast)); } } - // clang-format on + private: template static constexpr void _Push_heap_unchecked(_It _First, _It _Last, _Pr _Pred, _Pj _Proj) { @@ -5867,11 +5827,9 @@ namespace ranges { _RANGES _Pop_heap_hole_by_index(_STD move(_First), 0, _Count, _STD forward<_Ty>(_Val), _Pred, _Proj1, _Proj2); } - // clang-format off template requires sortable<_It, _Pr, _Pj> constexpr void _Pop_heap_unchecked(_It _First, _It _Last, _Pr _Pred, _Pj _Proj) { - // clang-format on // pop *_First to *(_Last - 1) and reheap if (_Last - _First < 2) { return; @@ -5887,7 +5845,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { @@ -5911,7 +5868,6 @@ namespace ranges { return _Rewrap_iterator(_Range, _STD move(_ULast)); } } - // clang-format on }; inline constexpr _Pop_heap_fn pop_heap{_Not_quite_object::_Construct_tag{}}; @@ -5944,11 +5900,9 @@ _CONSTEXPR20 void make_heap(_RanIt _First, _RanIt _Last) { // make [_First, _Las #ifdef __cpp_lib_concepts namespace ranges { - // clang-format off template requires sortable<_It, _Pr, _Pj> constexpr void _Make_heap_common(_It _First, _It _Last, _Pr _Pred, _Pj _Proj) { - // clang-format on // make [_First, _Last) into a heap with respect to _Pred and _Proj using _Diff = iter_difference_t<_It>; const _Diff _Bottom = _Last - _First; @@ -5965,11 +5919,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_STD move(_First)); auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -5978,11 +5930,9 @@ namespace ranges { return _First; } - // clang-format off template requires sortable, _Pr, _Pj> constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on if constexpr (common_range<_Rng>) { _Make_heap_common(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); return _RANGES end(_Range); @@ -6175,11 +6125,9 @@ _CONSTEXPR20 void sort_heap(_RanIt _First, _RanIt _Last) { // order heap by repe #ifdef __cpp_lib_concepts namespace ranges { - // clang-format off template requires sortable<_It, _Pr, _Pj> constexpr void _Sort_heap_common(const _It _First, _It _Last, _Pr _Pred, _Pj _Proj) { - // clang-format on // order heap by repeatedly popping for (; _Last - _First >= 2; --_Last) { _RANGES _Pop_heap_unchecked(_First, _Last, _Pred, _Proj); @@ -6190,11 +6138,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_STD move(_First)); auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -6203,11 +6149,9 @@ namespace ranges { return _First; } - // clang-format off template requires sortable, _Pr, _Pj> constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on if constexpr (common_range<_Rng>) { _Sort_heap_common(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); return _RANGES end(_Range); @@ -6616,13 +6560,11 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> constexpr merge_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UResult = _Merge_unchecked(_Get_unwrapped(_STD move(_First1)), _Get_unwrapped(_STD move(_Last1)), @@ -6633,13 +6575,11 @@ namespace ranges { return {_STD move(_First1), _STD move(_First2), _STD move(_UResult.out)}; } - // clang-format off template requires mergeable, iterator_t<_Rng2>, _Out, _Pr, _Pj1, _Pj2> constexpr merge_result, borrowed_iterator_t<_Rng2>, _Out> operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); auto _UResult = @@ -6991,12 +6931,10 @@ namespace ranges { *_Result.out = _STD move(_Temp); } - // clang-format off template requires sortable<_It, _Pr, _Pj> void _Inplace_merge_buffer_left(_It _First, _It _Mid, _It _Last, iter_value_t<_It>* _Left_first, const ptrdiff_t _Capacity, _Pr _Pred, _Pj _Proj) { - // clang-format on // move the range [_First, _Mid) to _Left_first, and merge it with [_Mid, _Last) to _First // usual invariants apply using _Ty = iter_value_t<_It>; @@ -7036,12 +6974,10 @@ namespace ranges { } } - // clang-format off template requires sortable<_It, _Pr, _Pj> void _Inplace_merge_buffer_right(_It _First, _It _Mid, _It _Last, iter_value_t<_It>* _Right_first, const ptrdiff_t _Capacity, _Pr _Pred, _Pj _Proj) { - // clang-format on // move the range [_Mid, _Last) to _Right_first, and merge it with [_First, _Mid) to _Last // usual invariants apply using _Ty = iter_value_t<_It>; @@ -7078,21 +7014,17 @@ namespace ranges { } } - // clang-format off template requires sortable<_It, _Pr, _Pj> void _Buffered_inplace_merge_common(_It _First, _It _Mid, _It _Last, iter_difference_t<_It> _Count1, iter_difference_t<_It> _Count2, iter_value_t<_It>* _Temp_ptr, ptrdiff_t _Capacity, _Pr _Pred, _Pj _Proj); - // clang-format on - // clang-format off template requires sortable<_It, _Pr, _Pj> void _Buffered_inplace_merge_divide_and_conquer2(_It _First, _It _Mid, _It _Last, const iter_difference_t<_It> _Count1, const iter_difference_t<_It> _Count2, iter_value_t<_It>* const _Temp_ptr, const ptrdiff_t _Capacity, _Pr _Pred, _Pj _Proj, _It _Firstn, _It _Lastn, const iter_difference_t<_It> _Count1n, const iter_difference_t<_It> _Count2n) { - // clang-format on // common block of _Buffered_inplace_merge_divide_and_conquer, below _It _Midn = _RANGES _Buffered_rotate_common(_Firstn, _Mid, _Lastn, static_cast>(_Count1 - _Count1n), _Count2n, _Temp_ptr, @@ -7104,13 +7036,11 @@ namespace ranges { static_cast>(_Count2 - _Count2n), _Temp_ptr, _Capacity, _Pred, _Proj); } - // clang-format off template requires sortable<_It, _Pr, _Pj> void _Buffered_inplace_merge_divide_and_conquer(_It _First, _It _Mid, _It _Last, const iter_difference_t<_It> _Count1, const iter_difference_t<_It> _Count2, iter_value_t<_It>* const _Temp_ptr, const ptrdiff_t _Capacity, _Pr _Pred, _Pj _Proj) { - // clang-format on // merge sorted [_First, _Mid) with sorted [_Mid, _Last) // usual invariants apply if (_Count1 <= _Count2) { @@ -7132,13 +7062,11 @@ namespace ranges { } } - // clang-format off template requires sortable<_It, _Pr, _Pj> void _Buffered_inplace_merge_common(_It _First, _It _Mid, _It _Last, iter_difference_t<_It> _Count1, iter_difference_t<_It> _Count2, iter_value_t<_It>* const _Temp_ptr, const ptrdiff_t _Capacity, _Pr _Pred, _Pj _Proj) { - // clang-format on // merge sorted [_First, _Mid) with sorted [_Mid, _Last) // usual invariants *do not* apply; only sortedness applies // establish the usual invariants @@ -7476,11 +7404,9 @@ void sort(_ExPo&& _Exec, const _RanIt _First, const _RanIt _Last) noexcept /* te #ifdef __cpp_lib_concepts namespace ranges { - // clang-format off template requires sortable<_It, _Pr, _Pj> constexpr _It _Insertion_sort_common(const _It _First, const _It _Last, _Pr _Pred, _Pj _Proj) { - // clang-format on // insertion sort [_First, _Last) if (_First == _Last) { // empty range is sorted @@ -7507,11 +7433,9 @@ namespace ranges { return _Last; } - // clang-format off template requires sortable<_It, _Pr, _Pj> constexpr void _Med3_common(_It _First, _It _Mid, _It _Last, _Pr _Pred, _Pj _Proj) { - // clang-format on // sort median of three elements to middle if (_STD invoke(_Pred, _STD invoke(_Proj, *_Mid), _STD invoke(_Proj, *_First))) { _RANGES iter_swap(_Mid, _First); @@ -7529,11 +7453,9 @@ namespace ranges { } } - // clang-format off template requires sortable<_It, _Pr, _Pj> constexpr void _Guess_median_common(_It _First, _It _Mid, _It _Last, _Pr _Pred, _Pj _Proj) { - // clang-format on // sort median element to middle using _Diff = iter_difference_t<_It>; const _Diff _Count = _Last - _First; @@ -7632,11 +7554,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_STD move(_First)); auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -7646,11 +7566,9 @@ namespace ranges { return _First; } - // clang-format off template requires sortable, _Pr, _Pj> constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on auto _UFirst = _Ubegin(_Range); auto _ULast = _Get_final_iterator_unwrapped(_Range); const auto _Count = _ULast - _UFirst; @@ -8205,11 +8123,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _It _Mid, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Mid); _Adl_verify_range(_Mid, _Last); @@ -8227,12 +8143,10 @@ namespace ranges { } } - // clang-format off template requires sortable, _Pr, _Pj> constexpr borrowed_iterator_t<_Rng> operator()( _Rng&& _Range, iterator_t<_Rng> _Mid, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_RANGES begin(_Range), _Mid); _Adl_verify_range(_Mid, _RANGES end(_Range)); @@ -8483,7 +8397,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _It _Nth, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { @@ -8520,7 +8433,7 @@ namespace ranges { _Ubegin(_Range), _STD move(_UNth), _STD move(_UFinal), _Pass_fn(_Pred), _Pass_fn(_Proj)); return _Nth; } - // clang-format on + private: template static constexpr void _Nth_element_common(_It _First, _It _Nth, _It _Last, _Pr _Pred, _Pj _Proj) { @@ -8746,7 +8659,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> @@ -8778,7 +8690,7 @@ namespace ranges { _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2), _STD move(_Result)}; } - // clang-format on + private: template _NODISCARD static constexpr set_union_result<_It1, _It2, _Out> _Set_union_unchecked(_It1 _First1, @@ -8871,7 +8783,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> @@ -8904,7 +8815,7 @@ namespace ranges { _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2), _STD move(_Result)}; } - // clang-format on + private: template _NODISCARD static constexpr set_intersection_result<_It1, _It2, _Out> _Set_intersection_unchecked(_It1 _First1, @@ -9004,7 +8915,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> @@ -9034,7 +8944,7 @@ namespace ranges { _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_Result)}; } - // clang-format on + private: template _NODISCARD static constexpr set_difference_result<_It1, _Out> _Set_difference_unchecked(_It1 _First1, @@ -9147,7 +9057,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> @@ -9181,7 +9090,7 @@ namespace ranges { _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2), _STD move(_Result)}; } - // clang-format on + private: template _NODISCARD static constexpr set_symmetric_difference_result<_It1, _It2, _Out> @@ -9893,11 +9802,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr next_permutation_result<_It> operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_STD move(_First)); auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -9907,12 +9814,10 @@ namespace ranges { return {_STD move(_First), _Found}; } - // clang-format off template requires sortable, _Pr, _Pj> constexpr next_permutation_result> operator()( _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on auto _ULast = _Get_final_iterator_unwrapped(_Range); const bool _Found = _Next_permutation_common(_Ubegin(_Range), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); return {_Rewrap_iterator(_Range, _STD move(_ULast)), _Found}; @@ -10001,11 +9906,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr prev_permutation_result<_It> operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_STD move(_First)); auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -10015,12 +9918,10 @@ namespace ranges { return {_STD move(_First), _Found}; } - // clang-format off template requires sortable, _Pr, _Pj> constexpr prev_permutation_result> operator()( _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on auto _ULast = _Get_final_iterator_unwrapped(_Range); const bool _Found = _Prev_permutation_common(_Ubegin(_Range), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); return {_Rewrap_iterator(_Range, _STD move(_ULast)), _Found}; diff --git a/stl/inc/format b/stl/inc/format index 738d6feb8b..46cf66b7f3 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -1487,11 +1487,9 @@ struct _Format_arg_traits { static auto _Phony_basic_format_arg_constructor(nullptr_t) -> const void*; // not defined - // clang-format off template requires is_void_v<_Ty> static auto _Phony_basic_format_arg_constructor(_Ty*) -> const void*; // not defined - // clang-format on template using _Storage_type = decltype(_Phony_basic_format_arg_constructor(_STD declval<_Ty>())); @@ -1716,11 +1714,9 @@ public: } }; -// clang-format off template requires output_iterator<_Out, const _CharT&> class basic_format_context { - // clang-format on private: _Out _OutputIt; basic_format_args _Args; diff --git a/stl/inc/ranges b/stl/inc/ranges index 149f8cf9a1..3ebd266642 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -77,45 +77,37 @@ namespace ranges { template struct _Base { - // clang-format off template requires _Can_compose<_Derived, _Other> constexpr auto operator|(_Base<_Other>&& __r) && noexcept( noexcept(_Pipeline{static_cast<_Derived&&>(*this), static_cast<_Other&&>(__r)})) { - // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); return _Pipeline{static_cast<_Derived&&>(*this), static_cast<_Other&&>(__r)}; } - // clang-format off template requires _Can_compose<_Derived, const _Other&> constexpr auto operator|(const _Base<_Other>& __r) && noexcept( noexcept(_Pipeline{static_cast<_Derived&&>(*this), static_cast(__r)})) { - // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); return _Pipeline{static_cast<_Derived&&>(*this), static_cast(__r)}; } - // clang-format off template requires _Can_compose constexpr auto operator|(_Base<_Other>&& __r) const& noexcept( noexcept(_Pipeline{static_cast(*this), static_cast<_Other&&>(__r)})) { - // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); return _Pipeline{static_cast(*this), static_cast<_Other&&>(__r)}; } - // clang-format off template requires _Can_compose constexpr auto operator|(const _Base<_Other>& __r) const& noexcept( noexcept(_Pipeline{static_cast(*this), static_cast(__r)})) { - // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); return _Pipeline{static_cast(*this), static_cast(__r)}; @@ -637,11 +629,9 @@ namespace ranges { bool _Engaged = false; }; - // clang-format off template requires default_initializable<_Ty> class _Defaultabox<_Ty> { // provide the same API more efficiently for default-constructible types - // clang-format on public: _Defaultabox() = default; @@ -882,11 +872,9 @@ namespace ranges { tuple<_Types...> _Captures; }; - // clang-format off template requires is_object_v<_Ty> class empty_view : public view_interface> { - // clang-format on public: _NODISCARD static constexpr _Ty* begin() noexcept { return nullptr; @@ -914,11 +902,9 @@ namespace ranges { inline constexpr empty_view<_Ty> empty; } // namespace views - // clang-format off template requires is_object_v<_Ty> class single_view : public view_interface> { - // clang-format on public: // clang-format off single_view() requires default_initializable<_Ty> = default; @@ -929,12 +915,10 @@ namespace ranges { constexpr explicit single_view(_Ty&& _Val_) noexcept(is_nothrow_move_constructible_v<_Ty>) // strengthened : _Val{in_place, _STD move(_Val_)} {} - // clang-format off template requires constructible_from<_Ty, _Types...> constexpr explicit single_view(in_place_t, _Types&&... _Args) noexcept( is_nothrow_constructible_v<_Ty, _Types...>) // strengthened - // clang-format on : _Val{in_place, _STD forward<_Types>(_Args)...} {} _NODISCARD constexpr _Ty* begin() noexcept { @@ -1208,11 +1192,9 @@ namespace ranges { } }; - // clang-format off template requires _Weakly_equality_comparable_with<_Wi, _Bo> && copyable<_Wi> struct _Iotinel { - // clang-format on private: using _It = _Ioterator<_Wi>; @@ -1245,11 +1227,9 @@ namespace ranges { } }; - // clang-format off template requires _Weakly_equality_comparable_with<_Wi, _Bo> && copyable<_Wi> class iota_view : public view_interface> { - // clang-format on private: /* [[no_unique_address]] */ _Wi _Value{}; /* [[no_unique_address]] */ _Bo _Bound{}; @@ -1357,11 +1337,9 @@ namespace ranges { __is >> __t; }; - // clang-format off template > requires default_initializable<_Ty> && _Stream_extractable<_Ty, _Elem, _Traits> class basic_istream_view : public view_interface> { - // clang-format on private: class _Iterator { private: @@ -1647,11 +1625,9 @@ namespace ranges { using all_t = decltype(all(_STD declval<_Rng>())); } // namespace views - // clang-format off template > _Pr> requires view<_Vw> && is_object_v<_Pr> class filter_view : public _Cached_position_t, _Vw, filter_view<_Vw, _Pr>> { - // clang-format on private: /* [[no_unique_address]] */ _Vw _Range{}; /* [[no_unique_address]] */ _Copyable_box<_Pr> _Pred{}; @@ -2607,11 +2583,9 @@ namespace ranges { inline constexpr _Take_fn take; } // namespace views - // clang-format off template requires input_range<_Vw> && is_object_v<_Pr> && indirect_unary_predicate> - class take_while_view : public view_interface> { - // clang-format on + class take_while_view : public view_interface> { private: /* [[no_unique_address]] */ _Vw _Range{}; /* [[no_unique_address]] */ _Copyable_box<_Pr> _Pred{}; @@ -2978,11 +2952,9 @@ namespace ranges { inline constexpr _Drop_fn drop; } // namespace views - // clang-format off template requires input_range<_Vw> && is_object_v<_Pr> && indirect_unary_predicate> class drop_while_view : public _Cached_position_t, _Vw, drop_while_view<_Vw, _Pr>> { - // clang-format on private: /* [[no_unique_address]] */ _Vw _Range{}; /* [[no_unique_address]] */ _Copyable_box<_Pr> _Pred{}; @@ -3063,11 +3035,9 @@ namespace ranges { inline constexpr _Drop_while_fn drop_while; } // namespace views - // clang-format off template requires view<_Vw> && input_range> class join_view; - // clang-format on template class _Join_view_base : public view_interface> { @@ -3810,15 +3780,11 @@ namespace ranges { } } - // clang-format off _NODISCARD constexpr auto begin() const requires forward_range<_Vw> && forward_range { - // clang-format on return _Outer_iter{*this, _RANGES begin(_Range)}; } - // clang-format off _NODISCARD constexpr auto end() requires forward_range<_Vw> && common_range<_Vw> { - // clang-format on constexpr bool _Both_simple = _Simple_view<_Vw> && _Simple_view<_Pat>; return _Outer_iter<_Both_simple>{*this, _RANGES end(_Range)}; } @@ -3864,11 +3830,9 @@ namespace ranges { inline constexpr _Lazy_split_fn lazy_split; } // namespace views - // clang-format off template requires view<_Vw> && view<_Pat> && indirectly_comparable, iterator_t<_Pat>, _RANGES equal_to> class split_view : public view_interface> { - // clang-format on private: /* [[no_unique_address]] */ _Vw _Range{}; /* [[no_unique_address]] */ _Pat _Pattern{}; @@ -4228,11 +4192,9 @@ namespace ranges { inline constexpr _Common_fn common; } // namespace views - // clang-format off template requires bidirectional_range<_Vw> class reverse_view : public _Cached_position_t, _Vw, reverse_view<_Vw>> { - // clang-format on private: /* [[no_unique_address]] */ _Vw _Range{}; diff --git a/stl/inc/xutility b/stl/inc/xutility index 310e5efabb..77aea457f9 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -337,13 +337,11 @@ concept _Destructible_object = is_object_v<_Ty> && destructible<_Ty>; template struct incrementable_traits {}; -// clang-format off template requires is_object_v<_Ty> struct incrementable_traits<_Ty*> { using difference_type = ptrdiff_t; }; -// clang-format on template struct incrementable_traits : incrementable_traits<_Ty> {}; @@ -379,13 +377,11 @@ using iter_difference_t = typename conditional_t<_Is_from_primary struct _Cond_value_type {}; -// clang-format off template requires is_object_v<_Ty> struct _Cond_value_type<_Ty> { using value_type = remove_cv_t<_Ty>; }; -// clang-format on template struct indirectly_readable_traits {}; @@ -393,13 +389,11 @@ struct indirectly_readable_traits {}; template struct indirectly_readable_traits<_Ty*> : _Cond_value_type<_Ty> {}; -// clang-format off template requires is_array_v<_Ty> struct indirectly_readable_traits<_Ty> { using value_type = remove_cv_t>; }; -// clang-format on template struct indirectly_readable_traits : indirectly_readable_traits<_Ty> {}; @@ -638,11 +632,9 @@ struct iterator_traits : _Iterator_traits_base<_Ty> { using _From_primary = iterator_traits; }; -// clang-format off template requires is_object_v<_Ty> struct iterator_traits<_Ty*> { - // clang-format on using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = remove_cv_t<_Ty>; @@ -846,11 +838,9 @@ struct _Iter_concept_impl2 { }; template <> struct _Iter_concept_impl2 { - // clang-format off template requires _Is_from_primary> using _Apply = random_access_iterator_tag; - // clang-format on }; template From 0c24eaf7b6d497acee6794ae96f858502abfc5d9 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 3 Feb 2022 22:23:20 -0800 Subject: [PATCH 06/25] yvals_core.h: Cite GH 2207 for `mbrtoc8()` and `c8rtomb()`. --- stl/inc/yvals_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index f46feecd0c..9e0e249be9 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -162,7 +162,7 @@ // P0475R1 Guaranteed Copy Elision For Piecewise Construction // P0476R2 bit_cast // P0482R6 Library Support For char8_t -// (mbrtoc8 and c8rtomb not yet implemented) +// (mbrtoc8 and c8rtomb not yet implemented, see GH-2207) // P0487R1 Fixing operator>>(basic_istream&, CharT*) // P0528R3 Atomic Compare-And-Exchange With Padding Bits // P0550R2 remove_cvref From 21ecf9c1cc2de6bcec8ccce90570117bd99397d3 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 23 Feb 2022 17:44:16 -0800 Subject: [PATCH 07/25] Unnecessary qualification of std::numeric_limits. --- stl/inc/limits | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/limits b/stl/inc/limits index 3346c8126d..9fa62e60dd 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -1023,7 +1023,7 @@ _NODISCARD constexpr int _Countl_zero_fallback(_Ty _Val) noexcept { // see "Hacker's Delight" section 5-4 template _NODISCARD constexpr int _Countr_zero_fallback(const _Ty _Val) noexcept { - constexpr int _Digits = std::numeric_limits<_Ty>::digits; + constexpr int _Digits = numeric_limits<_Ty>::digits; return _Digits - _Countl_zero_fallback(static_cast<_Ty>(static_cast<_Ty>(~_Val) & static_cast<_Ty>(_Val - 1))); } From 2457dbda48fa5e202e16bc8fdd888aa0cb864398 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 23 Feb 2022 17:47:05 -0800 Subject: [PATCH 08/25] Centralize on using `_STD` instead of `::std::`. --- stl/inc/complex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/complex b/stl/inc/complex index 3a4d7c65ce..134cb03aa5 100644 --- a/stl/inc/complex +++ b/stl/inc/complex @@ -203,7 +203,7 @@ namespace _Float_multi_prec { #undef _FMP_USING_X86_X64_INTRINSICS #undef _FMP_USING_ARM64_INTRINSICS -#define _FMP ::std::_Float_multi_prec:: +#define _FMP _STD _Float_multi_prec:: // implements numerical algorithms for namespace _Math_algorithms { From d04f53f80278515d1bfd51175db94cc2bded1378 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 15:54:26 -0800 Subject: [PATCH 09/25] Change `__analysis_assume` to `_Analysis_assume_`. This is for consistency - they're equivalent, but we should use the more "modern" form. --- stl/inc/istream | 2 +- tests/std/tests/Dev10_722102_shared_ptr_nullptr/test.cpp | 2 +- .../bad_random_engine.hpp | 2 +- tests/std/tests/VSO_0644691_utf_8_codecvt/test.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stl/inc/istream b/stl/inc/istream index abfce31f11..626dc9c560 100644 --- a/stl/inc/istream +++ b/stl/inc/istream @@ -807,7 +807,7 @@ basic_istream<_Elem, _Traits>& _Istream_extract_into_buffer( } _CATCH_IO_(ios_base, _Istr) } - __analysis_assume(static_cast(_Current) < _Size); // TRANSITION, VSO-860375 + _Analysis_assume_(static_cast(_Current) < _Size); // TRANSITION, VSO-860375 _Str[_Current] = _Elem(); // add terminating null character _Istr.width(0); if (_Current == 0) { diff --git a/tests/std/tests/Dev10_722102_shared_ptr_nullptr/test.cpp b/tests/std/tests/Dev10_722102_shared_ptr_nullptr/test.cpp index b56b97b986..3bb5a0a3d3 100644 --- a/tests/std/tests/Dev10_722102_shared_ptr_nullptr/test.cpp +++ b/tests/std/tests/Dev10_722102_shared_ptr_nullptr/test.cpp @@ -207,7 +207,7 @@ namespace unique_ptr_ { void operator()(pointer ptr) const noexcept { assert(ptr.ptr_ != nullptr); - __analysis_assume(ptr.ptr_); + _Analysis_assume_(ptr.ptr_); assert(*ptr.ptr_ == 42); *ptr.ptr_ = 13; } diff --git a/tests/std/tests/GH_001017_discrete_distribution_out_of_range/bad_random_engine.hpp b/tests/std/tests/GH_001017_discrete_distribution_out_of_range/bad_random_engine.hpp index d57d20bb64..8a98f6ea4d 100644 --- a/tests/std/tests/GH_001017_discrete_distribution_out_of_range/bad_random_engine.hpp +++ b/tests/std/tests/GH_001017_discrete_distribution_out_of_range/bad_random_engine.hpp @@ -165,7 +165,7 @@ class bad_random_engine { } } - __analysis_assume(limit_dimension_ < Dimension); + _Analysis_assume_(limit_dimension_ < Dimension); generators_[limit_dimension_] = generator{}; if (limit_dimension_ < Dimension - 1) { diff --git a/tests/std/tests/VSO_0644691_utf_8_codecvt/test.cpp b/tests/std/tests/VSO_0644691_utf_8_codecvt/test.cpp index 0ff6d249ee..84ea48905e 100644 --- a/tests/std/tests/VSO_0644691_utf_8_codecvt/test.cpp +++ b/tests/std/tests/VSO_0644691_utf_8_codecvt/test.cpp @@ -237,7 +237,7 @@ void test_codecvt_encoding( } } else { assert(testCase.wide != nullptr); - __analysis_assume(testCase.wide); + _Analysis_assume_(testCase.wide); wstring wide = widePrefix; wide.append(testCase.wide); const wchar_t* const wideFirst = wide.data(); From 3ffbb0e92eda26d1e098a076a2bed21089c95eff Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 16:01:18 -0800 Subject: [PATCH 10/25] Delete flaky skipped tr1 tests. Suggested by AlexGuteniev - we have no intention of salvaging these tests. If we wanted better coverage in these areas, we'd write new tests from scratch. --- tests/tr1/expected_results.txt | 9 - tests/tr1/test.lst | 14 - tests/tr1/tests/atomic1/env.lst | 4 - tests/tr1/tests/atomic1/test.cpp | 358 ------------------- tests/tr1/tests/atomic2/env.lst | 4 - tests/tr1/tests/atomic2/test.cpp | 246 ------------- tests/tr1/tests/atomic4/env.lst | 4 - tests/tr1/tests/atomic4/test.cpp | 113 ------ tests/tr1/tests/condition_variable/env.lst | 4 - tests/tr1/tests/condition_variable/test.cpp | 317 ----------------- tests/tr1/tests/thread/env.lst | 4 - tests/tr1/tests/thread/test.cpp | 365 -------------------- 12 files changed, 1442 deletions(-) delete mode 100644 tests/tr1/tests/atomic1/env.lst delete mode 100644 tests/tr1/tests/atomic1/test.cpp delete mode 100644 tests/tr1/tests/atomic2/env.lst delete mode 100644 tests/tr1/tests/atomic2/test.cpp delete mode 100644 tests/tr1/tests/atomic4/env.lst delete mode 100644 tests/tr1/tests/atomic4/test.cpp delete mode 100644 tests/tr1/tests/condition_variable/env.lst delete mode 100644 tests/tr1/tests/condition_variable/test.cpp delete mode 100644 tests/tr1/tests/thread/env.lst delete mode 100644 tests/tr1/tests/thread/test.cpp diff --git a/tests/tr1/expected_results.txt b/tests/tr1/expected_results.txt index 1fd088cc17..2ac2a854cb 100644 --- a/tests/tr1/expected_results.txt +++ b/tests/tr1/expected_results.txt @@ -1,11 +1,2 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -# TRANSITION, flaky tests -tests/atomic1 SKIPPED -tests/atomic2 SKIPPED -tests/atomic4 SKIPPED -tests/condition_variable SKIPPED - -# TRANSITION, flaky test (see GH-1642 and GH-718) -tests/thread SKIPPED diff --git a/tests/tr1/test.lst b/tests/tr1/test.lst index bd94b17bfc..777f823cdd 100644 --- a/tests/tr1/test.lst +++ b/tests/tr1/test.lst @@ -4,12 +4,6 @@ tests\algorithm tests\array tests\atomic - -# TRANSITION, flaky tests -# tests\atomic1 -# tests\atomic2 -# tests\atomic4 - tests\bitset tests\cctype tests\cerrno @@ -25,10 +19,6 @@ tests\codecvt tests\complex1 tests\complex2 tests\complex3 - -# TRANSITION, flaky tests -# tests\condition_variable - tests\csetjmp tests\csignal tests\cstdarg @@ -185,10 +175,6 @@ tests\string1 tests\string2 tests\strstream tests\system_error - -# TRANSITION, flaky test (see GH-1642 and GH-718) -# tests\thread - tests\tuple tests\type_traits1 tests\type_traits2 diff --git a/tests/tr1/tests/atomic1/env.lst b/tests/tr1/tests/atomic1/env.lst deleted file mode 100644 index d3c3c9bb88..0000000000 --- a/tests/tr1/tests/atomic1/env.lst +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -RUNALL_INCLUDE ..\..\env_threads.lst diff --git a/tests/tr1/tests/atomic1/test.cpp b/tests/tr1/tests/atomic1/test.cpp deleted file mode 100644 index 75ebff5447..0000000000 --- a/tests/tr1/tests/atomic1/test.cpp +++ /dev/null @@ -1,358 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -// test C++11 header with multiple threads -#define TEST_NAME ", part 1" -#undef NDEBUG - -#include "tdefs.h" -#include -#include -#include -#include -#include - -// These tests look for synchronization failures on an atomic type. They -// test only the unsigned arithmetic types, assuming that the signed types -// rely on the same underlying code; they also take advantage of the -// standard wraparound behavior of unsigned types. - -// The tests exercise the following functions: -// load() -// store() -// exchange() -// compare_exchange_weak() -// compare_exchange_strong() -// fetch_add() -// fetch_sub() -// fetch_xor() -// fetch_and and fetch_or are omitted -- it's hard to come up with a useful -// invariant that remains true over multiple asynchronous applications of these -// operations. These functions will, in general, rely on the same -// synchronization mechanism as fetch_xor. If there is an error -// in the implementation it should show up in the semantic tests. - -// All of the tests use the assert() macro for internal checks. They can't -// use the CHECK_XXX macros because the CHECK_XXX macros -// aren't synchronized, and adding synchronization to the macros would -// introduce external synchronization into these tests, defeating their -// purpose. - -// SUPPORT AND CONFIGURATION - -// adjust to get reasonable testing times for the platform: -#if ATOMIC_LLONG_LOCK_FREE -static const unsigned long iterations = 1000000; -#else // ATOMIC_LLONG_LOCK_FREE -static const unsigned long iterations = 100000; -#endif // ATOMIC_LLONG_LOCK_FREE - -inline unsigned long select(unsigned long first, unsigned long second) { // silence warnings - return first < second ? first + 1 : second; -} - -template -static unsigned long test_iterations() { // limit test iterations to - // numeric_limits::max() + 1 for small types - return select((unsigned long) STD numeric_limits::max(), iterations); -} - -// CLASS test_runner -class test_runner { // class to run multiple threads and wait for them all to finish -public: - template - void run_threads(Fn0 fn0) { // run 1 thread - thread_count = 1; - STD thread thr0(fn0); - threads[0].swap(thr0); - wait(); - } - template - void run_threads(Fn0 fn0, Fn1 fn1) { // run 2 threads - thread_count = 2; - STD thread thr0(fn0); - threads[0].swap(thr0); - STD thread thr1(fn1); - threads[1].swap(thr1); - wait(); - } - template - void run_threads(Fn0 fn0, Fn1 fn1, Fn2 fn2) { // run 3 threads - thread_count = 3; - STD thread thr0(fn0); - threads[0].swap(thr0); - STD thread thr1(fn1); - threads[1].swap(thr1); - STD thread thr2(fn2); - threads[2].swap(thr2); - wait(); - } - template - void run_threads(Fn0 fn0, Fn1 fn1, Fn2 fn2, Fn3 fn3) { // run 4 threads - thread_count = 4; - STD thread thr0(fn0); - threads[0].swap(thr0); - STD thread thr1(fn1); - threads[1].swap(thr1); - STD thread thr2(fn2); - threads[2].swap(thr2); - STD thread thr3(fn3); - threads[3].swap(thr3); - wait(); - } - -private: - void wait() { // wait for all threads to finish - for (int i = 0; i < thread_count; ++i) - threads[i].join(); - } - int thread_count; - STD thread threads[4]; -}; - -// TESTERS -struct flag_tester { // class for testing atomic_flag -public: - static void run() { // run 4 threads competing for flag - test_runner runner; - runner.run_threads(&flag_tester::do_it, &flag_tester::do_it, &flag_tester::do_it, &flag_tester::do_it); - CHECK_INT(val0, 0); - } - -private: - static void do_it() { // use flag as lock surrounding non-optimizable - // manipulations of shared variable - for (unsigned long i = 0; i < iterations; ++i) { // lock, manipulate, unlock - while (flag.test_and_set(STD memory_order_acquire)) { - // wait for lock - } - ++val0; - assert(val0 == 1); - val0 += 3; - val0 /= 2; - val0 *= 3; - val0 -= 5; - assert(val0 == 1); - --val0; - flag.clear(STD memory_order_release); - STD this_thread::yield(); - } - } - static STD atomic_flag flag; - static unsigned long val0; -}; -STD atomic_flag flag_tester::flag; -unsigned long flag_tester::val0; - -// CLASS TEMPLATE read_write_tester -template -struct read_write_tester { // class for testing acquire/release semantics for load/store ops -public: - static void run() { // run 2 threads, one writing and one reading - test_runner runner; - runner.run_threads(&read_write_tester::write, &read_write_tester::read); - CHECK_INT(val0 == test_iterations() - 1, true); - CHECK_INT(val1 == test_iterations() - 1, true); - } - -private: - static void write() { // do atomic writes with relaxed/release memory order - unsigned long limit = test_iterations() - 1; - for (unsigned long i = 0; i < limit; ++i) { // do atomic stores - Ty my_val = val0.load(STD memory_order_relaxed); - val0.store(my_val + 1, STD memory_order_relaxed); - val1.store(my_val + 1, STD memory_order_release); - } - } - static void read() { // do atomic reads with relaxed/acquire memory order - unsigned long limit = test_iterations() - 1; - for (unsigned long i = 0; i < limit; ++i) { // read values and check for proper update visibility - Ty my_val1a = val1.load(STD memory_order_acquire); - Ty my_val0a = val0.load(STD memory_order_relaxed); - Ty my_val1b = STD atomic_load_explicit(&val1, STD memory_order_relaxed); - Ty my_val0b = STD atomic_load_explicit(&val0, STD memory_order_relaxed); - assert(my_val1a <= my_val0a); - assert(my_val1b <= my_val0b); - } - } - static STD atomic val0; - static STD atomic val1; -}; -template -STD atomic read_write_tester::val0; -template -STD atomic read_write_tester::val1; - -// CLASS TEMPLATE exchange_tester -template -struct exchange_tester { // class for testing atomicity of exchange operations -public: - static void run() { // run 4 threads, all exchanging shared value - test_runner runner; - runner.run_threads( - &exchange_tester::do_it, &exchange_tester::do_it, &exchange_tester::do_it, &exchange_tester::do_it); - CHECK_INT(val0 == (iterations & STD numeric_limits::max()), true); - } - -private: - static void do_it() { // repeatedly exchange values - for (unsigned long i = 0; i < iterations; ++i) - val0.exchange((Ty) (i + 1)); - } - static STD atomic val0; -}; -template -STD atomic exchange_tester::val0; - -template -struct cas_weak_tester { // class for testing atomicity of - // compare-and-exchange-weak operations -public: - static void run() { // run 4 threads, all comparing and exchanging shared value - test_runner runner; - runner.run_threads( - &cas_weak_tester::do_it, &cas_weak_tester::do_it, &cas_weak_tester::do_it, &cas_weak_tester::do_it); - CHECK_INT(val0 == (Ty) test_iterations(), true); - } - -private: - static void do_it() { // repeatedly compare-and-exchange values - Ty my_val = 0; - Ty my_old_val = my_val; - unsigned long limit = test_iterations() / 4; - for (unsigned long i = 0; i < limit; ++i) { // compare-and-exchange incremented value - while (!val0.compare_exchange_weak(my_val, my_val + 1)) - assert(my_old_val < my_val); - my_old_val = my_val; - STD this_thread::yield(); - } - } - static STD atomic val0; -}; -template -STD atomic cas_weak_tester::val0; - -template -struct cas_strong_tester { // class for testing atomicity of - // compare-and-exchange-strong operations -public: - static void run() { // run 4 threads, all comparing and exchanging shared value - test_runner runner; - runner.run_threads( - &cas_strong_tester::do_it, &cas_strong_tester::do_it, &cas_strong_tester::do_it, &cas_strong_tester::do_it); - CHECK_INT(val0 == (Ty) test_iterations(), true); - } - -private: - static void do_it() { // repeatedly compare-and-exchange values - Ty my_val = 0; - Ty my_old_val = my_val; - unsigned long limit = test_iterations() / 4; - for (unsigned long i = 0; i < limit; ++i) { // compare-and-exchange incremented value - while (!val0.compare_exchange_strong(my_val, my_val + 1)) - assert(my_old_val < my_val); - my_old_val = my_val; - STD this_thread::yield(); - } - } - static STD atomic val0; -}; -template -STD atomic cas_strong_tester::val0; - -template -struct arithmetic_tester { // class for testing atomicity of arithmetic operations -public: - static void run() { // run 4 threads, all updating shared value - test_runner runner; - runner.run_threads(&arithmetic_tester::do_it0, &arithmetic_tester::do_it1, &arithmetic_tester::do_it2, - &arithmetic_tester::do_it3); - CHECK_INT(val0 == 0, true); - } - -private: - static void do_it0() { // increment/decrement by 2 - inc_dec(2); - } - static void do_it1() { // increment/decrement by 3 - inc_dec(3); - } - static void do_it2() { // increment/decrement by max() - 5 - inc_dec(STD numeric_limits::max() - 5); - } - static void do_it3() { // increment/decrement by max() - 7 - inc_dec(STD numeric_limits::max() - 7); - } - static void inc_dec(Ty value) { // increment/decrement by value - unsigned long limit = iterations; - for (unsigned long i = 0; i < limit; ++i) - val0.fetch_add(value, STD memory_order_acq_rel); - for (unsigned long i = 0; i < limit; ++i) - val0.fetch_sub(value, STD memory_order_acq_rel); - } - static STD atomic val0; -}; -template -STD atomic arithmetic_tester::val0; - -template -struct xor_tester { // class for testing atomicity of xor operations -public: - static void run() { // run 4 threads, all updating shared value - test_runner runner; - runner.run_threads(&xor_tester::do_it0, &xor_tester::do_it1, &xor_tester::do_it2, &xor_tester::do_it3); - CHECK_INT(val0 == 0, true); - } - -private: - static void do_it0() { // xor with 0011... - xor_it(0x3333333333333333ULL & STD numeric_limits::max()); - } - static void do_it1() { // xor with 0101... - xor_it(0x5555555555555555ULL & STD numeric_limits::max()); - } - static void do_it2() { // xor with 1010... - xor_it(0xAAAAAAAAAAAAAAAAULL & STD numeric_limits::max()); - } - static void do_it3() { // xor with 1100... - xor_it(0xCCCCCCCCCCCCCCCCULL & STD numeric_limits::max()); - } - static void xor_it(Ty value) { // xor with value - for (unsigned long i = 0; i < iterations; ++i) - val0.fetch_xor(value, STD memory_order_acq_rel); - } - static STD atomic val0; -}; -template -STD atomic xor_tester::val0; - -// RUN TESTS -template -void test_for_type() { // run tests for type Ty - read_write_tester::run(); - exchange_tester::run(); - cas_weak_tester::run(); - cas_strong_tester::run(); - arithmetic_tester::run(); - xor_tester::run(); -} - -void display(const char* mesg) { // optionally display progress message - if (!terse) - printf("%s", mesg); -} - -void test_main() { // test header - display("testing atomic_flag:\n"); - flag_tester::run(); - display("testing type unsigned char:\n"); - test_for_type(); - display("testing type unsigned short:\n"); - test_for_type(); - display("testing type unsigned int:\n"); - test_for_type(); - display("testing type unsigned long:\n"); - test_for_type(); - display("testing type unsigned long long:\n"); - test_for_type(); -} diff --git a/tests/tr1/tests/atomic2/env.lst b/tests/tr1/tests/atomic2/env.lst deleted file mode 100644 index d3c3c9bb88..0000000000 --- a/tests/tr1/tests/atomic2/env.lst +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -RUNALL_INCLUDE ..\..\env_threads.lst diff --git a/tests/tr1/tests/atomic2/test.cpp b/tests/tr1/tests/atomic2/test.cpp deleted file mode 100644 index a563cea304..0000000000 --- a/tests/tr1/tests/atomic2/test.cpp +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -// test C++11 header with UDT and multiple threads -#define TEST_NAME ", part 2" -#undef NDEBUG - -#include "tdefs.h" -#include -#include -#include -#include -#include - -// These tests look for synchronization failures on an atomic type managing -// an object of a user-defined type. - -// The tests exercise the following functions: -// load() -// store() -// exchange() -// compare_exchange_weak() -// compare_exchange_strong() - -// All of the tests use the assert() macro for internal checks. They can't -// use the CHECK_XXX macros because the CHECK_XXX macros aren't -// synchronized, and adding synchronization to the macros would introduce -// external synchronization into these tests, defeating their purpose. - -// SUPPORT AND CONFIGURATION - -// adjust to get reasonable testing times for the platform: -static const unsigned long iterations = 1000000; - -class test_runner { // class to run multiple threads and wait for them all to finish -public: - template - void run_threads(Fn0 fn0) { // run 1 thread - thread_count = 1; - STD thread thr0(fn0); - threads[0].swap(thr0); - wait(); - } - template - void run_threads(Fn0 fn0, Fn1 fn1) { // run 2 threads - thread_count = 2; - STD thread thr0(fn0); - threads[0].swap(thr0); - STD thread thr1(fn1); - threads[1].swap(thr1); - wait(); - } - template - void run_threads(Fn0 fn0, Fn1 fn1, Fn2 fn2) { // run 3 threads - thread_count = 3; - STD thread thr0(fn0); - threads[0].swap(thr0); - STD thread thr1(fn1); - threads[1].swap(thr1); - STD thread thr2(fn2); - threads[2].swap(thr2); - wait(); - } - template - void run_threads(Fn0 fn0, Fn1 fn1, Fn2 fn2, Fn3 fn3) { // run 4 threads - thread_count = 4; - STD thread thr0(fn0); - threads[0].swap(thr0); - STD thread thr1(fn1); - threads[1].swap(thr1); - STD thread thr2(fn2); - threads[2].swap(thr2); - STD thread thr3(fn3); - threads[3].swap(thr3); - wait(); - } - -private: - void wait() { // wait for all threads to finish - for (int i = 0; i < thread_count; ++i) - threads[i].join(); - } - int thread_count; - STD thread threads[4]; -}; - -struct UDT { // struct for testing atomic - unsigned long long counter0; - unsigned char counter1; - unsigned long long counter2; -}; - -inline void increment(UDT& udt) { // increment counters in UDT object - ++udt.counter0; - ++udt.counter1; - ++udt.counter2; -} - -inline bool operator==(const UDT& left, const UDT& right) { // return true if left and right are equal - return left.counter0 == right.counter0 && left.counter1 == right.counter1 && left.counter2 == right.counter2; -} - -inline bool operator!=(const UDT& left, const UDT& right) { // return true if left and right are not equal - return !(left == right); -} - -inline bool operator<(const UDT& left, const UDT& right) { // return true if left < right - return left.counter0 < right.counter0; -} - -inline bool operator<=(const UDT& left, const UDT& right) { // return true if left <= right - return !(right < left); -} - -struct read_write_tester { // class for testing acquire/release semantics for load/store ops -public: - static void run() { // run 2 threads, one writing and one reading - test_runner runner; - runner.run_threads(&read_write_tester::write, &read_write_tester::read); - CHECK_INT(val0.load().counter0 == iterations, true); - CHECK_INT(val0.load().counter1 == (iterations & STD numeric_limits::max()), true); - CHECK_INT(val0.load().counter2 == iterations, true); - CHECK_INT(val1.load().counter0 == iterations, true); - CHECK_INT(val1.load().counter1 == (iterations & STD numeric_limits::max()), true); - CHECK_INT(val1.load().counter2 == iterations, true); - } - -private: - static void write() { // do atomic writes with relaxed/release memory order - for (unsigned long i = 0; i < iterations; ++i) { // do atomic stores - UDT my_val = val0.load(STD memory_order_relaxed); - increment(my_val); - val0.store(my_val, STD memory_order_relaxed); - val1.store(my_val, STD memory_order_release); - } - } - static void read() { // do atomic reads with relaxed/acquire memory order - for (unsigned long i = 0; i < iterations; ++i) { // read values and check for proper update visibility - UDT my_val1a = val1.load(STD memory_order_acquire); - UDT my_val0a = val0.load(STD memory_order_relaxed); - UDT my_val1b = val1.load(STD memory_order_relaxed); - UDT my_val0b = val0.load(STD memory_order_relaxed); - assert(my_val1a <= my_val0a); - assert(my_val1b <= my_val0b); - } - } - static STD atomic val0; - static STD atomic val1; -}; -STD atomic read_write_tester::val0; -STD atomic read_write_tester::val1; - -struct exchange_tester { // class for testing atomicity of exchange operations -public: - static void run() { // run 4 threads, all exchanging shared value - test_runner runner; - runner.run_threads( - &exchange_tester::do_it, &exchange_tester::do_it, &exchange_tester::do_it, &exchange_tester::do_it); - CHECK_INT(val0.load().counter0 == iterations, true); - CHECK_INT(val0.load().counter1 == (iterations & STD numeric_limits::max()), true); - CHECK_INT(val0.load().counter2 == iterations, true); - } - -private: - static void do_it() { // repeatedly exchange values - UDT my_val{}; - for (unsigned long i = 0; i < iterations; ++i) { // repeatedly exchange values - increment(my_val); - val0.exchange(my_val); - } - } - static STD atomic val0; -}; -STD atomic exchange_tester::val0; - -struct cas_weak_tester { // class for testing atomicity of - // compare-and-exchange-weak operations -public: - static void run() { // run 4 threads, all comparing and exchanging shared value - test_runner runner; - runner.run_threads( - &cas_weak_tester::do_it, &cas_weak_tester::do_it, &cas_weak_tester::do_it, &cas_weak_tester::do_it); - CHECK_INT(val0.load().counter0 == iterations, true); - CHECK_INT(val0.load().counter1 == (iterations & STD numeric_limits::max()), true); - CHECK_INT(val0.load().counter2 == iterations, true); - } - -private: - static void do_it() { // repeatedly compare-and-exchange values - UDT my_val{}; - UDT my_old_val = my_val; - for (unsigned long i = 0; i < iterations / 4; ++i) { // compare-and-exchange incremented value - UDT temp_val = my_val; - increment(temp_val); - while (!val0.compare_exchange_weak(my_val, temp_val)) { // compare-and-exchange incremented value - assert(my_old_val < my_val); - temp_val = my_val; - increment(temp_val); - } - my_old_val = my_val; - STD this_thread::yield(); - } - } - static STD atomic val0; -}; -STD atomic cas_weak_tester::val0; - -struct cas_strong_tester { // class for testing atomicity of - // compare-and-exchange-strong operations -public: - static void run() { // run 4 threads, all comparing and exchanging shared value - test_runner runner; - runner.run_threads( - &cas_strong_tester::do_it, &cas_strong_tester::do_it, &cas_strong_tester::do_it, &cas_strong_tester::do_it); - CHECK_INT(val0.load().counter0 == iterations, true); - CHECK_INT(val0.load().counter1 == (iterations & STD numeric_limits::max()), true); - CHECK_INT(val0.load().counter2 == iterations, true); - } - -private: - static void do_it() { // repeatedly compare-and-exchange values - UDT my_val{}; - UDT my_old_val = my_val; - for (unsigned long i = 0; i < iterations / 4; ++i) { // compare-and-exchange incremented value - UDT temp_val = my_val; - increment(temp_val); - while (!val0.compare_exchange_strong(my_val, temp_val)) { // compare-and-exchange incremented value - assert(my_old_val < my_val); - temp_val = my_val; - increment(temp_val); - } - my_old_val = my_val; - STD this_thread::yield(); - } - } - static STD atomic val0; -}; -STD atomic cas_strong_tester::val0; - -// RUN TESTS -void test_main() { // test header - read_write_tester::run(); - exchange_tester::run(); - cas_weak_tester::run(); - cas_strong_tester::run(); -} diff --git a/tests/tr1/tests/atomic4/env.lst b/tests/tr1/tests/atomic4/env.lst deleted file mode 100644 index d3c3c9bb88..0000000000 --- a/tests/tr1/tests/atomic4/env.lst +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -RUNALL_INCLUDE ..\..\env_threads.lst diff --git a/tests/tr1/tests/atomic4/test.cpp b/tests/tr1/tests/atomic4/test.cpp deleted file mode 100644 index c1d4390ae6..0000000000 --- a/tests/tr1/tests/atomic4/test.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -// test atomic operations on shared_ptr objects -#define TEST_NAME "atomic shared_ptr operations" - -#define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING - -#include "tdefs.h" -#include -#include -#include -#include - -static const unsigned long iterations = 100000; - -typedef STD shared_ptr sp; -const sp s0(new int(0)); -const sp s1(new int(1)); - -static void test_load_store() { // test atomic load and store operations - sp sp0(s0); - sp sp1(s1); - static sp shared(sp0); - for (unsigned long i = 0; i < iterations; ++i) { // repeat several times - STD atomic_store(&shared, sp0); - sp temp = STD atomic_load_explicit(&shared, STD memory_order_seq_cst); - assert(temp == sp0 || temp == sp1); - STD this_thread::yield(); - STD atomic_store_explicit(&shared, sp1, STD memory_order_seq_cst); - temp = STD atomic_load(&shared); - assert(temp == sp0 || temp == sp1); - STD this_thread::yield(); - } -} - -static void test_exchange() { // test atomic exchange operation - sp sp0(s0); - sp sp1(s1); - static sp shared(sp0); - for (unsigned long i = 0; i < iterations; ++i) { // repeat several times - sp temp = STD atomic_exchange(&shared, sp0); - assert(temp == sp0 || temp == sp1); - STD this_thread::yield(); - temp = STD atomic_exchange_explicit(&shared, sp1, STD memory_order_seq_cst); - assert(temp == sp0 || temp == sp1); - STD this_thread::yield(); - } -} - -static void test_compare_exchange_weak() { // test atomic compare-exchange weak operation - sp sp0(s0); - sp sp1(s1); - static sp shared(sp0); - for (unsigned long i = 0; i < iterations; ++i) { // repeat several times - sp sp_local(sp0); - if (STD atomic_compare_exchange_weak(&shared, &sp_local, sp1)) - assert(sp_local == sp0); - else - assert(sp_local == sp1); - STD this_thread::yield(); - sp_local = sp1; - if (STD atomic_compare_exchange_weak_explicit( - &shared, &sp_local, sp0, STD memory_order_seq_cst, STD memory_order_seq_cst)) - assert(sp_local == sp1); - else - assert(sp_local == sp0); - STD this_thread::yield(); - } -} - -static void test_compare_exchange_strong() { // test atomic compare-exchange strong operation - sp sp0(s0); - sp sp1(s1); - static sp shared(sp0); - for (unsigned long i = 0; i < iterations; ++i) { // repeat several times - sp sp_local(sp0); - if (STD atomic_compare_exchange_strong(&shared, &sp_local, sp1)) - assert(sp_local == sp0); - else - assert(sp_local == sp1); - STD this_thread::yield(); - sp_local = sp1; - if (STD atomic_compare_exchange_strong_explicit( - &shared, &sp_local, sp0, STD memory_order_seq_cst, STD memory_order_seq_cst)) - assert(sp_local == sp1); - else - assert(sp_local == sp0); - STD this_thread::yield(); - } -} - -static void run_test(void (*fp)()) { // run *fp in four threads and wait for completion - STD thread thr0(fp); - STD thread thr1(fp); - STD thread thr2(fp); - STD thread thr3(fp); - thr0.join(); - thr1.join(); - thr2.join(); - thr3.join(); -} - -// RUN TESTS -void test_main() { // test header - sp sp0(new int(0)); - bool is_lock_free = STD atomic_is_lock_free(&sp0); - CHECK_INT(is_lock_free == false || is_lock_free == true, 1); - run_test(test_load_store); - run_test(test_exchange); - run_test(test_compare_exchange_weak); - run_test(test_compare_exchange_strong); -} diff --git a/tests/tr1/tests/condition_variable/env.lst b/tests/tr1/tests/condition_variable/env.lst deleted file mode 100644 index d3c3c9bb88..0000000000 --- a/tests/tr1/tests/condition_variable/env.lst +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -RUNALL_INCLUDE ..\..\env_threads.lst diff --git a/tests/tr1/tests/condition_variable/test.cpp b/tests/tr1/tests/condition_variable/test.cpp deleted file mode 100644 index 1cf728f446..0000000000 --- a/tests/tr1/tests/condition_variable/test.cpp +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -// test header, C++ -#define TEST_NAME "" - -#include "tdefs.h" -#include -#include -#include -#include -#include -#include -#include - -namespace { - int count; - int value; - STD mutex sync_mutex; - typedef STD unique_lock sync_lock_type; - sync_lock_type sync_lock(sync_mutex, STD defer_lock); - STD condition_variable sync_cond; - - const long interval = (long) STD chrono::nanoseconds(STD chrono::milliseconds(20)).count(); - const long one_sec = (long) STD chrono::nanoseconds(STD chrono::seconds(1)).count(); - - enum { // test types - timed_xtime = 0x01, - timed_until = 0x02, - timed_for = 0x04, - predicate = 0x08, - notify_one = 0x10, - notify_all = 0x20 - }; - - bool my_pred() { // predicate - return value == 1; - } - - bool (*pred)() = my_pred; - - bool should_time_out(int flags) { - return (flags & (timed_until | timed_xtime | timed_for)) != 0 && (flags & (notify_one | notify_all)) == 0; - } - - template - class waiter { // wait in separate thread - public: - waiter(Cond& c, Mutex& m, int& r) : cnd(c), mtx(m), result(r) {} - - void operator()(int flags) const { // launch thread and synchronize with main thread - try { // make sure exceptions don't escape - bool res = false; - wait_for_sync(); - - if (flags & timed_xtime) - res = do_timed_xtime(flags); - else if (flags & timed_until) - res = do_timed_until(flags); - else if (flags & timed_for) - res = do_timed_for(flags); - else - res = do_unbounded(flags); - STD lock_guard guard(sync_mutex); - result = res ? value : -1; - } catch (...) { // report exception and continue - CHECK_MSG("exception thrown in thread function", false); - STD lock_guard guard(sync_mutex); - result = -1; - } - } - - typedef void result_type; - - private: - void wait_for_sync() const { - STD lock_guard guard(sync_mutex); - ++count; - if (count == 3) - sync_cond.notify_one(); - } - - bool do_timed_xtime(int flags) const { // wait with timeout - xtime target; - xtime_get(&target, TIME_UTC); - - if (should_time_out(flags)) { - if (one_sec - interval <= target.nsec) { // normalize (target + interval) - ++target.sec; - target.nsec -= (one_sec - interval); - } else - target.nsec += interval; - } else { - target.sec += 60 * 60; // ~ 1 hour - target.nsec = 0; - } - - bool res; - if (flags & predicate) { - STD unique_lock guard(mtx); - res = cnd.wait_until(guard, &target, pred); - } else { // wait without predicate - res = true; - STD unique_lock guard(mtx); - while (res && value != 1) - res = cnd.wait_until(guard, &target) != STD cv_status::timeout; - } - return res; - } - - bool do_timed_until(int flags) const { // wait with timeout - STD chrono::time_point tgt; - if (should_time_out(flags)) - tgt = STD chrono::system_clock::now() + STD chrono::nanoseconds(interval); - else - tgt = STD chrono::system_clock::now() + STD chrono::hours(1); - - bool res; - if (flags & predicate) { - STD unique_lock guard(mtx); - res = cnd.wait_until(guard, tgt, pred); - } else { // wait without predicate - res = true; - STD unique_lock guard(mtx); - while (res && value != 1) - res = cnd.wait_until(guard, tgt) != STD cv_status::timeout; - } - return res; - } - - bool do_timed_for(int flags) const { // wait with timeout - STD chrono::nanoseconds dur; - if (should_time_out(flags)) - dur = STD chrono::nanoseconds(interval); - else - dur = STD chrono::hours(1); - - bool res; - if (flags & predicate) { - STD unique_lock guard(mtx); - res = cnd.wait_for(guard, dur, pred); - } else { // wait without predicate - res = true; - STD unique_lock guard(mtx); - while (res && value != 1) - res = cnd.wait_for(guard, dur) != STD cv_status::timeout; - } - return res; - } - - bool do_unbounded(int flags) const { // wait without timeout - if (flags & predicate) { - STD unique_lock guard(mtx); - cnd.wait(guard, pred); - } else { - STD unique_lock guard(mtx); - while (value != 1) - cnd.wait(guard); - } - return true; - } - Cond& cnd; - Mutex& mtx; - int& result; - }; - - template - void do_t_wait(Cond& cnd, Mutex& mtx, int flags) { // test wait - count = 0; - value = 0; - - if ((flags & (timed_for | timed_until | timed_xtime | notify_all | notify_one)) == 0) - flags = notify_all; // ensure that we return when we're not timed - - int result0 = -1; - waiter w0(cnd, mtx, result0); - STD thread thr0(w0, flags); - int result1 = -1; - waiter w1(cnd, mtx, result1); - STD thread thr1(w1, flags); - int result2 = -1; - waiter w2(cnd, mtx, result2); - STD thread thr2(w2, flags); - - // block until all threads have started - { - STD unique_lock guard(sync_mutex); - sync_cond.wait(guard, []() { return count == 3; }); - } - - if (flags & predicate) { // simulate spurious wakeup - cnd.notify_all(); - } - - if (flags & notify_one) { // notify one at a time - STD lock_guard guard(mtx); - value = 1; - - cnd.notify_one(); - cnd.notify_one(); - cnd.notify_one(); - } else if (flags & notify_all) { - STD lock_guard guard(mtx); - value = 1; - - cnd.notify_all(); - } - - thr0.join(); - thr1.join(); - thr2.join(); - - if (should_time_out(flags)) { // should time out without wakeup - CHECK_INT(result0, -1); - CHECK_INT(result1, -1); - CHECK_INT(result2, -1); - } else { // check for proper wakeup - CHECK_INT(result0, 1); - CHECK_INT(result1, 1); - CHECK_INT(result2, 1); - } - } - - template - void t_wait(Cond& cnd, Mutex& mtx, int flags, const char* name) { // test multiple waits - name = name; // to quiet diagnostics - - for (int i = 0; i < 5; ++i) - do_t_wait(cnd, mtx, flags); - } - - template - void t_condition_variables(Cond& cnd, Mutex& mtx, const char* name) { // test wait functions of condition variables - t_wait(cnd, mtx, notify_one, name); - t_wait(cnd, mtx, notify_all, name); - - t_wait(cnd, mtx, timed_xtime, name); - t_wait(cnd, mtx, timed_xtime | notify_one, name); - t_wait(cnd, mtx, timed_xtime | notify_all, name); - - t_wait(cnd, mtx, timed_until, name); - t_wait(cnd, mtx, timed_until | notify_one, name); - t_wait(cnd, mtx, timed_until | notify_all, name); - t_wait(cnd, mtx, timed_for, name); - t_wait(cnd, mtx, timed_for | notify_one, name); - t_wait(cnd, mtx, timed_for | notify_all, name); - - t_wait(cnd, mtx, notify_one | predicate, name); - t_wait(cnd, mtx, notify_all | predicate, name); - - t_wait(cnd, mtx, timed_xtime | predicate, name); - t_wait(cnd, mtx, timed_xtime | notify_one | predicate, name); - t_wait(cnd, mtx, timed_xtime | notify_all | predicate, name); - - t_wait(cnd, mtx, timed_until | predicate, name); - t_wait(cnd, mtx, timed_until | notify_one | predicate, name); - t_wait(cnd, mtx, timed_until | notify_all | predicate, name); - t_wait(cnd, mtx, timed_for | predicate, name); - t_wait(cnd, mtx, timed_for | notify_one | predicate, name); - t_wait(cnd, mtx, timed_for | notify_all | predicate, name); - } - - void t_condition_variable() { // test condition_variable - STD condition_variable cnd; - STD mutex mtx; - STD unique_lock lock(mtx, STD defer_lock); - - t_condition_variables(cnd, mtx, "unique_lock"); - - bool thrown = false; - try { // check for exception on attempted wait with unowned mutex - STD chrono::time_point target = - STD chrono::system_clock::now() + STD chrono::nanoseconds(interval); - CHECK(cnd.wait_until(lock, target) == STD cv_status::timeout); - } catch (const STD system_error& err) { // catch the exception - thrown = true; - CHECK(err.code().value() == (int) STD errc::operation_not_permitted); - } - CHECK(thrown); - } - - class my_mutex { // user-defined mutex type - public: - void lock() { - mtx.lock(); - } - void unlock() { - mtx.unlock(); - } - - private: - STD mutex mtx; - }; - - void t_condition_variable_any() { // test condition_variable_any with various mutex types - STD condition_variable_any cnd; - STD mutex mtx0; - t_condition_variables(cnd, mtx0, "mutex"); - - STD timed_mutex mtx1; - t_condition_variables(cnd, mtx1, "timed_mutex"); - - STD recursive_mutex mtx2; - t_condition_variables(cnd, mtx2, "recursive_mutex"); - - STD recursive_timed_mutex mtx3; - t_condition_variables(cnd, mtx3, "recursive_timed_mutex"); - - my_mutex mtx4; - t_condition_variables(cnd, mtx4, "my_mutex"); - } -} // unnamed namespace - -void test_main() { // test header - t_condition_variable(); - t_condition_variable_any(); -} diff --git a/tests/tr1/tests/thread/env.lst b/tests/tr1/tests/thread/env.lst deleted file mode 100644 index d3c3c9bb88..0000000000 --- a/tests/tr1/tests/thread/env.lst +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -RUNALL_INCLUDE ..\..\env_threads.lst diff --git a/tests/tr1/tests/thread/test.cpp b/tests/tr1/tests/thread/test.cpp deleted file mode 100644 index 4c63948793..0000000000 --- a/tests/tr1/tests/thread/test.cpp +++ /dev/null @@ -1,365 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -// test header, C++ -#define TEST_NAME "" - -#define _HAS_AUTO_PTR_ETC 1 - -#include "tdefs.h" -#include -#include -#include - -#define MOVE(x) STD move(x) - -#define DELAY_VALUE 2 // milliseconds for delay() - -namespace { - - int called = 0; - - void test_no_args() { // mark that function was called - called = 1; - } - - void test_one_arg(int val) { // mark that function was called - called = val; - } - - void test_two_args(int val0, int val1) { // mark that function was called - called = val0 + val1; - } - - struct fun_obj0 { // struct with function call operator - void operator()() const { // mark that function was called - called = 2; - } - typedef void result_type; - }; - - struct fun_obj1 : STD unary_function { // struct with function call operator - void operator()(int val) const { // mark that function was called - called = val; - } - }; - - struct fun_obj2 : STD binary_function { // struct with function call operator - void operator()(int val0, int val1) const { // mark that function was called - called = val0 + val1; - } - }; - - void t_ctors() { // test join, constructors except copy constructor - STD thread thr0; - - CHECK_INT(thr0.get_id() == STD thread::id(), true); - CHECK_INT(thr0.joinable(), false); - - called = 0; - STD thread thr1(test_no_args); - CHECK_INT(thr1.joinable(), true); - thr1.join(); - CHECK_INT(thr1.joinable(), false); - CHECK_INT(called, 1); - CHECK_INT(thr1.get_id() == STD thread::id(), true); - - called = 0; - fun_obj0 fun0; - STD thread thr2(fun0); - CHECK_INT(thr2.joinable(), true); - thr2.join(); - CHECK_INT(thr2.joinable(), false); - CHECK_INT(called, 2); - CHECK_INT(thr2.get_id() == STD thread::id(), true); - - int first, second; - first = 3; - STD thread thr3(test_one_arg, first); - CHECK_INT(thr3.joinable(), true); - thr3.join(); - CHECK_INT(thr3.joinable(), false); - CHECK_INT(called, 3); - - fun_obj1 fun1; - first = 4; - STD thread thr4(fun1, first); - CHECK_INT(thr4.joinable(), true); - thr4.join(); - CHECK_INT(thr4.joinable(), false); - CHECK_INT(called, 4); - - first = 4; - second = 5; - STD thread thr5(test_two_args, first, second); - CHECK_INT(thr5.joinable(), true); - thr5.join(); - CHECK_INT(thr5.joinable(), false); - CHECK_INT(called, 9); - - first = 5; - second = 6; - fun_obj2 fun2; - STD thread thr6(fun2, first, second); - CHECK_INT(thr6.joinable(), true); - thr6.join(); - CHECK_INT(thr6.joinable(), false); - CHECK_INT(called, 11); - } - - void delay() { // pause, then mark that function was called - STD this_thread::sleep_for(STD chrono::milliseconds(DELAY_VALUE)); - called = 1; - } - - void t_copy() { // test copy[move] constructor, assignment, detach - called = 0; - STD thread thr0(delay); - STD thread::id id0 = thr0.get_id(); - CHECK_INT(thr0.joinable(), true); - CHECK_INT(id0 != STD this_thread::get_id(), true); - STD thread thr1(MOVE(thr0)); - CHECK_INT(thr0.joinable(), false); - CHECK_INT(thr0.get_id() == STD thread::id(), true); - CHECK_INT(thr1.joinable(), true); - CHECK_INT(thr1.get_id() == id0, true); - - STD thread thr2; - thr2 = MOVE(thr1); - CHECK_INT(thr1.joinable(), false); - CHECK_INT(thr1.get_id() == STD thread::id(), true); - CHECK_INT(thr2.joinable(), true); - CHECK_INT(thr2.get_id() == id0, true); - thr2.join(); - CHECK_INT(called, 1); - - called = 0; - STD thread thr3(delay); - CHECK_INT(thr3.joinable(), true); - thr3.detach(); - CHECK_INT(called, 0); - CHECK_INT(thr3.joinable(), false); - CHECK_INT(thr3.get_id() == STD thread::id(), true); - } - - void t_swap0() { - STD thread thr0; - STD thread thr1; - - thr0.swap(thr1); - CHECK_INT(thr0.get_id() == STD thread::id(), true); - CHECK_INT(thr0.joinable(), false); - CHECK_INT(thr1.get_id() == STD thread::id(), true); - CHECK_INT(thr1.joinable(), false); - - thr1.swap(thr0); - CHECK_INT(thr0.get_id() == STD thread::id(), true); - CHECK_INT(thr0.joinable(), false); - CHECK_INT(thr1.get_id() == STD thread::id(), true); - CHECK_INT(thr1.joinable(), false); - - STD swap(thr0, thr1); - CHECK_INT(thr0.get_id() == STD thread::id(), true); - CHECK_INT(thr0.joinable(), false); - CHECK_INT(thr1.get_id() == STD thread::id(), true); - CHECK_INT(thr1.joinable(), false); - - STD swap(thr1, thr0); - CHECK_INT(thr0.get_id() == STD thread::id(), true); - CHECK_INT(thr0.joinable(), false); - CHECK_INT(thr1.get_id() == STD thread::id(), true); - CHECK_INT(thr1.joinable(), false); - } - - void t_swap1() { - called = 0; - STD thread thr0(delay); - STD thread::id id0 = thr0.get_id(); - STD thread thr1; - - thr0.swap(thr1); - CHECK_INT(thr0.get_id() == STD thread::id(), true); - CHECK_INT(thr0.joinable(), false); - CHECK_INT(thr1.get_id() == id0, true); - CHECK_INT(thr1.joinable(), true); - - thr1.swap(thr0); - CHECK_INT(thr0.get_id() == id0, true); - CHECK_INT(thr0.joinable(), true); - CHECK_INT(thr1.get_id() == STD thread::id(), true); - CHECK_INT(thr1.joinable(), false); - - STD swap(thr0, thr1); - CHECK_INT(thr0.get_id() == STD thread::id(), true); - CHECK_INT(thr0.joinable(), false); - CHECK_INT(thr1.get_id() == id0, true); - CHECK_INT(thr1.joinable(), true); - - STD swap(thr1, thr0); - CHECK_INT(thr0.get_id() == id0, true); - CHECK_INT(thr0.joinable(), true); - CHECK_INT(thr1.get_id() == STD thread::id(), true); - CHECK_INT(thr1.joinable(), false); - - thr0.join(); - CHECK_INT(called, 1); - } - - void t_swap2() { - called = 0; - STD thread thr0(delay); - STD thread::id id0 = thr0.get_id(); - STD thread thr1(delay); - STD thread::id id1 = thr1.get_id(); - - thr0.swap(thr1); - CHECK_INT(thr0.get_id() == id1, true); - CHECK_INT(thr0.joinable(), true); - CHECK_INT(thr1.get_id() == id0, true); - CHECK_INT(thr1.joinable(), true); - - thr1.swap(thr0); - CHECK_INT(thr0.get_id() == id0, true); - CHECK_INT(thr0.joinable(), true); - CHECK_INT(thr1.get_id() == id1, true); - CHECK_INT(thr1.joinable(), true); - - STD swap(thr0, thr1); - CHECK_INT(thr0.get_id() == id1, true); - CHECK_INT(thr0.joinable(), true); - CHECK_INT(thr1.get_id() == id0, true); - CHECK_INT(thr1.joinable(), true); - - STD swap(thr1, thr0); - CHECK_INT(thr0.get_id() == id0, true); - CHECK_INT(thr0.joinable(), true); - CHECK_INT(thr1.get_id() == id1, true); - CHECK_INT(thr1.joinable(), true); - - thr0.join(); - thr1.join(); - CHECK_INT(called, 1); - } - - void t_id() { - STD thread::id my_id = STD this_thread::get_id(); - CHECK_INT(my_id != STD thread::id(), true); - STD thread thr0(delay); - STD thread::id id0 = thr0.get_id(); - STD thread thr1(delay); - STD thread::id id1 = thr1.get_id(); - - CHECK_INT(id0 == id0, true); - CHECK_INT(!(id0 != id0), true); - CHECK_INT(!(id0 < id0), true); - CHECK_INT(id0 <= id0, true); - CHECK_INT(!(id0 > id0), true); - CHECK_INT(id0 >= id0, true); - - CHECK_INT(!(id0 == id1), true); - CHECK_INT(id0 != id1, true); - CHECK_INT(id0 < id1 && !(id1 < id0) || id1 < id0 && !(id0 < id1), true); - CHECK_INT(id0 <= id1 && !(id1 <= id0) || id1 <= id0 && !(id0 <= id1), true); - CHECK_INT(id0 > id1 && !(id1 > id0) || id1 > id0 && !(id0 > id1), true); - CHECK_INT(id0 >= id1 && !(id1 >= id0) || id1 >= id0 && !(id0 >= id1), true); - - if (id0 < id1 && id1 < my_id) - CHECK_INT(id0 < my_id, true); - else if (id0 < my_id && my_id < id1) - CHECK_INT(id0 < id1, true); - else if (id1 < id0 && id0 < my_id) - CHECK_INT(id1 < my_id, true); - else if (id1 < my_id && my_id < id0) - CHECK_INT(id1 < id0, true); - else if (my_id < id0 && id0 < id1) - CHECK_INT(my_id < id1, true); - else if (my_id < id1 && id1 < id0) - CHECK_INT(my_id < id0, true); - else - CHECK_MSG("Non-transitive id <", false); - - STD ostringstream str0; - str0 << id0; - STD ostringstream str1; - str1 << id1; - STD ostringstream str2; - str2 << my_id; - STD ostringstream str3; - str3 << STD thread::id(); - CHECK_INT(str0.str() != str1.str(), true); - CHECK_INT(str0.str() != str2.str(), true); - CHECK_INT(str0.str() != str3.str(), true); - CHECK_INT(str1.str() != str2.str(), true); - CHECK_INT(str1.str() != str3.str(), true); - CHECK_INT(str2.str() != str3.str(), true); - - STD hash hasher; - CHECK_INT(hasher(id1), hasher(id1)); - - thr1.join(); - thr0.join(); - } - - void t_misc() { - STD this_thread::yield(); // nothing meaningful to test - CHECK_INT(STD thread::hardware_concurrency() >= 1, true); - - { - xtime tgt; - xtime_get(&tgt, TIME_UTC); - tgt.nsec += 30000000; - if (1000000000 <= tgt.nsec) { - tgt.nsec -= 1000000000; - ++tgt.sec; - } - STD this_thread::sleep_until(&tgt); - xtime now; - xtime_get(&now, TIME_UTC); - CHECK_INT(tgt.sec < now.sec || tgt.sec == now.sec && tgt.nsec <= now.nsec, true); - } - - { - STD chrono::system_clock::time_point tgt = - STD chrono::system_clock::now() + STD chrono::system_clock::duration(100); - STD this_thread::sleep_until(tgt); - CHECK_INT(tgt <= STD chrono::system_clock::now(), true); - - tgt = STD chrono::system_clock::now() - STD chrono::system_clock::duration(100); - STD this_thread::sleep_until(tgt); - CHECK_INT(tgt <= STD chrono::system_clock::now(), true); - } - - { - STD chrono::system_clock::duration dur = STD chrono::system_clock::duration(100); - STD chrono::system_clock::time_point tgt = STD chrono::system_clock::now() + dur; - STD this_thread::sleep_for(dur); - CHECK_INT(tgt <= STD chrono::system_clock::now(), true); - - dur = -dur; - tgt = STD chrono::system_clock::now() + dur; - STD this_thread::sleep_for(dur); - CHECK_INT(tgt <= STD chrono::system_clock::now(), true); - } - } -} // unnamed namespace - -void test_main() { // test header - if (!terse) { // display value of __STDCPP_THREADS__ -#ifdef __STDCPP_THREADS__ -#define STRING2(x) #x -#define STRING(x) STRING2() -#define MACRO_NAME STRING(__STDCPP_THREADS__) - _CSTD printf("__STDCPP_THREADS__ = %s\n", MACRO_NAME); -#else // __STDCPP_THREADS__ - _CSTD printf("__STDCPP_THREADS__ not defined\n"); -#endif // __STDCPP_THREADS__ - } - - t_ctors(); - t_copy(); - t_swap0(); - t_swap1(); - t_swap2(); - t_id(); - t_misc(); -} From 055464ee6e06f969859639e1c8ebb1fb8effdadf Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 16:24:38 -0800 Subject: [PATCH 11/25] Woof! Epic fail! --- stl/inc/variant | 2 +- .../tests/Dev09_172666_tr1_tuple_odr/test.cpp | 4 ++-- .../Dev11_0133625_locale0_implib_cpp/test.cpp | 2 +- .../test.cpp | 19 +++++++++---------- .../test.cpp | 2 +- tests/std/tests/P0088R3_variant/test.cpp | 6 +++--- tests/std/tests/P0220R1_any/test.cpp | 2 +- .../test.cpp | 2 +- .../test.compile.pass.cpp | 4 ++-- .../std/tests/VSO_0000000_regex_use/test.cpp | 2 +- 10 files changed, 22 insertions(+), 23 deletions(-) diff --git a/stl/inc/variant b/stl/inc/variant index 2fa56c20c5..2d69df564e 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -105,7 +105,7 @@ template struct _Meta_apply_; template using _Meta_apply = - // explode _List into the parameters of meta-callable _Fn + // unpack _List into the parameters of meta-callable _Fn typename _Meta_apply_<_Fn, _List>::type; template class _List, class... _Types> 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 ae6e80c61e..293625f488 100644 --- a/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp +++ b/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp @@ -9,8 +9,8 @@ namespace fs = std::experimental::filesystem; int meow(); inline bool test_wchar_t_minus() { - // Test for DevDiv-1004799: : /Zc:wchar_t- explodes. Calling file_size - // should cause the blow-up to occur if we are wchar_t incorrect. Test is disabled + // Test for DevDiv-1004799: : /Zc:wchar_t- fails. Calling file_size + // should cause the failure to occur if we are wchar_t incorrect. Test is disabled // (i.e. always passes) if compiled with /clr:pure and /Zc:wchar_t-, as it triggers // LNK2031: calling convention missing in metadata errors, which are irrelevant here. #if defined(_M_CEE_PURE) && !defined(_NATIVE_WCHAR_T_DEFINED) diff --git a/tests/std/tests/Dev11_0133625_locale0_implib_cpp/test.cpp b/tests/std/tests/Dev11_0133625_locale0_implib_cpp/test.cpp index 3b5ca693ec..e4a542d630 100644 --- a/tests/std/tests/Dev11_0133625_locale0_implib_cpp/test.cpp +++ b/tests/std/tests/Dev11_0133625_locale0_implib_cpp/test.cpp @@ -16,7 +16,7 @@ using namespace std; // In managed code, /clr's metadata merge triggered linker errors. // This test uses a facet to drag in locale0_implib.cpp, then uses a string. // It's then compiled with lots of different options. -// This will explode if basic_string sneaks its way into msvcprt[d].lib again. +// This will fail if basic_string sneaks its way into msvcprt[d].lib again. int main() { use_facet>(locale::classic()); diff --git a/tests/std/tests/Dev11_0535636_functional_overhaul/test.cpp b/tests/std/tests/Dev11_0535636_functional_overhaul/test.cpp index c8f365e97d..3650ebf162 100644 --- a/tests/std/tests/Dev11_0535636_functional_overhaul/test.cpp +++ b/tests/std/tests/Dev11_0535636_functional_overhaul/test.cpp @@ -1757,30 +1757,29 @@ void test_function() { assert(cf(10) == 40); // swap() must be noexcept. - struct Explosive { + struct Puppy { int m_i; const bool* m_p; - Explosive(int i, const bool* p) noexcept : m_i(i), m_p(p) {} - - Explosive(const Explosive& other) noexcept(false) : m_i(other.m_i), m_p(other.m_p) { + Puppy(int i, const bool* p) noexcept : m_i(i), m_p(p) {} + Puppy(const Puppy& other) noexcept(false) : m_i(other.m_i), m_p(other.m_p) { if (*m_p) { - throw string("boom"); + throw string("BARK"); } } - Explosive& operator=(const Explosive&) = delete; + Puppy& operator=(const Puppy&) = delete; int operator()() const noexcept { return m_i; } }; - bool explode = false; - function f1 = Explosive(300, &explode); - function f2 = Explosive(9999, &explode); - explode = true; + bool bark = false; + function f1 = Puppy(300, &bark); + function f2 = Puppy(9999, &bark); + bark = true; assert(f1() == 300); assert(f2() == 9999); f1.swap(f2); diff --git a/tests/std/tests/Dev11_0579795_inplace_merge_out_of_memory/test.cpp b/tests/std/tests/Dev11_0579795_inplace_merge_out_of_memory/test.cpp index 560b360c0d..3b3fdfe486 100644 --- a/tests/std/tests/Dev11_0579795_inplace_merge_out_of_memory/test.cpp +++ b/tests/std/tests/Dev11_0579795_inplace_merge_out_of_memory/test.cpp @@ -201,7 +201,7 @@ void test_stability() { void test_after_skipping_in_position_overhaul() { g_max_memory = prohibit_attempts_to_allocate; - { // check that 1 element trivial cases don't explode + { // check that 1 element trivial cases don't fail array a = {{5}}; inplace_merge(a.begin(), a.begin(), a.begin()); // empty degenerate case inplace_merge(a.begin(), a.begin(), a.end()); // first partition eliminates everything degenerate case diff --git a/tests/std/tests/P0088R3_variant/test.cpp b/tests/std/tests/P0088R3_variant/test.cpp index 1212126d9a..461e719ec2 100644 --- a/tests/std/tests/P0088R3_variant/test.cpp +++ b/tests/std/tests/P0088R3_variant/test.cpp @@ -4693,13 +4693,13 @@ void test_T_ctor_basic() { } #if !_HAS_CXX20 // Narrowing check occurs with P0608R3 -struct BoomOnAnything { +struct FailOnAnything { template - constexpr BoomOnAnything(T) { static_assert(!std::is_same::value, ""); } + constexpr FailOnAnything(T) { static_assert(!std::is_same::value, ""); } }; void test_no_narrowing_check_for_class_types() { - using V = std::variant; + using V = std::variant; V v(42); assert(v.index() == 0); assert(std::get<0>(v) == 42); diff --git a/tests/std/tests/P0220R1_any/test.cpp b/tests/std/tests/P0220R1_any/test.cpp index fa54fafca4..21545e4eed 100644 --- a/tests/std/tests/P0220R1_any/test.cpp +++ b/tests/std/tests/P0220R1_any/test.cpp @@ -2614,7 +2614,7 @@ namespace msvc { #pragma clang diagnostic ignored "-Wself-move" #endif // __clang__ void run_test() { - // test that self-move-assignment doesn't explode + // test that self-move-assignment doesn't fail { // empty any a; diff --git a/tests/std/tests/VSO_0000000_container_allocator_constructors/test.cpp b/tests/std/tests/VSO_0000000_container_allocator_constructors/test.cpp index bd23cd28a0..8a00c071f4 100644 --- a/tests/std/tests/VSO_0000000_container_allocator_constructors/test.cpp +++ b/tests/std/tests/VSO_0000000_container_allocator_constructors/test.cpp @@ -22,7 +22,7 @@ using namespace std; #pragma warning(disable : 28251) // Inconsistent annotation for 'new': this instance has no annotations. -// Break std::allocator by making calling new explode +// Break std::allocator by making calling new fail void* operator new(size_t) { abort(); 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 829f09e1ae..28920cace2 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 @@ -335,7 +335,7 @@ void exception_test_impl(const ThrowingFunction& tf) { try { tf(); } catch (...) { - throw_with_nested("BOOMx2"); + throw_with_nested("WOOFx2"); } } catch (const exception& e) { check_nested_exception_impl(e); @@ -347,7 +347,7 @@ void exception_test() { exception_ptr e_ptr = make_exception_ptr(e); exception_test_impl([]() { throw 23; }); // can't nest - exception_test_impl([]() { throw runtime_error("BOOM"); }); // can nest + exception_test_impl([]() { throw runtime_error("WOOF"); }); // can nest } template diff --git a/tests/std/tests/VSO_0000000_regex_use/test.cpp b/tests/std/tests/VSO_0000000_regex_use/test.cpp index fe202ca392..37149bf51e 100644 --- a/tests/std/tests/VSO_0000000_regex_use/test.cpp +++ b/tests/std/tests/VSO_0000000_regex_use/test.cpp @@ -353,7 +353,7 @@ void test_VSO_101318_ECMAScript_identity_escapes_should_be_lax() { // Test the ambiguous cases that we now want to accept g_regexTester.should_match("z", "\\z"); g_regexTester.should_match("\xB5", "\\\xB5"); // \xB5 is the micro symbol in Latin-1 - // ES6 explicitly says "but not c" so this should explode + // ES6 explicitly says "but not c" so this should fail g_regexTester.should_throw("\\c", error_escape); // Make sure w s and d still do what they're supposed to g_regexTester.should_match("1", "\\d"); From 916174a6ee6c823f2f0839ef0ce756eb068e8a1b Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 16:34:51 -0800 Subject: [PATCH 12/25] Attach brace. --- tests/std/tests/P0980R1_constexpr_strings/test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/std/tests/P0980R1_constexpr_strings/test.cpp b/tests/std/tests/P0980R1_constexpr_strings/test.cpp index e484f2da4b..d7e8d0e9d2 100644 --- a/tests/std/tests/P0980R1_constexpr_strings/test.cpp +++ b/tests/std/tests/P0980R1_constexpr_strings/test.cpp @@ -2384,8 +2384,7 @@ constexpr void test_all() { } #if _HAS_CXX23 -void test_gh_2524() // COMPILE-ONLY -{ +void test_gh_2524() { // COMPILE-ONLY // resize_and_overwrite generates warning C4018 when Operation returns int string s; s.resize_and_overwrite(1, [](char* buffer, size_t) { From 48266b3e425d0ca958e7512b1a2f51c1e64955d9 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 17:04:15 -0800 Subject: [PATCH 13/25] Remove unnecessary defenses for macroized isalnum etc. Followup to GH 2147. --- stl/inc/locale | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/stl/inc/locale b/stl/inc/locale index 712221be2c..483c3027a1 100644 --- a/stl/inc/locale +++ b/stl/inc/locale @@ -165,72 +165,72 @@ _NODISCARD bool has_facet(const locale& _Loc) noexcept { } template -_NODISCARD bool(isalnum)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool isalnum(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::alnum, _Ch); } template -_NODISCARD bool(isalpha)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool isalpha(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::alpha, _Ch); } template -_NODISCARD bool(isblank)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool isblank(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::blank, _Ch); } template -_NODISCARD bool(iscntrl)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool iscntrl(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::cntrl, _Ch); } template -_NODISCARD bool(isdigit)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool isdigit(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::digit, _Ch); } template -_NODISCARD bool(isgraph)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool isgraph(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::graph, _Ch); } template -_NODISCARD bool(islower)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool islower(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::lower, _Ch); } template -_NODISCARD bool(isprint)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool isprint(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::print, _Ch); } template -_NODISCARD bool(ispunct)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool ispunct(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::punct, _Ch); } template -_NODISCARD bool(isspace)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool isspace(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::space, _Ch); } template -_NODISCARD bool(isupper)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool isupper(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::upper, _Ch); } template -_NODISCARD bool(isxdigit)(_Elem _Ch, const locale& _Loc) { +_NODISCARD bool isxdigit(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).is(ctype_base::xdigit, _Ch); } template -_NODISCARD _Elem(tolower)(_Elem _Ch, const locale& _Loc) { +_NODISCARD _Elem tolower(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).tolower(_Ch); } template -_NODISCARD _Elem(toupper)(_Elem _Ch, const locale& _Loc) { +_NODISCARD _Elem toupper(_Elem _Ch, const locale& _Loc) { return _STD use_facet>(_Loc).toupper(_Ch); } _STD_END From bfedea93dd00cf91166924078b89ae36383d81cc Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 17:08:56 -0800 Subject: [PATCH 14/25] Improve formatting of _Refill_lower(). --- stl/inc/random | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index b832a9bc19..7fccece019 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -1217,9 +1217,8 @@ public: } protected: - _Post_satisfies_(this->_Idx == 0) - - void _Refill_lower() { // compute values for the lower half of the history array + _Post_satisfies_(this->_Idx == 0) void _Refill_lower() { + // compute values for the lower half of the history array constexpr size_t _Wrap_bound_one = _Nx - _One_mod_n; constexpr size_t _Wrap_bound_m = _Nx - _M_mod_n; From 60a62534163763eeff0e4f7dfd663f16a6e6bf3d Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 18:07:38 -0800 Subject: [PATCH 15/25] Use range-for in . --- stl/inc/random | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index 7fccece019..90ce7d1ab0 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -989,8 +989,8 @@ public: result_type _Buffer[_Nx]; typename _Mybase::_Traits::_Cy_t _Carry_buf; const auto _Save_flags = _Istr.flags(ios_base::dec | ios_base::skipws); - for (size_t _Ix = 0; _Ix < _Nx; ++_Ix) { - _Istr >> _Buffer[_Ix]; + for (auto& _Val : _Buffer) { + _Istr >> _Val; } _Istr >> _Carry_buf; @@ -1721,8 +1721,9 @@ public: friend basic_istream<_Elem, _Traits>& operator>>( basic_istream<_Elem, _Traits>& _Istr, shuffle_order_engine& _Eng) { // read state from _Istr _Istr >> _Eng._Eng; - for (size_t _Idx = 0; _Idx < shuffle_order_engine::table_size; ++_Idx) { - _Istr >> _Eng._Arr[_Idx]; + + for (auto& _Val : _Eng._Arr) { + _Istr >> _Val; } return _Istr >> _Eng._Yx; @@ -1732,8 +1733,9 @@ public: friend basic_ostream<_Elem, _Traits>& operator<<( basic_ostream<_Elem, _Traits>& _Ostr, const shuffle_order_engine& _Eng) { // write state to _Ostr _Ostr << _Eng._Eng; - for (size_t _Idx = 0; _Idx < shuffle_order_engine::table_size; ++_Idx) { - _Ostr << ' ' << _Eng._Arr[_Idx]; + + for (const auto& _Val : _Eng._Arr) { + _Ostr << ' ' << _Val; } return _Ostr << ' ' << _Eng._Yx; @@ -1741,8 +1743,8 @@ public: private: void _Init() { // compute values for operator() - for (size_t _Idx = 0; _Idx < _Kx; ++_Idx) { - _Arr[_Idx] = _Eng(); + for (auto& _Val : _Arr) { + _Val = _Eng(); } _Yx = _Eng(); @@ -4423,11 +4425,10 @@ public: template basic_ostream<_Elem, _Traits>& _Write(basic_ostream<_Elem, _Traits>& _Ostr) const { // write state to _Ostr - const size_t _Nvals = _Pvec.size(); - _Ostr << ' ' << _Nvals; + _Ostr << ' ' << _Pvec.size(); - for (size_t _Idx = 0; _Idx < _Nvals; ++_Idx) { - _Out(_Ostr, _Pvec[_Idx]); + for (const auto& _Val : _Pvec) { + _Out(_Ostr, _Val); } return _Ostr; @@ -4685,8 +4686,8 @@ public: const piecewise_constant_distribution& _Dist) { // write state to _Ostr static_cast(_Dist._Par)._Write(_Ostr); - for (size_t _Idx = 0; _Idx < _Dist._Par._Bvec.size(); ++_Idx) { - _Out(_Ostr, _Dist._Par._Bvec[_Idx]); + for (const auto& _Val : _Dist._Par._Bvec) { + _Out(_Ostr, _Val); } return _Ostr; @@ -4911,8 +4912,8 @@ public: const piecewise_linear_distribution& _Dist) { // write state to _Ostr static_cast(_Dist._Par)._Write(_Ostr); - for (size_t _Idx = 0; _Idx < _Dist._Par._Bvec.size(); ++_Idx) { - _Out(_Ostr, _Dist._Par._Bvec[_Idx]); + for (const auto& _Val : _Dist._Par._Bvec) { + _Out(_Ostr, _Val); } return _Ostr; From cef31d03d07af16e7389ced57bb36834a58f7ee9 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 18:13:19 -0800 Subject: [PATCH 16/25] : Slightly simplify loop in _Small_poisson_distribution::operator(). --- stl/inc/random | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index 90ce7d1ab0..5dd9dd5354 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2221,15 +2221,13 @@ public: template _NODISCARD _Ty operator()(_Engine& _Eng) const { - _Ty _Res; - _Ty1 _Val; - for (_Res = 0, _Val = 1.0;; ++_Res) { // count repetitions + _Ty1 _Val = 1.0; + for (_Ty _Res = 0;; ++_Res) { // count repetitions _Val *= _NRAND(_Eng, _Ty1); if (_Val <= _Gx0) { - break; + return _Res; } } - return _Res; } void _Init(const _Ty1& _Mean0) { // set internal state From 64406b0f00aa5a7f02b62e994d271fe54be91b21 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 18:17:41 -0800 Subject: [PATCH 17/25] VSO_0102478_moving_allocators/test.cpp: Pass format strings directly to printf. This allows the compiler to detect type mismatches. --- tests/std/tests/VSO_0102478_moving_allocators/test.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/std/tests/VSO_0102478_moving_allocators/test.cpp b/tests/std/tests/VSO_0102478_moving_allocators/test.cpp index 41af2700a9..14b5809fe3 100644 --- a/tests/std/tests/VSO_0102478_moving_allocators/test.cpp +++ b/tests/std/tests/VSO_0102478_moving_allocators/test.cpp @@ -25,17 +25,15 @@ using namespace std; -const char* const report_header_format = "%-30s| %-23s| %-8s| %-9s| %-10s| %-11s| %-10s\n"; -const char* const report_entry_format = "%-30s %-23s %-8d %-9d %-10s %-11d %-10d\n"; - void print_report_header() { - printf(report_header_format, "Type", "Test", "# Moves", "# Copies", "Result", "# Expctd M", "# Expctd C"); + printf("%-30s| %-23s| %-8s| %-9s| %-10s| %-11s| %-10s\n", "Type", "Test", "# Moves", "# Copies", "Result", + "# Expctd M", "# Expctd C"); } void print_report_entry(const string& type, const string& test, int num_moves, int num_copies, bool result, int num_expected_moves, int num_expected_copies) { - printf(report_entry_format, type.data(), test.data(), num_moves, num_copies, (result ? "Pass" : "FAILED"), - num_expected_moves, num_expected_copies); + printf("%-30s %-23s %-8d %-9d %-10s %-11d %-10d\n", type.data(), test.data(), num_moves, num_copies, + (result ? "Pass" : "FAILED"), num_expected_moves, num_expected_copies); } int& get_alloc_moved_count() { From 7cac4defbdd965bf20fb8e870294b0cc7031496b Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 19:29:40 -0800 Subject: [PATCH 18/25] Unnecessary _STD qualification on _Ugly function. --- stl/inc/complex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/complex b/stl/inc/complex index 134cb03aa5..baaa7af5c9 100644 --- a/stl/inc/complex +++ b/stl/inc/complex @@ -1932,7 +1932,7 @@ _NODISCARD inline float _Log_abs(const complex& _Left) noexcept { template _NODISCARD complex<_Ty> log(const complex<_Ty>& _Left) { - const _Ty _Log_abs_v = _STD _Log_abs(_Left); // get logarithm of magnitude + const _Ty _Log_abs_v = _Log_abs(_Left); // get logarithm of magnitude const _Ty _Theta = _Ctraits<_Ty>::atan2(_STD imag(_Left), _STD real(_Left)); // get phase return complex<_Ty>(_Log_abs_v, _Theta); } From 7b3bda9ce11a47cef5e1275d2e69a5e0a245b006 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 19:46:27 -0800 Subject: [PATCH 19/25] Simplify `__cpp_lib_coroutine` test after GH 1451. --- tests/std/tests/P0912R5_coroutine/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/P0912R5_coroutine/test.cpp b/tests/std/tests/P0912R5_coroutine/test.cpp index 2edce782ce..f35e8510f0 100644 --- a/tests/std/tests/P0912R5_coroutine/test.cpp +++ b/tests/std/tests/P0912R5_coroutine/test.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include // TRANSITION, P0912R5 Library Support For Coroutines -#if defined(__cpp_lib_coroutine) && __cpp_lib_coroutine >= 201902L // TRANSITION, P0912R5 Library Support For Coroutines +#ifdef __cpp_lib_coroutine // TRANSITION, P0912R5 Library Support For Coroutines #include #include From f1164fa0ec504cf216466d211556035cd8f89104 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 25 Feb 2022 19:51:23 -0800 Subject: [PATCH 20/25] Remove dead macro `_STL_WIN32_WINNT_WINXP`. --- stl/inc/yvals_core.h | 1 - 1 file changed, 1 deletion(-) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 9e0e249be9..6cddbb6d58 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1470,7 +1470,6 @@ compiler option, or define _ALLOW_RTCc_IN_STL to acknowledge that you have recei #error In yvals_core.h, defined(MRTDLL) implies defined(_M_CEE_PURE); !defined(_M_CEE_PURE) implies !defined(MRTDLL) #endif // defined(MRTDLL) && !defined(_M_CEE_PURE) -#define _STL_WIN32_WINNT_WINXP 0x0501 // _WIN32_WINNT_WINXP from sdkddkver.h #define _STL_WIN32_WINNT_VISTA 0x0600 // _WIN32_WINNT_VISTA from sdkddkver.h #define _STL_WIN32_WINNT_WIN8 0x0602 // _WIN32_WINNT_WIN8 from sdkddkver.h #define _STL_WIN32_WINNT_WINBLUE 0x0603 // _WIN32_WINNT_WINBLUE from sdkddkver.h From 9d06110c67431f8d6d26ad29e79faf6e24fbd925 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 1 Mar 2022 14:42:51 -0800 Subject: [PATCH 21/25] P0083R3_splicing_maps_and_sets/test.cpp: Drop special case for Clang. This test is for C++17 and above. Clang 10 added support for C++20 constinit, so we can drop the special case here. (We don't need special coverage for C++17 specifically here.) --- tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp b/tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp index 89f2514cc4..5790dd8515 100644 --- a/tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp +++ b/tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp @@ -153,12 +153,10 @@ void test_node_handle(NodeHandle& nh1, NodeHandle& nh2, Validator1 v1, Validator // Nothrow/constexpr default construction static_assert(std::is_nothrow_default_constructible_v); CHECK_EMPTY(NodeHandle{}); -#if defined(__cpp_constinit) +#ifdef __cpp_constinit #pragma warning(suppress : 4640) // C4640 emitted by MSVC because 'NodeHandle' type has non-trivial dtor { static constinit NodeHandle static_handle{}; } -#elif defined(__clang__) - { [[clang::require_constant_initialization]] static NodeHandle static_handle{}; } -#endif // ^^^ __clang__ ^^^ +#endif // ^^^ __cpp_constinit ^^^ // No copies! static_assert(!std::is_copy_constructible_v); From da10492e5243470386c095681261d0d573a458d0 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 1 Mar 2022 14:55:35 -0800 Subject: [PATCH 22/25] Update comments to "// TRANSITION, Clang 14 coroutine support". --- stl/inc/yvals_core.h | 2 +- .../std/tests/GH_000545_include_compare/test_coroutine.cpp | 6 +++--- tests/std/tests/P0912R5_coroutine/test.cpp | 6 +++--- .../VSO_0157762_feature_test_macros/test.compile.pass.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 6cddbb6d58..03472f1a8e 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1254,7 +1254,7 @@ // C++20 #define __cpp_lib_atomic_value_initialization 201911L -#ifdef __cpp_impl_coroutine +#ifdef __cpp_impl_coroutine // TRANSITION, Clang 14 coroutine support #define __cpp_lib_coroutine 201902L #endif // __cpp_impl_coroutine diff --git a/tests/std/tests/GH_000545_include_compare/test_coroutine.cpp b/tests/std/tests/GH_000545_include_compare/test_coroutine.cpp index 991dbd6cb6..f78062eadb 100644 --- a/tests/std/tests/GH_000545_include_compare/test_coroutine.cpp +++ b/tests/std/tests/GH_000545_include_compare/test_coroutine.cpp @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include // TRANSITION, P0912R5 Library Support For Coroutines -#ifdef __cpp_lib_coroutine // TRANSITION, P0912R5 Library Support For Coroutines +#include // TRANSITION, Clang 14 coroutine support +#ifdef __cpp_lib_coroutine // TRANSITION, Clang 14 coroutine support #include @@ -10,6 +10,6 @@ static_assert(std::is_eq(std::partial_ordering::equivalent)); -#endif // TRANSITION, P0912R5 Library Support For Coroutines +#endif // TRANSITION, Clang 14 coroutine support void test_coroutine() {} diff --git a/tests/std/tests/P0912R5_coroutine/test.cpp b/tests/std/tests/P0912R5_coroutine/test.cpp index f35e8510f0..76a81601fc 100644 --- a/tests/std/tests/P0912R5_coroutine/test.cpp +++ b/tests/std/tests/P0912R5_coroutine/test.cpp @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include // TRANSITION, P0912R5 Library Support For Coroutines -#ifdef __cpp_lib_coroutine // TRANSITION, P0912R5 Library Support For Coroutines +#include // TRANSITION, Clang 14 coroutine support +#ifdef __cpp_lib_coroutine // TRANSITION, Clang 14 coroutine support #include #include @@ -183,4 +183,4 @@ int main() { #else // ^^^ test ^^^ / vvv don't test vvv int main() {} -#endif // TRANSITION, P0912R5 Library Support For Coroutines +#endif // TRANSITION, Clang 14 coroutine support diff --git a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp index 3acc962160..3b76a9ab93 100644 --- a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp @@ -612,7 +612,7 @@ STATIC_ASSERT(__cpp_lib_constexpr_vector == 201907L); #endif #endif -#if _HAS_CXX20 && defined(__cpp_impl_coroutine) // TRANSITION, Clang coroutine support +#if _HAS_CXX20 && defined(__cpp_impl_coroutine) // TRANSITION, Clang 14 coroutine support #ifndef __cpp_lib_coroutine #error __cpp_lib_coroutine is not defined #elif __cpp_lib_coroutine != 201902L From e71cfeaf638d677f059e9b3ea375b506d765a202 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 1 Mar 2022 15:26:36 -0800 Subject: [PATCH 23/25] P0912R5_coroutine/env.lst: Add MSVC/EDG C++20 and Clang C++23 coverage. --- tests/std/tests/P0912R5_coroutine/env.lst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/P0912R5_coroutine/env.lst b/tests/std/tests/P0912R5_coroutine/env.lst index f873150e6b..556538093c 100644 --- a/tests/std/tests/P0912R5_coroutine/env.lst +++ b/tests/std/tests/P0912R5_coroutine/env.lst @@ -11,11 +11,15 @@ PM_CL="/EHsc /MD /await:strict /std:c++17" PM_CL="/EHsc /MD /await:strict /std:c++17 /permissive-" PM_CL="/EHsc /MTd /await:strict /std:c++17 /permissive- /Zc:preprocessor" PM_CL="/EHsc /MD /await:strict /std:c++17 /permissive- /analyze:only /analyze:autolog-" +PM_CL="/EHsc /MD /std:c++20 /permissive" +PM_CL="/EHsc /MD /std:c++20 /permissive-" +PM_CL="/EHsc /MTd /std:c++20 /permissive- /Zc:preprocessor" +PM_CL="/EHsc /MD /std:c++20 /permissive- /analyze:only /analyze:autolog-" PM_CL="/EHsc /MD /std:c++latest /permissive" PM_CL="/EHsc /MD /std:c++latest /permissive-" PM_CL="/EHsc /MTd /std:c++latest /permissive- /Zc:preprocessor" PM_CL="/EHsc /MD /std:c++latest /permissive- /analyze:only /analyze:autolog-" -PM_CL="/BE /c /EHsc /MD /std:c++latest /permissive-" +PM_CL="/BE /c /EHsc /MD /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /D_HAS_CXX23" From fbd9d2bdb91f03f33ee62b25d6ceae85cbf5434a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 1 Mar 2022 17:55:51 -0800 Subject: [PATCH 24/25] Update comments and test coverage for `/await:strict`. Thanks to @cpplearner for noticing this. Coroutines are usually C++20 but are also activated by `/await:strict`, so we permanently need to check `__cpp_impl_coroutine` - this is not a temporary thing until Clang 14 is released. (Tests that are C++20-specific can be simplified after Clang 14, so they still have TRANSITION comments.) Finally, we should also add a new configuration to `VSO_0157762_feature_test_macros`. --- stl/inc/yvals_core.h | 2 +- tests/std/tests/VSO_0157762_feature_test_macros/env.lst | 1 + .../tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 03472f1a8e..6cddbb6d58 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1254,7 +1254,7 @@ // C++20 #define __cpp_lib_atomic_value_initialization 201911L -#ifdef __cpp_impl_coroutine // TRANSITION, Clang 14 coroutine support +#ifdef __cpp_impl_coroutine #define __cpp_lib_coroutine 201902L #endif // __cpp_impl_coroutine diff --git a/tests/std/tests/VSO_0157762_feature_test_macros/env.lst b/tests/std/tests/VSO_0157762_feature_test_macros/env.lst index bb1dab478a..61f7c1183f 100644 --- a/tests/std/tests/VSO_0157762_feature_test_macros/env.lst +++ b/tests/std/tests/VSO_0157762_feature_test_macros/env.lst @@ -45,4 +45,5 @@ PM_CL="/MT /std:c++latest /permissive- /EHsc /GR- /DTEST_DISABLED_RTTI" PM_CL="/MT /std:c++latest /permissive- /EHsc /Zc:sizedDealloc- /DTEST_DISABLED_SIZED_DEALLOCATION" PM_CL="/MT /std:c++latest /permissive- /EHsc /Zc:threadSafeInit- /DTEST_DISABLED_THREADSAFE_STATIC_INIT" PM_CL="/MT /std:c++latest /permissive- /EHsc /D_HAS_STD_BYTE=0" +PM_CL="/MT /std:c++14 /permissive- /EHsc /await:strict" PM_CL="/MT /std:c++latest /permissive- /EHsc" diff --git a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp index 3b76a9ab93..0bd7d02cc6 100644 --- a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp @@ -612,7 +612,7 @@ STATIC_ASSERT(__cpp_lib_constexpr_vector == 201907L); #endif #endif -#if _HAS_CXX20 && defined(__cpp_impl_coroutine) // TRANSITION, Clang 14 coroutine support +#ifdef __cpp_impl_coroutine #ifndef __cpp_lib_coroutine #error __cpp_lib_coroutine is not defined #elif __cpp_lib_coroutine != 201902L From 9dc39cf3eec599ba1a460ec68bd2f6e20cd3e80b Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 1 Mar 2022 18:04:56 -0800 Subject: [PATCH 25/25] VSO_0157762_feature_test_macros/env.lst: Remove unused configurations. These configurations were unused after GH 752 "Remove compiler specific feature test macro tests". --- tests/std/tests/VSO_0157762_feature_test_macros/env.lst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/std/tests/VSO_0157762_feature_test_macros/env.lst b/tests/std/tests/VSO_0157762_feature_test_macros/env.lst index 61f7c1183f..e8811948f3 100644 --- a/tests/std/tests/VSO_0157762_feature_test_macros/env.lst +++ b/tests/std/tests/VSO_0157762_feature_test_macros/env.lst @@ -38,12 +38,6 @@ PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsin PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /D_HAS_CXX23 /fp:strict" # The following lines are extras not present in usual_matrix.lst -PM_CL="/MT /std:c++latest /permissive- /EHsc /Zc:alignedNew- /DTEST_DISABLED_ALIGNED_NEW" -PM_CL="/MT /std:c++latest /permissive- /EHs- /DTEST_DISABLED_EXCEPTIONS" -PM_CL="/MT /std:c++latest /permissive- /EHsc /Zc:noexceptTypes- /DTEST_DISABLED_NOEXCEPT_FUNCTION_TYPE" -PM_CL="/MT /std:c++latest /permissive- /EHsc /GR- /DTEST_DISABLED_RTTI" -PM_CL="/MT /std:c++latest /permissive- /EHsc /Zc:sizedDealloc- /DTEST_DISABLED_SIZED_DEALLOCATION" -PM_CL="/MT /std:c++latest /permissive- /EHsc /Zc:threadSafeInit- /DTEST_DISABLED_THREADSAFE_STATIC_INIT" PM_CL="/MT /std:c++latest /permissive- /EHsc /D_HAS_STD_BYTE=0" PM_CL="/MT /std:c++14 /permissive- /EHsc /await:strict" PM_CL="/MT /std:c++latest /permissive- /EHsc"