diff options
author | Andrey Khalyavin <halyavin@gmail.com> | 2022-07-05 23:56:28 +0300 |
---|---|---|
committer | Andrey Khalyavin <halyavin@gmail.com> | 2022-07-05 23:56:28 +0300 |
commit | 41223d67bc008890be4c26f2860a749faad77d15 (patch) | |
tree | a31baff5f563db0e7f6bc0699f1a3f8b6e461311 /contrib/libs | |
parent | 7cca6053f9af9db0dce2fc1c9bf1bad0910cdceb (diff) | |
download | ydb-41223d67bc008890be4c26f2860a749faad77d15.tar.gz |
Update libc++ to a7c2a628 (15 Feb 2022).
Notable changes:
* macros for disabling and enabling compile warnings
* replace _VSTD with std in __ranges
* add stdatomic.h
* implement unreachable()
* implement ranges::rbegin, rend, crbegin and crend
* remove experimental/filesystem header
ref:3104f711bf2401dd8b882290fa4fa01f71924406
Diffstat (limited to 'contrib/libs')
57 files changed, 553 insertions, 520 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/import b/contrib/libs/cxxsupp/libcxx/import index c8f540c7e6..5e5f6e0a17 100755 --- a/contrib/libs/cxxsupp/libcxx/import +++ b/contrib/libs/cxxsupp/libcxx/import @@ -1,6 +1,6 @@ #!/bin/sh -e -rev=8f0b2ac1 +rev=a7c2a628 output_dir="libcxx-r$rev" if [ -z $1 ] ; then git clone https://github.com/llvm/llvm-project.git --no-checkout "$output_dir/tmp" diff --git a/contrib/libs/cxxsupp/libcxx/include/__availability b/contrib/libs/cxxsupp/libcxx/include/__availability index fd3e8e3e52..12eafee99b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__availability +++ b/contrib/libs/cxxsupp/libcxx/include/__availability @@ -244,10 +244,6 @@ # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore # endif - // This controls the availability of the C++20 format library. - // The library is in development and not ABI stable yet. P2216 is - // retroactively accepted in C++20. This paper contains ABI breaking - // changes. # define _LIBCPP_AVAILABILITY_FORMAT \ __attribute__((unavailable)) # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/class_or_enum.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/class_or_enum.h index f53d8dd074..729e444b39 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/class_or_enum.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/class_or_enum.h @@ -26,6 +26,7 @@ template<class _Tp> concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>; // Work around Clang bug https://llvm.org/PR52970 +// TODO: remove this workaround once libc++ no longer has to support Clang 13 (it was fixed in Clang 14). template<class _Tp> concept __workaround_52970 = is_class_v<__uncvref_t<_Tp>> || is_union_v<__uncvref_t<_Tp>>; diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config index 17792f64c9..cf196ccb27 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config +++ b/contrib/libs/cxxsupp/libcxx/include/__config @@ -168,6 +168,9 @@ # define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION #endif +#define _LIBCPP_TOSTRING2(x) #x +#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) + #if __cplusplus < 201103L && !defined(_LIBCPP_COMPILER_MSVC) #define _LIBCPP_CXX03_LANG #endif @@ -573,8 +576,6 @@ typedef __char32_t char32_t; #elif defined(_LIBCPP_COMPILER_MSVC) -#define _LIBCPP_TOSTRING2(x) #x -#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) #define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) #if _MSC_VER < 1900 @@ -1505,11 +1506,28 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( // Note that this can be replaced by #error as soon as clang-cl // implements msvc::no_unique_address, since there should be no C++20 // compiler that doesn't support one of the two attributes at that point. - // We geenrally don't want to use this macro outside of C++20-only code, + // We generally don't want to use this macro outside of C++20-only code, // because using it conditionally in one language version only would make // the ABI inconsistent. #endif +#ifdef _LIBCPP_COMPILER_CLANG_BASED +# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") +# define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str)) +# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) +#elif defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") +# define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) +# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str)) +#else +# define _LIBCPP_DIAGNOSTIC_PUSH +# define _LIBCPP_DIAGNOSTIC_POP +# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) +# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) +#endif + #endif // __cplusplus #endif // _LIBCPP_CONFIG diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h index 0993c52ae4..a1f18add81 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h @@ -20,6 +20,7 @@ #include <__filesystem/operations.h> #include <__filesystem/path.h> #include <__filesystem/perms.h> +#include <__utility/unreachable.h> #include <chrono> #include <cstdint> #include <cstdlib> @@ -362,7 +363,7 @@ private: __ec->clear(); return __data_.__type_; } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY @@ -383,7 +384,7 @@ private: return __data_.__type_; } } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY @@ -398,7 +399,7 @@ private: case _RefreshSymlink: return file_status(__get_ft(__ec), __data_.__non_sym_perms_); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY @@ -414,7 +415,7 @@ private: case _RefreshSymlinkUnresolved: return file_status(__get_sym_ft(__ec), __data_.__sym_perms_); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY @@ -439,7 +440,7 @@ private: return __data_.__size_; } } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY @@ -458,7 +459,7 @@ private: return __data_.__nlink_; } } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY @@ -481,7 +482,7 @@ private: return __data_.__write_time_; } } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } private: diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h index df08e93d2e..8db42cdb98 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h @@ -16,6 +16,7 @@ #include <__format/format_fwd.h> #include <__format/format_parse_context.h> #include <__memory/addressof.h> +#include <__utility/unreachable.h> #include <__variant/monostate.h> #include <string> #include <string_view> @@ -77,7 +78,7 @@ visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { #ifndef _LIBCPP_HAS_NO_INT128 return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__i128); #else - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); #endif case __format::__arg_t::__unsigned: return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__unsigned); @@ -88,7 +89,7 @@ visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { #ifndef _LIBCPP_HAS_NO_INT128 return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__u128); #else - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); #endif case __format::__arg_t::__float: return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__float); @@ -106,7 +107,7 @@ visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { case __format::__arg_t::__handle: return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__handle); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } template <class _Context> diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h index 1d4c8fc91f..1f423146bb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h @@ -18,6 +18,7 @@ #include <__format/format_fwd.h> #include <__format/format_string.h> #include <__format/parser_std_format_spec.h> +#include <__utility/unreachable.h> #include <string_view> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -116,7 +117,7 @@ __padding_size(size_t __size, size_t __width, size_t __fill = __width - __size; switch (__align) { case __format_spec::_Flags::_Alignment::__default: - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); case __format_spec::_Flags::_Alignment::__left: return {0, __fill}; @@ -132,7 +133,7 @@ __padding_size(size_t __size, size_t __width, case __format_spec::_Flags::_Alignment::__right: return {__fill, 0}; } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } /** diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h index 2e710b409d..c29cda48a9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h @@ -27,6 +27,7 @@ #include <__format/formatter_integral.h> #include <__format/parser_std_format_spec.h> #include <__utility/move.h> +#include <__utility/unreachable.h> #include <charconv> #include <cmath> @@ -689,7 +690,7 @@ private: default: _LIBCPP_ASSERT(false, "The parser should have validated the type"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } } }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h index 9125e94bf6..4f82b34462 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h @@ -19,6 +19,7 @@ #include <__format/format_fwd.h> #include <__format/formatter.h> #include <__format/parser_std_format_spec.h> +#include <__utility/unreachable.h> #include <array> #include <charconv> #include <concepts> @@ -176,7 +177,7 @@ __determine_grouping(ptrdiff_t __size, const string& __grouping) { } } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } template <class _Parser> @@ -292,7 +293,7 @@ private: } default: _LIBCPP_ASSERT(false, "The parser should have validated the type"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } } diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h b/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h index d770853215..ca4eae1fa9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h @@ -45,7 +45,7 @@ namespace __format_spec { /** * Contains the flags for the std-format-spec. * - * Some format-options can only be used for specific C++types and may depend on + * Some format-options can only be used for specific C++ types and may depend on * the selected format-type. * * The C++type filtering can be done using the proper policies for * @ref __parser_std. diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h index 12a5f3152a..c0b847472b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h @@ -16,6 +16,7 @@ #include <__iterator/incrementable_traits.h> #include <__iterator/iterator_traits.h> #include <__utility/move.h> +#include <__utility/unreachable.h> #include <concepts> #include <cstdlib> #include <limits> @@ -180,7 +181,7 @@ public: return __n; } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h b/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h index fbf7c05e7a..e82b437a3b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h @@ -28,10 +28,8 @@ class _LIBCPP_TYPE_VIS random_device #ifdef _LIBCPP_USING_DEV_RANDOM int __f_; #elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT) -# if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunused-private-field" -# endif + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field") // Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now // use `arc4random()` as of this comment. In order to avoid breaking the ABI, we @@ -42,9 +40,7 @@ class _LIBCPP_TYPE_VIS random_device // ... vendors can add workarounds here if they switch to a different representation ... -# if defined(__clang__) -# pragma clang diagnostic pop -# endif + _LIBCPP_DIAGNOSTIC_POP #endif public: diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h index 5b623c1e4a..2ebdab4eb8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h @@ -15,7 +15,6 @@ #include <__iterator/readable_traits.h> #include <__ranges/enable_borrowed_range.h> #include <__utility/auto_cast.h> -#include <concepts> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h index 238ebdeaa4..54916fd476 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h @@ -38,30 +38,30 @@ namespace __all { requires ranges::view<decay_t<_Tp>> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(_VSTD::forward<_Tp>(__t)))) + noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))) { - return _LIBCPP_AUTO_CAST(_VSTD::forward<_Tp>(__t)); + return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)); } template<class _Tp> requires (!ranges::view<decay_t<_Tp>>) && - requires (_Tp&& __t) { ranges::ref_view{_VSTD::forward<_Tp>(__t)}; } + requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::ref_view{_VSTD::forward<_Tp>(__t)})) + noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)})) { - return ranges::ref_view{_VSTD::forward<_Tp>(__t)}; + return ranges::ref_view{std::forward<_Tp>(__t)}; } template<class _Tp> requires (!ranges::view<decay_t<_Tp>> && - !requires (_Tp&& __t) { ranges::ref_view{_VSTD::forward<_Tp>(__t)}; } && - requires (_Tp&& __t) { ranges::owning_view{_VSTD::forward<_Tp>(__t)}; }) + !requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } && + requires (_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; }) [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::owning_view{_VSTD::forward<_Tp>(__t)})) + noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)})) { - return ranges::owning_view{_VSTD::forward<_Tp>(__t)}; + return ranges::owning_view{std::forward<_Tp>(__t)}; } }; } // namespace __all diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/common_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/common_view.h index b8a32eb31f..3f58dafeb0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/common_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/common_view.h @@ -44,13 +44,13 @@ public: common_view() requires default_initializable<_View> = default; _LIBCPP_HIDE_FROM_ABI - constexpr explicit common_view(_View __v) : __base_(_VSTD::move(__v)) { } + constexpr explicit common_view(_View __v) : __base_(std::move(__v)) { } _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; } _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return _VSTD::move(__base_); } + constexpr _View base() && { return std::move(__base_); } _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { @@ -109,16 +109,16 @@ namespace __common { requires common_range<_Range> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(views::all(_VSTD::forward<_Range>(__range)))) - -> decltype( views::all(_VSTD::forward<_Range>(__range))) - { return views::all(_VSTD::forward<_Range>(__range)); } + noexcept(noexcept(views::all(std::forward<_Range>(__range)))) + -> decltype( views::all(std::forward<_Range>(__range))) + { return views::all(std::forward<_Range>(__range)); } template<class _Range> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(common_view{_VSTD::forward<_Range>(__range)})) - -> decltype( common_view{_VSTD::forward<_Range>(__range)}) - { return common_view{_VSTD::forward<_Range>(__range)}; } + noexcept(noexcept(common_view{std::forward<_Range>(__range)})) + -> decltype( common_view{std::forward<_Range>(__range)}) + { return common_view{std::forward<_Range>(__range)}; } }; } // namespace __common diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/copyable_box.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/copyable_box.h index d092b7f9ba..8b7f227925 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/copyable_box.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/copyable_box.h @@ -49,7 +49,7 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr explicit __copyable_box(in_place_t, _Args&& ...__args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) - : __val_(in_place, _VSTD::forward<_Args>(__args)...) + : __val_(in_place, std::forward<_Args>(__args)...) { } _LIBCPP_HIDE_FROM_ABI @@ -65,7 +65,7 @@ namespace ranges { constexpr __copyable_box& operator=(__copyable_box const& __other) noexcept(is_nothrow_copy_constructible_v<_Tp>) { - if (this != _VSTD::addressof(__other)) { + if (this != std::addressof(__other)) { if (__other.__has_value()) __val_.emplace(*__other); else __val_.reset(); } @@ -79,8 +79,8 @@ namespace ranges { constexpr __copyable_box& operator=(__copyable_box&& __other) noexcept(is_nothrow_move_constructible_v<_Tp>) { - if (this != _VSTD::addressof(__other)) { - if (__other.__has_value()) __val_.emplace(_VSTD::move(*__other)); + if (this != std::addressof(__other)) { + if (__other.__has_value()) __val_.emplace(std::move(*__other)); else __val_.reset(); } return *this; @@ -124,7 +124,7 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr explicit __copyable_box(in_place_t, _Args&& ...__args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) - : __val_(_VSTD::forward<_Args>(__args)...) + : __val_(std::forward<_Args>(__args)...) { } _LIBCPP_HIDE_FROM_ABI @@ -144,9 +144,9 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr __copyable_box& operator=(__copyable_box const& __other) noexcept { static_assert(is_nothrow_copy_constructible_v<_Tp>); - if (this != _VSTD::addressof(__other)) { - _VSTD::destroy_at(_VSTD::addressof(__val_)); - _VSTD::construct_at(_VSTD::addressof(__val_), __other.__val_); + if (this != std::addressof(__other)) { + std::destroy_at(std::addressof(__val_)); + std::construct_at(std::addressof(__val_), __other.__val_); } return *this; } @@ -154,9 +154,9 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr __copyable_box& operator=(__copyable_box&& __other) noexcept { static_assert(is_nothrow_move_constructible_v<_Tp>); - if (this != _VSTD::addressof(__other)) { - _VSTD::destroy_at(_VSTD::addressof(__val_)); - _VSTD::construct_at(_VSTD::addressof(__val_), _VSTD::move(__other.__val_)); + if (this != std::addressof(__other)) { + std::destroy_at(std::addressof(__val_)); + std::construct_at(std::addressof(__val_), std::move(__other.__val_)); } return *this; } @@ -164,8 +164,8 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return __val_; } _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return __val_; } - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp *operator->() const noexcept { return _VSTD::addressof(__val_); } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp *operator->() noexcept { return _VSTD::addressof(__val_); } + _LIBCPP_HIDE_FROM_ABI constexpr const _Tp *operator->() const noexcept { return std::addressof(__val_); } + _LIBCPP_HIDE_FROM_ABI constexpr _Tp *operator->() noexcept { return std::addressof(__val_); } _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return true; } }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h index a2d839fc4d..400284c48e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h @@ -39,9 +39,9 @@ namespace __counted { template<contiguous_iterator _It> _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) - noexcept(noexcept(span(_VSTD::to_address(__it), static_cast<size_t>(__count)))) + noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(__count)))) // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly - { return span(_VSTD::to_address(__it), static_cast<size_t>(__count)); } + { return span(std::to_address(__it), static_cast<size_t>(__count)); } template<random_access_iterator _It> _LIBCPP_HIDE_FROM_ABI @@ -53,17 +53,17 @@ namespace __counted { template<class _It> _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) - noexcept(noexcept(subrange(counted_iterator(_VSTD::move(__it), __count), default_sentinel))) - -> decltype( subrange(counted_iterator(_VSTD::move(__it), __count), default_sentinel)) - { return subrange(counted_iterator(_VSTD::move(__it), __count), default_sentinel); } + noexcept(noexcept(subrange(counted_iterator(std::move(__it), __count), default_sentinel))) + -> decltype( subrange(counted_iterator(std::move(__it), __count), default_sentinel)) + { return subrange(counted_iterator(std::move(__it), __count), default_sentinel); } template<class _It, convertible_to<iter_difference_t<_It>> _Diff> requires input_or_output_iterator<decay_t<_It>> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_It&& __it, _Diff&& __count) const - noexcept(noexcept(__go(_VSTD::forward<_It>(__it), _VSTD::forward<_Diff>(__count)))) - -> decltype( __go(_VSTD::forward<_It>(__it), _VSTD::forward<_Diff>(__count))) - { return __go(_VSTD::forward<_It>(__it), _VSTD::forward<_Diff>(__count)); } + noexcept(noexcept(__go(std::forward<_It>(__it), std::forward<_Diff>(__count)))) + -> decltype( __go(std::forward<_It>(__it), std::forward<_Diff>(__count))) + { return __go(std::forward<_It>(__it), std::forward<_Diff>(__count)); } }; } // namespace __counted diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h index 994a604a9f..4f0496d6e4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h @@ -60,8 +60,8 @@ namespace __data { template<__ranges_begin_invocable _Tp> _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_VSTD::to_address(ranges::begin(__t)))) { - return _VSTD::to_address(ranges::begin(__t)); + noexcept(noexcept(std::to_address(ranges::begin(__t)))) { + return std::to_address(ranges::begin(__t)); } }; } // namespace __data diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h index 64c5674164..0e5b68b11d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h @@ -55,13 +55,13 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr drop_view(_View __base, range_difference_t<_View> __count) : __count_(__count) - , __base_(_VSTD::move(__base)) + , __base_(std::move(__base)) { _LIBCPP_ASSERT(__count_ >= 0, "count must be greater than or equal to zero."); } _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return _VSTD::move(__base_); } + _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } _LIBCPP_HIDE_FROM_ABI constexpr auto begin() diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h index 77f02b63d5..2fbc607789 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h @@ -111,7 +111,7 @@ namespace ranges { __iterator() requires default_initializable<_Start> = default; _LIBCPP_HIDE_FROM_ABI - constexpr explicit __iterator(_Start __value) : __value_(_VSTD::move(__value)) {} + constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {} _LIBCPP_HIDE_FROM_ABI constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) { @@ -276,7 +276,7 @@ namespace ranges { public: _LIBCPP_HIDE_FROM_ABI __sentinel() = default; - constexpr explicit __sentinel(_Bound __bound) : __bound_(_VSTD::move(__bound)) {} + constexpr explicit __sentinel(_Bound __bound) : __bound_(std::move(__bound)) {} _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) { @@ -306,11 +306,11 @@ namespace ranges { iota_view() requires default_initializable<_Start> = default; _LIBCPP_HIDE_FROM_ABI - constexpr explicit iota_view(_Start __value) : __value_(_VSTD::move(__value)) { } + constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) { } _LIBCPP_HIDE_FROM_ABI constexpr iota_view(type_identity_t<_Start> __value, type_identity_t<_Bound> __bound) - : __value_(_VSTD::move(__value)), __bound_(_VSTD::move(__bound)) { + : __value_(std::move(__value)), __bound_(std::move(__bound)) { // Validate the precondition if possible. if constexpr (totally_ordered_with<_Start, _Bound>) { _LIBCPP_ASSERT(ranges::less_equal()(__value_, __bound_), @@ -321,17 +321,17 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr iota_view(__iterator __first, __iterator __last) requires same_as<_Start, _Bound> - : iota_view(_VSTD::move(__first.__value_), _VSTD::move(__last.__value_)) {} + : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {} _LIBCPP_HIDE_FROM_ABI constexpr iota_view(__iterator __first, _Bound __last) requires same_as<_Bound, unreachable_sentinel_t> - : iota_view(_VSTD::move(__first.__value_), _VSTD::move(__last)) {} + : iota_view(std::move(__first.__value_), std::move(__last)) {} _LIBCPP_HIDE_FROM_ABI constexpr iota_view(__iterator __first, __sentinel __last) requires (!same_as<_Start, _Bound> && !same_as<_Start, unreachable_sentinel_t>) - : iota_view(_VSTD::move(__first.__value_), _VSTD::move(__last.__bound_)) {} + : iota_view(std::move(__first.__value_), std::move(__last.__bound_)) {} _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__value_}; } @@ -358,13 +358,13 @@ namespace ranges { if constexpr (__integer_like<_Start> && __integer_like<_Bound>) { if (__value_ < 0) { if (__bound_ < 0) { - return _VSTD::__to_unsigned_like(-__value_) - _VSTD::__to_unsigned_like(-__bound_); + return std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_); } - return _VSTD::__to_unsigned_like(__bound_) + _VSTD::__to_unsigned_like(-__value_); + return std::__to_unsigned_like(__bound_) + std::__to_unsigned_like(-__value_); } - return _VSTD::__to_unsigned_like(__bound_) - _VSTD::__to_unsigned_like(__value_); + return std::__to_unsigned_like(__bound_) - std::__to_unsigned_like(__value_); } - return _VSTD::__to_unsigned_like(__bound_ - __value_); + return std::__to_unsigned_like(__bound_ - __value_); } }; @@ -382,16 +382,16 @@ namespace __iota { template<class _Start> _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start) const - noexcept(noexcept(ranges::iota_view(_VSTD::forward<_Start>(__start)))) - -> decltype( ranges::iota_view(_VSTD::forward<_Start>(__start))) - { return ranges::iota_view(_VSTD::forward<_Start>(__start)); } + noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start)))) + -> decltype( ranges::iota_view(std::forward<_Start>(__start))) + { return ranges::iota_view(std::forward<_Start>(__start)); } template<class _Start, class _Bound> _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start, _Bound&& __bound) const - noexcept(noexcept(ranges::iota_view(_VSTD::forward<_Start>(__start), _VSTD::forward<_Bound>(__bound)))) - -> decltype( ranges::iota_view(_VSTD::forward<_Start>(__start), _VSTD::forward<_Bound>(__bound))) - { return ranges::iota_view(_VSTD::forward<_Start>(__start), _VSTD::forward<_Bound>(__bound)); } + noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound)))) + -> decltype( ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound))) + { return ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound)); } }; } // namespace __iota diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h index 4bab8dfeec..18180984d1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h @@ -76,13 +76,13 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr explicit join_view(_View __base) - : __base_(_VSTD::move(__base)) {} + : __base_(std::move(__base)) {} _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; } _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return _VSTD::move(__base_); } + constexpr _View base() && { return std::move(__base_); } _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { @@ -152,7 +152,7 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s) requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> - : __end_(_VSTD::move(__s.__end_)) {} + : __end_(std::move(__s.__end_)) {} template<bool _OtherConst> requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> @@ -223,8 +223,8 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, _Outer __outer) - : __outer_(_VSTD::move(__outer)) - , __parent_(_VSTD::addressof(__parent)) { + : __outer_(std::move(__outer)) + , __parent_(std::addressof(__parent)) { __satisfy(); } @@ -233,8 +233,8 @@ namespace ranges { requires _Const && convertible_to<iterator_t<_View>, _Outer> && convertible_to<iterator_t<_InnerRange>, _Inner> - : __outer_(_VSTD::move(__i.__outer_)) - , __inner_(_VSTD::move(__i.__inner_)) + : __outer_(std::move(__i.__outer_)) + , __inner_(std::move(__i.__inner_)) , __parent_(__i.__parent_) {} _LIBCPP_HIDE_FROM_ABI diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/non_propagating_cache.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/non_propagating_cache.h index 89b5ef0746..30fcd9f11e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/non_propagating_cache.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/non_propagating_cache.h @@ -45,7 +45,7 @@ namespace ranges { // constructing the contained type from an iterator. struct __wrapper { template<class ..._Args> - constexpr explicit __wrapper(__forward_tag, _Args&& ...__args) : __t_(_VSTD::forward<_Args>(__args)...) { } + constexpr explicit __wrapper(__forward_tag, _Args&& ...__args) : __t_(std::forward<_Args>(__args)...) { } template<class _Fn> constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) { } _Tp __t_; @@ -70,7 +70,7 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept { - if (this != _VSTD::addressof(__other)) { + if (this != std::addressof(__other)) { __value_.reset(); } return *this; @@ -100,7 +100,7 @@ namespace ranges { template<class ..._Args> _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __emplace(_Args&& ...__args) { - return __value_.emplace(__forward_tag{}, _VSTD::forward<_Args>(__args)...).__t_; + return __value_.emplace(__forward_tag{}, std::forward<_Args>(__args)...).__t_; } }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/owning_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/owning_view.h index c0c6a32e12..322152d7ca 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/owning_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/owning_view.h @@ -38,15 +38,15 @@ namespace ranges { public: owning_view() requires default_initializable<_Rp> = default; - _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(_VSTD::move(__r)) {} + _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(std::move(__r)) {} owning_view(owning_view&&) = default; owning_view& operator=(owning_view&&) = default; _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; } _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; } - _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return _VSTD::move(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return _VSTD::move(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return std::move(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); } _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); } _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/range_adaptor.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/range_adaptor.h index 04a0505288..9b456b18f0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/range_adaptor.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/range_adaptor.h @@ -39,7 +39,7 @@ struct __range_adaptor_closure; // i.e. something that can be called via the `x | f` notation. template <class _Fn> struct __range_adaptor_closure_t : _Fn, __range_adaptor_closure<__range_adaptor_closure_t<_Fn>> { - constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(_VSTD::move(__f)) { } + constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) { } }; template <class _Tp> @@ -53,7 +53,7 @@ struct __range_adaptor_closure { [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) operator|(_View&& __view, _Closure&& __closure) noexcept(is_nothrow_invocable_v<_Closure, _View>) - { return _VSTD::invoke(_VSTD::forward<_Closure>(__closure), _VSTD::forward<_View>(__view)); } + { return std::invoke(std::forward<_Closure>(__closure), std::forward<_View>(__view)); } template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure> requires same_as<_Tp, remove_cvref_t<_Closure>> && @@ -63,7 +63,7 @@ struct __range_adaptor_closure { friend constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2) noexcept(is_nothrow_constructible_v<decay_t<_Closure>, _Closure> && is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>) - { return __range_adaptor_closure_t(_VSTD::__compose(_VSTD::forward<_OtherClosure>(__c2), _VSTD::forward<_Closure>(__c1))); } + { return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1))); } }; #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/rbegin.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/rbegin.h new file mode 100644 index 0000000000..cc4c0582cc --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/rbegin.h @@ -0,0 +1,130 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef _LIBCPP___RANGES_RBEGIN_H +#define _LIBCPP___RANGES_RBEGIN_H + +#include <__concepts/class_or_enum.h> +#include <__concepts/same_as.h> +#include <__config> +#include <__iterator/concepts.h> +#include <__iterator/readable_traits.h> +#include <__iterator/reverse_iterator.h> +#include <__ranges/access.h> +#include <__utility/auto_cast.h> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCPP_HAS_NO_CONCEPTS) + +// [ranges.access.rbegin] + +namespace ranges { +namespace __rbegin { +template <class _Tp> +concept __member_rbegin = + __can_borrow<_Tp> && + __workaround_52970<_Tp> && + requires(_Tp&& __t) { + { _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator; + }; + +void rbegin(auto&) = delete; +void rbegin(const auto&) = delete; + +template <class _Tp> +concept __unqualified_rbegin = + !__member_rbegin<_Tp> && + __can_borrow<_Tp> && + __class_or_enum<remove_cvref_t<_Tp>> && + requires(_Tp&& __t) { + { _LIBCPP_AUTO_CAST(rbegin(__t)) } -> input_or_output_iterator; + }; + +template <class _Tp> +concept __can_reverse = + __can_borrow<_Tp> && + !__member_rbegin<_Tp> && + !__unqualified_rbegin<_Tp> && + requires(_Tp&& __t) { + { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>; + { ranges::begin(__t) } -> bidirectional_iterator; + }; + +struct __fn { + template <class _Tp> + requires __member_rbegin<_Tp> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin()))) + { + return _LIBCPP_AUTO_CAST(__t.rbegin()); + } + + template <class _Tp> + requires __unqualified_rbegin<_Tp> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t)))) + { + return _LIBCPP_AUTO_CAST(rbegin(__t)); + } + + template <class _Tp> + requires __can_reverse<_Tp> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::end(__t))) + { + return std::make_reverse_iterator(ranges::end(__t)); + } + + void operator()(auto&&) const = delete; +}; +} // namespace __rbegin + +inline namespace __cpo { + inline constexpr auto rbegin = __rbegin::__fn{}; +} // namespace __cpo +} // namespace ranges + +// [range.access.crbegin] + +namespace ranges { +namespace __crbegin { +struct __fn { + template <class _Tp> + requires is_lvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t)))) + -> decltype( ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))) + { return ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t)); } + + template <class _Tp> + requires is_rvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::rbegin(static_cast<const _Tp&&>(__t)))) + -> decltype( ranges::rbegin(static_cast<const _Tp&&>(__t))) + { return ranges::rbegin(static_cast<const _Tp&&>(__t)); } +}; +} // namespace __crbegin + +inline namespace __cpo { + inline constexpr auto crbegin = __crbegin::__fn{}; +} // namespace __cpo +} // namespace ranges + +#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___RANGES_RBEGIN_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/ref_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/ref_view.h index b97de36e79..90fb5c1832 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/ref_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/ref_view.h @@ -48,7 +48,7 @@ public: convertible_to<_Tp, _Range&> && requires { __fun(declval<_Tp>()); } _LIBCPP_HIDE_FROM_ABI constexpr ref_view(_Tp&& __t) - : __range_(_VSTD::addressof(static_cast<_Range&>(_VSTD::forward<_Tp>(__t)))) + : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t)))) {} _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/rend.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/rend.h new file mode 100644 index 0000000000..cd7826021d --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/rend.h @@ -0,0 +1,134 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef _LIBCPP___RANGES_REND_H +#define _LIBCPP___RANGES_REND_H + +#include <__concepts/class_or_enum.h> +#include <__concepts/same_as.h> +#include <__config> +#include <__iterator/concepts.h> +#include <__iterator/readable_traits.h> +#include <__iterator/reverse_iterator.h> +#include <__ranges/access.h> +#include <__ranges/rbegin.h> +#include <__utility/auto_cast.h> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCPP_HAS_NO_CONCEPTS) + +// [range.access.rend] + +namespace ranges { +namespace __rend { +template <class _Tp> +concept __member_rend = + __can_borrow<_Tp> && + __workaround_52970<_Tp> && + requires(_Tp&& __t) { + ranges::rbegin(__t); + { _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>; + }; + +void rend(auto&) = delete; +void rend(const auto&) = delete; + +template <class _Tp> +concept __unqualified_rend = + !__member_rend<_Tp> && + __can_borrow<_Tp> && + __class_or_enum<remove_cvref_t<_Tp>> && + requires(_Tp&& __t) { + ranges::rbegin(__t); + { _LIBCPP_AUTO_CAST(rend(__t)) } -> sentinel_for<decltype(ranges::rbegin(__t))>; + }; + +template <class _Tp> +concept __can_reverse = + __can_borrow<_Tp> && + !__member_rend<_Tp> && + !__unqualified_rend<_Tp> && + requires(_Tp&& __t) { + { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>; + { ranges::begin(__t) } -> bidirectional_iterator; + }; + +class __fn { +public: + template <class _Tp> + requires __member_rend<_Tp> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend()))) + { + return _LIBCPP_AUTO_CAST(__t.rend()); + } + + template <class _Tp> + requires __unqualified_rend<_Tp> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t)))) + { + return _LIBCPP_AUTO_CAST(rend(__t)); + } + + template <class _Tp> + requires __can_reverse<_Tp> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::begin(__t))) + { + return std::make_reverse_iterator(ranges::begin(__t)); + } + + void operator()(auto&&) const = delete; +}; +} // namespace __rend + +inline namespace __cpo { + inline constexpr auto rend = __rend::__fn{}; +} // namespace __cpo +} // namespace ranges + +// [range.access.crend] + +namespace ranges { +namespace __crend { +struct __fn { + template <class _Tp> + requires is_lvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t)))) + -> decltype( ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))) + { return ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t)); } + + template <class _Tp> + requires is_rvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::rend(static_cast<const _Tp&&>(__t)))) + -> decltype( ranges::rend(static_cast<const _Tp&&>(__t))) + { return ranges::rend(static_cast<const _Tp&&>(__t)); } +}; +} // namespace __crend + +inline namespace __cpo { + inline constexpr auto crend = __crend::__fn{}; +} // namespace __cpo +} // namespace ranges + +#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___RANGES_REND_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h index c7f1ab8f94..59b8289a23 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h @@ -51,13 +51,13 @@ namespace ranges { reverse_view() requires default_initializable<_View> = default; _LIBCPP_HIDE_FROM_ABI - constexpr explicit reverse_view(_View __view) : __base_(_VSTD::move(__view)) {} + constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {} _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; } _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return _VSTD::move(__base_); } + constexpr _View base() && { return std::move(__base_); } _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() { @@ -65,7 +65,7 @@ namespace ranges { if (__cached_begin_.__has_value()) return *__cached_begin_; - auto __tmp = _VSTD::make_reverse_iterator(ranges::next(ranges::begin(__base_), ranges::end(__base_))); + auto __tmp = std::make_reverse_iterator(ranges::next(ranges::begin(__base_), ranges::end(__base_))); if constexpr (_UseCache) __cached_begin_.__emplace(__tmp); return __tmp; @@ -73,22 +73,22 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() requires common_range<_View> { - return _VSTD::make_reverse_iterator(ranges::end(__base_)); + return std::make_reverse_iterator(ranges::end(__base_)); } _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const requires common_range<const _View> { - return _VSTD::make_reverse_iterator(ranges::end(__base_)); + return std::make_reverse_iterator(ranges::end(__base_)); } _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> end() { - return _VSTD::make_reverse_iterator(ranges::begin(__base_)); + return std::make_reverse_iterator(ranges::begin(__base_)); } _LIBCPP_HIDE_FROM_ABI constexpr auto end() const requires common_range<const _View> { - return _VSTD::make_reverse_iterator(ranges::begin(__base_)); + return std::make_reverse_iterator(ranges::begin(__base_)); } _LIBCPP_HIDE_FROM_ABI @@ -143,9 +143,9 @@ namespace ranges { requires __is_reverse_view<remove_cvref_t<_Range>> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(_VSTD::forward<_Range>(__range).base())) - -> decltype( _VSTD::forward<_Range>(__range).base()) - { return _VSTD::forward<_Range>(__range).base(); } + noexcept(noexcept(std::forward<_Range>(__range).base())) + -> decltype( std::forward<_Range>(__range).base()) + { return std::forward<_Range>(__range).base(); } template<class _Range, class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type> @@ -171,9 +171,9 @@ namespace ranges { !__is_unsized_reverse_subrange<remove_cvref_t<_Range>>) [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(reverse_view{_VSTD::forward<_Range>(__range)})) - -> decltype( reverse_view{_VSTD::forward<_Range>(__range)}) - { return reverse_view{_VSTD::forward<_Range>(__range)}; } + noexcept(noexcept(reverse_view{std::forward<_Range>(__range)})) + -> decltype( reverse_view{std::forward<_Range>(__range)}) + { return reverse_view{std::forward<_Range>(__range)}; } }; } // namespace __reverse diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h index 49e1aad520..5347b78da9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h @@ -40,13 +40,13 @@ namespace ranges { constexpr explicit single_view(const _Tp& __t) : __value_(in_place, __t) {} _LIBCPP_HIDE_FROM_ABI - constexpr explicit single_view(_Tp&& __t) : __value_(in_place, _VSTD::move(__t)) {} + constexpr explicit single_view(_Tp&& __t) : __value_(in_place, std::move(__t)) {} template<class... _Args> requires constructible_from<_Tp, _Args...> _LIBCPP_HIDE_FROM_ABI constexpr explicit single_view(in_place_t, _Args&&... __args) - : __value_{in_place, _VSTD::forward<_Args>(__args)...} {} + : __value_{in_place, std::forward<_Args>(__args)...} {} _LIBCPP_HIDE_FROM_ABI constexpr _Tp* begin() noexcept { return data(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h index a96103db9e..50bcca6874 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h @@ -94,7 +94,7 @@ namespace __size { template<__difference _Tp> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __integer_like auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::end(__t) - ranges::begin(__t))) { - return _VSTD::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t)); + return std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t)); } }; } // namespace __size diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h index 2450e230f2..4593205aef 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h @@ -56,8 +56,8 @@ namespace ranges { requires derived_from<tuple_size<_Tp>, integral_constant<size_t, 2>>; typename tuple_element_t<0, remove_const_t<_Tp>>; typename tuple_element_t<1, remove_const_t<_Tp>>; - { _VSTD::get<0>(__t) } -> convertible_to<const tuple_element_t<0, _Tp>&>; - { _VSTD::get<1>(__t) } -> convertible_to<const tuple_element_t<1, _Tp>&>; + { std::get<0>(__t) } -> convertible_to<const tuple_element_t<0, _Tp>&>; + { std::get<1>(__t) } -> convertible_to<const tuple_element_t<1, _Tp>&>; }; template<class _Pair, class _Iter, class _Sent> @@ -93,14 +93,14 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent) requires _MustProvideSizeAtConstruction - : __begin_(_VSTD::move(__iter)), __end_(_VSTD::move(__sent)) + : __begin_(std::move(__iter)), __end_(std::move(__sent)) { } _LIBCPP_HIDE_FROM_ABI constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent, make_unsigned_t<iter_difference_t<_Iter>> __n) requires (_Kind == subrange_kind::sized) - : __begin_(_VSTD::move(__iter)), __end_(_VSTD::move(__sent)), __size_(__n) + : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n) { if constexpr (sized_sentinel_for<_Sent, _Iter>) _LIBCPP_ASSERT((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n), @@ -149,7 +149,7 @@ namespace ranges { } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() requires (!copyable<_Iter>) { - return _VSTD::move(__begin_); + return std::move(__begin_); } _LIBCPP_HIDE_FROM_ABI @@ -168,7 +168,7 @@ namespace ranges { if constexpr (_StoreSize) return __size_; else - return _VSTD::__to_unsigned_like(__end_ - __begin_); + return std::__to_unsigned_like(__end_ - __begin_); } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) const& @@ -181,7 +181,7 @@ namespace ranges { [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) && { advance(__n); - return _VSTD::move(*this); + return std::move(*this); } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const @@ -198,14 +198,14 @@ namespace ranges { if (__n < 0) { ranges::advance(__begin_, __n); if constexpr (_StoreSize) - __size_ += _VSTD::__to_unsigned_like(-__n); + __size_ += std::__to_unsigned_like(-__n); return *this; } } auto __d = __n - ranges::advance(__begin_, __n, __end_); if constexpr (_StoreSize) - __size_ -= _VSTD::__to_unsigned_like(__d); + __size_ -= std::__to_unsigned_like(__d); return *this; } }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h index de44fc1fae..0b0f9c3744 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h @@ -50,13 +50,13 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr take_view(_View __base, range_difference_t<_View> __count) - : __base_(_VSTD::move(__base)), __count_(__count) {} + : __base_(std::move(__base)), __count_(__count) {} _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; } _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return _VSTD::move(__base_); } + constexpr _View base() && { return std::move(__base_); } _LIBCPP_HIDE_FROM_ABI constexpr auto begin() requires (!__simple_view<_View>) { @@ -119,14 +119,14 @@ namespace ranges { constexpr auto size() requires sized_range<_View> { auto __n = ranges::size(__base_); // TODO: use ranges::min here. - return _VSTD::min(__n, static_cast<decltype(__n)>(__count_)); + return std::min(__n, static_cast<decltype(__n)>(__count_)); } _LIBCPP_HIDE_FROM_ABI constexpr auto size() const requires sized_range<const _View> { auto __n = ranges::size(__base_); // TODO: use ranges::min here. - return _VSTD::min(__n, static_cast<decltype(__n)>(__count_)); + return std::min(__n, static_cast<decltype(__n)>(__count_)); } }; @@ -146,12 +146,12 @@ public: __sentinel() = default; _LIBCPP_HIDE_FROM_ABI - constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(_VSTD::move(__end)) {} + constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {} _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s) requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> - : __end_(_VSTD::move(__s.__end_)) {} + : __end_(std::move(__s.__end_)) {} _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h index dad46536c7..42ea1b82c7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h @@ -71,12 +71,12 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr transform_view(_View __base, _Fn __func) - : __func_(_VSTD::in_place, _VSTD::move(__func)), __base_(_VSTD::move(__base)) {} + : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {} _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; } _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return _VSTD::move(__base_); } + constexpr _View base() && { return std::move(__base_); } _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin() { @@ -183,7 +183,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current) - : __parent_(_VSTD::addressof(__parent)), __current_(_VSTD::move(__current)) {} + : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {} // Note: `__i` should always be `__iterator<false>`, but directly using // `__iterator<false>` is ill-formed when `_Const` is false @@ -191,7 +191,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i) requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> - : __parent_(__i.__parent_), __current_(_VSTD::move(__i.__current_)) {} + : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {} _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { @@ -200,14 +200,14 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { - return _VSTD::move(__current_); + return std::move(__current_); } _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const - noexcept(noexcept(_VSTD::invoke(*__parent_->__func_, *__current_))) + noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_))) { - return _VSTD::invoke(*__parent_->__func_, *__current_); + return std::invoke(*__parent_->__func_, *__current_); } _LIBCPP_HIDE_FROM_ABI @@ -263,10 +263,10 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const - noexcept(noexcept(_VSTD::invoke(*__parent_->__func_, __current_[__n]))) + noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n]))) requires random_access_range<_Base> { - return _VSTD::invoke(*__parent_->__func_, __current_[__n]); + return std::invoke(*__parent_->__func_, __current_[__n]); } _LIBCPP_HIDE_FROM_ABI @@ -344,7 +344,7 @@ public: noexcept(noexcept(*__i)) { if constexpr (is_lvalue_reference_v<decltype(*__i)>) - return _VSTD::move(*__i); + return std::move(*__i); else return *__i; } @@ -378,7 +378,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i) requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> - : __end_(_VSTD::move(__i.__end_)) {} + : __end_(std::move(__i.__end_)) {} _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } @@ -413,16 +413,16 @@ namespace __transform { template<class _Range, class _Fn> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Fn&& __f) const - noexcept(noexcept(transform_view(_VSTD::forward<_Range>(__range), _VSTD::forward<_Fn>(__f)))) - -> decltype( transform_view(_VSTD::forward<_Range>(__range), _VSTD::forward<_Fn>(__f))) - { return transform_view(_VSTD::forward<_Range>(__range), _VSTD::forward<_Fn>(__f)); } + noexcept(noexcept(transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)))) + -> decltype( transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f))) + { return transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)); } template<class _Fn> requires constructible_from<decay_t<_Fn>, _Fn> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f) const noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>) - { return __range_adaptor_closure_t(_VSTD::__bind_back(*this, _VSTD::forward<_Fn>(__f))); } + { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f))); } }; } // namespace __transform diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h index eca563fe3f..91ae4bde7d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h @@ -90,19 +90,19 @@ public: template<class _D2 = _Derived> _LIBCPP_HIDE_FROM_ABI constexpr auto data() - noexcept(noexcept(_VSTD::to_address(ranges::begin(__derived())))) + noexcept(noexcept(std::to_address(ranges::begin(__derived())))) requires contiguous_iterator<iterator_t<_D2>> { - return _VSTD::to_address(ranges::begin(__derived())); + return std::to_address(ranges::begin(__derived())); } template<class _D2 = _Derived> _LIBCPP_HIDE_FROM_ABI constexpr auto data() const - noexcept(noexcept(_VSTD::to_address(ranges::begin(__derived())))) + noexcept(noexcept(std::to_address(ranges::begin(__derived())))) requires range<const _D2> && contiguous_iterator<iterator_t<const _D2>> { - return _VSTD::to_address(ranges::begin(__derived())); + return std::to_address(ranges::begin(__derived())); } template<class _D2 = _Derived> diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h b/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h new file mode 100644 index 0000000000..485edb227c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___UTILITY_UNREACHABLE_H +#define _LIBCPP___UTILITY_UNREACHABLE_H + +#include <__config> +#include <cstdlib> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() +{ +#if __has_builtin(__builtin_unreachable) + __builtin_unreachable(); +#else + std::abort(); +#endif +} + +#if _LIBCPP_STD_VER > 20 + +[[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void unreachable() { __libcpp_unreachable(); } + +#endif // _LIBCPP_STD_VER > 20 + +_LIBCPP_END_NAMESPACE_STD + +#endif diff --git a/contrib/libs/cxxsupp/libcxx/include/array b/contrib/libs/cxxsupp/libcxx/include/array index d78dbe09c8..8d6a3b5a9f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/array +++ b/contrib/libs/cxxsupp/libcxx/include/array @@ -111,8 +111,8 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce #include <__config> #include <__debug> #include <__tuple> +#include <__utility/unreachable.h> #include <algorithm> -#include <cstdlib> // for _LIBCPP_UNREACHABLE #include <iterator> #include <stdexcept> #include <type_traits> @@ -309,54 +309,54 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference operator[](size_type) _NOEXCEPT { _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type) const _NOEXCEPT { _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference at(size_type) { __throw_out_of_range("array<T, 0>::at"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type) const { __throw_out_of_range("array<T, 0>::at"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() _NOEXCEPT { _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const _NOEXCEPT { _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() _NOEXCEPT { _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const _NOEXCEPT { _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array"); - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } }; -#if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER > 14 template<class _Tp, class... _Args, class = enable_if_t<__all<_IsSame<_Tp, _Args>::value...>::value> > diff --git a/contrib/libs/cxxsupp/libcxx/include/atomic b/contrib/libs/cxxsupp/libcxx/include/atomic index 8aba896d18..b047e9e18f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/atomic +++ b/contrib/libs/cxxsupp/libcxx/include/atomic @@ -540,7 +540,7 @@ template <class T> # error <atomic> is not implemented #endif #ifdef kill_dependency -# error C++ standard library is incompatible with <stdatomic.h> +# error C++ standard library is incompatible with <stdatomic.h> before C++23. Please compile with -std=c++23. #endif #define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \ diff --git a/contrib/libs/cxxsupp/libcxx/include/charconv b/contrib/libs/cxxsupp/libcxx/include/charconv index 5f2f281912..8a953b049c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/charconv +++ b/contrib/libs/cxxsupp/libcxx/include/charconv @@ -83,16 +83,16 @@ namespace std { #include <__charconv/from_chars_result.h> #include <__charconv/to_chars_result.h> #include <__config> +#include <__debug> #include <__errc> +#include <__utility/unreachable.h> #include <cmath> // for log2f #include <cstdint> -#include <cstdlib> // for _LIBCPP_UNREACHABLE +#include <cstdlib> #include <cstring> #include <limits> #include <type_traits> -#include <__debug> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif @@ -341,7 +341,7 @@ _LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_INLINE_VISIBILITY int __to_chars_integral_ __r += 4; } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } template <typename _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/cstdlib b/contrib/libs/cxxsupp/libcxx/include/cstdlib index bf799d77cc..82fe9efba8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstdlib +++ b/contrib/libs/cxxsupp/libcxx/include/cstdlib @@ -88,12 +88,6 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 # pragma GCC system_header #endif -#ifdef __GNUC__ -#define _LIBCPP_UNREACHABLE() __builtin_unreachable() -#else -#define _LIBCPP_UNREACHABLE() _VSTD::abort() -#endif - _LIBCPP_BEGIN_NAMESPACE_STD using ::size_t _LIBCPP_USING_IF_EXISTS; diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__config b/contrib/libs/cxxsupp/libcxx/include/experimental/__config index 7cbb7f425e..a71b348c04 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__config +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__config @@ -32,19 +32,6 @@ #define _LIBCPP_END_NAMESPACE_LFTS_PMR _LIBCPP_END_NAMESPACE_LFTS } #define _VSTD_LFTS_PMR _VSTD_LFTS::pmr -#if defined(_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM) -# define _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM /* nothing */ -#else -# define _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM __attribute__((deprecated("std::experimental::filesystem has now been deprecated in favor of C++17's std::filesystem. Please stop using it and start using std::filesystem. This experimental version will be removed in LLVM 11. You can remove this warning by defining the _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM macro."))) -#endif - -#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace filesystem _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM { \ - inline namespace v1 { - -#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \ - } } _LIBCPP_END_NAMESPACE_EXPERIMENTAL - #if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L #define _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/filesystem b/contrib/libs/cxxsupp/libcxx/include/experimental/filesystem index 8f3fa38a3f..8b13789179 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/filesystem +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/filesystem @@ -1,256 +1 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#ifndef _LIBCPP_EXPERIMENTAL_FILESYSTEM -#define _LIBCPP_EXPERIMENTAL_FILESYSTEM -/* - filesystem synopsis - namespace std { namespace experimental { namespace filesystem { inline namespace v1 { - - class path; - - void swap(path& lhs, path& rhs) noexcept; - size_t hash_value(const path& p) noexcept; - - bool operator==(const path& lhs, const path& rhs) noexcept; - bool operator!=(const path& lhs, const path& rhs) noexcept; - bool operator< (const path& lhs, const path& rhs) noexcept; - bool operator<=(const path& lhs, const path& rhs) noexcept; - bool operator> (const path& lhs, const path& rhs) noexcept; - bool operator>=(const path& lhs, const path& rhs) noexcept; - - path operator/ (const path& lhs, const path& rhs); - - // fs.path.io operators are friends of path. - template <class charT, class traits> - friend basic_ostream<charT, traits>& - operator<<(basic_ostream<charT, traits>& os, const path& p); - - template <class charT, class traits> - friend basic_istream<charT, traits>& - operator>>(basic_istream<charT, traits>& is, path& p); - - template <class Source> - path u8path(const Source& source); - template <class InputIterator> - path u8path(InputIterator first, InputIterator last); - - class filesystem_error; - class directory_entry; - - class directory_iterator; - - // enable directory_iterator range-based for statements - directory_iterator begin(directory_iterator iter) noexcept; - directory_iterator end(const directory_iterator&) noexcept; - - class recursive_directory_iterator; - - // enable recursive_directory_iterator range-based for statements - recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept; - recursive_directory_iterator end(const recursive_directory_iterator&) noexcept; - - class file_status; - - struct space_info - { - uintmax_t capacity; - uintmax_t free; - uintmax_t available; - }; - - enum class file_type; - enum class perms; - enum class perm_options; - enum class copy_options; - enum class directory_options; - - typedef chrono::time_point<trivial-clock> file_time_type; - - // operational functions - - path absolute(const path& p); - path absolute(const path& p, error_code &ec); - - path canonical(const path& p); - path canonical(const path& p, error_code& ec); - - void copy(const path& from, const path& to); - void copy(const path& from, const path& to, error_code& ec); - void copy(const path& from, const path& to, copy_options options); - void copy(const path& from, const path& to, copy_options options, - error_code& ec); - - bool copy_file(const path& from, const path& to); - bool copy_file(const path& from, const path& to, error_code& ec); - bool copy_file(const path& from, const path& to, copy_options option); - bool copy_file(const path& from, const path& to, copy_options option, - error_code& ec); - - void copy_symlink(const path& existing_symlink, const path& new_symlink); - void copy_symlink(const path& existing_symlink, const path& new_symlink, - error_code& ec) noexcept; - - bool create_directories(const path& p); - bool create_directories(const path& p, error_code& ec); - - bool create_directory(const path& p); - bool create_directory(const path& p, error_code& ec) noexcept; - - bool create_directory(const path& p, const path& attributes); - bool create_directory(const path& p, const path& attributes, - error_code& ec) noexcept; - - void create_directory_symlink(const path& to, const path& new_symlink); - void create_directory_symlink(const path& to, const path& new_symlink, - error_code& ec) noexcept; - - void create_hard_link(const path& to, const path& new_hard_link); - void create_hard_link(const path& to, const path& new_hard_link, - error_code& ec) noexcept; - - void create_symlink(const path& to, const path& new_symlink); - void create_symlink(const path& to, const path& new_symlink, - error_code& ec) noexcept; - - path current_path(); - path current_path(error_code& ec); - void current_path(const path& p); - void current_path(const path& p, error_code& ec) noexcept; - - bool exists(file_status s) noexcept; - bool exists(const path& p); - bool exists(const path& p, error_code& ec) noexcept; - - bool equivalent(const path& p1, const path& p2); - bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept; - - uintmax_t file_size(const path& p); - uintmax_t file_size(const path& p, error_code& ec) noexcept; - - uintmax_t hard_link_count(const path& p); - uintmax_t hard_link_count(const path& p, error_code& ec) noexcept; - - bool is_block_file(file_status s) noexcept; - bool is_block_file(const path& p); - bool is_block_file(const path& p, error_code& ec) noexcept; - - bool is_character_file(file_status s) noexcept; - bool is_character_file(const path& p); - bool is_character_file(const path& p, error_code& ec) noexcept; - - bool is_directory(file_status s) noexcept; - bool is_directory(const path& p); - bool is_directory(const path& p, error_code& ec) noexcept; - - bool is_empty(const path& p); - bool is_empty(const path& p, error_code& ec) noexcept; - - bool is_fifo(file_status s) noexcept; - bool is_fifo(const path& p); - bool is_fifo(const path& p, error_code& ec) noexcept; - - bool is_other(file_status s) noexcept; - bool is_other(const path& p); - bool is_other(const path& p, error_code& ec) noexcept; - - bool is_regular_file(file_status s) noexcept; - bool is_regular_file(const path& p); - bool is_regular_file(const path& p, error_code& ec) noexcept; - - bool is_socket(file_status s) noexcept; - bool is_socket(const path& p); - bool is_socket(const path& p, error_code& ec) noexcept; - - bool is_symlink(file_status s) noexcept; - bool is_symlink(const path& p); - bool is_symlink(const path& p, error_code& ec) noexcept; - - file_time_type last_write_time(const path& p); - file_time_type last_write_time(const path& p, error_code& ec) noexcept; - void last_write_time(const path& p, file_time_type new_time); - void last_write_time(const path& p, file_time_type new_time, - error_code& ec) noexcept; - - void permissions(const path& p, perms prms, - perm_options opts=perm_options::replace); - void permissions(const path& p, perms prms, error_code& ec) noexcept; - void permissions(const path& p, perms prms, perm_options opts, - error_code& ec); - - path proximate(const path& p, error_code& ec); - path proximate(const path& p, const path& base = current_path()); - path proximate(const path& p, const path& base, error_code &ec); - - path read_symlink(const path& p); - path read_symlink(const path& p, error_code& ec); - - path relative(const path& p, error_code& ec); - path relative(const path& p, const path& base=current_path()); - path relative(const path& p, const path& base, error_code& ec); - - bool remove(const path& p); - bool remove(const path& p, error_code& ec) noexcept; - - uintmax_t remove_all(const path& p); - uintmax_t remove_all(const path& p, error_code& ec); - - void rename(const path& from, const path& to); - void rename(const path& from, const path& to, error_code& ec) noexcept; - - void resize_file(const path& p, uintmax_t size); - void resize_file(const path& p, uintmax_t size, error_code& ec) noexcept; - - space_info space(const path& p); - space_info space(const path& p, error_code& ec) noexcept; - - file_status status(const path& p); - file_status status(const path& p, error_code& ec) noexcept; - - bool status_known(file_status s) noexcept; - - file_status symlink_status(const path& p); - file_status symlink_status(const path& p, error_code& ec) noexcept; - - path temp_directory_path(); - path temp_directory_path(error_code& ec); - - path weakly_canonical(path const& p); - path weakly_canonical(path const& p, error_code& ec); - - -} } } } // namespaces std::experimental::filesystem::v1 - -*/ - -#include <experimental/__config> -#include <filesystem> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -#ifndef _LIBCPP_CXX03_LANG - -#define __cpp_lib_experimental_filesystem 201406 - -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM - -using namespace _VSTD_FS; - -_LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM - -#endif // !_LIBCPP_CXX03_LANG - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_EXPERIMENTAL_FILESYSTEM diff --git a/contrib/libs/cxxsupp/libcxx/include/fstream b/contrib/libs/cxxsupp/libcxx/include/fstream index b4f83f9145..aadcd56874 100644 --- a/contrib/libs/cxxsupp/libcxx/include/fstream +++ b/contrib/libs/cxxsupp/libcxx/include/fstream @@ -183,6 +183,7 @@ typedef basic_fstream<wchar_t> wfstream; #include <__config> #include <__debug> #include <__locale> +#include <__utility/unreachable.h> #include <cstdio> #include <cstdlib> #include <istream> @@ -538,7 +539,7 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring( default: return nullptr; } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } template <class _CharT, class _Traits> diff --git a/contrib/libs/cxxsupp/libcxx/include/locale b/contrib/libs/cxxsupp/libcxx/include/locale index d95b79bf2d..c540305d33 100644 --- a/contrib/libs/cxxsupp/libcxx/include/locale +++ b/contrib/libs/cxxsupp/libcxx/include/locale @@ -1486,14 +1486,11 @@ num_put<_CharT, _OutputIterator>::__do_put_integral(iter_type __s, ios_base& __i + ((numeric_limits<_Unsigned>::digits % 3) != 0) // round up + 2; // base prefix + terminating null character // terminating null character char __nar[__nbuf]; -#ifdef _LIBCPP_COMPILER_CLANG_BASED -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" -#endif + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") + _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); -#ifdef _LIBCPP_COMPILER_CLANG_BASED -#pragma clang diagnostic pop -#endif + _LIBCPP_DIAGNOSTIC_POP char* __ne = __nar + __nc; char* __np = this->__identify_padding(__nar, __ne, __iob); // Stage 2 - Widen __nar while adding thousands separators @@ -1553,10 +1550,9 @@ num_put<_CharT, _OutputIterator>::__do_put_floating_point(iter_type __s, ios_bas char __nar[__nbuf]; char* __nb = __nar; int __nc; -#ifdef _LIBCPP_COMPILER_CLANG_BASED -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" -#endif + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") + _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") if (__specify_precision) __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); @@ -1573,9 +1569,7 @@ num_put<_CharT, _OutputIterator>::__do_put_floating_point(iter_type __s, ios_bas __throw_bad_alloc(); __nbh.reset(__nb); } -#ifdef _LIBCPP_COMPILER_CLANG_BASED -#pragma clang diagnostic pop -#endif + _LIBCPP_DIAGNOSTIC_POP char* __ne = __nb + __nc; char* __np = this->__identify_padding(__nb, __ne, __iob); // Stage 2 - Widen __nar while adding thousands separators diff --git a/contrib/libs/cxxsupp/libcxx/include/module.modulemap b/contrib/libs/cxxsupp/libcxx/include/module.modulemap index 6a55bf3f42..b958737645 100644 --- a/contrib/libs/cxxsupp/libcxx/include/module.modulemap +++ b/contrib/libs/cxxsupp/libcxx/include/module.modulemap @@ -50,6 +50,10 @@ module std [system] { header "setjmp.h" export * } + module stdatomic_h { + header "stdatomic.h" + export * + } // FIXME: <stdalign.h> is missing. // <signal.h> provided by C library. // <stdarg.h> provided by compiler. @@ -815,7 +819,9 @@ module std [system] { module non_propagating_cache { private header "__ranges/non_propagating_cache.h" } module owning_view { private header "__ranges/owning_view.h" } module range_adaptor { private header "__ranges/range_adaptor.h" } + module rbegin { private header "__ranges/rbegin.h" } module ref_view { private header "__ranges/ref_view.h" } + module rend { private header "__ranges/rend.h" } module reverse_view { private header "__ranges/reverse_view.h" } module single_view { private header "__ranges/single_view.h" } module size { private header "__ranges/size.h" } @@ -959,6 +965,7 @@ module std [system] { module swap { private header "__utility/swap.h" } module to_underlying { private header "__utility/to_underlying.h" } module transaction { private header "__utility/transaction.h" } + module unreachable { private header "__utility/unreachable.h" } } } module valarray { @@ -1020,10 +1027,6 @@ module std [system] { header "experimental/deque" export * } - module filesystem { - header "experimental/filesystem" - export * - } module forward_list { header "experimental/forward_list" export * diff --git a/contrib/libs/cxxsupp/libcxx/include/ranges b/contrib/libs/cxxsupp/libcxx/include/ranges index e8142084fe..2bc9121cd6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ranges +++ b/contrib/libs/cxxsupp/libcxx/include/ranges @@ -250,7 +250,9 @@ namespace std { #include <__ranges/enable_view.h> #include <__ranges/iota_view.h> #include <__ranges/join_view.h> +#include <__ranges/rbegin.h> #include <__ranges/ref_view.h> +#include <__ranges/rend.h> #include <__ranges/reverse_view.h> #include <__ranges/single_view.h> #include <__ranges/size.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/utility b/contrib/libs/cxxsupp/libcxx/include/utility index 5dd4d1b859..ab19e2bc6f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/utility +++ b/contrib/libs/cxxsupp/libcxx/include/utility @@ -239,6 +239,7 @@ template <class T> #include <__utility/swap.h> #include <__utility/to_underlying.h> #include <__utility/transaction.h> +#include <__utility/unreachable.h> #include <compare> #include <initializer_list> #include <version> diff --git a/contrib/libs/cxxsupp/libcxx/include/version b/contrib/libs/cxxsupp/libcxx/include/version index 0fd9e0f80e..5b595e35cb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/version +++ b/contrib/libs/cxxsupp/libcxx/include/version @@ -404,11 +404,11 @@ __cpp_lib_void_t 201411L <type_traits> // # define __cpp_lib_reference_from_temporary 202202L // # define __cpp_lib_spanstream 202106L // # define __cpp_lib_stacktrace 202011L -// # define __cpp_lib_stdatomic_h 202011L +# define __cpp_lib_stdatomic_h 202011L # define __cpp_lib_string_contains 202011L # define __cpp_lib_string_resize_and_overwrite 202110L # define __cpp_lib_to_underlying 202102L -// # define __cpp_lib_unreachable 202202L +# define __cpp_lib_unreachable 202202L #endif // clang-format on diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h index b693476518..4e117c3f19 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h @@ -14,11 +14,11 @@ #include "chrono" #include "climits" #include "cstdarg" -#include "cstdlib" #include "ctime" #include "filesystem" #include "ratio" #include "system_error" +#include <utility> #if defined(_LIBCPP_WIN32API) # define WIN32_LEAN_AND_MEAN @@ -188,7 +188,7 @@ struct ErrorHandler { case 2: __throw_filesystem_error(what, *p1_, *p2_, ec); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 0) @@ -207,7 +207,7 @@ struct ErrorHandler { case 2: __throw_filesystem_error(what, *p1_, *p2_, ec); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp b/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp index 8e1a8ef1ab..39777a316a 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include <__utility/unreachable.h> #include "filesystem" #include "array" #include "iterator" @@ -154,7 +155,7 @@ public: return makeState(PS_AtEnd); case PS_AtEnd: - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } } @@ -202,7 +203,7 @@ public: return makeState(PS_InRootName, Path.data(), RStart + 1); case PS_InRootName: case PS_BeforeBegin: - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } } @@ -224,7 +225,7 @@ public: case PS_InFilenames: return RawEntry; } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } explicit operator bool() const noexcept { @@ -285,7 +286,7 @@ private: case PS_AtEnd: return getAfterBack(); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } /// \brief Return a pointer to the first character in the currently lexed @@ -302,7 +303,7 @@ private: case PS_AtEnd: return &Path.back() + 1; } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } // Consume all consecutive separators. @@ -685,7 +686,7 @@ void filesystem_error::__create_what(int __num_paths) { return detail::format_string("filesystem error: %s [" PATH_CSTR_FMT "] [" PATH_CSTR_FMT "]", derived_what, path1().c_str(), path2().c_str()); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); }(); } @@ -1192,7 +1193,7 @@ bool __fs_is_empty(const path& p, error_code* ec) { } else if (is_regular_file(st)) return static_cast<uintmax_t>(pst.st_size) == 0; - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } static file_time_type __extract_last_write_time(const path& p, const StatT& st, @@ -1805,7 +1806,7 @@ path path::lexically_normal() const { break; } case PK_None: - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } } // [fs.path.generic]p6.8: If the path is empty, add a dot. diff --git a/contrib/libs/cxxsupp/libcxx/src/future.cpp b/contrib/libs/cxxsupp/libcxx/src/future.cpp index 177fe7523e..07ae9389ec 100644 --- a/contrib/libs/cxxsupp/libcxx/src/future.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/future.cpp @@ -29,13 +29,9 @@ __future_error_category::name() const noexcept return "future"; } -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wswitch" -#elif defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wswitch" -#endif +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wswitch") +_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wswitch") string __future_error_category::message(int ev) const @@ -58,11 +54,7 @@ __future_error_category::message(int ev) const return string("unspecified future_errc value\n"); } -#if defined(__clang__) -#pragma clang diagnostic pop -#elif defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic pop -#endif +_LIBCPP_DIAGNOSTIC_POP const error_category& future_category() noexcept diff --git a/contrib/libs/cxxsupp/libcxx/src/hash.cpp b/contrib/libs/cxxsupp/libcxx/src/hash.cpp index b8e921ad06..daf276f5b7 100644 --- a/contrib/libs/cxxsupp/libcxx/src/hash.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/hash.cpp @@ -11,9 +11,7 @@ #include "stdexcept" #include "type_traits" -#ifdef __clang__ -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wtautological-constant-out-of-range-compare") _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/include/ryu/d2s_intrinsics.h b/contrib/libs/cxxsupp/libcxx/src/include/ryu/d2s_intrinsics.h index 95912818ac..756fe1e831 100644 --- a/contrib/libs/cxxsupp/libcxx/src/include/ryu/d2s_intrinsics.h +++ b/contrib/libs/cxxsupp/libcxx/src/include/ryu/d2s_intrinsics.h @@ -46,6 +46,8 @@ #include "include/ryu/ryu.h" +#include "include/ryu/ryu.h" + _LIBCPP_BEGIN_NAMESPACE_STD #if defined(_M_X64) && defined(_MSC_VER) diff --git a/contrib/libs/cxxsupp/libcxx/src/include/ryu/ryu.h b/contrib/libs/cxxsupp/libcxx/src/include/ryu/ryu.h index 78c04e81ab..cfd5303472 100644 --- a/contrib/libs/cxxsupp/libcxx/src/include/ryu/ryu.h +++ b/contrib/libs/cxxsupp/libcxx/src/include/ryu/ryu.h @@ -68,7 +68,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // https://github.com/ulfjack/ryu/tree/59661c3/ryu -#if !defined(_LIBCPP_COMPILER_MSVC) +#if !defined(_MSC_VER) _LIBCPP_HIDE_FROM_ABI inline unsigned char _BitScanForward64(unsigned long* __index, unsigned long long __mask) { if (__mask == 0) { return false; @@ -84,7 +84,7 @@ _LIBCPP_HIDE_FROM_ABI inline unsigned char _BitScanForward(unsigned long* __inde *__index = __builtin_ctz(__mask); return true; } -#endif // _LIBCPP_COMPILER_MSVC +#endif // !_MSC_VER template <class _Floating> [[nodiscard]] to_chars_result _Floating_to_chars_ryu( diff --git a/contrib/libs/cxxsupp/libcxx/src/locale.cpp b/contrib/libs/cxxsupp/libcxx/src/locale.cpp index c9ecfb24ff..92fd8d7445 100644 --- a/contrib/libs/cxxsupp/libcxx/src/locale.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/locale.cpp @@ -12,6 +12,8 @@ #define _LCONV_C99 #endif +#include <__utility/unreachable.h> +#include "algorithm" #include "clocale" #include "codecvt" #include "cstdio" @@ -46,9 +48,7 @@ // On Linux, wint_t and wchar_t have different signed-ness, and this causes // lots of noise in the build log, but no bugs that I know of. -#if defined(__clang__) -#pragma clang diagnostic ignored "-Wsign-conversion" -#endif +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wsign-conversion") _LIBCPP_BEGIN_NAMESPACE_STD @@ -4641,7 +4641,7 @@ static bool checked_string_to_char_convert(char& dest, return false; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } @@ -5218,12 +5218,8 @@ __time_get::~__time_get() { freelocale(__loc_); } -#if defined(__clang__) -#pragma clang diagnostic ignored "-Wmissing-field-initializers" -#endif -#if defined(__GNUG__) -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif + +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-field-initializers") template <> string @@ -5369,9 +5365,7 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct) return result; } -#if defined(__clang__) -#pragma clang diagnostic ignored "-Wmissing-braces" -#endif +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-braces") #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> diff --git a/contrib/libs/cxxsupp/libcxx/src/strstream.cpp b/contrib/libs/cxxsupp/libcxx/src/strstream.cpp index e62c07768b..fe7e2d4120 100644 --- a/contrib/libs/cxxsupp/libcxx/src/strstream.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/strstream.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include <__utility/unreachable.h> #include "strstream" #include "algorithm" #include "climits" @@ -268,7 +269,7 @@ strstreambuf::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmod newoff = seekhigh - eback(); break; default: - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } newoff += __off; if (0 <= newoff && newoff <= seekhigh - eback()) diff --git a/contrib/libs/cxxsupp/libcxx/src/support/win32/locale_win32.cpp b/contrib/libs/cxxsupp/libcxx/src/support/win32/locale_win32.cpp index 43e5c9a572..67f4d1341a 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/win32/locale_win32.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/support/win32/locale_win32.cpp @@ -97,10 +97,10 @@ int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...) ret, n, format, loc, ap); #else __libcpp_locale_guard __current(loc); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") int result = vsnprintf( ret, n, format, ap ); -#pragma clang diagnostic pop + _LIBCPP_DIAGNOSTIC_POP #endif va_end(ap); return result; diff --git a/contrib/libs/cxxsupp/libcxx/src/support/win32/support.cpp b/contrib/libs/cxxsupp/libcxx/src/support/win32/support.cpp index 6d4b371f3d..dbec4083cb 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/win32/support.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/support/win32/support.cpp @@ -23,10 +23,10 @@ int __libcpp_vasprintf( char **sptr, const char *__restrict format, va_list ap ) // Query the count required. va_list ap_copy; va_copy(ap_copy, ap); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") int count = vsnprintf( NULL, 0, format, ap_copy ); -#pragma clang diagnostic pop + _LIBCPP_DIAGNOSTIC_POP va_end(ap_copy); if (count < 0) return count; @@ -36,10 +36,10 @@ int __libcpp_vasprintf( char **sptr, const char *__restrict format, va_list ap ) return -1; // If we haven't used exactly what was required, something is wrong. // Maybe bug in vsnprintf. Report the error and return. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") if (vsnprintf(p, buffer_size, format, ap) != count) { -#pragma clang diagnostic pop + _LIBCPP_DIAGNOSTIC_POP free(p); return -1; } |