diff options
author | mikhnenko <mikhnenko@yandex-team.com> | 2023-10-06 17:52:32 +0300 |
---|---|---|
committer | mikhnenko <mikhnenko@yandex-team.com> | 2023-10-06 20:37:34 +0300 |
commit | 5ae8a1d5a335e8842ec7d738b63084ff9e859d91 (patch) | |
tree | f78e50dd87826dbfa0e105524e7712de898e0168 | |
parent | abce6653da14c738a48f8703314aa8ad569e5bf9 (diff) | |
download | ydb-5ae8a1d5a335e8842ec7d738b63084ff9e859d91.tar.gz |
Upd libc++ to 95a2527261443729a398e16bc7dc6dd325fc2691 (29 Mar 2022)
45 files changed, 739 insertions, 288 deletions
diff --git a/build/sysincl/stl-to-libcxx.yml b/build/sysincl/stl-to-libcxx.yml index 7a278a578a..165b0d6b35 100644 --- a/build/sysincl/stl-to-libcxx.yml +++ b/build/sysincl/stl-to-libcxx.yml @@ -253,6 +253,7 @@ - __algorithm/ranges_find_if.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h - __algorithm/ranges_find_if_not.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h - __algorithm/ranges_max_element.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h + - __algorithm/ranges_min.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h - __algorithm/ranges_min_element.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h - __algorithm/ranges_mismatch.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h - __algorithm/ranges_swap_ranges.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 950c7da368..13a430895e 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -9,7 +9,7 @@ FAKEID=628318530716 SANDBOX_FAKEID=${FAKEID}.7600000 -CPP_FAKEID=2023-09-24 +CPP_FAKEID=2023-09-27 GO_FAKEID=11100371 ANDROID_FAKEID=2023-05-17 CLANG_TIDY_FAKEID=2023-06-06 diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h new file mode 100644 index 0000000000..0bb1e72ac5 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h @@ -0,0 +1,89 @@ +//===----------------------------------------------------------------------===// +// +// 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___ALGORITHM_RANGES_MIN_H +#define _LIBCPP___ALGORITHM_RANGES_MIN_H + +#include <__algorithm/ranges_min_element.h> +#include <__assert> +#include <__concepts/copyable.h> +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__functional/ranges_operations.h> +#include <__iterator/concepts.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <initializer_list> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __min { +struct __fn { + template <class _Tp, class _Proj = identity, + indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + const _Tp& operator()(const _Tp& __a, const _Tp& __b, _Comp __comp = {}, _Proj __proj = {}) const { + return std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a)) ? __b : __a; + } + + template <copyable _Tp, class _Proj = identity, + indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + _Tp operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const { + _LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list must contain at least one element"); + return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp, __proj); + } + + template <input_range _Rp, class _Proj = identity, + indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less> + requires indirectly_copyable_storable<iterator_t<_Rp>, range_value_t<_Rp>*> + _LIBCPP_HIDE_FROM_ABI constexpr + range_value_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { + auto __first = ranges::begin(__r); + auto __last = ranges::end(__r); + + _LIBCPP_ASSERT(__first != __last, "range must contain at least one element"); + + if constexpr (forward_range<_Rp>) { + return *ranges::__min_element_impl(__first, __last, __comp, __proj); + } else { + range_value_t<_Rp> __result = *__first; + while (++__first != __last) { + if (std::invoke(__comp, std::invoke(__proj, *__first), std::invoke(__proj, __result))) + __result = *__first; + } + return __result; + } + } +}; +} // namespace __min + +inline namespace __cpo { + inline constexpr auto min = __min::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP_STD_VER > 17 && && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_MIN_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h index 70497f484e..ae82dceb9a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h @@ -29,33 +29,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __min_element { -struct __fn { - template <class _Ip, class _Sp, class _Proj, class _Comp> - _LIBCPP_HIDE_FROM_ABI static constexpr - _Ip __go(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) { - if (__first == __last) - return __first; - _Ip __i = __first; - while (++__i != __last) - if (std::invoke(__comp, std::invoke(__proj, *__i), std::invoke(__proj, *__first))) - __first = __i; +template <class _Ip, class _Sp, class _Proj, class _Comp> +_LIBCPP_HIDE_FROM_ABI static constexpr +_Ip __min_element_impl(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) { + if (__first == __last) return __first; - } + _Ip __i = __first; + while (++__i != __last) + if (std::invoke(__comp, std::invoke(__proj, *__i), std::invoke(__proj, *__first))) + __first = __i; + return __first; +} + +namespace __min_element { +struct __fn { template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less> _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const { - return __go(__first, __last, __comp, __proj); + return ranges::__min_element_impl(__first, __last, __comp, __proj); } template <forward_range _Rp, class _Proj = identity, indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less> _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { - return __go(ranges::begin(__r), ranges::end(__r), __comp, __proj); + return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj); } }; } // namespace __min_element diff --git a/contrib/libs/cxxsupp/libcxx/include/__assert b/contrib/libs/cxxsupp/libcxx/include/__assert index 75763d0374..cb397e4198 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__assert +++ b/contrib/libs/cxxsupp/libcxx/include/__assert @@ -10,52 +10,50 @@ #ifndef _LIBCPP___ASSERT #define _LIBCPP___ASSERT +#include <__availability> #include <__config> -#include <iosfwd> // for std::string #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +// This is for backwards compatibility with code that might have been enabling +// assertions through the Debug mode previously. #if _LIBCPP_DEBUG_LEVEL >= 1 -# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : ::std::__libcpp_debug_function(::std::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) +# ifndef _LIBCPP_ENABLE_ASSERTIONS +# define _LIBCPP_ENABLE_ASSERTIONS 1 +# endif +#endif + +#ifndef _LIBCPP_ENABLE_ASSERTIONS +# define _LIBCPP_ENABLE_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS_DEFAULT +#endif + +#if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1 +# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1" +#endif + +#if _LIBCPP_ENABLE_ASSERTIONS +# define _LIBCPP_ASSERT(expression, message) \ + (__builtin_expect(static_cast<bool>(expression), 1) ? \ + (void)0 : \ + ::std::__libcpp_assertion_handler(__FILE__, __LINE__, #expression, message)) #else -# define _LIBCPP_ASSERT(x, m) ((void)0) +# if __has_builtin(__builtin_assume) +# define _LIBCPP_ASSERT(expression, message) \ + (_LIBCPP_DIAGNOSTIC_PUSH \ + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wassume") \ + __builtin_assume(static_cast<bool>(expression)) \ + _LIBCPP_DIAGNOSTIC_POP) +# else +# define _LIBCPP_ASSERT(expression, message) ((void)0) +# endif #endif _LIBCPP_BEGIN_NAMESPACE_STD -struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info { - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - __libcpp_debug_info() - : __file_(nullptr), __line_(-1), __pred_(nullptr), __msg_(nullptr) {} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - __libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m) - : __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {} - - _LIBCPP_FUNC_VIS string what() const; - - const char* __file_; - int __line_; - const char* __pred_; - const char* __msg_; -}; - -/// __libcpp_debug_function_type - The type of the assertion failure handler. -typedef void(*__libcpp_debug_function_type)(__libcpp_debug_info const&); - -/// __libcpp_debug_function - The handler function called when a _LIBCPP_ASSERT -/// fails. -extern _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_function_type __libcpp_debug_function; - -/// __libcpp_abort_debug_function - A debug handler that aborts when called. -_LIBCPP_NORETURN _LIBCPP_FUNC_VIS -void __libcpp_abort_debug_function(__libcpp_debug_info const&); - -/// __libcpp_set_debug_function - Set the debug handler to the specified -/// function. -_LIBCPP_FUNC_VIS -bool __libcpp_set_debug_function(__libcpp_debug_function_type __func); +_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ASSERTION_HANDLER +void __libcpp_assertion_handler(char const* __file, int __line, char const* __expression, char const* __message); _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__availability b/contrib/libs/cxxsupp/libcxx/include/__availability index b0f52ad1e9..789e26679f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__availability +++ b/contrib/libs/cxxsupp/libcxx/include/__availability @@ -91,6 +91,10 @@ // other exception types. These were put in the shared library to prevent // code bloat from every user program defining the vtable for these exception // types. + // + // Note that when exceptions are disabled, the methods that normally throw + // these exceptions can be used even on older deployment targets, but those + // methods will abort instead of throwing. # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST @@ -99,10 +103,15 @@ # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS // This controls the availability of the sized version of ::operator delete, - // which was added to the dylib later. + // ::operator delete[], and their align_val_t variants, which were all added + // in C++17, and hence not present in early dylibs. # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE // This controls the availability of the std::future_error exception. + // + // Note that when exceptions are disabled, the methods that normally throw + // std::future_error can be used even on older deployment targets, but those + // methods will abort instead of throwing. # define _LIBCPP_AVAILABILITY_FUTURE_ERROR // This controls the availability of std::type_info's vtable. @@ -126,7 +135,7 @@ # define _LIBCPP_AVAILABILITY_FILESYSTEM_POP // # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem - // This controls the availability of std::to_chars. + // This controls the availability of std::to_chars for integral arguments. # define _LIBCPP_AVAILABILITY_TO_CHARS // This controls the availability of floating-point std::to_chars functions. @@ -135,7 +144,8 @@ // This controls the availability of the C++20 synchronization library, // which requires shared library support for various operations - // (see libcxx/src/atomic.cpp). + // (see libcxx/src/atomic.cpp). This includes <barier>, <latch>, + // <semaphore>, and notification functions on std::atomic. # define _LIBCPP_AVAILABILITY_SYNC // # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait // # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier @@ -149,10 +159,27 @@ # define _LIBCPP_AVAILABILITY_FORMAT // # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format + // This controls whether the std::__libcpp_assertion_handler default + // assertion handler is provided by the library. + // + // Note that when users provide their own custom assertion handler, + // it doesn't matter whether the dylib provides a default handler, + // and the availability markup can actually give a false positive + // diagnostic (it will think that no handler is provided, when in + // reality the user has provided their own). + // + // Users can pass -D_LIBCPP_AVAILABILITY_CUSTOM_ASSERTION_HANDLER_PROVIDED + // to the compiler to tell the library to ignore the fact that the + // default handler isn't available on their deployment target. Note that + // defining this macro but failing to define a custom assertion handler + // will lead to a load-time error on back-deployment targets, so it + // should be avoided. +# define _LIBCPP_AVAILABILITY_DEFAULT_ASSERTION_HANDLER + #elif defined(__APPLE__) # define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(macos,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) @@ -168,7 +195,7 @@ // macOS and iOS versions, so the version mismatch between macOS and others // is intended. # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \ - __attribute__((availability(macosx,strict,introduced=10.13))) \ + __attribute__((availability(macos,strict,introduced=10.13))) \ __attribute__((availability(ios,strict,introduced=12.0))) \ __attribute__((availability(tvos,strict,introduced=12.0))) \ __attribute__((availability(watchos,strict,introduced=5.0))) @@ -178,13 +205,13 @@ _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(macos,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(macos,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) @@ -193,26 +220,26 @@ __attribute__((availability(ios,strict,introduced=6.0))) # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(macos,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(macos,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(macos,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) # define _LIBCPP_AVAILABILITY_FILESYSTEM \ - __attribute__((availability(macosx,strict,introduced=10.15))) \ + __attribute__((availability(macos,strict,introduced=10.15))) \ __attribute__((availability(ios,strict,introduced=13.0))) \ __attribute__((availability(tvos,strict,introduced=13.0))) \ __attribute__((availability(watchos,strict,introduced=6.0))) # define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \ - _Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \ - _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \ - _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \ _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))") # define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \ _Pragma("clang attribute pop") \ @@ -233,7 +260,7 @@ __attribute__((unavailable)) # define _LIBCPP_AVAILABILITY_SYNC \ - __attribute__((availability(macosx,strict,introduced=11.0))) \ + __attribute__((availability(macos,strict,introduced=11.0))) \ __attribute__((availability(ios,strict,introduced=14.0))) \ __attribute__((availability(tvos,strict,introduced=14.0))) \ __attribute__((availability(watchos,strict,introduced=7.0))) @@ -250,6 +277,9 @@ # define _LIBCPP_AVAILABILITY_FORMAT \ __attribute__((unavailable)) # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format + +# define _LIBCPP_AVAILABILITY_DEFAULT_ASSERTION_HANDLER \ + __attribute__((unavailable)) #else // ...New vendors can add availability markup here... @@ -273,4 +303,14 @@ # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS #endif +// Define the special assertion handler availability attribute, which can be silenced by +// users if they provide their own custom assertion handler. The rest of the code should +// not use the *_DEFAULT_* macro directly, since that would make it ignore the fact that +// the user provided a custom handler. +#if defined(_LIBCPP_AVAILABILITY_CUSTOM_ASSERTION_HANDLER_PROVIDED) +# define _LIBCPP_AVAILABILITY_ASSERTION_HANDLER /* nothing */ +#else +# define _LIBCPP_AVAILABILITY_ASSERTION_HANDLER _LIBCPP_AVAILABILITY_DEFAULT_ASSERTION_HANDLER +#endif + #endif // _LIBCPP___AVAILABILITY diff --git a/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_defaults.h b/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_defaults.h index f537aa0ed2..48cedeaa73 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_defaults.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_defaults.h @@ -11,8 +11,8 @@ // we will define the mapping from an internal macro to the real BSD symbol. //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_BSD_LOCALE_DEFAULTS_H -#define _LIBCPP_BSD_LOCALE_DEFAULTS_H +#ifndef _LIBCPP___BSD_LOCALE_DEFAULTS_H +#define _LIBCPP___BSD_LOCALE_DEFAULTS_H #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -34,4 +34,4 @@ #define __libcpp_asprintf_l(__ret, __l, __f, ...) asprintf_l(__ret, __l, __f, ##__VA_ARGS__) #define __libcpp_sscanf_l(__s, __l, __f, ...) sscanf_l(__s, __l, __f, ##__VA_ARGS__) -#endif // _LIBCPP_BSD_LOCALE_DEFAULTS_H +#endif // _LIBCPP___BSD_LOCALE_DEFAULTS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_fallbacks.h b/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_fallbacks.h index ceb1407d52..3d5b785744 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_fallbacks.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_fallbacks.h @@ -10,8 +10,8 @@ // of those functions for non-BSD platforms. //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_BSD_LOCALE_FALLBACKS_DEFAULTS_H -#define _LIBCPP_BSD_LOCALE_FALLBACKS_DEFAULTS_H +#ifndef _LIBCPP___BSD_LOCALE_FALLBACKS_H +#define _LIBCPP___BSD_LOCALE_FALLBACKS_H #include <memory> #include <stdarg.h> @@ -140,4 +140,4 @@ int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_BSD_LOCALE_FALLBACKS_DEFAULTS_H +#endif // _LIBCPP___BSD_LOCALE_FALLBACKS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config index f5d9d9caa1..f0e448dd32 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config +++ b/contrib/libs/cxxsupp/libcxx/include/__config @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_CONFIG -#define _LIBCPP_CONFIG +#ifndef _LIBCPP___CONFIG +#define _LIBCPP___CONFIG #include <__wrappers_config> #if defined(_MSC_VER) && !defined(__clang__) @@ -1467,4 +1467,4 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( #endif // __cplusplus -#endif // _LIBCPP_CONFIG +#endif // _LIBCPP___CONFIG diff --git a/contrib/libs/cxxsupp/libcxx/include/__debug b/contrib/libs/cxxsupp/libcxx/include/__debug index a4160b3b7f..f5ebcac153 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__debug +++ b/contrib/libs/cxxsupp/libcxx/include/__debug @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_DEBUG_H -#define _LIBCPP_DEBUG_H +#ifndef _LIBCPP___DEBUG +#define _LIBCPP___DEBUG #include <__assert> #include <__config> @@ -229,4 +229,4 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_DEBUG_H +#endif // _LIBCPP___DEBUG diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h new file mode 100644 index 0000000000..32513d0350 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h @@ -0,0 +1,207 @@ +// -*- 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___FORMAT_BUFFER_H +#define _LIBCPP___FORMAT_BUFFER_H + +#include <__algorithm/copy_n.h> +#include <__algorithm/unwrap_iter.h> +#include <__config> +#include <__format/formatter.h> // for __char_type TODO FMT Move the concept? +#include <__iterator/back_insert_iterator.h> +#include <__iterator/concepts.h> +#include <__iterator/iterator_traits.h> +#include <__iterator/wrap_iter.h> +#include <__utility/move.h> +#include <concepts> +#include <cstddef> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 17 + +namespace __format { + +/// A "buffer" that handles writing to the proper iterator. +/// +/// This helper is used together with the @ref back_insert_iterator to offer +/// type-erasure for the formatting functions. This reduces the number to +/// template instantiations. +template <__formatter::__char_type _CharT> +class _LIBCPP_TEMPLATE_VIS __output_buffer { +public: + using value_type = _CharT; + + template <class _Tp> + _LIBCPP_HIDE_FROM_ABI explicit __output_buffer(_CharT* __ptr, + size_t __capacity, _Tp* __obj) + : __ptr_(__ptr), __capacity_(__capacity), + __flush_([](_CharT* __p, size_t __size, void* __o) { + static_cast<_Tp*>(__o)->flush(__p, __size); + }), + __obj_(__obj) {} + + _LIBCPP_HIDE_FROM_ABI void reset(_CharT* __ptr, size_t __capacity) { + __ptr_ = __ptr; + __capacity_ = __capacity; + } + + _LIBCPP_HIDE_FROM_ABI auto make_output_iterator() { + return back_insert_iterator{*this}; + } + + // TODO FMT It would be nice to have an overload taking a + // basic_string_view<_CharT> and append it directly. + _LIBCPP_HIDE_FROM_ABI void push_back(_CharT __c) { + __ptr_[__size_++] = __c; + + // Profiling showed flushing after adding is more efficient than flushing + // when entering the function. + if (__size_ == __capacity_) + flush(); + } + + _LIBCPP_HIDE_FROM_ABI void flush() { + __flush_(__ptr_, __size_, __obj_); + __size_ = 0; + } + +private: + _CharT* __ptr_; + size_t __capacity_; + size_t __size_{0}; + void (*__flush_)(_CharT*, size_t, void*); + void* __obj_; +}; + +/// A storage using an internal buffer. +/// +/// This storage is used when writing a single element to the output iterator +/// is expensive. +template <__formatter::__char_type _CharT> +class _LIBCPP_TEMPLATE_VIS __internal_storage { +public: + _LIBCPP_HIDE_FROM_ABI _CharT* begin() { return __buffer_; } + _LIBCPP_HIDE_FROM_ABI size_t capacity() { return __buffer_size_; } + +private: + static constexpr size_t __buffer_size_ = 256 / sizeof(_CharT); + _CharT __buffer_[__buffer_size_]; +}; + +/// A storage writing directly to the storage. +/// +/// This requires the storage to be a contiguous buffer of \a _CharT. +/// Since the output is directly written to the underlying storage this class +/// is just an empty class. +template <__formatter::__char_type _CharT> +class _LIBCPP_TEMPLATE_VIS __direct_storage {}; + +template <class _OutIt, class _CharT> +concept __enable_direct_output = __formatter::__char_type<_CharT> && + (same_as<_OutIt, _CharT*> +#if _LIBCPP_DEBUG_LEVEL < 2 + || same_as<_OutIt, __wrap_iter<_CharT*>> +#endif + ); + +/// Write policy for directly writing to the underlying output. +template <class _OutIt, __formatter::__char_type _CharT> +class _LIBCPP_TEMPLATE_VIS __writer_direct { +public: + _LIBCPP_HIDE_FROM_ABI explicit __writer_direct(_OutIt __out_it) + : __out_it_(__out_it) {} + + _LIBCPP_HIDE_FROM_ABI auto out() { return __out_it_; } + + _LIBCPP_HIDE_FROM_ABI void flush(_CharT*, size_t __size) { + // _OutIt can be a __wrap_iter<CharT*>. Therefore the original iterator + // is adjusted. + __out_it_ += __size; + } + +private: + _OutIt __out_it_; +}; + +/// Write policy for copying the buffer to the output. +template <class _OutIt, __formatter::__char_type _CharT> +class _LIBCPP_TEMPLATE_VIS __writer_iterator { +public: + _LIBCPP_HIDE_FROM_ABI explicit __writer_iterator(_OutIt __out_it) + : __out_it_{_VSTD::move(__out_it)} {} + + _LIBCPP_HIDE_FROM_ABI auto out() { return __out_it_; } + + _LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) { + __out_it_ = _VSTD::copy_n(__ptr, __size, _VSTD::move(__out_it_)); + } + +private: + _OutIt __out_it_; +}; + +/// Selects the type of the writer used for the output iterator. +template <class _OutIt, class _CharT> +class _LIBCPP_TEMPLATE_VIS __writer_selector { +public: + using type = conditional_t<__enable_direct_output<_OutIt, _CharT>, + __writer_direct<_OutIt, _CharT>, + __writer_iterator<_OutIt, _CharT>>; +}; + +/// The generic formatting buffer. +template <class _OutIt, __formatter::__char_type _CharT> +requires(output_iterator<_OutIt, const _CharT&>) class _LIBCPP_TEMPLATE_VIS + __format_buffer { + using _Storage = + conditional_t<__enable_direct_output<_OutIt, _CharT>, + __direct_storage<_CharT>, __internal_storage<_CharT>>; + +public: + _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) requires( + same_as<_Storage, __internal_storage<_CharT>>) + : __output_(__storage_.begin(), __storage_.capacity(), this), + __writer_(_VSTD::move(__out_it)) {} + + _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) requires( + same_as<_Storage, __direct_storage<_CharT>>) + : __output_(_VSTD::__unwrap_iter(__out_it), size_t(-1), this), + __writer_(_VSTD::move(__out_it)) {} + + _LIBCPP_HIDE_FROM_ABI auto make_output_iterator() { + return __output_.make_output_iterator(); + } + + _LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) { + __writer_.flush(__ptr, __size); + } + + _LIBCPP_HIDE_FROM_ABI _OutIt out() && { + __output_.flush(); + return _VSTD::move(__writer_).out(); + } + +private: + _LIBCPP_NO_UNIQUE_ADDRESS _Storage __storage_; + __output_buffer<_CharT> __output_; + typename __writer_selector<_OutIt, _CharT>::type __writer_; +}; +} // namespace __format + +#endif //_LIBCPP_STD_VER > 17 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___FORMAT_BUFFER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h index 058f7a4bee..e712a5ef43 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h @@ -12,6 +12,7 @@ #include <__availability> #include <__config> +#include <__format/buffer.h> #include <__format/format_args.h> #include <__format/format_fwd.h> #include <__iterator/back_insert_iterator.h> @@ -60,16 +61,12 @@ __format_context_create( } #endif -// TODO FMT Implement [format.context]/4 -// [Note 1: For a given type charT, implementations are encouraged to provide a -// single instantiation of basic_format_context for appending to -// basic_string<charT>, vector<charT>, or any other container with contiguous -// storage by wrapping those in temporary objects with a uniform interface -// (such as a span<charT>) and polymorphic reallocation. - end note] - -using format_context = basic_format_context<back_insert_iterator<string>, char>; +using format_context = + basic_format_context<back_insert_iterator<__format::__output_buffer<char>>, + char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -using wformat_context = basic_format_context<back_insert_iterator<wstring>, wchar_t>; +using wformat_context = basic_format_context< + back_insert_iterator<__format::__output_buffer<wchar_t>>, wchar_t>; #endif template <class _OutIt, class _CharT> diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_pointer.h index d83e2be77e..aa4fc3398d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_pointer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_pointer.h @@ -20,6 +20,7 @@ #include <__format/formatter_integral.h> #include <__format/parser_std_format_spec.h> #include <__iterator/access.h> +#include <cstddef> #include <cstdint> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__hash_table b/contrib/libs/cxxsupp/libcxx/include/__hash_table index c4a1158daa..605f13c360 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__hash_table +++ b/contrib/libs/cxxsupp/libcxx/include/__hash_table @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP__HASH_TABLE -#define _LIBCPP__HASH_TABLE +#ifndef _LIBCPP___HASH_TABLE +#define _LIBCPP___HASH_TABLE #include <__algorithm/max.h> #include <__algorithm/min.h> @@ -2485,8 +2485,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p) _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered container erase(iterator) called with an iterator not" " referring to this container"); - _LIBCPP_DEBUG_ASSERT(__p != end(), - "unordered container erase(iterator) called with a non-dereferenceable iterator"); + _LIBCPP_ASSERT(__p != end(), + "unordered container erase(iterator) called with a non-dereferenceable iterator"); #if _LIBCPP_DEBUG_LEVEL == 2 iterator __r(__np, this); #else @@ -2806,4 +2806,4 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // _LIBCPP__HASH_TABLE +#endif // _LIBCPP___HASH_TABLE diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h index 775f227004..6ce5595add 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h @@ -141,8 +141,9 @@ public: #if _LIBCPP_STD_VER > 17 -// The `cpp17-*-iterator` exposition-only concepts are easily confused with the Cpp17*Iterator tables, -// so they've been banished to a namespace that makes it obvious they have a niche use-case. +// The `cpp17-*-iterator` exposition-only concepts have very similar names to the `Cpp17*Iterator` named requirements +// from `[iterator.cpp17]`. To avoid confusion between the two, the exposition-only concepts have been banished to +// a "detail" namespace indicating they have a niche use-case. namespace __iterator_traits_detail { template<class _Ip> concept __cpp17_iterator = diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h index c77f461853..bc07cf33f7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h @@ -12,10 +12,18 @@ #include <__compare/compare_three_way_result.h> #include <__compare/three_way_comparable.h> +#include <__concepts/convertible_to.h> #include <__config> +#include <__iterator/concepts.h> +#include <__iterator/incrementable_traits.h> +#include <__iterator/iter_move.h> +#include <__iterator/iter_swap.h> #include <__iterator/iterator.h> #include <__iterator/iterator_traits.h> +#include <__iterator/prev.h> +#include <__iterator/readable_traits.h> #include <__memory/addressof.h> +#include <__utility/move.h> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -41,22 +49,31 @@ private: _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break #endif +#if _LIBCPP_STD_VER > 17 + static_assert(__is_cpp17_bidirectional_iterator<_Iter>::value || bidirectional_iterator<_Iter>, + "reverse_iterator<It> requires It to be a bidirectional iterator."); +#endif // _LIBCPP_STD_VER > 17 + protected: _Iter current; public: - typedef _Iter iterator_type; - typedef typename iterator_traits<_Iter>::difference_type difference_type; - typedef typename iterator_traits<_Iter>::reference reference; - typedef typename iterator_traits<_Iter>::pointer pointer; - typedef _If<__is_cpp17_random_access_iterator<_Iter>::value, - random_access_iterator_tag, - typename iterator_traits<_Iter>::iterator_category> iterator_category; - typedef typename iterator_traits<_Iter>::value_type value_type; + using iterator_type = _Iter; + using iterator_category = _If<__is_cpp17_random_access_iterator<_Iter>::value, + random_access_iterator_tag, + typename iterator_traits<_Iter>::iterator_category>; + using pointer = typename iterator_traits<_Iter>::pointer; #if _LIBCPP_STD_VER > 17 - typedef _If<__is_cpp17_random_access_iterator<_Iter>::value, - random_access_iterator_tag, - bidirectional_iterator_tag> iterator_concept; + using iterator_concept = _If<__is_cpp17_random_access_iterator<_Iter>::value, + random_access_iterator_tag, + bidirectional_iterator_tag>; + using value_type = iter_value_t<_Iter>; + using difference_type = iter_difference_t<_Iter>; + using reference = iter_reference_t<_Iter>; +#else + using value_type = typename iterator_traits<_Iter>::value_type; + using difference_type = typename iterator_traits<_Iter>::difference_type; + using reference = typename iterator_traits<_Iter>::reference; #endif #ifndef _LIBCPP_ABI_NO_ITERATOR_BASES @@ -114,32 +131,75 @@ public: _Iter base() const {return current;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference operator*() const {_Iter __tmp = current; return *--__tmp;} + +#if _LIBCPP_STD_VER > 17 + _LIBCPP_INLINE_VISIBILITY + constexpr pointer operator->() const + requires is_pointer_v<_Iter> || requires(const _Iter i) { i.operator->(); } + { + if constexpr (is_pointer_v<_Iter>) { + return std::prev(current); + } else { + return std::prev(current).operator->(); + } + } +#else _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - pointer operator->() const {return _VSTD::addressof(operator*());} + pointer operator->() const { + return std::addressof(operator*()); + } +#endif // _LIBCPP_STD_VER > 17 + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator& operator++() {--current; return *this;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - reverse_iterator operator++(int) {reverse_iterator __tmp(*this); --current; return __tmp;} + reverse_iterator operator++(int) {reverse_iterator __tmp(*this); --current; return __tmp;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator& operator--() {++current; return *this;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - reverse_iterator operator--(int) {reverse_iterator __tmp(*this); ++current; return __tmp;} + reverse_iterator operator--(int) {reverse_iterator __tmp(*this); ++current; return __tmp;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - reverse_iterator operator+ (difference_type __n) const {return reverse_iterator(current - __n);} + reverse_iterator operator+(difference_type __n) const {return reverse_iterator(current - __n);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator& operator+=(difference_type __n) {current -= __n; return *this;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - reverse_iterator operator- (difference_type __n) const {return reverse_iterator(current + __n);} + reverse_iterator operator-(difference_type __n) const {return reverse_iterator(current + __n);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator& operator-=(difference_type __n) {current += __n; return *this;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - reference operator[](difference_type __n) const {return *(*this + __n);} + reference operator[](difference_type __n) const {return *(*this + __n);} + +#if _LIBCPP_STD_VER > 17 + _LIBCPP_HIDE_FROM_ABI friend constexpr + iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) + noexcept(is_nothrow_copy_constructible_v<_Iter> && + noexcept(ranges::iter_move(--declval<_Iter&>()))) { + auto __tmp = __i.base(); + return ranges::iter_move(--__tmp); + } + + template <indirectly_swappable<_Iter> _Iter2> + _LIBCPP_HIDE_FROM_ABI friend constexpr + void iter_swap(const reverse_iterator& __x, const reverse_iterator<_Iter2>& __y) + noexcept(is_nothrow_copy_constructible_v<_Iter> && + is_nothrow_copy_constructible_v<_Iter2> && + noexcept(ranges::iter_swap(--declval<_Iter&>(), --declval<_Iter2&>()))) { + auto __xtmp = __x.base(); + auto __ytmp = __y.base(); + ranges::iter_swap(--__xtmp, --__ytmp); + } +#endif // _LIBCPP_STD_VER > 17 }; template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) +#if _LIBCPP_STD_VER > 17 + requires requires { + { __x.base() == __y.base() } -> convertible_to<bool>; + } +#endif // _LIBCPP_STD_VER > 17 { return __x.base() == __y.base(); } @@ -148,6 +208,11 @@ template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) +#if _LIBCPP_STD_VER > 17 + requires requires { + { __x.base() > __y.base() } -> convertible_to<bool>; + } +#endif // _LIBCPP_STD_VER > 17 { return __x.base() > __y.base(); } @@ -156,6 +221,11 @@ template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) +#if _LIBCPP_STD_VER > 17 + requires requires { + { __x.base() != __y.base() } -> convertible_to<bool>; + } +#endif // _LIBCPP_STD_VER > 17 { return __x.base() != __y.base(); } @@ -164,6 +234,11 @@ template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) +#if _LIBCPP_STD_VER > 17 + requires requires { + { __x.base() < __y.base() } -> convertible_to<bool>; + } +#endif // _LIBCPP_STD_VER > 17 { return __x.base() < __y.base(); } @@ -172,6 +247,11 @@ template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) +#if _LIBCPP_STD_VER > 17 + requires requires { + { __x.base() <= __y.base() } -> convertible_to<bool>; + } +#endif // _LIBCPP_STD_VER > 17 { return __x.base() <= __y.base(); } @@ -180,6 +260,11 @@ template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) +#if _LIBCPP_STD_VER > 17 + requires requires { + { __x.base() >= __y.base() } -> convertible_to<bool>; + } +#endif // _LIBCPP_STD_VER > 17 { return __x.base() >= __y.base(); } @@ -221,6 +306,12 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i return reverse_iterator<_Iter>(__x.base() - __n); } +#if _LIBCPP_STD_VER > 17 +template <class _Iter1, class _Iter2> + requires (!sized_sentinel_for<_Iter1, _Iter2>) +inline constexpr bool disable_sized_sentinel_for<reverse_iterator<_Iter1>, reverse_iterator<_Iter2>> = true; +#endif // _LIBCPP_STD_VER > 17 + #if _LIBCPP_STD_VER > 11 template <class _Iter> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h b/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h index 8a7bf40d7f..bcca0fdb18 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h @@ -34,7 +34,7 @@ template<class _Tp, class ..._Args, class = decltype( )> _LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) { - _LIBCPP_ASSERT(__location, "null pointer given to construct_at"); + _LIBCPP_ASSERT(__location != nullptr, "null pointer given to construct_at"); return ::new (_VSTD::__voidify(*__location)) _Tp(_VSTD::forward<_Args>(__args)...); } @@ -52,7 +52,7 @@ _ForwardIterator __destroy(_ForwardIterator, _ForwardIterator); template <class _Tp, typename enable_if<!is_array<_Tp>::value, int>::type = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __destroy_at(_Tp* __loc) { - _LIBCPP_ASSERT(__loc, "null pointer given to destroy_at"); + _LIBCPP_ASSERT(__loc != nullptr, "null pointer given to destroy_at"); __loc->~_Tp(); } @@ -60,7 +60,7 @@ void __destroy_at(_Tp* __loc) { template <class _Tp, typename enable_if<is_array<_Tp>::value, int>::type = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __destroy_at(_Tp* __loc) { - _LIBCPP_ASSERT(__loc, "null pointer given to destroy_at"); + _LIBCPP_ASSERT(__loc != nullptr, "null pointer given to destroy_at"); _VSTD::__destroy(_VSTD::begin(*__loc), _VSTD::end(*__loc)); } #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h index bce2b3f9d6..3aa59bc2f7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h @@ -485,7 +485,7 @@ public: explicit shared_ptr(_Yp* __p) : __ptr_(__p) { unique_ptr<_Yp> __hold(__p); typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer<_Yp*, __shared_ptr_default_delete<_Tp, _Yp>, _AllocT > _CntrlBlk; + typedef __shared_ptr_pointer<_Yp*, __shared_ptr_default_delete<_Tp, _Yp>, _AllocT> _CntrlBlk; __cntrl_ = new _CntrlBlk(__p, __shared_ptr_default_delete<_Tp, _Yp>(), _AllocT()); __hold.release(); __enable_weak_this(__p, __p); @@ -501,7 +501,7 @@ public: { #endif // _LIBCPP_NO_EXCEPTIONS typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; + typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk; #ifndef _LIBCPP_CXX03_LANG __cntrl_ = new _CntrlBlk(__p, _VSTD::move(__d), _AllocT()); #else @@ -560,7 +560,7 @@ public: { #endif // _LIBCPP_NO_EXCEPTIONS typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; - typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT > _CntrlBlk; + typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk; #ifndef _LIBCPP_CXX03_LANG __cntrl_ = new _CntrlBlk(__p, _VSTD::move(__d), _AllocT()); #else @@ -693,8 +693,8 @@ public: #endif { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, _Dp, _AllocT > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT()); + typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, _Dp, _AllocT> _CntrlBlk; + __cntrl_ = new _CntrlBlk(__r.get(), std::move(__r.get_deleter()), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } __r.release(); @@ -717,7 +717,7 @@ public: typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, reference_wrapper<typename remove_reference<_Dp>::type>, - _AllocT > _CntrlBlk; + _AllocT> _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), _VSTD::ref(__r.get_deleter()), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h index 14e1bf0edf..4cc71243f2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h @@ -139,7 +139,7 @@ private: typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; template <bool _Dummy, class _Deleter = typename __dependent_type< - __identity<deleter_type>, _Dummy>::type> + __type_identity<deleter_type>, _Dummy>::type> using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG = typename enable_if<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>::type; @@ -353,7 +353,7 @@ private: typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; template <bool _Dummy, class _Deleter = typename __dependent_type< - __identity<deleter_type>, _Dummy>::type> + __type_identity<deleter_type>, _Dummy>::type> using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG = typename enable_if<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>::type; diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h index ad5a874e07..0f1cca033a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h @@ -128,8 +128,7 @@ namespace __end { { _LIBCPP_AUTO_CAST(end(__t)) } -> sentinel_for<iterator_t<_Tp>>; }; - class __fn { - public: + struct __fn { template <class _Tp, size_t _Np> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept requires (sizeof(_Tp) >= 0) // Disallow incomplete element types. diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h index 7193206d4c..9602ee1b2a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h @@ -9,7 +9,7 @@ #ifndef _LIBCPP___RANGES_TAKE_VIEW_H #define _LIBCPP___RANGES_TAKE_VIEW_H -#include <__algorithm/min.h> +#include <__algorithm/ranges_min.h> #include <__config> #include <__iterator/concepts.h> #include <__iterator/counted_iterator.h> @@ -118,15 +118,13 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr auto size() requires sized_range<_View> { auto __n = ranges::size(__base_); - // TODO: use ranges::min here. - return std::min(__n, static_cast<decltype(__n)>(__count_)); + return ranges::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 std::min(__n, static_cast<decltype(__n)>(__count_)); + return ranges::min(__n, static_cast<decltype(__n)>(__count_)); } }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__split_buffer b/contrib/libs/cxxsupp/libcxx/include/__split_buffer index dd789e8e9d..d02972da8d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__split_buffer +++ b/contrib/libs/cxxsupp/libcxx/include/__split_buffer @@ -1,6 +1,14 @@ // -*- C++ -*- -#ifndef _LIBCPP_SPLIT_BUFFER -#define _LIBCPP_SPLIT_BUFFER +//===----------------------------------------------------------------------===// +// +// 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___SPLIT_BUFFER +#define _LIBCPP___SPLIT_BUFFER #include <__algorithm/max.h> #include <__algorithm/move.h> @@ -633,4 +641,4 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // _LIBCPP_SPLIT_BUFFER +#endif // _LIBCPP___SPLIT_BUFFER diff --git a/contrib/libs/cxxsupp/libcxx/include/__threading_support b/contrib/libs/cxxsupp/libcxx/include/__threading_support index 2c3f1bf9d0..c4fe5ecb56 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__threading_support +++ b/contrib/libs/cxxsupp/libcxx/include/__threading_support @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_THREADING_SUPPORT -#define _LIBCPP_THREADING_SUPPORT +#ifndef _LIBCPP___THREADING_SUPPORT +#define _LIBCPP___THREADING_SUPPORT #include <__availability> #include <__chrono/convert_to_timespec.h> @@ -674,4 +674,4 @@ get_id() _NOEXCEPT _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_THREADING_SUPPORT +#endif // _LIBCPP___THREADING_SUPPORT diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm index 4d922807a2..f857870be9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/algorithm +++ b/contrib/libs/cxxsupp/libcxx/include/algorithm @@ -57,7 +57,6 @@ namespace ranges { constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 - template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 @@ -83,9 +82,22 @@ namespace ranges { indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr borrowed_iterator_t<R> find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<class T, class Proj = identity, + indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> + constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + + template<copyable T, class Proj = identity, + indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> + constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> + constexpr range_value_t<R> + min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 } -template <class InputIterator, class Predicate> constexpr bool // constexpr in C++20 all_of(InputIterator first, InputIterator last, Predicate pred); @@ -804,6 +816,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_find_if.h> #include <__algorithm/ranges_find_if_not.h> #include <__algorithm/ranges_max_element.h> +#include <__algorithm/ranges_min.h> #include <__algorithm/ranges_min_element.h> #include <__algorithm/ranges_mismatch.h> #include <__algorithm/ranges_swap_ranges.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/deque b/contrib/libs/cxxsupp/libcxx/include/deque index a1b22eb2f6..e2e61a5522 100644 --- a/contrib/libs/cxxsupp/libcxx/include/deque +++ b/contrib/libs/cxxsupp/libcxx/include/deque @@ -1316,7 +1316,7 @@ public: deque(_InputIter __f, _InputIter __l, const allocator_type& __a, typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0); deque(const deque& __c); - deque(const deque& __c, const __identity_t<allocator_type>& __a); + deque(const deque& __c, const __type_identity_t<allocator_type>& __a); deque& operator=(const deque& __c); @@ -1330,7 +1330,7 @@ public: _LIBCPP_INLINE_VISIBILITY deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value); _LIBCPP_INLINE_VISIBILITY - deque(deque&& __c, const __identity_t<allocator_type>& __a); + deque(deque&& __c, const __type_identity_t<allocator_type>& __a); _LIBCPP_INLINE_VISIBILITY deque& operator=(deque&& __c) _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value && @@ -1652,7 +1652,7 @@ deque<_Tp, _Allocator>::deque(const deque& __c) } template <class _Tp, class _Allocator> -deque<_Tp, _Allocator>::deque(const deque& __c, const __identity_t<allocator_type>& __a) +deque<_Tp, _Allocator>::deque(const deque& __c, const __type_identity_t<allocator_type>& __a) : __base(__a) { __append(__c.begin(), __c.end()); @@ -1695,7 +1695,7 @@ deque<_Tp, _Allocator>::deque(deque&& __c) template <class _Tp, class _Allocator> inline -deque<_Tp, _Allocator>::deque(deque&& __c, const __identity_t<allocator_type>& __a) +deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<allocator_type>& __a) : __base(_VSTD::move(__c), __a) { if (__a != __c.__alloc()) diff --git a/contrib/libs/cxxsupp/libcxx/include/exception b/contrib/libs/cxxsupp/libcxx/include/exception index a5a1f99cf9..82756a70c4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/exception +++ b/contrib/libs/cxxsupp/libcxx/include/exception @@ -279,10 +279,10 @@ throw_with_nested(_Tp&& __t) } template <class _From, class _To> -struct __can_dynamic_cast : public _LIBCPP_BOOL_CONSTANT( +struct __can_dynamic_cast : _BoolConstant< is_polymorphic<_From>::value && (!is_base_of<_To, _From>::value || - is_convertible<const _From*, const _To*>::value)) {}; + is_convertible<const _From*, const _To*>::value)> {}; template <class _Ep> inline _LIBCPP_INLINE_VISIBILITY diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format index ebb84dcc83..5ff62c3f0f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/format +++ b/contrib/libs/cxxsupp/libcxx/include/format @@ -125,6 +125,7 @@ namespace std { #include <__algorithm/clamp.h> #include <__config> #include <__debug> +#include <__format/buffer.h> #include <__format/format_arg.h> #include <__format/format_args.h> #include <__format/format_context.h> @@ -292,11 +293,12 @@ requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt basic_format_parse_context{__fmt, __args.__size()}, _VSTD::__format_context_create(_VSTD::move(__out_it), __args)); else { - basic_string<_CharT> __str; + __format::__format_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it)}; _VSTD::__format::__vformat_to( basic_format_parse_context{__fmt, __args.__size()}, - _VSTD::__format_context_create(_VSTD::back_inserter(__str), __args)); - return _VSTD::copy_n(__str.begin(), __str.size(), _VSTD::move(__out_it)); + _VSTD::__format_context_create(__buffer.make_output_iterator(), + __args)); + return _VSTD::move(__buffer).out(); } } @@ -417,12 +419,12 @@ requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt _VSTD::__format_context_create(_VSTD::move(__out_it), __args, _VSTD::move(__loc))); else { - basic_string<_CharT> __str; + __format::__format_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it)}; _VSTD::__format::__vformat_to( basic_format_parse_context{__fmt, __args.__size()}, - _VSTD::__format_context_create(_VSTD::back_inserter(__str), __args, - _VSTD::move(__loc))); - return _VSTD::copy_n(__str.begin(), __str.size(), _VSTD::move(__out_it)); + _VSTD::__format_context_create(__buffer.make_output_iterator(), + __args, _VSTD::move(__loc))); + return _VSTD::move(__buffer).out(); } } diff --git a/contrib/libs/cxxsupp/libcxx/include/forward_list b/contrib/libs/cxxsupp/libcxx/include/forward_list index e01a8e7189..4b3f4e2ec8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/forward_list +++ b/contrib/libs/cxxsupp/libcxx/include/forward_list @@ -691,7 +691,7 @@ public: __is_cpp17_input_iterator<_InputIterator>::value >::type* = nullptr); forward_list(const forward_list& __x); - forward_list(const forward_list& __x, const __identity_t<allocator_type>& __a); + forward_list(const forward_list& __x, const __type_identity_t<allocator_type>& __a); forward_list& operator=(const forward_list& __x); @@ -700,7 +700,7 @@ public: forward_list(forward_list&& __x) _NOEXCEPT_(is_nothrow_move_constructible<base>::value) : base(_VSTD::move(__x)) {} - forward_list(forward_list&& __x, const __identity_t<allocator_type>& __a); + forward_list(forward_list&& __x, const __type_identity_t<allocator_type>& __a); forward_list(initializer_list<value_type> __il); forward_list(initializer_list<value_type> __il, const allocator_type& __a); @@ -983,7 +983,7 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x) template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x, - const __identity_t<allocator_type>& __a) + const __type_identity_t<allocator_type>& __a) : base(__a) { insert_after(cbefore_begin(), __x.begin(), __x.end()); @@ -1004,7 +1004,7 @@ forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, - const __identity_t<allocator_type>& __a) + const __type_identity_t<allocator_type>& __a) : base(_VSTD::move(__x), __a) { if (base::__alloc() != __x.__alloc()) diff --git a/contrib/libs/cxxsupp/libcxx/include/iterator b/contrib/libs/cxxsupp/libcxx/include/iterator index 852fa353a9..8ba4d0ccb1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iterator +++ b/contrib/libs/cxxsupp/libcxx/include/iterator @@ -225,10 +225,17 @@ class reverse_iterator protected: Iterator current; public: - typedef Iterator iterator_type; - typedef typename iterator_traits<Iterator>::difference_type difference_type; - typedef typename iterator_traits<Iterator>::reference reference; - typedef typename iterator_traits<Iterator>::pointer pointer; + using iterator_type = Iterator; + using iterator_concept = see below; // since C++20 + using iterator_category = typename iterator_traits<Iterator>::iterator_category; // since C++17, until C++20 + using iterator_category = see below; // since C++20 + using value_type = typename iterator_traits<Iterator>::value_type; // since C++17, until C++20 + using value_type = iter_value_t<Iterator>; // since C++20 + using difference_type = typename iterator_traits<Iterator>::difference_type; // until C++20 + using difference_type = iter_difference_t<Iterator>; // since C++20 + using pointer = typename iterator_traits<Iterator>::pointer; + using reference = typename iterator_traits<Iterator>::reference; // until C++20 + using reference = iter_reference_t<Iterator>; // since C++20 constexpr reverse_iterator(); constexpr explicit reverse_iterator(Iterator x); @@ -236,7 +243,8 @@ public: template <class U> constexpr reverse_iterator& operator=(const reverse_iterator<U>& u); constexpr Iterator base() const; constexpr reference operator*() const; - constexpr pointer operator->() const; + constexpr pointer operator->() const; // until C++20 + constexpr pointer operator->() const requires see below; // since C++20 constexpr reverse_iterator& operator++(); constexpr reverse_iterator operator++(int); constexpr reverse_iterator& operator--(); @@ -245,7 +253,14 @@ public: constexpr reverse_iterator& operator+=(difference_type n); constexpr reverse_iterator operator- (difference_type n) const; constexpr reverse_iterator& operator-=(difference_type n); - constexpr reference operator[](difference_type n) const; + constexpr unspecified operator[](difference_type n) const; + + friend constexpr iter_rvalue_reference_t<Iterator> + iter_move(const reverse_iterator& i) noexcept(see below); + template<indirectly_swappable<Iterator> Iterator2> + friend constexpr void + iter_swap(const reverse_iterator& x, + const reverse_iterator<Iterator2>& y) noexcept(see below); }; template <class Iterator1, class Iterator2> @@ -254,11 +269,11 @@ operator==(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator template <class Iterator1, class Iterator2> constexpr bool // constexpr in C++17 -operator<(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); +operator!=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> constexpr bool // constexpr in C++17 -operator!=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); +operator<(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> constexpr bool // constexpr in C++17 @@ -266,11 +281,16 @@ operator>(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2 template <class Iterator1, class Iterator2> constexpr bool // constexpr in C++17 -operator>=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); +operator<=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> constexpr bool // constexpr in C++17 -operator<=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); +operator>=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); + +template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2> + constexpr compare_three_way_result_t<Iterator1, Iterator2> + operator<=>(const reverse_iterator<Iterator1>& x, + const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> constexpr auto @@ -285,6 +305,11 @@ operator+(typename reverse_iterator<Iterator>::difference_type n, template <class Iterator> constexpr reverse_iterator<Iterator> make_reverse_iterator(Iterator i); // C++14, constexpr in C++17 +template<class Iterator1, class Iterator2> + requires (!sized_sentinel_for<Iterator1, Iterator2>) + inline constexpr bool disable_sized_sentinel_for<reverse_iterator<Iterator1>, + reverse_iterator<Iterator2>> = true; + template <class Container> class back_insert_iterator : public iterator<output_iterator_tag, void, void, void, void> // until C++17 diff --git a/contrib/libs/cxxsupp/libcxx/include/list b/contrib/libs/cxxsupp/libcxx/include/list index cb0653d03a..dee0a075c7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/list +++ b/contrib/libs/cxxsupp/libcxx/include/list @@ -883,7 +883,7 @@ public: typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); list(const list& __c); - list(const list& __c, const __identity_t<allocator_type>& __a); + list(const list& __c, const __type_identity_t<allocator_type>& __a); _LIBCPP_INLINE_VISIBILITY list& operator=(const list& __c); #ifndef _LIBCPP_CXX03_LANG @@ -894,7 +894,7 @@ public: list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value); _LIBCPP_INLINE_VISIBILITY - list(list&& __c, const __identity_t<allocator_type>& __a); + list(list&& __c, const __type_identity_t<allocator_type>& __a); _LIBCPP_INLINE_VISIBILITY list& operator=(list&& __c) _NOEXCEPT_( @@ -1255,7 +1255,7 @@ list<_Tp, _Alloc>::list(const list& __c) } template <class _Tp, class _Alloc> -list<_Tp, _Alloc>::list(const list& __c, const __identity_t<allocator_type>& __a) +list<_Tp, _Alloc>::list(const list& __c, const __type_identity_t<allocator_type>& __a) : base(__a) { _VSTD::__debug_db_insert_c(this); @@ -1294,7 +1294,7 @@ inline list<_Tp, _Alloc>::list(list&& __c) template <class _Tp, class _Alloc> inline -list<_Tp, _Alloc>::list(list&& __c, const __identity_t<allocator_type>& __a) +list<_Tp, _Alloc>::list(list&& __c, const __type_identity_t<allocator_type>& __a) : base(__a) { _VSTD::__debug_db_insert_c(this); @@ -2020,6 +2020,17 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) } } +template <class _Iterator> +_LIBCPP_HIDE_FROM_ABI +bool __iterator_in_range(_Iterator __first, _Iterator __last, _Iterator __it) { + for (_Iterator __p = __first; __p != __last; ++__p) { + if (__p == __it) { + return true; + } + } + return false; +} + template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l) @@ -2030,16 +2041,10 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con "list::splice(iterator, list, iterator, iterator) called with second iterator not referring to the list argument"); _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__l)) == _VSTD::addressof(__c), "list::splice(iterator, list, iterator, iterator) called with third iterator not referring to the list argument"); + _LIBCPP_DEBUG_ASSERT(this != std::addressof(__c) || !std::__iterator_in_range(__f, __l, __p), + "list::splice(iterator, list, iterator, iterator)" + " called with the first iterator within the range of the second and third iterators"); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (this == _VSTD::addressof(__c)) - { - for (const_iterator __i = __f; __i != __l; ++__i) - _LIBCPP_DEBUG_ASSERT(__i != __p, - "list::splice(iterator, list, iterator, iterator)" - " called with the first iterator within the range of the second and third iterators"); - } -#endif if (__f != __l) { __link_pointer __first = __f.__ptr_; diff --git a/contrib/libs/cxxsupp/libcxx/include/locale b/contrib/libs/cxxsupp/libcxx/include/locale index 1e437027d4..64613c964d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/locale +++ b/contrib/libs/cxxsupp/libcxx/include/locale @@ -3236,9 +3236,9 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m int __fd) { __me = __mb; - for (unsigned __p = 0; __p < 4; ++__p) + for (char __p : __pat.field) { - switch (__pat.field[__p]) + switch (__p) { case money_base::none: __mi = __me; diff --git a/contrib/libs/cxxsupp/libcxx/include/map b/contrib/libs/cxxsupp/libcxx/include/map index fa7b877966..d90524b9a6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/map +++ b/contrib/libs/cxxsupp/libcxx/include/map @@ -958,8 +958,8 @@ public: typedef _Key key_type; typedef _Tp mapped_type; typedef pair<const key_type, mapped_type> value_type; - typedef __identity_t<_Compare> key_compare; - typedef __identity_t<_Allocator> allocator_type; + typedef __type_identity_t<_Compare> key_compare; + typedef __type_identity_t<_Allocator> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -1743,8 +1743,8 @@ public: typedef _Key key_type; typedef _Tp mapped_type; typedef pair<const key_type, mapped_type> value_type; - typedef __identity_t<_Compare> key_compare; - typedef __identity_t<_Allocator> allocator_type; + typedef __type_identity_t<_Compare> key_compare; + typedef __type_identity_t<_Allocator> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; diff --git a/contrib/libs/cxxsupp/libcxx/include/ratio b/contrib/libs/cxxsupp/libcxx/include/ratio index 8970ba3693..07376bf8d7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ratio +++ b/contrib/libs/cxxsupp/libcxx/include/ratio @@ -416,11 +416,11 @@ struct _LIBCPP_TEMPLATE_VIS ratio_subtract template <class _R1, class _R2> struct _LIBCPP_TEMPLATE_VIS ratio_equal - : public _LIBCPP_BOOL_CONSTANT((_R1::num == _R2::num && _R1::den == _R2::den)) {}; + : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {}; template <class _R1, class _R2> struct _LIBCPP_TEMPLATE_VIS ratio_not_equal - : public _LIBCPP_BOOL_CONSTANT((!ratio_equal<_R1, _R2>::value)) {}; + : _BoolConstant<!ratio_equal<_R1, _R2>::value> {}; // ratio_less @@ -479,19 +479,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL> template <class _R1, class _R2> struct _LIBCPP_TEMPLATE_VIS ratio_less - : public _LIBCPP_BOOL_CONSTANT((__ratio_less<_R1, _R2>::value)) {}; + : _BoolConstant<__ratio_less<_R1, _R2>::value> {}; template <class _R1, class _R2> struct _LIBCPP_TEMPLATE_VIS ratio_less_equal - : public _LIBCPP_BOOL_CONSTANT((!ratio_less<_R2, _R1>::value)) {}; + : _BoolConstant<!ratio_less<_R2, _R1>::value> {}; template <class _R1, class _R2> struct _LIBCPP_TEMPLATE_VIS ratio_greater - : public _LIBCPP_BOOL_CONSTANT((ratio_less<_R2, _R1>::value)) {}; + : _BoolConstant<ratio_less<_R2, _R1>::value> {}; template <class _R1, class _R2> struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal - : public _LIBCPP_BOOL_CONSTANT((!ratio_less<_R1, _R2>::value)) {}; + : _BoolConstant<!ratio_less<_R1, _R2>::value> {}; template <class _R1, class _R2> struct __ratio_gcd diff --git a/contrib/libs/cxxsupp/libcxx/include/set b/contrib/libs/cxxsupp/libcxx/include/set index 176369e81b..ca5ed7a530 100644 --- a/contrib/libs/cxxsupp/libcxx/include/set +++ b/contrib/libs/cxxsupp/libcxx/include/set @@ -503,9 +503,9 @@ public: // types: typedef _Key key_type; typedef key_type value_type; - typedef __identity_t<_Compare> key_compare; + typedef __type_identity_t<_Compare> key_compare; typedef key_compare value_compare; - typedef __identity_t<_Allocator> allocator_type; + typedef __type_identity_t<_Allocator> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -1036,9 +1036,9 @@ public: // types: typedef _Key key_type; typedef key_type value_type; - typedef __identity_t<_Compare> key_compare; + typedef __type_identity_t<_Compare> key_compare; typedef key_compare value_compare; - typedef __identity_t<_Allocator> allocator_type; + typedef __type_identity_t<_Allocator> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; diff --git a/contrib/libs/cxxsupp/libcxx/include/span b/contrib/libs/cxxsupp/libcxx/include/span index c65e6d261e..351cd6045e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/span +++ b/contrib/libs/cxxsupp/libcxx/include/span @@ -616,7 +616,13 @@ template<class _Tp, size_t _Sz> template<class _Tp, size_t _Sz> span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>; -#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +template<class _Container> + span(_Container&) -> span<typename _Container::value_type>; + +template<class _Container> + span(const _Container&) -> span<const typename _Container::value_type>; +#else template<ranges::contiguous_range _Range> span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>; #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/type_traits b/contrib/libs/cxxsupp/libcxx/include/type_traits index 6906ffa1bd..a90b9ca62e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/type_traits +++ b/contrib/libs/cxxsupp/libcxx/include/type_traits @@ -455,9 +455,6 @@ _LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value; #if _LIBCPP_STD_VER > 14 template <bool __b> using bool_constant = integral_constant<bool, __b>; -#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)> -#else -#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)> #endif template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {}; @@ -469,8 +466,8 @@ template <bool _Bp, class _Tp = void> using __enable_if_t _LIBCPP_NODEBUG = type template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; #endif -typedef _LIBCPP_BOOL_CONSTANT(true) true_type; -typedef _LIBCPP_BOOL_CONSTANT(false) false_type; +typedef integral_constant<bool, true> true_type; +typedef integral_constant<bool, false> false_type; template <bool _Val> using _BoolConstant _LIBCPP_NODEBUG = integral_constant<bool, _Val>; @@ -556,12 +553,6 @@ using _IsValidExpansion _LIBCPP_NODEBUG = decltype(__sfinae_test_impl<_Templ, _A template <class> struct __void_t { typedef void type; }; -template <class _Tp> -struct __identity { typedef _Tp type; }; - -template <class _Tp> -using __identity_t _LIBCPP_NODEBUG = typename __identity<_Tp>::type; - template <class _Tp, bool> struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {}; @@ -1386,6 +1377,13 @@ template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; #endif // type_identity + +template <class _Tp> +struct __type_identity { typedef _Tp type; }; + +template <class _Tp> +using __type_identity_t _LIBCPP_NODEBUG = typename __type_identity<_Tp>::type; + #if _LIBCPP_STD_VER > 17 template<class _Tp> struct type_identity { typedef _Tp type; }; template<class _Tp> using type_identity_t = typename type_identity<_Tp>::type; @@ -1406,7 +1404,7 @@ inline constexpr bool is_signed_v = __is_signed(_Tp); #else // __has_keyword(__is_signed) template <class _Tp, bool = is_integral<_Tp>::value> -struct __libcpp_is_signed_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(-1) < _Tp(0)) {}; +struct __libcpp_is_signed_impl : public _BoolConstant<(_Tp(-1) < _Tp(0))> {}; template <class _Tp> struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point @@ -1444,7 +1442,7 @@ inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); #else // __has_keyword(__is_unsigned) template <class _Tp, bool = is_integral<_Tp>::value> -struct __libcpp_is_unsigned_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(0) < _Tp(-1)) {}; +struct __libcpp_is_unsigned_impl : public _BoolConstant<(_Tp(0) < _Tp(-1))> {}; template <class _Tp> struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map index c854548950..c701e67b2e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_map +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map @@ -1014,9 +1014,9 @@ public: // types typedef _Key key_type; typedef _Tp mapped_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; + typedef __type_identity_t<_Hash> hasher; + typedef __type_identity_t<_Pred> key_equal; + typedef __type_identity_t<_Alloc> allocator_type; typedef pair<const key_type, mapped_type> value_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -1908,9 +1908,9 @@ public: // types typedef _Key key_type; typedef _Tp mapped_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; + typedef __type_identity_t<_Hash> hasher; + typedef __type_identity_t<_Pred> key_equal; + typedef __type_identity_t<_Alloc> allocator_type; typedef pair<const key_type, mapped_type> value_type; typedef value_type& reference; typedef const value_type& const_reference; diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_set b/contrib/libs/cxxsupp/libcxx/include/unordered_set index 2f902cc793..0dd53a298e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_set +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_set @@ -490,9 +490,9 @@ public: // types typedef _Value key_type; typedef key_type value_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; + typedef __type_identity_t<_Hash> hasher; + typedef __type_identity_t<_Pred> key_equal; + typedef __type_identity_t<_Alloc> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), @@ -639,36 +639,27 @@ public: pair<iterator, bool> emplace(_Args&&... __args) {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} template <class... _Args> - _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator emplace_hint(const_iterator __p, _Args&&... __args) - { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not" - " referring to this unordered_set"); - return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first; - } -#else - iterator emplace_hint(const_iterator, _Args&&... __args) - {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;} -#endif + _LIBCPP_INLINE_VISIBILITY + iterator emplace_hint(const_iterator __p, _Args&&... __args) { + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, + "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not" + " referring to this unordered_set"); + (void)__p; + return __table_.__emplace_unique(std::forward<_Args>(__args)...).first; + } _LIBCPP_INLINE_VISIBILITY pair<iterator, bool> insert(value_type&& __x) {return __table_.__insert_unique(_VSTD::move(__x));} _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator insert(const_iterator __p, value_type&& __x) - { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" - " referring to this unordered_set"); - return insert(_VSTD::move(__x)).first; - } -#else - iterator insert(const_iterator, value_type&& __x) - {return insert(_VSTD::move(__x)).first;} -#endif + iterator insert(const_iterator __p, value_type&& __x) { + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, + "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" + " referring to this unordered_set"); + (void)__p; + return insert(std::move(__x)).first; + } + _LIBCPP_INLINE_VISIBILITY void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} @@ -678,18 +669,13 @@ public: {return __table_.__insert_unique(__x);} _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator insert(const_iterator __p, const value_type& __x) - { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" - " referring to this unordered_set"); - return insert(__x).first; - } -#else - iterator insert(const_iterator, const value_type& __x) - {return insert(__x).first;} -#endif + iterator insert(const_iterator __p, const value_type& __x) { + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, + "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" + " referring to this unordered_set"); + (void)__p; + return insert(__x).first; + } template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); @@ -1164,9 +1150,9 @@ public: // types typedef _Value key_type; typedef key_type value_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; + typedef __type_identity_t<_Hash> hasher; + typedef __type_identity_t<_Pred> key_equal; + typedef __type_identity_t<_Alloc> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), diff --git a/contrib/libs/cxxsupp/libcxx/include/variant b/contrib/libs/cxxsupp/libcxx/include/variant index a0bde11d5b..704e5ebd91 100644 --- a/contrib/libs/cxxsupp/libcxx/include/variant +++ b/contrib/libs/cxxsupp/libcxx/include/variant @@ -562,7 +562,7 @@ private: inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fdiagonal_impl() { return __make_dispatch<_Fp, _Vs...>( - index_sequence<((void)__identity<_Vs>{}, _Ip)...>{}); + index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{}); } template <class _Fp, class... _Vs, size_t... _Is> @@ -1202,12 +1202,12 @@ private: struct __no_narrowing_check { template <class _Dest, class _Source> - using _Apply = __identity<_Dest>; + using _Apply = __type_identity<_Dest>; }; struct __narrowing_check { template <class _Dest> - static auto __test_impl(_Dest (&&)[1]) -> __identity<_Dest>; + static auto __test_impl(_Dest (&&)[1]) -> __type_identity<_Dest>; template <class _Dest, class _Source> using _Apply _LIBCPP_NODEBUG = decltype(__test_impl<_Dest>({declval<_Source>()})); }; @@ -1233,7 +1233,7 @@ template <class _Tp, size_t> struct __overload_bool { template <class _Up, class _Ap = __uncvref_t<_Up>> auto operator()(bool, _Up&&) const - -> enable_if_t<is_same_v<_Ap, bool>, __identity<_Tp>>; + -> enable_if_t<is_same_v<_Ap, bool>, __type_identity<_Tp>>; }; template <size_t _Idx> diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector index a99c84582b..d340417601 100644 --- a/contrib/libs/cxxsupp/libcxx/include/vector +++ b/contrib/libs/cxxsupp/libcxx/include/vector @@ -428,7 +428,7 @@ public: } vector(const vector& __x); - vector(const vector& __x, const __identity_t<allocator_type>& __a); + vector(const vector& __x, const __type_identity_t<allocator_type>& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(const vector& __x); @@ -448,7 +448,7 @@ public: #endif _LIBCPP_INLINE_VISIBILITY - vector(vector&& __x, const __identity_t<allocator_type>& __a); + vector(vector&& __x, const __type_identity_t<allocator_type>& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __x) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); @@ -1214,7 +1214,7 @@ vector<_Tp, _Allocator>::vector(const vector& __x) } template <class _Tp, class _Allocator> -vector<_Tp, _Allocator>::vector(const vector& __x, const __identity_t<allocator_type>& __a) +vector<_Tp, _Allocator>::vector(const vector& __x, const __type_identity_t<allocator_type>& __a) : __end_cap_(nullptr, __a) { _VSTD::__debug_db_insert_c(this); @@ -1250,7 +1250,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x) template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY -vector<_Tp, _Allocator>::vector(vector&& __x, const __identity_t<allocator_type>& __a) +vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a) : __end_cap_(nullptr, __a) { _VSTD::__debug_db_insert_c(this); @@ -2201,7 +2201,7 @@ public: #else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); #endif - vector(vector&& __v, const __identity_t<allocator_type>& __a); + vector(vector&& __v, const __type_identity_t<allocator_type>& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); @@ -2837,7 +2837,7 @@ inline _LIBCPP_INLINE_VISIBILITY vector<bool, _Allocator>::vector(vector&& __v) } template <class _Allocator> -vector<bool, _Allocator>::vector(vector&& __v, const __identity_t<allocator_type>& __a) +vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator_type>& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a) diff --git a/contrib/libs/cxxsupp/libcxx/src/assert.cpp b/contrib/libs/cxxsupp/libcxx/src/assert.cpp index 21a3863cd0..5445980072 100644 --- a/contrib/libs/cxxsupp/libcxx/src/assert.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/assert.cpp @@ -10,29 +10,13 @@ #include <__config> #include <cstdio> #include <cstdlib> -#include <string> _LIBCPP_BEGIN_NAMESPACE_STD -std::string __libcpp_debug_info::what() const { - string msg = __file_; - msg += ":" + std::to_string(__line_) + ": _LIBCPP_ASSERT '"; - msg += __pred_; - msg += "' failed. "; - msg += __msg_; - return msg; -} - -_LIBCPP_NORETURN void __libcpp_abort_debug_function(__libcpp_debug_info const& info) { - std::fprintf(stderr, "%s\n", info.what().c_str()); - std::abort(); -} - -_LIBCPP_CONSTINIT __libcpp_debug_function_type __libcpp_debug_function = __libcpp_abort_debug_function; - -bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) { - __libcpp_debug_function = __func; - return true; +_LIBCPP_WEAK +void __libcpp_assertion_handler(char const* __file, int __line, char const* __expression, char const* __message) { + std::fprintf(stderr, "%s:%d: libc++ assertion '%s' failed. %s\n", __file, __line, __expression, __message); + std::abort(); } _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h index 13f9e0f4c9..26130d71ab 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h @@ -111,7 +111,7 @@ format_string(const char* msg, ...) { } error_code capture_errno() { - _LIBCPP_ASSERT(errno, "Expected errno to be non-zero"); + _LIBCPP_ASSERT(errno != 0, "Expected errno to be non-zero"); return error_code(errno, generic_category()); } diff --git a/contrib/libs/cxxsupp/libcxx/src/random.cpp b/contrib/libs/cxxsupp/libcxx/src/random.cpp index 466b015772..38732462cf 100644 --- a/contrib/libs/cxxsupp/libcxx/src/random.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/random.cpp @@ -210,7 +210,7 @@ random_device::entropy() const noexcept return std::numeric_limits<result_type>::digits; return ent; -#elif defined(__OpenBSD__) || defined(_LIBCPP_USING_FUCHSIA_CPRNG) +#elif defined(_LIBCPP_USING_ARC4_RANDOM) || defined(_LIBCPP_USING_FUCHSIA_CPRNG) return std::numeric_limits<result_type>::digits; #else return 0; diff --git a/contrib/libs/cxxsupp/libcxx/ya.make b/contrib/libs/cxxsupp/libcxx/ya.make index 335049d0e8..0ebf537dbb 100644 --- a/contrib/libs/cxxsupp/libcxx/ya.make +++ b/contrib/libs/cxxsupp/libcxx/ya.make @@ -13,9 +13,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(2022-03-14) +VERSION(2022-03-29) -ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/d0af4276d62418ba9e54fec99b293d2fd7c92213.tar.gz) +ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/f0799465b2cc25738d7164774926a8ba3a63b98d.tar.gz) ADDINCL( GLOBAL contrib/libs/cxxsupp/libcxx/include diff --git a/contrib/libs/hyperscan/src/util/ue2string.h b/contrib/libs/hyperscan/src/util/ue2string.h index f436936d71..3ca69b826b 100644 --- a/contrib/libs/hyperscan/src/util/ue2string.h +++ b/contrib/libs/hyperscan/src/util/ue2string.h @@ -106,6 +106,7 @@ public: boost::random_access_traversal_tag, elem const> { public: + using iterator_category = typename std::random_access_iterator_tag; const_iterator() {} private: friend class boost::iterator_core_access; |