diff options
author | mikhnenko <mikhnenko@yandex-team.com> | 2023-11-07 19:02:37 +0300 |
---|---|---|
committer | mikhnenko <mikhnenko@yandex-team.com> | 2023-11-07 19:40:24 +0300 |
commit | c67f6bf0e38c3e450cf3fb320b3db868fd4b5fe8 (patch) | |
tree | d4662b2c9af0f2658f74c56d1d1e5cb672f34680 /contrib | |
parent | aa4bbf0349f5ee93d10e133c1d79cb5151f853f0 (diff) | |
download | ydb-c67f6bf0e38c3e450cf3fb320b3db868fd4b5fe8.tar.gz |
Upd libc++ to 18 Jun 2022 ff3989e6ae740a9b3adaad0e2bf7691ffd6dad12
```
[libc++] Add Implemented Papers section
[libc++] Enable -Wweak-vtables
[libc++] Make sure we install libc++abi headers on Apple
[libc++] Don't force -O2 when building the benchmarks
[libc++] Mark standard-mandated includes as such
[libc++] Implement std::boyer_moore{, _horspool}_searcher
[libc++] Unwrap reverse_iterator<reverse_iterator<Iter>> in __unwrap_iter
[libc++] Simplify __config a bit
[libc++][ranges] Implement `ranges::sort`.
[libc++] Remove now-unused experimental/filesystem config file
[libc++] Robust against C++20-hostile iterators
[libc++] Implement ranges::lexicographical_compare
[libc++] Removes unneeded <iterator> includes.
[libcxx] Fix allocator<void>::pointer in C++20 with removed members
[libcxx] Remove extraneous '---' lines in .clang-format files
[libc++][NFCI] span: replace enable_if with concepts
[libc++] Find a clang-format everybody is happy with
[libc++] Use explicit module cache path in tests
[libc++] Remove macros for IBM compiler
```
Diffstat (limited to 'contrib')
61 files changed, 1821 insertions, 1150 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h index 2a4e535c6f..886a1ac6ce 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h @@ -74,13 +74,6 @@ __copy_impl(reverse_iterator<_InIter> __first, return std::make_pair(__last, reverse_iterator<_OutIter>(std::__rewrap_iter(__result.base(), __result_first))); } -template <class _InIter, class _Sent, class _OutIter> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 -pair<reverse_iterator<reverse_iterator<_InIter> >, reverse_iterator<reverse_iterator<_OutIter> > > -__copy_impl(reverse_iterator<reverse_iterator<_InIter> > __first, - reverse_iterator<reverse_iterator<_Sent> > __last, - reverse_iterator<reverse_iterator<_OutIter> > __result); - template <class _InIter, class _Sent, class _OutIter, __enable_if_t<!(is_copy_constructible<_InIter>::value && is_copy_constructible<_Sent>::value @@ -101,18 +94,6 @@ __copy(_InIter __first, _Sent __last, _OutIter __result) { return std::make_pair(std::__rewrap_iter(__first, __ret.first), std::__rewrap_iter(__result, __ret.second)); } -// __unwrap_iter can't unwrap random_access_iterators, so we need to unwrap two reverse_iterators manually -template <class _InIter, class _Sent, class _OutIter> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 -pair<reverse_iterator<reverse_iterator<_InIter> >, reverse_iterator<reverse_iterator<_OutIter> > > -__copy_impl(reverse_iterator<reverse_iterator<_InIter> > __first, - reverse_iterator<reverse_iterator<_Sent> > __last, - reverse_iterator<reverse_iterator<_OutIter> > __result) { - auto __ret = std::__copy(__first.base().base(), __last.base().base(), __result.base().base()); - return std::make_pair(reverse_iterator<reverse_iterator<_InIter> >(reverse_iterator<_InIter>(__ret.first)), - reverse_iterator<reverse_iterator<_OutIter> >(reverse_iterator<_OutIter>(__ret.second))); -} - template <class _InputIterator, class _OutputIterator> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h new file mode 100644 index 0000000000..8141c4ed17 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// 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_MAKE_PROJECTED_H +#define _LIBCPP___ALGORITHM_MAKE_PROJECTED_H + +#include <__concepts/same_as.h> +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__utility/forward.h> + +#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_BEGIN_NAMESPACE_STD + +namespace ranges { + +template <class _Comp, class _Proj> +_LIBCPP_HIDE_FROM_ABI constexpr static +decltype(auto) __make_projected_comp(_Comp& __comp, _Proj& __proj) { + if constexpr (same_as<_Proj, identity>) { + // Avoid creating the lambda and just use the pristine comparator -- for certain algorithms, this would enable + // optimizations that rely on the type of the comparator. + return __comp; + + } else { + return [&](auto&& __lhs, auto&& __rhs) { + return std::invoke(__comp, + std::invoke(__proj, std::forward<decltype(__lhs)>(__lhs)), + std::invoke(__proj, std::forward<decltype(__rhs)>(__rhs))); + }; + } +} + +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_MAKE_PROJECTED_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h new file mode 100644 index 0000000000..fe709f7a7f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h @@ -0,0 +1,98 @@ +//===----------------------------------------------------------------------===// +// +// 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_LEXICOGRAPHICAL_COMPARE_H +#define _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_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 <__utility/move.h> + +#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_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __lexicographical_compare { +struct __fn { + + template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Proj1, class _Proj2, class _Comp> + _LIBCPP_HIDE_FROM_ABI constexpr static + bool __lexicographical_compare_impl(_Iter1 __first1, _Sent1 __last1, + _Iter2 __first2, _Sent2 __last2, + _Comp& __comp, + _Proj1& __proj1, + _Proj2& __proj2) { + while (__first2 != __last2) { + if (__first1 == __last1 + || std::invoke(__comp, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2))) + return true; + if (std::invoke(__comp, std::invoke(__proj2, *__first2), std::invoke(__proj1, *__first1))) + return false; + ++__first1; + ++__first2; + } + return false; + } + + template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1, + input_iterator _Iter2, sentinel_for<_Iter2> _Sent2, + class _Proj1 = identity, + class _Proj2 = identity, + indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Iter1 __first1, _Sent1 __last1, + _Iter2 __first2, _Sent2 __last2, + _Comp __comp = {}, + _Proj1 __proj1 = {}, + _Proj2 __proj2 = {}) const { + return __lexicographical_compare_impl(std::move(__first1), std::move(__last1), + std::move(__first2), std::move(__last2), + __comp, + __proj1, + __proj2); + } + + template <input_range _Range1, + input_range _Range2, + class _Proj1 = identity, + class _Proj2 = identity, + indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, + projected<iterator_t<_Range2>, _Proj2>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { + return __lexicographical_compare_impl(ranges::begin(__range1), ranges::end(__range1), + ranges::begin(__range2), ranges::end(__range2), + __comp, + __proj1, + __proj2); + } + +}; +} // namespace __lexicographical_compare + +inline namespace __cpo { + inline constexpr auto lexicographical_compare = __lexicographical_compare::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h new file mode 100644 index 0000000000..a446a53e06 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// 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_SORT_H +#define _LIBCPP___ALGORITHM_RANGES_SORT_H + +#include <__algorithm/make_projected.h> +#include <__algorithm/sort.h> +#include <__concepts/same_as.h> +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__functional/ranges_operations.h> +#include <__iterator/concepts.h> +#include <__iterator/iterator_traits.h> +#include <__iterator/next.h> +#include <__iterator/projected.h> +#include <__iterator/sortable.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/dangling.h> +#include <__utility/forward.h> +#include <__utility/move.h> + +#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_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __sort { + +struct __fn { + template <class _Iter, class _Sent, class _Comp, class _Proj> + _LIBCPP_HIDE_FROM_ABI constexpr static + _Iter __sort_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { + auto __last_iter = ranges::next(__first, __last); + + auto&& __projected_comp = __make_projected_comp(__comp, __proj); + std::__sort_impl(std::move(__first), __last_iter, __projected_comp); + + return __last_iter; + } + + template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity> + requires sortable<_Iter, _Comp, _Proj> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const { + return __sort_fn_impl(std::move(__first), std::move(__last), __comp, __proj); + } + + template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity> + requires sortable<iterator_t<_Range>, _Comp, _Proj> + _LIBCPP_HIDE_FROM_ABI constexpr + borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { + return __sort_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj); + } +}; + +} // namespace __sort + +inline namespace __cpo { + inline constexpr auto sort = __sort::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h index 0f463e14cc..f7406a5170 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h @@ -18,6 +18,7 @@ #include <__config> #include <__debug> #include <__functional/operations.h> +#include <__functional/ranges_operations.h> #include <__iterator/iterator_traits.h> #include <__utility/swap.h> #include <climits> @@ -115,6 +116,7 @@ _LIBCPP_HIDDEN unsigned __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _F return __r; } +// The comparator being simple is a prerequisite for using the branchless optimization. template <class _Tp> struct __is_simple_comparator : false_type {}; template <class _Tp> @@ -123,6 +125,12 @@ template <class _Tp> struct __is_simple_comparator<less<_Tp>&> : true_type {}; template <class _Tp> struct __is_simple_comparator<greater<_Tp>&> : true_type {}; +#if _LIBCPP_STD_VER > 17 +template <> +struct __is_simple_comparator<ranges::less&> : true_type {}; +template <> +struct __is_simple_comparator<ranges::greater&> : true_type {}; +#endif template <class _Compare, class _Iter, class _Tp = typename iterator_traits<_Iter>::value_type> using __use_branchless_sort = @@ -571,22 +579,28 @@ extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long do extern template _LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&); -template <class _RandomAccessIterator, class _Compare> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void -sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { +template <class _RandomAccessIterator, class _Comp> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) { _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last); - typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + using _Comp_ref = typename __comp_ref_type<_Comp>::type; if (__libcpp_is_constant_evaluated()) { - _VSTD::__partial_sort<_Comp_ref>(__first, __last, __last, _Comp_ref(__comp)); + std::__partial_sort<_Comp_ref>(__first, __last, __last, _Comp_ref(__comp)); } else { - _VSTD::__sort<_Comp_ref>(_VSTD::__unwrap_iter(__first), _VSTD::__unwrap_iter(__last), _Comp_ref(__comp)); + std::__sort<_Comp_ref>(std::__unwrap_iter(__first), std::__unwrap_iter(__last), _Comp_ref(__comp)); } } +template <class _RandomAccessIterator, class _Comp> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +void sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) { + std::__sort_impl(std::move(__first), std::move(__last), __comp); +} + template <class _RandomAccessIterator> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void sort(_RandomAccessIterator __first, - _RandomAccessIterator __last) { - _VSTD::sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +void sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { + std::sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h index be33194164..7d1807b7bb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h @@ -63,6 +63,22 @@ __unwrap_iter(_Iter __i) _NOEXCEPT return _Impl::__apply(__i); } +template <class _OrigIter, class _UnwrappedIter> +struct __rewrap_iter_impl { + static _LIBCPP_CONSTEXPR _OrigIter __apply(_OrigIter __first, _UnwrappedIter __result) { + // Precondition: __result is reachable from __first + // Precondition: _OrigIter is a contiguous iterator + return __first + (__result - std::__unwrap_iter(__first)); + } +}; + +template <class _OrigIter> +struct __rewrap_iter_impl<_OrigIter, _OrigIter> { + static _LIBCPP_CONSTEXPR _OrigIter __apply(_OrigIter, _OrigIter __result) { + return __result; + } +}; + template<class _OrigIter> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter, _OrigIter __result) @@ -70,13 +86,11 @@ _OrigIter __rewrap_iter(_OrigIter, _OrigIter __result) return __result; } -template<class _OrigIter, class _UnwrappedIter> +template<class _OrigIter, class _UnwrappedIter, class _Impl = __rewrap_iter_impl<_OrigIter, _UnwrappedIter> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter __first, _UnwrappedIter __result) { - // Precondition: __result is reachable from __first - // Precondition: _OrigIter is a contiguous iterator - return __first + (__result - _VSTD::__unwrap_iter(__first)); + return _Impl::__apply(__first, __result); } _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config index d575e2ef39..ae679eb9e5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config +++ b/contrib/libs/cxxsupp/libcxx/include/__config @@ -26,135 +26,133 @@ # define _LIBCPP_COMPILER_CLANG_BASED # define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000) #elif defined(__clang__) -#define _LIBCPP_COMPILER_CLANG +# define _LIBCPP_COMPILER_CLANG # define _LIBCPP_COMPILER_CLANG_BASED # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) #elif defined(__GNUC__) -#define _LIBCPP_COMPILER_GCC +# define _LIBCPP_COMPILER_GCC #elif defined(_MSC_VER) -#define _LIBCPP_COMPILER_MSVC +# define _LIBCPP_COMPILER_MSVC -#if _MSVC_LANG == 201705L -# define _LIBCPP_STD_VER 20 -#elif _MSVC_LANG == 201703L -# define _LIBCPP_STD_VER 17 -#else -# define _LIBCPP_STD_VER 14 -#endif +# if _MSVC_LANG == 201705L +# define _LIBCPP_STD_VER 20 +# elif _MSVC_LANG == 201703L +# define _LIBCPP_STD_VER 17 +# else +# define _LIBCPP_STD_VER 14 +# endif -#define Y_UCRT_INCLUDE_NEXT(x) <Y_UCRT_INCLUDE/x> -#define Y_MSVC_INCLUDE_NEXT(x) <Y_MSVC_INCLUDE/x> -#elif defined(__IBMCPP__) -#define _LIBCPP_COMPILER_IBM +# define Y_UCRT_INCLUDE_NEXT(x) <Y_UCRT_INCLUDE/x> +# define Y_MSVC_INCLUDE_NEXT(x) <Y_MSVC_INCLUDE/x> #endif #ifdef __cplusplus -#define _LIBCPP_VERSION 15000 +# define _LIBCPP_VERSION 15000 -#if __STDC_HOSTED__ == 0 -# define _LIBCPP_FREESTANDING -#endif +# if __STDC_HOSTED__ == 0 +# define _LIBCPP_FREESTANDING +# endif -#ifndef _LIBCPP_STD_VER -# if __cplusplus <= 201103L -# define _LIBCPP_STD_VER 11 -# elif __cplusplus <= 201402L -# define _LIBCPP_STD_VER 14 -# elif __cplusplus <= 201703L -# define _LIBCPP_STD_VER 17 -# elif __cplusplus <= 202002L -# define _LIBCPP_STD_VER 20 +# ifndef _LIBCPP_STD_VER +# if __cplusplus <= 201103L +# define _LIBCPP_STD_VER 11 +# elif __cplusplus <= 201402L +# define _LIBCPP_STD_VER 14 +# elif __cplusplus <= 201703L +# define _LIBCPP_STD_VER 17 +# elif __cplusplus <= 202002L +# define _LIBCPP_STD_VER 20 +# else +# define _LIBCPP_STD_VER 22 // current year, or date of c++2b ratification +# endif +# endif // _LIBCPP_STD_VER + +# if defined(__ELF__) +# define _LIBCPP_OBJECT_FORMAT_ELF 1 +# elif defined(__MACH__) +# define _LIBCPP_OBJECT_FORMAT_MACHO 1 +# elif defined(_WIN32) || defined(__CYGWIN__) +# define _LIBCPP_OBJECT_FORMAT_COFF 1 +# elif defined(__wasm__) +# define _LIBCPP_OBJECT_FORMAT_WASM 1 +# elif defined(_AIX) +# define _LIBCPP_OBJECT_FORMAT_XCOFF 1 # else -# define _LIBCPP_STD_VER 22 // current year, or date of c++2b ratification -# endif -#endif // _LIBCPP_STD_VER - -#if defined(__ELF__) -# define _LIBCPP_OBJECT_FORMAT_ELF 1 -#elif defined(__MACH__) -# define _LIBCPP_OBJECT_FORMAT_MACHO 1 -#elif defined(_WIN32) || defined(__CYGWIN__) -# define _LIBCPP_OBJECT_FORMAT_COFF 1 -#elif defined(__wasm__) -# define _LIBCPP_OBJECT_FORMAT_WASM 1 -#elif defined(_AIX) -# define _LIBCPP_OBJECT_FORMAT_XCOFF 1 -#else - // ... add new file formats here ... -#endif +// ... add new file formats here ... +# endif -#if _LIBCPP_ABI_VERSION >= 2 +# if _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. -# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. -# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE +# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE // Fix undefined behavior in how std::list stores its linked nodes. -# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __tree stores its end and parent nodes. -# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __hash_table stores its pointer types. -# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB -# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB -# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE +# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB +# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE // Define a key function for `bad_function_call` in the library, to centralize // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. -# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION // Override the default return value of exception::what() for // bad_function_call::what() with a string that is specific to // bad_function_call (see http://wg21.link/LWG2233). This is an ABI break // because it changes the vtable layout of bad_function_call. -# define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE // Enable optimized version of __do_get_(un)signed which avoids redundant copies. -# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET +# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET // In C++20 and later, don't derive std::plus from std::binary_function, // nor std::negate from std::unary_function. -# define _LIBCPP_ABI_NO_BINDER_BASES +# define _LIBCPP_ABI_NO_BINDER_BASES // Give reverse_iterator<T> one data member of type T, not two. // Also, in C++17 and later, don't derive iterator types from std::iterator. -# define _LIBCPP_ABI_NO_ITERATOR_BASES +# define _LIBCPP_ABI_NO_ITERATOR_BASES // Use the smallest possible integer type to represent the index of the variant. // Previously libc++ used "unsigned int" exclusively. -# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION +# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION // Unstable attempt to provide a more optimized std::function #ifdef __EMSCRIPTEN__ // XXX EMSCRIPTEN https://github.com/emscripten-core/emscripten/issues/11022 //# define _LIBCPP_ABI_OPTIMIZED_FUNCTION #else -# define _LIBCPP_ABI_OPTIMIZED_FUNCTION +# define _LIBCPP_ABI_OPTIMIZED_FUNCTION #endif // All the regex constants must be distinct and nonzero. -# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO +# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO // Use raw pointers, not wrapped ones, for std::span's iterator type. -# define _LIBCPP_ABI_SPAN_POINTER_ITERATORS +# define _LIBCPP_ABI_SPAN_POINTER_ITERATORS // Re-worked external template instantiations for std::string with a focus on // performance and fast-path inlining. -# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION +# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION // Enable clang::trivial_abi on std::unique_ptr. -# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI +# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI // Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr -# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI +# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI // std::random_device holds some state when it uses an implementation that gets // entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this // implementation to another one on a platform that has already shipped // std::random_device, one needs to retain the same object layout to remain ABI // compatible. This switch removes these workarounds for platforms that don't care // about ABI compatibility. -# define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT +# define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT // Don't export the legacy __basic_string_common class and its methods from the built library. -# define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON +# define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON // Don't export the legacy __vector_base_common class and its methods from the built library. -# define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON +# define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON // According to the Standard, `bitset::operator[] const` returns bool -# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL +# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL // Remove the base 10 implementation of std::to_chars from the dylib. // The implementation moved to the header, but we still export the symbols from // the dylib for backwards compatibility. -# define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 -#elif _LIBCPP_ABI_VERSION == 1 -# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF)||defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) +# define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 +# elif _LIBCPP_ABI_VERSION == 1 +# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) // Enable compiling copies of now inline methods into the dylib to support // applications compiled against older libraries. This is unnecessary with // COFF dllexport semantics, since dllexport forces a non-inline definition @@ -163,180 +161,180 @@ // the linker will take issue with the symbols in the shared object if the // weak inline methods get visibility (such as from -fvisibility-inlines-hidden), // so disable it. -# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS -# endif +# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS +# endif // Feature macros for disabling pre ABI v1 features. All of these options // are deprecated. -# if defined(__FreeBSD__) -# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +# if defined(__FreeBSD__) +# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +# endif # endif -#endif -#if defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_ABI_VERSION >= 2 +# if defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_ABI_VERSION >= 2 // Enable additional explicit instantiations of iostreams components. This // reduces the number of weak definitions generated in programs that use // iostreams by providing a single strong definition in the shared library. -# define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 +# define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 // Define a key function for `bad_function_call` in the library, to centralize // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. -# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION -#endif +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# endif -#define _LIBCPP_TOSTRING2(x) #x -#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) +# define _LIBCPP_TOSTRING2(x) # x +# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) -#if __cplusplus < 201103L -#define _LIBCPP_CXX03_LANG -#endif +# if __cplusplus < 201103L +# define _LIBCPP_CXX03_LANG +# endif -#ifndef __has_attribute -#define __has_attribute(__x) 0 -#endif +# ifndef __has_attribute +# define __has_attribute(__x) 0 +# endif -#ifndef __has_builtin -#define __has_builtin(__x) 0 -#endif +# ifndef __has_builtin +# define __has_builtin(__x) 0 +# endif -#ifndef __has_extension -#define __has_extension(__x) 0 -#endif +# ifndef __has_extension +# define __has_extension(__x) 0 +# endif -#ifndef __has_feature -#define __has_feature(__x) 0 -#endif +# ifndef __has_feature +# define __has_feature(__x) 0 +# endif -#ifndef __has_cpp_attribute -#define __has_cpp_attribute(__x) 0 -#endif +# ifndef __has_cpp_attribute +# define __has_cpp_attribute(__x) 0 +# endif // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by // the compiler and '1' otherwise. -#ifndef __is_identifier -#define __is_identifier(__x) 1 -#endif +# ifndef __is_identifier +# define __is_identifier(__x) 1 +# endif -#ifndef __has_declspec_attribute -#define __has_declspec_attribute(__x) 0 -#endif +# ifndef __has_declspec_attribute +# define __has_declspec_attribute(__x) 0 +# endif -#define __has_keyword(__x) !(__is_identifier(__x)) +# define __has_keyword(__x) !(__is_identifier(__x)) -#ifndef __has_include -#define __has_include(...) 0 -#endif +# ifndef __has_include +# define __has_include(...) 0 +# endif -#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L -#error "libc++ does not support using GCC with C++03. Please enable C++11" -#endif +# if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L +# error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11" +# endif // FIXME: ABI detection should be done via compiler builtin macros. This // is just a placeholder until Clang implements such macros. For now assume // that Windows compilers pretending to be MSVC++ target the Microsoft ABI, // and allow the user to explicitly specify the ABI to handle cases where this // heuristic falls short. -#if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" -#elif defined(_LIBCPP_ABI_FORCE_ITANIUM) -# define _LIBCPP_ABI_ITANIUM -#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# define _LIBCPP_ABI_MICROSOFT -#else -# if defined(_WIN32) && defined(_MSC_VER) +# if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) +# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" +# elif defined(_LIBCPP_ABI_FORCE_ITANIUM) +# define _LIBCPP_ABI_ITANIUM +# elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) # define _LIBCPP_ABI_MICROSOFT # else -# define _LIBCPP_ABI_ITANIUM +# if defined(_WIN32) && defined(_MSC_VER) +# define _LIBCPP_ABI_MICROSOFT +# else +# define _LIBCPP_ABI_ITANIUM +# endif # endif -#endif -#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) -# define _LIBCPP_ABI_VCRUNTIME -#endif +# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) +# define _LIBCPP_ABI_VCRUNTIME +# endif // Need to detect which libc we're using if we're on Linux. -#if defined(__linux__) -# include <features.h> -# if defined(__GLIBC_PREREQ) -# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) -# else -# define _LIBCPP_GLIBC_PREREQ(a, b) 0 -# endif // defined(__GLIBC_PREREQ) -#endif // defined(__linux__) - -#if defined(__MVS__) -# include <features.h> // for __NATIVE_ASCII_F -#endif - -#ifdef __LITTLE_ENDIAN__ -# if __LITTLE_ENDIAN__ -# define _LIBCPP_LITTLE_ENDIAN -# endif // __LITTLE_ENDIAN__ -#endif // __LITTLE_ENDIAN__ +# if defined(__linux__) +# include <features.h> +# if defined(__GLIBC_PREREQ) +# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) +# else +# define _LIBCPP_GLIBC_PREREQ(a, b) 0 +# endif // defined(__GLIBC_PREREQ) +# endif // defined(__linux__) -#ifdef __BIG_ENDIAN__ -# if __BIG_ENDIAN__ -# define _LIBCPP_BIG_ENDIAN -# endif // __BIG_ENDIAN__ -#endif // __BIG_ENDIAN__ +# if defined(__MVS__) +# include <features.h> // for __NATIVE_ASCII_F +# endif -#ifdef __BYTE_ORDER__ -# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# define _LIBCPP_LITTLE_ENDIAN -# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -# define _LIBCPP_BIG_ENDIAN -# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -#endif // __BYTE_ORDER__ - -#ifdef __FreeBSD__ -# include <sys/endian.h> -# include <osreldate.h> -# if _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -#endif // __FreeBSD__ - -#if defined(__NetBSD__) || defined(__OpenBSD__) -# include <sys/endian.h> -# if _BYTE_ORDER == _LITTLE_ENDIAN +# ifdef __LITTLE_ENDIAN__ +# if __LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# endif // __LITTLE_ENDIAN__ +# endif // __LITTLE_ENDIAN__ + +# ifdef __BIG_ENDIAN__ +# if __BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BIG_ENDIAN__ +# endif // __BIG_ENDIAN__ + +# ifdef __BYTE_ORDER__ +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# endif // __BYTE_ORDER__ + +# ifdef __FreeBSD__ +# include <sys/endian.h> +# include <osreldate.h> +# if _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# endif // __FreeBSD__ + +# if defined(__NetBSD__) || defined(__OpenBSD__) +# include <sys/endian.h> +# if _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# endif // defined(__NetBSD__) || defined(__OpenBSD__) + +# if defined(_WIN32) +# define _LIBCPP_WIN32API # define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -#endif // defined(__NetBSD__) || defined(__OpenBSD__) - -#if defined(_WIN32) -# define _LIBCPP_WIN32API -# define _LIBCPP_LITTLE_ENDIAN -# define _LIBCPP_SHORT_WCHAR 1 +# define _LIBCPP_SHORT_WCHAR 1 // Both MinGW and native MSVC provide a "MSVC"-like environment -# define _LIBCPP_MSVCRT_LIKE +# define _LIBCPP_MSVCRT_LIKE // If mingw not explicitly detected, assume using MS C runtime only if // a MS compatibility version is specified. -# if defined(_MSC_VER) && !defined(__MINGW32__) -# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library -# endif -# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__)) -# define _LIBCPP_HAS_BITSCAN64 -# endif -# define _LIBCPP_HAS_OPEN_WITH_WCHAR -#endif // defined(_WIN32) +# if defined(_MSC_VER) && !defined(__MINGW32__) +# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library +# endif +# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__)) +# define _LIBCPP_HAS_BITSCAN64 +# endif +# define _LIBCPP_HAS_OPEN_WITH_WCHAR +# endif // defined(_WIN32) -#ifdef __sun__ -# include <sys/isa_defs.h> -# ifdef _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else -# define _LIBCPP_BIG_ENDIAN -# endif -#endif // __sun__ +# ifdef __sun__ +# include <sys/isa_defs.h> +# ifdef _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else +# define _LIBCPP_BIG_ENDIAN +# endif +# endif // __sun__ -#if defined(_AIX) && !defined(__64BIT__) - // The size of wchar is 2 byte on 32-bit mode on AIX. -# define _LIBCPP_SHORT_WCHAR 1 -#endif +# if defined(_AIX) && !defined(__64BIT__) +// The size of wchar is 2 byte on 32-bit mode on AIX. +# define _LIBCPP_SHORT_WCHAR 1 +# endif // Libc++ supports various implementations of std::random_device. // @@ -376,711 +374,621 @@ // Use rand_s(), for use on Windows. // When this option is used, the token passed to `std::random_device`'s // constructor *must* be "/dev/urandom" -- anything else is an error. -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ - defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__) -# define _LIBCPP_USING_ARC4_RANDOM -#elif defined(__wasi__) || defined(__EMSCRIPTEN__) -# define _LIBCPP_USING_GETENTROPY -#elif defined(__Fuchsia__) -# define _LIBCPP_USING_FUCHSIA_CPRNG -#elif defined(__native_client__) -# define _LIBCPP_USING_NACL_RANDOM -#elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_USING_WIN32_RANDOM -#else -# define _LIBCPP_USING_DEV_RANDOM -#endif - -#if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -# include <endian.h> -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# elif __BYTE_ORDER == __BIG_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# else // __BYTE_ORDER == __BIG_ENDIAN -# error unable to determine endian +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ + defined(__DragonFly__) || defined(__sun__) +# define _LIBCPP_USING_ARC4_RANDOM +# elif defined(__wasi__) || defined(__EMSCRIPTEN__) +# define _LIBCPP_USING_GETENTROPY +# elif defined(__Fuchsia__) +# define _LIBCPP_USING_FUCHSIA_CPRNG +# elif defined(__native_client__) +# define _LIBCPP_USING_NACL_RANDOM +# elif defined(_LIBCPP_WIN32API) +# define _LIBCPP_USING_WIN32_RANDOM +# else +# define _LIBCPP_USING_DEV_RANDOM # endif -#endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) -#else -# define _LIBCPP_NO_CFI -#endif +# if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) +# include <endian.h> +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER == __BIG_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# else // __BYTE_ORDER == __BIG_ENDIAN +# error unable to determine endian +# endif +# endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -#ifndef _LIBCPP_CXX03_LANG -# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) -#elif defined(_LIBCPP_COMPILER_CLANG_BASED) -# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) -#else -# error "We don't know a correct way to implement alignof(T) in C++03 outside of Clang" -#endif +# if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) +# else +# define _LIBCPP_NO_CFI +# endif -#define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) +# ifndef _LIBCPP_CXX03_LANG -#if defined(_LIBCPP_COMPILER_CLANG_BASED) +# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) +# define _ALIGNAS_TYPE(x) alignas(x) +# define _ALIGNAS(x) alignas(x) +# define _LIBCPP_NORETURN [[noreturn]] +# define _NOEXCEPT noexcept +# define _NOEXCEPT_(x) noexcept(x) -#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ - (!defined(__arm__) || __ARM_ARCH_7K__ >= 2) -# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT -#endif +# else -#if __has_feature(cxx_alignas) -# define _ALIGNAS_TYPE(x) alignas(x) -# define _ALIGNAS(x) alignas(x) -#else -# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) -# define _ALIGNAS(x) __attribute__((__aligned__(x))) -#endif +# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) +# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) +# define _ALIGNAS(x) __attribute__((__aligned__(x))) +# define _LIBCPP_NORETURN __attribute__((noreturn)) +# define _LIBCPP_HAS_NO_NOEXCEPT +# define nullptr __nullptr +# define _NOEXCEPT throw() +# define _NOEXCEPT_(x) -#if __cplusplus < 201103L typedef __char16_t char16_t; typedef __char32_t char32_t; -#endif - -#if !__has_feature(cxx_exceptions) -# define _LIBCPP_NO_EXCEPTIONS -#endif - -#if __has_feature(cxx_attributes) -# define _LIBCPP_NORETURN [[noreturn]] -#else -# define _LIBCPP_NORETURN __attribute__ ((noreturn)) -#endif -#ifdef _LIBCPP_CXX03_LANG -# define nullptr __nullptr -#endif - -// Objective-C++ features (opt-in) -#if __has_feature(objc_arc) -#define _LIBCPP_HAS_OBJC_ARC -#endif - -#if __has_feature(objc_arc_weak) -#define _LIBCPP_HAS_OBJC_ARC_WEAK -#endif - -#if __has_extension(blocks) -# define _LIBCPP_HAS_EXTENSION_BLOCKS -#endif - -#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) -# define _LIBCPP_HAS_BLOCKS_RUNTIME -#endif +# endif -#if !(__has_feature(cxx_noexcept)) -#define _LIBCPP_HAS_NO_NOEXCEPT -#endif +# if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L +# define _LIBCPP_NO_EXCEPTIONS +# endif -#if !__has_feature(address_sanitizer) -#define _LIBCPP_HAS_NO_ASAN -#endif +# define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) -// Allow for build-time disabling of unsigned integer sanitization -#if __has_attribute(no_sanitize) -#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) -#endif +# if defined(_LIBCPP_COMPILER_CLANG_BASED) -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && (!defined(__arm__) || __ARM_ARCH_7K__ >= 2) +# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +# endif -#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ +// Objective-C++ features (opt-in) +# if __has_feature(objc_arc) +# define _LIBCPP_HAS_OBJC_ARC +# endif -#elif defined(_LIBCPP_COMPILER_GCC) +# if __has_feature(objc_arc_weak) +# define _LIBCPP_HAS_OBJC_ARC_WEAK +# endif -#define _ALIGNAS(x) __attribute__((__aligned__(x))) -#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) +# if __has_extension(blocks) +# define _LIBCPP_HAS_EXTENSION_BLOCKS +# endif -#define _LIBCPP_NORETURN __attribute__((noreturn)) +# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) +# define _LIBCPP_HAS_BLOCKS_RUNTIME +# endif -#if !defined(__EXCEPTIONS) -# define _LIBCPP_NO_EXCEPTIONS -#endif +# if !__has_feature(address_sanitizer) +# define _LIBCPP_HAS_NO_ASAN +# endif -#if !defined(__SANITIZE_ADDRESS__) -#define _LIBCPP_HAS_NO_ASAN -#endif +// Allow for build-time disabling of unsigned integer sanitization +# if __has_attribute(no_sanitize) +# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) +# endif -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) -#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ +# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ -#elif defined(_LIBCPP_COMPILER_MSVC) +# elif defined(_LIBCPP_COMPILER_GCC) -#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) +# if !defined(__SANITIZE_ADDRESS__) +# define _LIBCPP_HAS_NO_ASAN +# endif -#if _MSC_VER < 1900 -#error "MSVC versions prior to Visual Studio 2015 are not supported" -#endif +# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) -#define _LIBCPP_HAS_IS_FINAL -#define __alignof__ __alignof -#define _LIBCPP_NORETURN __declspec(noreturn) -#define _ALIGNAS(x) __declspec(align(x)) -#define _ALIGNAS_TYPE(x) alignas(x) - -#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) -#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) -#undef __has_feature -#define __has_feature(x) __has_feature_##x -#define __has_feature_is_standard_layout 1 -#define __has_feature_is_trivially_copyable 1 -#define __has_feature_is_trivial 1 -#define __has_feature_is_pod 1 -#define __has_feature_cxx_noexcept 1 -#define __has_feature_has_nothrow_assign 1 -#define __has_feature_is_union 1 -#define __has_feature_is_class 1 -#define __has_feature_is_enum 1 -#define __has_feature_is_convertible_to 1 -#define __has_feature_is_empty 1 -#define __has_feature_is_polymorphic 1 -#define __has_feature_has_virtual_destructor 1 -#define __has_feature_cxx_reference_qualified_functions 1 -#define __has_feature_is_constructible 1 -#define __has_feature_is_trivially_constructible 1 -#define __has_feature_is_trivially_assignable 1 -#define __has_feature_is_convertible_to 1 -#define __has_feature_has_trivial_constructor 1 -#define __has_feature_has_trivial_destructor 1 -#define __has_feature_has_nothrow_constructor 1 -#define __has_feature_has_nothrow_copy 1 -#define __has_feature_cxx_explicit_conversions 1 - -#undef __has_builtin -#define __has_builtin(x) __has_builtin_##x -#define __has_builtin___builtin_addressof 1 -#if defined(_MSC_VER) && defined(__CUDACC__) - // nvcc fails to compile __builtin_is_constant_evaluated() at the time -# define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED 1 -#else -# define __has_builtin___builtin_is_constant_evaluated 1 -#endif +# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ -#define _LIBCPP_WEAK +# elif defined(_LIBCPP_COMPILER_MSVC) -#define _LIBCPP_HAS_NO_ASAN +# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) -#define _LIBCPP_ALWAYS_INLINE __forceinline +# if _MSC_VER < 1900 +# error "MSVC versions prior to Visual Studio 2015 are not supported" +# endif -#define _LIBCPP_HAS_NO_VECTOR_EXTENSION +# define _LIBCPP_NORETURN __declspec(noreturn) -#define _LIBCPP_DISABLE_EXTENSION_WARNING +# define _LIBCPP_WEAK -#elif defined(_LIBCPP_COMPILER_IBM) +# define _LIBCPP_HAS_NO_ASAN -#define _ALIGNAS(x) __attribute__((__aligned__(x))) -#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) -#define _ATTRIBUTE(x) __attribute__((x)) -#define _LIBCPP_NORETURN __attribute__((noreturn)) +# define _LIBCPP_ALWAYS_INLINE __forceinline -#define _LIBCPP_HAS_NO_UNICODE_CHARS +# define _LIBCPP_HAS_NO_VECTOR_EXTENSION -#if defined(_AIX) -#define __MULTILOCALE_API -#endif +# define _LIBCPP_DISABLE_EXTENSION_WARNING -#define _LIBCPP_HAS_NO_ASAN +# endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC] -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# if defined(_LIBCPP_OBJECT_FORMAT_COFF) -#define _LIBCPP_HAS_NO_VECTOR_EXTENSION +# ifdef _DLL +# define _LIBCPP_CRT_FUNC __declspec(dllimport) +# else +# define _LIBCPP_CRT_FUNC +# endif -#define _LIBCPP_DISABLE_EXTENSION_WARNING +# if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY)) +# define _LIBCPP_DLL_VIS +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_EXPORTED_FROM_ABI +# elif defined(_LIBCPP_BUILDING_LIBRARY) +# define _LIBCPP_DLL_VIS __declspec(dllexport) +# if defined(__MINGW32__) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# else +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS +# endif +# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport) +# else +# define _LIBCPP_DLL_VIS __declspec(dllimport) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport) +# endif -#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] +# define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS +# define _LIBCPP_HIDDEN +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# define _LIBCPP_TEMPLATE_VIS +# define _LIBCPP_TEMPLATE_DATA_VIS +# define _LIBCPP_ENUM_VIS -#if defined(_LIBCPP_OBJECT_FORMAT_COFF) +# endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) -#ifdef _DLL -# define _LIBCPP_CRT_FUNC __declspec(dllimport) -#else -# define _LIBCPP_CRT_FUNC -#endif +# ifndef _LIBCPP_HIDDEN +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_HIDDEN __attribute__((__visibility__("hidden"))) +# else +# define _LIBCPP_HIDDEN +# endif +# endif -#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY)) -# define _LIBCPP_DLL_VIS -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS -# define _LIBCPP_EXPORTED_FROM_ABI -#elif defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_DLL_VIS __declspec(dllexport) -# if defined(__MINGW32__) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# else -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS +# ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +// The inline should be removed once PR32114 is resolved +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN +# else +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# endif # endif -# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport) -#else -# define _LIBCPP_DLL_VIS __declspec(dllimport) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS -# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport) -#endif -#define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS -#define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS -#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS -#define _LIBCPP_HIDDEN -#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -#define _LIBCPP_TEMPLATE_VIS -#define _LIBCPP_TEMPLATE_DATA_VIS -#define _LIBCPP_ENUM_VIS +# ifndef _LIBCPP_FUNC_VIS +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_FUNC_VIS __attribute__((__visibility__("default"))) +# else +# define _LIBCPP_FUNC_VIS +# endif +# endif -#endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) +# ifndef _LIBCPP_TYPE_VIS +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_TYPE_VIS __attribute__((__visibility__("default"))) +# else +# define _LIBCPP_TYPE_VIS +# endif +# endif -#ifndef _LIBCPP_HIDDEN -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) -# else -# define _LIBCPP_HIDDEN +# ifndef _LIBCPP_TEMPLATE_VIS +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# if __has_attribute(__type_visibility__) +# define _LIBCPP_TEMPLATE_VIS __attribute__((__type_visibility__("default"))) +# else +# define _LIBCPP_TEMPLATE_VIS __attribute__((__visibility__("default"))) +# endif +# else +# define _LIBCPP_TEMPLATE_VIS +# endif # endif -#endif -#ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -// The inline should be removed once PR32114 is resolved -# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN -# else -# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# ifndef _LIBCPP_TEMPLATE_DATA_VIS +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_TEMPLATE_DATA_VIS __attribute__((__visibility__("default"))) +# else +# define _LIBCPP_TEMPLATE_DATA_VIS +# endif # endif -#endif -#ifndef _LIBCPP_FUNC_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_FUNC_VIS +# ifndef _LIBCPP_EXPORTED_FROM_ABI +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_EXPORTED_FROM_ABI __attribute__((__visibility__("default"))) +# else +# define _LIBCPP_EXPORTED_FROM_ABI +# endif # endif -#endif -#ifndef _LIBCPP_TYPE_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_TYPE_VIS +# ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS # endif -#endif -#ifndef _LIBCPP_TEMPLATE_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# if __has_attribute(__type_visibility__) -# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default"))) +# ifndef _LIBCPP_EXCEPTION_ABI +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_EXCEPTION_ABI __attribute__((__visibility__("default"))) # else -# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default"))) +# define _LIBCPP_EXCEPTION_ABI # endif -# else -# define _LIBCPP_TEMPLATE_VIS # endif -#endif -#ifndef _LIBCPP_TEMPLATE_DATA_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_TEMPLATE_DATA_VIS __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_TEMPLATE_DATA_VIS +# ifndef _LIBCPP_ENUM_VIS +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) +# define _LIBCPP_ENUM_VIS __attribute__((__type_visibility__("default"))) +# else +# define _LIBCPP_ENUM_VIS +# endif # endif -#endif -#ifndef _LIBCPP_EXPORTED_FROM_ABI -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXPORTED_FROM_ABI __attribute__((__visibility__("default"))) -# else -# define _LIBCPP_EXPORTED_FROM_ABI +# ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__((__visibility__("default"))) +# else +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# endif # endif -#endif - -#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS -#define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS -#endif -#ifndef _LIBCPP_EXCEPTION_ABI -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_EXCEPTION_ABI +# ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS # endif -#endif -#ifndef _LIBCPP_ENUM_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) -# define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default"))) +# if __has_attribute(internal_linkage) +# define _LIBCPP_INTERNAL_LINKAGE __attribute__((internal_linkage)) # else -# define _LIBCPP_ENUM_VIS +# define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE # endif -#endif -#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default"))) +# if __has_attribute(exclude_from_explicit_instantiation) +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__)) # else -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +// Try to approximate the effect of exclude_from_explicit_instantiation +// (which is that entities are not assumed to be provided by explicit +// template instantiations in the dylib) by always inlining those entities. +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE # endif -#endif - -#ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -#define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -#endif - -#if __has_attribute(internal_linkage) -# define _LIBCPP_INTERNAL_LINKAGE __attribute__ ((internal_linkage)) -#else -# define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE -#endif - -#if __has_attribute(exclude_from_explicit_instantiation) -# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__ ((__exclude_from_explicit_instantiation__)) -#else - // Try to approximate the effect of exclude_from_explicit_instantiation - // (which is that entities are not assumed to be provided by explicit - // template instantiations in the dylib) by always inlining those entities. -# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE -#endif -#ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU -# ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT -# define _LIBCPP_HIDE_FROM_ABI_PER_TU 0 -# else -# define _LIBCPP_HIDE_FROM_ABI_PER_TU 1 +# ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU +# ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT +# define _LIBCPP_HIDE_FROM_ABI_PER_TU 0 +# else +# define _LIBCPP_HIDE_FROM_ABI_PER_TU 1 +# endif # endif -#endif -#ifndef _LIBCPP_HIDE_FROM_ABI -# if _LIBCPP_HIDE_FROM_ABI_PER_TU -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE -# else -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION +# ifndef _LIBCPP_HIDE_FROM_ABI +# if _LIBCPP_HIDE_FROM_ABI_PER_TU +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE +# else +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION +# endif # endif -#endif -#ifdef _LIBCPP_BUILDING_LIBRARY -# if _LIBCPP_ABI_VERSION > 1 -# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI +# ifdef _LIBCPP_BUILDING_LIBRARY +# if _LIBCPP_ABI_VERSION > 1 +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI +# else +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 +# endif # else -# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI # endif -#else -# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI -#endif // Just so we can migrate to the new macros gradually. -#define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI +# define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI // Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect. -#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE { -#define _LIBCPP_END_NAMESPACE_STD } } -#define _VSTD std -_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD +// clang-format off +# define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE { +# define _LIBCPP_END_NAMESPACE_STD }} +# define _VSTD std -#if _LIBCPP_STD_VER > 14 -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { -#else -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { -#endif - -#define _LIBCPP_END_NAMESPACE_FILESYSTEM \ - _LIBCPP_END_NAMESPACE_STD } } +_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD -#define _VSTD_FS std::__fs::filesystem +# if _LIBCPP_STD_VER > 14 +# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { +# else +# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { +# endif -#if __has_attribute(__enable_if__) -# define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, ""))) -#endif +# define _LIBCPP_END_NAMESPACE_FILESYSTEM _LIBCPP_END_NAMESPACE_STD }} +// clang-format on -#ifndef _LIBCPP_HAS_NO_NOEXCEPT -# define _NOEXCEPT noexcept -# define _NOEXCEPT_(x) noexcept(x) -#else -# define _NOEXCEPT throw() -# define _NOEXCEPT_(x) -#endif +# define _VSTD_FS std::__fs::filesystem -#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS -typedef unsigned short char16_t; -typedef unsigned int char32_t; -#endif +# if __has_attribute(__enable_if__) +# define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, ""))) +# endif -#ifndef __SIZEOF_INT128__ -#define _LIBCPP_HAS_NO_INT128 -#endif +# ifndef __SIZEOF_INT128__ +# define _LIBCPP_HAS_NO_INT128 +# endif -#ifdef _LIBCPP_CXX03_LANG -# define static_assert(...) _Static_assert(__VA_ARGS__) -# define decltype(...) __decltype(__VA_ARGS__) -#endif // _LIBCPP_CXX03_LANG +# ifdef _LIBCPP_CXX03_LANG +# define static_assert(...) _Static_assert(__VA_ARGS__) +# define decltype(...) __decltype(__VA_ARGS__) +# endif // _LIBCPP_CXX03_LANG -#ifdef _LIBCPP_CXX03_LANG -# define _LIBCPP_CONSTEXPR -#else -# define _LIBCPP_CONSTEXPR constexpr -#endif +# ifdef _LIBCPP_CXX03_LANG +# define _LIBCPP_CONSTEXPR +# else +# define _LIBCPP_CONSTEXPR constexpr +# endif -#ifndef __cpp_consteval -# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR -#else -# define _LIBCPP_CONSTEVAL consteval -#endif +# ifndef __cpp_consteval +# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR +# else +# define _LIBCPP_CONSTEVAL consteval +# endif -#ifdef __GNUC__ -# define _LIBCPP_NOALIAS __attribute__((__malloc__)) -#else -# define _LIBCPP_NOALIAS -#endif +# ifdef __GNUC__ +# define _LIBCPP_NOALIAS __attribute__((__malloc__)) +# else +# define _LIBCPP_NOALIAS +# endif -#if __has_attribute(using_if_exists) -# define _LIBCPP_USING_IF_EXISTS __attribute__((using_if_exists)) -#else -# define _LIBCPP_USING_IF_EXISTS -#endif +# if __has_attribute(using_if_exists) +# define _LIBCPP_USING_IF_EXISTS __attribute__((using_if_exists)) +# else +# define _LIBCPP_USING_IF_EXISTS +# endif -#ifdef _LIBCPP_CXX03_LANG -# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx -# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ - __lx __v_; \ - _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \ - _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ - _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} \ - }; -#else // _LIBCPP_CXX03_LANG -# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x -# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) -#endif // _LIBCPP_CXX03_LANG - -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \ - defined(__sun__) || defined(__NetBSD__) -#define _LIBCPP_LOCALE__L_EXTENSIONS 1 -#endif +# ifdef _LIBCPP_CXX03_LANG +# define _LIBCPP_DECLARE_STRONG_ENUM(x) \ + struct _LIBCPP_TYPE_VIS x { \ + enum __lx +// clang-format off +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ + __lx __v_; \ + _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \ + _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ + _LIBCPP_INLINE_VISIBILITY operator int() const { return __v_; } \ + }; +// clang-format on + +# else // _LIBCPP_CXX03_LANG +# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) +# endif // _LIBCPP_CXX03_LANG + +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || defined(__sun__) || \ + defined(__NetBSD__) +# define _LIBCPP_LOCALE__L_EXTENSIONS 1 +# endif -#ifdef __FreeBSD__ -#define _DECLARE_C99_LDBL_MATH 1 -#endif +# ifdef __FreeBSD__ +# define _DECLARE_C99_LDBL_MATH 1 +# endif // If we are getting operator new from the MSVC CRT, then allocation overloads // for align_val_t were added in 19.12, aka VS 2017 version 15.3. -#if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912 -# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION -#elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new) - // We're deferring to Microsoft's STL to provide aligned new et al. We don't - // have it unless the language feature test macro is defined. -# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION -#elif defined(__MVS__) -# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION -#endif +# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912 +# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new) +// We're deferring to Microsoft's STL to provide aligned new et al. We don't +// have it unless the language feature test macro is defined. +# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +# elif defined(__MVS__) +# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +# endif -#if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \ - (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) -# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION -#endif +# if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# endif -#if defined(__APPLE__) || defined(__FreeBSD__) -#define _LIBCPP_HAS_DEFAULTRUNELOCALE -#endif +# if defined(__APPLE__) || defined(__FreeBSD__) +# define _LIBCPP_HAS_DEFAULTRUNELOCALE +# endif -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) -#define _LIBCPP_WCTYPE_IS_MASK -#endif +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) +# define _LIBCPP_WCTYPE_IS_MASK +# endif -#if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) -#define _LIBCPP_HAS_NO_CHAR8_T -#endif +# if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) +# define _LIBCPP_HAS_NO_CHAR8_T +# endif // Deprecation macros. // // Deprecations warnings are always enabled, except when users explicitly opt-out // by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS. -#if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) -# if __has_attribute(deprecated) -# define _LIBCPP_DEPRECATED __attribute__ ((deprecated)) -# elif _LIBCPP_STD_VER > 11 -# define _LIBCPP_DEPRECATED [[deprecated]] +# if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) +# if __has_attribute(deprecated) +# define _LIBCPP_DEPRECATED __attribute__((deprecated)) +# define _LIBCPP_DEPRECATED_(m) __attribute__((deprected(m))) +# elif _LIBCPP_STD_VER > 11 +# define _LIBCPP_DEPRECATED [[deprecated]] +# define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]] +# else +# define _LIBCPP_DEPRECATED +# define _LIBCPP_DEPRECATED_(m) +# endif # else # define _LIBCPP_DEPRECATED +# define _LIBCPP_DEPRECATED_(m) # endif -#else -# define _LIBCPP_DEPRECATED -#endif -#if !defined(_LIBCPP_CXX03_LANG) -# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX11 -#endif +# if !defined(_LIBCPP_CXX03_LANG) +# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED +# else +# define _LIBCPP_DEPRECATED_IN_CXX11 +# endif -#if _LIBCPP_STD_VER > 11 -# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX14 -#endif +# if _LIBCPP_STD_VER > 11 +# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED +# else +# define _LIBCPP_DEPRECATED_IN_CXX14 +# endif -#if _LIBCPP_STD_VER > 14 -# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX17 -#endif +# if _LIBCPP_STD_VER > 14 +# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED +# else +# define _LIBCPP_DEPRECATED_IN_CXX17 +# endif -#if _LIBCPP_STD_VER > 17 -# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX20 -#endif +# if _LIBCPP_STD_VER > 17 +# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED +# else +# define _LIBCPP_DEPRECATED_IN_CXX20 +# endif -#if !defined(_LIBCPP_HAS_NO_CHAR8_T) -# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_WITH_CHAR8_T -#endif +# if !defined(_LIBCPP_HAS_NO_CHAR8_T) +# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED +# else +# define _LIBCPP_DEPRECATED_WITH_CHAR8_T +# endif // Macros to enter and leave a state where deprecation warnings are suppressed. -#if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -# define _LIBCPP_SUPPRESS_DEPRECATED_POP \ - _Pragma("GCC diagnostic pop") -#else -# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH -# define _LIBCPP_SUPPRESS_DEPRECATED_POP -#endif +# if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +# define _LIBCPP_SUPPRESS_DEPRECATED_POP _Pragma("GCC diagnostic pop") +# else +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH +# define _LIBCPP_SUPPRESS_DEPRECATED_POP +# endif -#if _LIBCPP_STD_VER <= 11 -# define _LIBCPP_EXPLICIT_AFTER_CXX11 -#else -# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit -#endif +# if _LIBCPP_STD_VER <= 11 +# define _LIBCPP_EXPLICIT_AFTER_CXX11 +# else +# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit +# endif -#if _LIBCPP_STD_VER > 11 -# define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr -#else -# define _LIBCPP_CONSTEXPR_AFTER_CXX11 -#endif +# if _LIBCPP_STD_VER > 11 +# define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr +# else +# define _LIBCPP_CONSTEXPR_AFTER_CXX11 +# endif -#if _LIBCPP_STD_VER > 14 -# define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr -#else -# define _LIBCPP_CONSTEXPR_AFTER_CXX14 -#endif +# if _LIBCPP_STD_VER > 14 +# define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr +# else +# define _LIBCPP_CONSTEXPR_AFTER_CXX14 +# endif -#if _LIBCPP_STD_VER > 17 -# define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr -#else -# define _LIBCPP_CONSTEXPR_AFTER_CXX17 -#endif +# if _LIBCPP_STD_VER > 17 +# define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr +# else +# define _LIBCPP_CONSTEXPR_AFTER_CXX17 +# endif -#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_NODISCARD [[nodiscard]] -#elif defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_CXX03_LANG) -# define _LIBCPP_NODISCARD [[clang::warn_unused_result]] -#else +# if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC) +# define _LIBCPP_NODISCARD [[nodiscard]] +# elif defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_CXX03_LANG) +# define _LIBCPP_NODISCARD [[clang::warn_unused_result]] +# else // We can't use GCC's [[gnu::warn_unused_result]] and // __attribute__((warn_unused_result)), because GCC does not silence them via // (void) cast. -# define _LIBCPP_NODISCARD -#endif +# define _LIBCPP_NODISCARD +# endif // _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not // specified as such as an extension. -#if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT) -# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD -#else -# define _LIBCPP_NODISCARD_EXT -#endif +# if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT) +# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD +# else +# define _LIBCPP_NODISCARD_EXT +# endif -#if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && \ - (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD)) -# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD -#else -# define _LIBCPP_NODISCARD_AFTER_CXX17 -#endif +# if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD)) +# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD +# else +# define _LIBCPP_NODISCARD_AFTER_CXX17 +# endif -#if __has_attribute(no_destroy) -# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) -#else -# define _LIBCPP_NO_DESTROY -#endif +# if __has_attribute(no_destroy) +# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) +# else +# define _LIBCPP_NO_DESTROY +# endif -#ifndef _LIBCPP_HAS_NO_ASAN -extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( - const void *, const void *, const void *, const void *); -#endif +# ifndef _LIBCPP_HAS_NO_ASAN + extern "C" _LIBCPP_FUNC_VIS void + __sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*); +# endif // Try to find out if RTTI is disabled. -#if defined(_LIBCPP_COMPILER_CLANG_BASED) && !__has_feature(cxx_rtti) -# define _LIBCPP_NO_RTTI -#elif defined(__GNUC__) && !defined(__GXX_RTTI) -# define _LIBCPP_NO_RTTI -#elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI) -# define _LIBCPP_NO_RTTI -#endif +# if !defined(__cpp_rtti) || __cpp_rtti < 199711L +# define _LIBCPP_NO_RTTI +# endif -#ifndef _LIBCPP_WEAK -#define _LIBCPP_WEAK __attribute__((__weak__)) -#endif +# ifndef _LIBCPP_WEAK +# define _LIBCPP_WEAK __attribute__((__weak__)) +# endif // Thread API -#if !defined(_LIBCPP_HAS_NO_THREADS) && \ - !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ - !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ - !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -# if defined(__FreeBSD__) || \ - defined(__wasi__) || \ - defined(__NetBSD__) || \ - defined(__OpenBSD__) || \ - defined(__NuttX__) || \ - defined(__linux__) || \ - defined(__GNU__) || \ - defined(__APPLE__) || \ - defined(__sun__) || \ - defined(__MVS__) || \ - defined(_AIX) || \ - defined(__EMSCRIPTEN__) || \ - defined(__CYGWIN__) -# define _LIBCPP_HAS_THREAD_API_PTHREAD -# elif defined(__Fuchsia__) - // TODO(44575): Switch to C11 thread API when possible. -# define _LIBCPP_HAS_THREAD_API_PTHREAD -# elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_HAS_THREAD_API_WIN32 -# else -# error "No thread API" -# endif // _LIBCPP_HAS_THREAD_API -#endif // _LIBCPP_HAS_NO_THREADS - -#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -#if defined(__ANDROID__) && __ANDROID_API__ >= 30 -#define _LIBCPP_HAS_COND_CLOCKWAIT -#elif defined(_LIBCPP_GLIBC_PREREQ) -#if _LIBCPP_GLIBC_PREREQ(2, 30) -#define _LIBCPP_HAS_COND_CLOCKWAIT -#endif -#endif -#endif +// clang-format off +# if !defined(_LIBCPP_HAS_NO_THREADS) && \ + !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ + !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ + !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) + +# if defined(__FreeBSD__) || \ + defined(__wasi__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NuttX__) || \ + defined(__linux__) || \ + defined(__GNU__) || \ + defined(__APPLE__) || \ + defined(__sun__) || \ + defined(__MVS__) || \ + defined(_AIX) || \ + defined(__EMSCRIPTEN__) || \ + defined(__CYGWIN__) +// clang-format on +# define _LIBCPP_HAS_THREAD_API_PTHREAD +# elif defined(__Fuchsia__) +// TODO(44575): Switch to C11 thread API when possible. +# define _LIBCPP_HAS_THREAD_API_PTHREAD +# elif defined(_LIBCPP_WIN32API) +# define _LIBCPP_HAS_THREAD_API_WIN32 +# else +# error "No thread API" +# endif // _LIBCPP_HAS_THREAD_API +# endif // _LIBCPP_HAS_NO_THREADS + +# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +# if defined(__ANDROID__) && __ANDROID_API__ >= 30 +# define _LIBCPP_HAS_COND_CLOCKWAIT +# elif defined(_LIBCPP_GLIBC_PREREQ) +# if _LIBCPP_GLIBC_PREREQ(2, 30) +# define _LIBCPP_HAS_COND_CLOCKWAIT +# endif +# endif +# endif -#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ +# if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +# error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ _LIBCPP_HAS_NO_THREADS is not defined. -#endif +# endif -#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -#error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ +# if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) +# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ _LIBCPP_HAS_NO_THREADS is defined. -#endif +# endif -#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) -#error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ +# if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) +# error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ _LIBCPP_HAS_NO_THREADS is defined. -#endif +# endif -#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) -#define __STDCPP_THREADS__ 1 -#endif +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) +# define __STDCPP_THREADS__ 1 +# endif // The glibc and Bionic implementation of pthreads implements // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32 @@ -1092,11 +1000,13 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( // // TODO(EricWF): Enable this optimization on Bionic after speaking to their // respective stakeholders. -#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \ - || (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) \ - || defined(_LIBCPP_HAS_THREAD_API_WIN32) -# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION -#endif +// clang-format off +# if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) || \ + (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || \ + defined(_LIBCPP_HAS_THREAD_API_WIN32) +// clang-format on +# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION +# endif // Destroying a condvar is a nop on Windows. // @@ -1106,261 +1016,252 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( // // TODO(EricWF): This is potentially true for some pthread implementations // as well. -#if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || \ - defined(_LIBCPP_HAS_THREAD_API_WIN32) -# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION -#endif +# if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || defined(_LIBCPP_HAS_THREAD_API_WIN32) +# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION +# endif // Some systems do not provide gets() in their C library, for security reasons. -#if defined(_LIBCPP_MSVCRT) || \ - (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || \ - defined(__OpenBSD__) -# define _LIBCPP_C_HAS_NO_GETS -#endif - -#if defined(__BIONIC__) || defined(__NuttX__) || \ - defined(__Fuchsia__) || defined(__wasi__) || \ - defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) -#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE -#endif +# if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || defined(__OpenBSD__) +# define _LIBCPP_C_HAS_NO_GETS +# endif -#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) -# define _LIBCPP_HAS_C_ATOMIC_IMP -#elif defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_HAS_GCC_ATOMIC_IMP -#endif +# if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \ + defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) +# define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE +# endif -#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \ - !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \ - !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP) -# define _LIBCPP_HAS_NO_ATOMIC_HEADER -#else -# ifndef _LIBCPP_ATOMIC_FLAG_TYPE -# define _LIBCPP_ATOMIC_FLAG_TYPE bool +# if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) +# define _LIBCPP_HAS_C_ATOMIC_IMP +# elif defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_HAS_GCC_ATOMIC_IMP # endif -# ifdef _LIBCPP_FREESTANDING -# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS + +# if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \ + !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP) +# define _LIBCPP_HAS_NO_ATOMIC_HEADER +# else +# ifndef _LIBCPP_ATOMIC_FLAG_TYPE +# define _LIBCPP_ATOMIC_FLAG_TYPE bool +# endif +# ifdef _LIBCPP_FREESTANDING +# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS +# endif # endif -#endif -#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK -#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK -#endif +# ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +# endif -#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) -# if defined(__clang__) && __has_attribute(acquire_capability) +# if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) +# if defined(__clang__) && __has_attribute(acquire_capability) // Work around the attribute handling in clang. When both __declspec and // __attribute__ are present, the processing goes awry preventing the definition // of the types. In MinGW mode, __declspec evaluates to __attribute__, and thus // combining the two does work. -# if !defined(_MSC_VER) -# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +# if !defined(_MSC_VER) +# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +# endif # endif # endif -#endif -#ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS -# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) -#else -# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) -#endif +# ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) +# else +# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) +# endif -#if _LIBCPP_STD_VER > 17 -# define _LIBCPP_CONSTINIT constinit -#elif __has_attribute(require_constant_initialization) -# define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) -#else -# define _LIBCPP_CONSTINIT -#endif +# if _LIBCPP_STD_VER > 17 +# define _LIBCPP_CONSTINIT constinit +# elif __has_attribute(require_constant_initialization) +# define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) +# else +# define _LIBCPP_CONSTINIT +# endif -#if !__has_builtin(__builtin_is_constant_evaluated) || (defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER < 900) || __CUDACC_VER_MAJOR__ == 10 -#define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED -#endif +# if !__has_builtin(__builtin_is_constant_evaluated) || (defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER < 900) || __CUDACC_VER_MAJOR__ == 10 +# define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED +# endif -#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) -# define _LIBCPP_DIAGNOSE_WARNING(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "warning"))) -# define _LIBCPP_DIAGNOSE_ERROR(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "error"))) -#else -# define _LIBCPP_DIAGNOSE_WARNING(...) -# define _LIBCPP_DIAGNOSE_ERROR(...) -#endif +# if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) +# define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((diagnose_if(__VA_ARGS__, "warning"))) +# define _LIBCPP_DIAGNOSE_ERROR(...) __attribute__((diagnose_if(__VA_ARGS__, "error"))) +# else +# define _LIBCPP_DIAGNOSE_WARNING(...) +# define _LIBCPP_DIAGNOSE_ERROR(...) +# endif // Use a function like macro to imply that it must be followed by a semicolon -#if _LIBCPP_STD_VER > 14 && __has_cpp_attribute(fallthrough) -# define _LIBCPP_FALLTHROUGH() [[fallthrough]] -#elif __has_cpp_attribute(clang::fallthrough) -# define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]] -#elif __has_attribute(__fallthrough__) -# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) -#else -# define _LIBCPP_FALLTHROUGH() ((void)0) -#endif +# if __has_cpp_attribute(fallthrough) +# define _LIBCPP_FALLTHROUGH() [[fallthrough]] +# elif __has_attribute(__fallthrough__) +# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) +# else +# define _LIBCPP_FALLTHROUGH() ((void)0) +# endif -#if defined(_LIBCPP_COMPILER_CLANG_BASED) -# define _LIBCPP_REINITIALIZES_OBJECT [[clang::reinitializes]] -#else -# define _LIBCPP_REINITIALIZES_OBJECT -#endif +# if defined(_LIBCPP_COMPILER_CLANG_BASED) +# define _LIBCPP_REINITIALIZES_OBJECT [[clang::reinitializes]] +# else +# define _LIBCPP_REINITIALIZES_OBJECT +# endif -#if __has_attribute(__nodebug__) && !defined(__CUDACC__) -#define _LIBCPP_NODEBUG __attribute__((__nodebug__)) -#else -#define _LIBCPP_NODEBUG -#endif +# if __has_attribute(__nodebug__) && !defined(__CUDACC__) +# define _LIBCPP_NODEBUG __attribute__((__nodebug__)) +# else +# define _LIBCPP_NODEBUG +# endif -#if __has_attribute(__standalone_debug__) -#define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__)) -#else -#define _LIBCPP_STANDALONE_DEBUG -#endif +# if __has_attribute(__standalone_debug__) +# define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__)) +# else +# define _LIBCPP_STANDALONE_DEBUG +# endif -#if __has_attribute(__preferred_name__) -#define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x))) -#else -#define _LIBCPP_PREFERRED_NAME(x) -#endif +# if __has_attribute(__preferred_name__) +# define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x))) +# else +# define _LIBCPP_PREFERRED_NAME(x) +# endif // We often repeat things just for handling wide characters in the library. // When wide characters are disabled, it can be useful to have a quick way of // disabling it without having to resort to #if-#endif, which has a larger // impact on readability. -#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) -# define _LIBCPP_IF_WIDE_CHARACTERS(...) -#else -# define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__ -#endif +# if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# define _LIBCPP_IF_WIDE_CHARACTERS(...) +# else +# define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__ +# endif -#if defined(_LIBCPP_ABI_MICROSOFT) && \ - (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) && \ - !defined(__CUDACC__) -# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) -#else -# define _LIBCPP_DECLSPEC_EMPTY_BASES -#endif +# if defined(_LIBCPP_ABI_MICROSOFT) && (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) && \ + !defined(__CUDACC__) +# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) +# else +# define _LIBCPP_DECLSPEC_EMPTY_BASES +# endif -#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) -#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS -#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE -#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES - -#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) -#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS -#define _LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS -#define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS -#define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR -#define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS -#endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES - -#if !defined(__cpp_impl_coroutine) || __cpp_impl_coroutine < 201902L -#define _LIBCPP_HAS_NO_CXX20_COROUTINES -#endif +# if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) +# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR +# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS +# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE +# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS +# endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES + +# if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) +# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS +# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION +# define _LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS +# define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS +# define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR +# define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS +# endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES + +# if !defined(__cpp_impl_coroutine) || __cpp_impl_coroutine < 201902L +# define _LIBCPP_HAS_NO_CXX20_COROUTINES +# endif // Yandex-specific: We build our own libc++, so it has everything available -#define _LIBCPP_DISABLE_AVAILABILITY +# define _LIBCPP_DISABLE_AVAILABILITY // End of Yandex-specific # define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") # define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") -#ifndef _LIBCPP_NO_AUTO_LINK -# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# pragma comment(lib, "c++.lib") -# else -# pragma comment(lib, "libc++.lib") -# endif -# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) -#endif // _LIBCPP_NO_AUTO_LINK +# ifndef _LIBCPP_NO_AUTO_LINK +# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# pragma comment(lib, "c++.lib") +# else +# pragma comment(lib, "libc++.lib") +# endif +# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# endif // _LIBCPP_NO_AUTO_LINK // Configures the fopen close-on-exec mode character, if any. This string will // be appended to any mode string used by fstream for fopen/fdopen. // // Not all platforms support this, but it helps avoid fd-leaks on platforms that // do. -#if defined(__BIONIC__) -# define _LIBCPP_FOPEN_CLOEXEC_MODE "e" -#else -# define _LIBCPP_FOPEN_CLOEXEC_MODE -#endif +# if defined(__BIONIC__) +# define _LIBCPP_FOPEN_CLOEXEC_MODE "e" +# else +# define _LIBCPP_FOPEN_CLOEXEC_MODE +# endif // Support for _FILE_OFFSET_BITS=64 landed gradually in Android, so the full set // of functions used in cstdio may not be available for low API levels when // using 64-bit file offsets on LP32. -#if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24 -#define _LIBCPP_HAS_NO_FGETPOS_FSETPOS -#endif +# if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24 +# define _LIBCPP_HAS_NO_FGETPOS_FSETPOS +# endif -#if __has_attribute(init_priority) - // TODO: Remove this once we drop support for building libc++ with old Clangs -# if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1200) || \ - (defined(__apple_build_version__) && __apple_build_version__ < 13000000) -# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101))) -# else -# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(100))) -# endif -#else -# define _LIBCPP_INIT_PRIORITY_MAX -#endif +# if __has_attribute(init_priority) +// TODO: Remove this once we drop support for building libc++ with old Clangs +# if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1200) || \ + (defined(__apple_build_version__) && __apple_build_version__ < 13000000) +# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101))) +# else +# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(100))) +# endif +# else +# define _LIBCPP_INIT_PRIORITY_MAX +# endif -#if defined(__GNUC__) || defined(__clang__) - // The attribute uses 1-based indices for ordinary and static member functions. - // The attribute uses 2-based indices for non-static member functions. -# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \ - __attribute__((__format__(archetype, format_string_index, first_format_arg_index))) -#else -# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) /* nothing */ -#endif +# if defined(__GNUC__) || defined(__clang__) +// The attribute uses 1-based indices for ordinary and static member functions. +// The attribute uses 2-based indices for non-static member functions. +# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \ + __attribute__((__format__(archetype, format_string_index, first_format_arg_index))) +# else +# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) /* nothing */ +# endif -#if __has_cpp_attribute(msvc::no_unique_address) - // MSVC implements [[no_unique_address]] as a silent no-op currently. - // (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) - // However, MSVC implements [[msvc::no_unique_address]] which does what - // [[no_unique_address]] is supposed to do, in general. - - // Clang-cl does not yet (14.0) implement either [[no_unique_address]] or - // [[msvc::no_unique_address]] though. If/when it does implement - // [[msvc::no_unique_address]], this should be preferred though. -# define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] -#elif __has_cpp_attribute(no_unique_address) -# define _LIBCPP_NO_UNIQUE_ADDRESS [[no_unique_address]] -#else -# define _LIBCPP_NO_UNIQUE_ADDRESS /* nothing */ - // 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 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 +# if __has_cpp_attribute(msvc::no_unique_address) +// MSVC implements [[no_unique_address]] as a silent no-op currently. +// (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) +// However, MSVC implements [[msvc::no_unique_address]] which does what +// [[no_unique_address]] is supposed to do, in general. + +// Clang-cl does not yet (14.0) implement either [[no_unique_address]] or +// [[msvc::no_unique_address]] though. If/when it does implement +// [[msvc::no_unique_address]], this should be preferred though. +# define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] +# elif __has_cpp_attribute(no_unique_address) +# define _LIBCPP_NO_UNIQUE_ADDRESS [[no_unique_address]] +# else +# define _LIBCPP_NO_UNIQUE_ADDRESS /* nothing */ +// 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 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 +# 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 -#if defined(_AIX) && !defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_PACKED_BYTE_FOR_AIX _Pragma("pack(1)") -# define _LIBCPP_PACKED_BYTE_FOR_AIX_END _Pragma("pack(pop)") -#else -# define _LIBCPP_PACKED_BYTE_FOR_AIX /* empty */ -# define _LIBCPP_PACKED_BYTE_FOR_AIX_END /* empty */ -#endif +# if defined(_AIX) && !defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_PACKED_BYTE_FOR_AIX _Pragma("pack(1)") +# define _LIBCPP_PACKED_BYTE_FOR_AIX_END _Pragma("pack(pop)") +# else +# define _LIBCPP_PACKED_BYTE_FOR_AIX /* empty */ +# define _LIBCPP_PACKED_BYTE_FOR_AIX_END /* empty */ +# endif #endif // __cplusplus diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/boyer_moore_searcher.h b/contrib/libs/cxxsupp/libcxx/include/__functional/boyer_moore_searcher.h new file mode 100644 index 0000000000..20e554408f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/boyer_moore_searcher.h @@ -0,0 +1,313 @@ +//===----------------------------------------------------------------------===// +// +// 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___FUNCTIONAL_BOYER_MOORE_SEARCHER_H +#define _LIBCPP___FUNCTIONAL_BOYER_MOORE_SEARCHER_H + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#include <__algorithm/fill_n.h> +#include <__config> +#include <__functional/hash.h> +#include <__functional/operations.h> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> +#include <__memory/shared_ptr.h> +#include <__utility/pair.h> +#include <array> +#include <unordered_map> +#include <vector> + +#if _LIBCPP_STD_VER > 14 + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Key, + class _Value, + class _Hash, + class _BinaryPredicate, + bool /*useArray*/> +class _BMSkipTable; + +// General case for BM data searching; use a map +template <class _Key, + class _Value, + class _Hash, + class _BinaryPredicate> +class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> { +private: + using value_type = _Value; + using key_type = _Key; + + const value_type __default_value_; + unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_; + +public: + _LIBCPP_HIDE_FROM_ABI + explicit _BMSkipTable(size_t __sz, value_type __default_value, _Hash __hash, _BinaryPredicate __pred) + : __default_value_(__default_value), + __table_(__sz, __hash, __pred) {} + + _LIBCPP_HIDE_FROM_ABI void insert(const key_type& __key, value_type __val) { + __table_[__key] = __val; + } + + _LIBCPP_HIDE_FROM_ABI value_type operator[](const key_type& __key) const { + auto __it = __table_.find(__key); + return __it == __table_.end() ? __default_value_ : __it->second; + } +}; + +// Special case small numeric values; use an array +template <class _Key, + class _Value, + class _Hash, + class _BinaryPredicate> +class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> { +private: + using value_type = _Value; + using key_type = _Key; + + using unsigned_key_type = make_unsigned_t<key_type>; + std::array<value_type, 256> __table_; + static_assert(numeric_limits<unsigned_key_type>::max() < 256); + +public: + _LIBCPP_HIDE_FROM_ABI explicit _BMSkipTable(size_t, value_type __default_value, _Hash, _BinaryPredicate) { + std::fill_n(__table_.data(), __table_.size(), __default_value); + } + + _LIBCPP_HIDE_FROM_ABI void insert(key_type __key, value_type __val) { + __table_[static_cast<unsigned_key_type>(__key)] = __val; + } + + _LIBCPP_HIDE_FROM_ABI value_type operator[](key_type __key) const { + return __table_[static_cast<unsigned_key_type>(__key)]; + } +}; + +template <class _RandomAccessIterator1, + class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, + class _BinaryPredicate = equal_to<>> +class _LIBCPP_TEMPLATE_VIS boyer_moore_searcher { +private: + using difference_type = typename std::iterator_traits<_RandomAccessIterator1>::difference_type; + using value_type = typename std::iterator_traits<_RandomAccessIterator1>::value_type; + using __skip_table_type = _BMSkipTable<value_type, + difference_type, + _Hash, + _BinaryPredicate, + is_integral_v<value_type> + && sizeof(value_type) == 1 + && is_same_v<_Hash, hash<value_type>> + && is_same_v<_BinaryPredicate, equal_to<>>>; + +public: + boyer_moore_searcher(_RandomAccessIterator1 __first, + _RandomAccessIterator1 __last, + _Hash __hash = _Hash(), + _BinaryPredicate __pred = _BinaryPredicate()) + : __first_(__first), + __last_(__last), + __pred_(__pred), + __pattern_length_(__last - __first), + __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, -1, __hash, __pred_)), + __suffix_(std::__allocate_shared_unbounded_array<difference_type[]>( + allocator<difference_type>(), __pattern_length_ + 1)) { + difference_type __i = 0; + while (__first != __last) { + __skip_table_->insert(*__first, __i); + ++__first; + ++__i; + } + __build_suffix_table(__first_, __last_, __pred_); + } + + template <class _RandomAccessIterator2> + pair<_RandomAccessIterator2, _RandomAccessIterator2> + operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const { + static_assert(__is_same_uncvref<typename iterator_traits<_RandomAccessIterator1>::value_type, + typename iterator_traits<_RandomAccessIterator2>::value_type>::value, + "Corpus and Pattern iterators must point to the same type"); + if (__first == __last) + return std::make_pair(__last, __last); + if (__first_ == __last_) + return std::make_pair(__first, __first); + + if (__pattern_length_ > (__last - __first)) + return std::make_pair(__last, __last); + return __search(__first, __last); + } + +private: + _RandomAccessIterator1 __first_; + _RandomAccessIterator1 __last_; + _BinaryPredicate __pred_; + difference_type __pattern_length_; + shared_ptr<__skip_table_type> __skip_table_; + shared_ptr<difference_type[]> __suffix_; + + template <class _RandomAccessIterator2> + pair<_RandomAccessIterator2, _RandomAccessIterator2> + __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const { + _RandomAccessIterator2 __current = __f; + const _RandomAccessIterator2 __last = __l - __pattern_length_; + const __skip_table_type& __skip_table = *__skip_table_; + + while (__current <= __last) { + difference_type __j = __pattern_length_; + while (__pred_(__first_[__j - 1], __current[__j - 1])) { + --__j; + if (__j == 0) + return std::make_pair(__current, __current + __pattern_length_); + } + + difference_type __k = __skip_table[__current[__j - 1]]; + difference_type __m = __j - __k - 1; + if (__k < __j && __m > __suffix_[__j]) + __current += __m; + else + __current += __suffix_[__j]; + } + return std::make_pair(__l, __l); + } + + template <class _Iterator, class _Container> + void __compute_bm_prefix(_Iterator __first, _Iterator __last, _BinaryPredicate __pred, _Container& __prefix) { + const size_t __count = __last - __first; + + __prefix[0] = 0; + size_t __k = 0; + + for (size_t __i = 1; __i != __count; ++__i) { + while (__k > 0 && !__pred(__first[__k], __first[__i])) + __k = __prefix[__k - 1]; + + if (__pred(__first[__k], __first[__i])) + ++__k; + __prefix[__i] = __k; + } + } + + void __build_suffix_table(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _BinaryPredicate __pred) { + const size_t __count = __last - __first; + + if (__count == 0) + return; + + vector<difference_type> __scratch(__count); + + __compute_bm_prefix(__first, __last, __pred, __scratch); + for (size_t __i = 0; __i <= __count; ++__i) + __suffix_[__i] = __count - __scratch[__count - 1]; + + using _ReverseIter = reverse_iterator<_RandomAccessIterator1>; + __compute_bm_prefix(_ReverseIter(__last), _ReverseIter(__first), __pred, __scratch); + + for (size_t __i = 0; __i != __count; ++__i) { + const size_t __j = __count - __scratch[__i]; + const difference_type __k = __i - __scratch[__i] + 1; + + if (__suffix_[__j] > __k) + __suffix_[__j] = __k; + } + } +}; + +template <class _RandomAccessIterator1, + class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, + class _BinaryPredicate = equal_to<>> +class _LIBCPP_TEMPLATE_VIS boyer_moore_horspool_searcher { +private: + using difference_type = typename iterator_traits<_RandomAccessIterator1>::difference_type; + using value_type = typename iterator_traits<_RandomAccessIterator1>::value_type; + using __skip_table_type = _BMSkipTable<value_type, + difference_type, + _Hash, + _BinaryPredicate, + is_integral_v<value_type> + && sizeof(value_type) == 1 + && is_same_v<_Hash, hash<value_type>> + && is_same_v<_BinaryPredicate, equal_to<>>>; +public: + boyer_moore_horspool_searcher(_RandomAccessIterator1 __first, + _RandomAccessIterator1 __last, + _Hash __hash = _Hash(), + _BinaryPredicate __pred = _BinaryPredicate()) + : __first_(__first), + __last_(__last), + __pred_(__pred), + __pattern_length_(__last - __first), + __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, __pattern_length_, __hash, __pred_)) { + if (__first == __last) + return; + --__last; + difference_type __i = 0; + while (__first != __last) { + __skip_table_->insert(*__first, __pattern_length_ - 1 - __i); + ++__first; + ++__i; + } + } + + template <class _RandomAccessIterator2> + pair<_RandomAccessIterator2, _RandomAccessIterator2> + operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const { + static_assert(__is_same_uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type, + typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value, + "Corpus and Pattern iterators must point to the same type"); + if (__first == __last) + return std::make_pair(__last, __last); + if (__first_ == __last_) + return std::make_pair(__first, __first); + + if (__pattern_length_ > __last - __first) + return std::make_pair(__last, __last); + + return __search(__first, __last); + } + +private: + _RandomAccessIterator1 __first_; + _RandomAccessIterator1 __last_; + _BinaryPredicate __pred_; + difference_type __pattern_length_; + shared_ptr<__skip_table_type> __skip_table_; + + template <class _RandomAccessIterator2> + pair<_RandomAccessIterator2, _RandomAccessIterator2> + __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const { + _RandomAccessIterator2 __current = __f; + const _RandomAccessIterator2 __last = __l - __pattern_length_; + const __skip_table_type& __skip_table = *__skip_table_; + + while (__current <= __last) { + difference_type __j = __pattern_length_; + while (__pred_(__first_[__j - 1], __current[__j - 1])) { + --__j; + if (__j == 0) + return std::make_pair(__current, __current + __pattern_length_); + } + __current += __skip_table[__current[__pattern_length_ - 1]]; + } + return std::make_pair(__l, __l); + } +}; + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP_STD_VER > 14 + +#endif // _LIBCPP___FUNCTIONAL_BOYER_MOORE_SEARCHER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h index 8ff6ff44cb..d1c815bd8a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h @@ -35,6 +35,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD // bad_function_call +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables") class _LIBCPP_EXCEPTION_ABI bad_function_call : public exception { @@ -52,6 +54,7 @@ public: virtual const char* what() const _NOEXCEPT; #endif }; +_LIBCPP_DIAGNOSTIC_POP _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_bad_function_call() diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h b/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h index 89cb02a368..f39f44ea08 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h @@ -533,8 +533,6 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP }; #endif // !_LIBCPP_HAS_NO_CHAR8_T -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS - _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash<char16_t> @@ -567,8 +565,6 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; -#endif // _LIBCPP_HAS_NO_UNICODE_CHARS - #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h index bc07cf33f7..89bda19eff 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h @@ -10,6 +10,7 @@ #ifndef _LIBCPP___ITERATOR_REVERSE_ITERATOR_H #define _LIBCPP___ITERATOR_REVERSE_ITERATOR_H +#include <__algorithm/unwrap_iter.h> #include <__compare/compare_three_way_result.h> #include <__compare/three_way_comparable.h> #include <__concepts/convertible_to.h> @@ -321,6 +322,49 @@ reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) } #endif +template <class _Iter> +using _ReverseWrapper = reverse_iterator<reverse_iterator<_Iter> >; + +template <class _Iter, bool __b> +struct __unwrap_iter_impl<_ReverseWrapper<_Iter>, __b> { + static _LIBCPP_CONSTEXPR decltype(std::__unwrap_iter(std::declval<_Iter>())) + __apply(_ReverseWrapper<_Iter> __i) _NOEXCEPT { + return std::__unwrap_iter(__i.base().base()); + } +}; + +template <class _OrigIter, class _UnwrappedIter> +struct __rewrap_iter_impl<_ReverseWrapper<_OrigIter>, _UnwrappedIter> { + template <class _Iter> + struct _ReverseWrapperCount { + static _LIBCPP_CONSTEXPR const size_t value = 1; + }; + + template <class _Iter> + struct _ReverseWrapperCount<_ReverseWrapper<_Iter> > { + static _LIBCPP_CONSTEXPR const size_t value = 1 + _ReverseWrapperCount<_Iter>::value; + }; + + template <size_t _RewrapCount, class _OIter, class _UIter, __enable_if_t<_RewrapCount != 0, int> = 0> + _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _ReverseWrapper<_OIter> __rewrap(_ReverseWrapper<_OIter> __iter1, + _UIter __iter2) { + return _ReverseWrapper<_OIter>( + reverse_iterator<_OIter>(__rewrap<_RewrapCount - 1>(__iter1.base().base(), __iter2))); + } + + template <size_t _RewrapCount, class _OIter, class _UIter, __enable_if_t<_RewrapCount == 0, int> = 0> + _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR decltype(std::__rewrap_iter(std::declval<_OIter>(), + std::declval<_UIter>())) + __rewrap(_OIter __iter1, _UIter __iter2) { + return std::__rewrap_iter(__iter1, __iter2); + } + + _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _ReverseWrapper<_OrigIter> __apply(_ReverseWrapper<_OrigIter> __iter1, + _UnwrappedIter __iter2) { + return __rewrap<_ReverseWrapperCount<_OrigIter>::value>(__iter1, __iter2); + } +}; + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___ITERATOR_REVERSE_ITERATOR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h index e034a09998..55ce44d047 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h @@ -27,27 +27,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> class allocator; -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION) template <> class _LIBCPP_TEMPLATE_VIS allocator<void> { +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) public: _LIBCPP_DEPRECATED_IN_CXX17 typedef void* pointer; _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer; _LIBCPP_DEPRECATED_IN_CXX17 typedef void value_type; template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;}; +#endif }; template <> class _LIBCPP_TEMPLATE_VIS allocator<const void> { +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) public: _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* pointer; _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer; _LIBCPP_DEPRECATED_IN_CXX17 typedef const void value_type; template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;}; +#endif }; #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h b/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h index bcca0fdb18..bfa20a149d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h @@ -29,17 +29,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER > 17 -template<class _Tp, class ..._Args, class = decltype( - ::new (declval<void*>()) _Tp(declval<_Args>()...) -)> -_LIBCPP_HIDE_FROM_ABI -constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) { - _LIBCPP_ASSERT(__location != nullptr, "null pointer given to construct_at"); - return ::new (_VSTD::__voidify(*__location)) _Tp(_VSTD::forward<_Args>(__args)...); +template <class _Tp, class... _Args, class = decltype(::new(declval<void*>()) _Tp(declval<_Args>()...))> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __args) { + _LIBCPP_ASSERT(__location != nullptr, "null pointer given to construct_at"); + return ::new (_VSTD::__voidify(*__location)) _Tp(_VSTD::forward<_Args>(__args)...); } #endif +template <class _Tp, class... _Args, class = decltype(::new(declval<void*>()) _Tp(declval<_Args>()...))> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __construct_at(_Tp* __location, _Args&&... __args) { +#if _LIBCPP_STD_VER > 17 + return std::construct_at(__location, std::forward<_Args>(__args)...); +#else + return ::new (std::__voidify(*__location)) _Tp(std::forward<_Args>(__args)...); +#endif +} + // destroy_at // The internal functions are available regardless of the language version (with the exception of the `__destroy_at` diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h index dddd84157d..ac7572f770 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h @@ -992,7 +992,7 @@ shared_ptr<_Tp> make_shared(_Args&& ...__args) return _VSTD::allocate_shared<_Tp>(allocator<_Tp>(), _VSTD::forward<_Args>(__args)...); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER > 14 template <size_t _Alignment> struct __sp_aligned_storage { @@ -1070,7 +1070,7 @@ template<class _Array, class _Alloc, class... _Arg> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Array> __allocate_shared_unbounded_array(const _Alloc& __a, size_t __n, _Arg&& ...__arg) { - static_assert(is_unbounded_array_v<_Array>); + static_assert(__libcpp_is_unbounded_array<_Array>::value); // We compute the number of bytes necessary to hold the control block and the // array elements. Then, we allocate an array of properly-aligned dummy structs // large enough to hold the control block and array. This allows shifting the @@ -1080,7 +1080,7 @@ shared_ptr<_Array> __allocate_shared_unbounded_array(const _Alloc& __a, size_t _ using _StorageAlloc = __allocator_traits_rebind_t<_Alloc, _AlignedStorage>; __allocation_guard<_StorageAlloc> __guard(__a, _ControlBlock::__bytes_for(__n) / sizeof(_AlignedStorage)); _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get())); - std::construct_at(__control_block, __a, __n, std::forward<_Arg>(__arg)...); + std::__construct_at(__control_block, __a, __n, std::forward<_Arg>(__arg)...); __guard.__release_ptr(); return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block); } @@ -1133,17 +1133,21 @@ template<class _Array, class _Alloc, class... _Arg> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Array> __allocate_shared_bounded_array(const _Alloc& __a, _Arg&& ...__arg) { - static_assert(is_bounded_array_v<_Array>); + static_assert(__libcpp_is_bounded_array<_Array>::value); using _ControlBlock = __bounded_array_control_block<_Array, _Alloc>; using _ControlBlockAlloc = __allocator_traits_rebind_t<_Alloc, _ControlBlock>; __allocation_guard<_ControlBlockAlloc> __guard(__a, 1); _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get())); - std::construct_at(__control_block, __a, std::forward<_Arg>(__arg)...); + std::__construct_at(__control_block, __a, std::forward<_Arg>(__arg)...); __guard.__release_ptr(); return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block); } +#endif // _LIBCPP_STD_VER > 14 + +#if _LIBCPP_STD_VER > 17 + template<class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a) diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h b/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h index dfdfdf4edd..3a8560f080 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h @@ -347,10 +347,6 @@ uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofir __unreachable_sentinel(), __iter_move); } -#endif // _LIBCPP_STD_VER > 14 - -#if _LIBCPP_STD_VER > 17 - // Destroys every element in the range [first, last) FROM RIGHT TO LEFT using allocator // destruction. If elements are themselves C-style arrays, they are recursively destroyed // in the same manner. @@ -370,7 +366,7 @@ constexpr void __allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter return; if constexpr (is_array_v<_ValueType>) { - static_assert(!is_unbounded_array_v<_ValueType>, + static_assert(!__libcpp_is_unbounded_array<_ValueType>::value, "arrays of unbounded arrays don't exist, but if they did we would mess up here"); using _Element = remove_extent_t<_ValueType>; @@ -494,7 +490,7 @@ constexpr void __uninitialized_allocator_value_construct_n(_Alloc& __alloc, _Bid __guard.__complete(); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER > 14 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h index 82fe077cc7..14d82a0381 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h @@ -516,8 +516,6 @@ char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __ #endif // _LIBCPP_HAS_NO_CHAR8_T -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS - template <> struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> { @@ -698,8 +696,6 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _ return nullptr; } -#endif // _LIBCPP_HAS_NO_UNICODE_CHARS - // helper fns for basic_string and string_view // __str_find diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h index f6e800d723..27de9dfd38 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h @@ -19,6 +19,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD +template <class> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_bounded_array : false_type {}; +template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_bounded_array<_Tp[_Np]> : true_type {}; + #if _LIBCPP_STD_VER > 17 template <class> struct _LIBCPP_TEMPLATE_VIS is_bounded_array : false_type {}; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_integral.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_integral.h index f3ee5de8a5..6a70913a2e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_integral.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_integral.h @@ -30,10 +30,8 @@ template <> struct __libcpp_is_integral<wchar_t> { enum { va #ifndef _LIBCPP_HAS_NO_CHAR8_T template <> struct __libcpp_is_integral<char8_t> { enum { value = 1 }; }; #endif -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS template <> struct __libcpp_is_integral<char16_t> { enum { value = 1 }; }; template <> struct __libcpp_is_integral<char32_t> { enum { value = 1 }; }; -#endif template <> struct __libcpp_is_integral<short> { enum { value = 1 }; }; template <> struct __libcpp_is_integral<unsigned short> { enum { value = 1 }; }; template <> struct __libcpp_is_integral<int> { enum { value = 1 }; }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unbounded_array.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unbounded_array.h index 9e857533c6..11a12607e1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unbounded_array.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unbounded_array.h @@ -18,6 +18,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD +template <class> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_unbounded_array : false_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_unbounded_array<_Tp[]> : true_type {}; + #if _LIBCPP_STD_VER > 17 template <class> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : false_type {}; diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h b/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h index 5a8121d8a6..3cfd981067 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h @@ -30,13 +30,10 @@ struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {}; template<class _Tp> concept __is_safe_integral_cmp = is_integral_v<_Tp> && - !_IsSameAsAny<_Tp, bool, char + !_IsSameAsAny<_Tp, bool, char, char16_t, char32_t #ifndef _LIBCPP_HAS_NO_CHAR8_T , char8_t #endif -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS - , char16_t, char32_t -#endif #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS , wchar_t #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__wrappers_config b/contrib/libs/cxxsupp/libcxx/include/__wrappers_config index a8c6226ad1..eaa5d522af 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__wrappers_config +++ b/contrib/libs/cxxsupp/libcxx/include/__wrappers_config @@ -40,7 +40,7 @@ // should be removed in https://st.yandex-team.ru/IGNIETFERRO-1955 #define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS -// #define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION +#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION // should be removed in https://st.yandex-team.ru/IGNIETFERRO-1956 #define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm index 44ecb14a01..2dad3e1d41 100644 --- a/contrib/libs/cxxsupp/libcxx/include/algorithm +++ b/contrib/libs/cxxsupp/libcxx/include/algorithm @@ -53,7 +53,6 @@ namespace ranges { indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 - template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> @@ -283,6 +282,17 @@ namespace ranges { requires permutable<iterator_t<R>> constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20 + template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr I + sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr borrowed_iterator_t<R> + sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + template<class T, output_iterator<const T&> O, sentinel_for<O> S> constexpr O ranges::fill(O first, S last, const T& value); // since C++20 @@ -424,6 +434,22 @@ namespace ranges { constexpr borrowed_iterator_t<R> ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20 + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + class Proj1 = identity, class Proj2 = identity, + indirect_strict_weak_order<projected<I1, Proj1>, + projected<I2, Proj2>> Comp = ranges::less> + constexpr bool + ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, input_range R2, class Proj1 = identity, + class Proj2 = identity, + indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, + projected<iterator_t<R2>, Proj2>> Comp = ranges::less> + constexpr bool + ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + } constexpr bool // constexpr in C++20 @@ -1067,8 +1093,6 @@ template <class BidirectionalIterator, class Compare> #include <__debug> #include <cstddef> #include <cstring> -#include <initializer_list> -#include <iterator> // TODO: Remove this include #include <memory> #include <type_traits> #include <version> @@ -1162,6 +1186,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_is_partitioned.h> #include <__algorithm/ranges_is_sorted.h> #include <__algorithm/ranges_is_sorted_until.h> +#include <__algorithm/ranges_lexicographical_compare.h> #include <__algorithm/ranges_lower_bound.h> #include <__algorithm/ranges_max.h> #include <__algorithm/ranges_max_element.h> @@ -1174,6 +1199,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_replace.h> #include <__algorithm/ranges_replace_if.h> #include <__algorithm/ranges_reverse.h> +#include <__algorithm/ranges_sort.h> #include <__algorithm/ranges_swap_ranges.h> #include <__algorithm/ranges_transform.h> #include <__algorithm/ranges_upper_bound.h> @@ -1211,6 +1237,9 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/unwrap_iter.h> #include <__algorithm/upper_bound.h> +// standard-mandated includes +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/array b/contrib/libs/cxxsupp/libcxx/include/array index 4258853853..ab919309b9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/array +++ b/contrib/libs/cxxsupp/libcxx/include/array @@ -119,12 +119,23 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce #include <__utility/integer_sequence.h> #include <__utility/move.h> #include <__utility/unreachable.h> -#include <compare> -#include <iterator> // TODO: Remove this include #include <stdexcept> #include <type_traits> #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [array.syn] +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/bitset b/contrib/libs/cxxsupp/libcxx/include/bitset index 039aaedaf4..9597bf3bc1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/bitset +++ b/contrib/libs/cxxsupp/libcxx/include/bitset @@ -120,11 +120,13 @@ template <size_t N> struct hash<std::bitset<N>>; #include <__functional/unary_function.h> #include <climits> #include <cstddef> -#include <iosfwd> #include <stdexcept> -#include <string> #include <version> +// standard-mandated includes +#include <iosfwd> +#include <string> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/coroutine b/contrib/libs/cxxsupp/libcxx/include/coroutine index 11b2863e66..a96c4a7a5a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/coroutine +++ b/contrib/libs/cxxsupp/libcxx/include/coroutine @@ -46,6 +46,9 @@ struct suspend_always; #include <__coroutine/trivial_awaitables.h> #include <version> +// standard-mandated includes +#include <compare> + #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/deque b/contrib/libs/cxxsupp/libcxx/include/deque index aee9141099..371b966c66 100644 --- a/contrib/libs/cxxsupp/libcxx/include/deque +++ b/contrib/libs/cxxsupp/libcxx/include/deque @@ -180,14 +180,24 @@ template <class T, class Allocator, class Predicate> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> -#include <compare> -#include <initializer_list> -#include <iterator> // TODO: Remove this include #include <limits> #include <stdexcept> #include <type_traits> #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [deque.syn] +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/filesystem b/contrib/libs/cxxsupp/libcxx/include/filesystem index fd20ec4457..87de8861ea 100644 --- a/contrib/libs/cxxsupp/libcxx/include/filesystem +++ b/contrib/libs/cxxsupp/libcxx/include/filesystem @@ -257,9 +257,11 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct #include <__filesystem/recursive_directory_iterator.h> #include <__filesystem/space_info.h> #include <__filesystem/u8path.h> -#include <compare> #include <version> +// standard-mandated includes +#include <compare> + #if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) # error "The <filesystem> library is not supported since libc++ has been configured without support for a filesystem." #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format index b60a6aaa68..c882066660 100644 --- a/contrib/libs/cxxsupp/libcxx/include/format +++ b/contrib/libs/cxxsupp/libcxx/include/format @@ -157,6 +157,7 @@ namespace std { #include <__format/formatter_pointer.h> #include <__format/formatter_string.h> #include <__format/parser_std_format_spec.h> +#include <__iterator/back_insert_iterator.h> #include <__iterator/incrementable_traits.h> #include <__variant/monostate.h> #include <array> diff --git a/contrib/libs/cxxsupp/libcxx/include/forward_list b/contrib/libs/cxxsupp/libcxx/include/forward_list index 3dd0308c22..4600d82ecd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/forward_list +++ b/contrib/libs/cxxsupp/libcxx/include/forward_list @@ -189,13 +189,24 @@ template <class T, class Allocator, class Predicate> #include <__iterator/move_iterator.h> #include <__iterator/next.h> #include <__utility/forward.h> -#include <initializer_list> -#include <iterator> // TODO: Remove this include #include <limits> #include <memory> #include <type_traits> #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [forward.list.syn] +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/functional b/contrib/libs/cxxsupp/libcxx/include/functional index 7430551c65..dd39e274a5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/functional +++ b/contrib/libs/cxxsupp/libcxx/include/functional @@ -502,6 +502,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited #include <__functional/bind_front.h> #include <__functional/binder1st.h> #include <__functional/binder2nd.h> +#include <__functional/boyer_moore_searcher.h> #include <__functional/compose.h> #include <__functional/default_searcher.h> #include <__functional/function.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/ios b/contrib/libs/cxxsupp/libcxx/include/ios index d1b8c43a8a..7140e00b40 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ios +++ b/contrib/libs/cxxsupp/libcxx/include/ios @@ -220,10 +220,12 @@ storage-class-specifier const error_category& iostream_category() noexcept; #include <__ios/fpos.h> #include <__locale> #include <__utility/swap.h> -#include <iosfwd> #include <system_error> #include <version> +// standard-mandated includes +#include <iosfwd> + #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) #include <atomic> // for __xindex_ #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/iosfwd b/contrib/libs/cxxsupp/libcxx/include/iosfwd index e0cba7ddf8..f57f58c1fc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iosfwd +++ b/contrib/libs/cxxsupp/libcxx/include/iosfwd @@ -232,10 +232,8 @@ typedef fpos<mbstate_t> wstreampos; #ifndef _LIBCPP_HAS_NO_CHAR8_T typedef fpos<mbstate_t> u8streampos; #endif -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS typedef fpos<mbstate_t> u16streampos; typedef fpos<mbstate_t> u32streampos; -#endif #if defined(_NEWLIB_VERSION) // On newlib, off_t is 'long int' diff --git a/contrib/libs/cxxsupp/libcxx/include/iostream b/contrib/libs/cxxsupp/libcxx/include/iostream index 0b13777ff4..a0298454da 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iostream +++ b/contrib/libs/cxxsupp/libcxx/include/iostream @@ -35,11 +35,13 @@ extern wostream wclog; #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <version> + +// standard-mandated includes #include <ios> #include <istream> #include <ostream> #include <streambuf> -#include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/list b/contrib/libs/cxxsupp/libcxx/include/list index 48d56c2201..0b9525b9fb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/list +++ b/contrib/libs/cxxsupp/libcxx/include/list @@ -197,13 +197,24 @@ template <class T, class Allocator, class Predicate> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> -#include <initializer_list> -#include <iterator> // TODO: Remove this include #include <limits> #include <memory> #include <type_traits> #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [list.syn] +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/locale b/contrib/libs/cxxsupp/libcxx/include/locale index a59ad376da..a98e36f43b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/locale +++ b/contrib/libs/cxxsupp/libcxx/include/locale @@ -208,7 +208,6 @@ template <class charT> class messages_byname; #include <cstdlib> #include <ctime> #include <ios> -#include <iterator> // TODO: Remove this include #include <limits> #include <memory> #include <streambuf> diff --git a/contrib/libs/cxxsupp/libcxx/include/map b/contrib/libs/cxxsupp/libcxx/include/map index 640d7a6f05..3a4c58af97 100644 --- a/contrib/libs/cxxsupp/libcxx/include/map +++ b/contrib/libs/cxxsupp/libcxx/include/map @@ -542,13 +542,23 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20 #include <__tree> #include <__utility/forward.h> #include <__utility/swap.h> -#include <compare> -#include <initializer_list> -#include <iterator> // TODO: Remove this include #include <memory> #include <type_traits> #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [associative.map.syn] +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/memory b/contrib/libs/cxxsupp/libcxx/include/memory index 616ee7b5d7..ed4003b1b6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/memory +++ b/contrib/libs/cxxsupp/libcxx/include/memory @@ -859,12 +859,10 @@ template<size_t N, class T> #include <__memory/uninitialized_algorithms.h> #include <__memory/unique_ptr.h> #include <__memory/uses_allocator.h> -#include <compare> #include <cstddef> #include <cstdint> #include <cstring> #include <iosfwd> -#include <iterator> // TODO: Remove this include #include <new> #include <stdexcept> #include <stlfwd> @@ -873,6 +871,9 @@ template<size_t N, class T> #include <typeinfo> #include <version> +// standard-mandated includes +#include <compare> + #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) # include <__memory/auto_ptr.h> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/numeric b/contrib/libs/cxxsupp/libcxx/include/numeric index 6ece54612b..476ce5348c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/numeric +++ b/contrib/libs/cxxsupp/libcxx/include/numeric @@ -147,7 +147,6 @@ template<class T> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <cmath> // for isnormal -#include <iterator> // TODO: Remove this include #include <version> #include <__numeric/accumulate.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/optional b/contrib/libs/cxxsupp/libcxx/include/optional index 87e1617f16..9d04d2301f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/optional +++ b/contrib/libs/cxxsupp/libcxx/include/optional @@ -171,13 +171,15 @@ template<class T> #include <__utility/in_place.h> #include <__utility/move.h> #include <__utility/swap.h> -#include <compare> #include <initializer_list> #include <new> #include <stdexcept> #include <type_traits> #include <version> +// standard-mandated includes +#include <compare> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/ostream b/contrib/libs/cxxsupp/libcxx/include/ostream index 9679e42b31..aa4c8c3d87 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ostream +++ b/contrib/libs/cxxsupp/libcxx/include/ostream @@ -138,7 +138,6 @@ template <class Stream, class T> #include <__config> #include <bitset> #include <ios> -#include <iterator> // TODO: Remove this include #include <locale> #include <streambuf> #include <version> diff --git a/contrib/libs/cxxsupp/libcxx/include/queue b/contrib/libs/cxxsupp/libcxx/include/queue index da5d63077b..a6e8a52e19 100644 --- a/contrib/libs/cxxsupp/libcxx/include/queue +++ b/contrib/libs/cxxsupp/libcxx/include/queue @@ -226,12 +226,15 @@ template <class T, class Container, class Compare> #include <__iterator/iterator_traits.h> #include <__memory/uses_allocator.h> #include <__utility/forward.h> -#include <compare> #include <deque> #include <type_traits> #include <vector> #include <version> +// standard-mandated includes +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/random b/contrib/libs/cxxsupp/libcxx/include/random index a2e1719b86..b0817dd3a7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/random +++ b/contrib/libs/cxxsupp/libcxx/include/random @@ -1716,9 +1716,11 @@ class piecewise_linear_distribution #include <__random/uniform_random_bit_generator.h> #include <__random/uniform_real_distribution.h> #include <__random/weibull_distribution.h> -#include <initializer_list> #include <version> +// standard-mandated includes +#include <initializer_list> + #include <cmath> // for backward compatibility; TODO remove it #include <cstddef> // for backward compatibility; TODO remove it #include <cstdint> // for backward compatibility; TODO remove it diff --git a/contrib/libs/cxxsupp/libcxx/include/regex b/contrib/libs/cxxsupp/libcxx/include/regex index a6ad7d625a..a0a6561ef0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/regex +++ b/contrib/libs/cxxsupp/libcxx/include/regex @@ -766,22 +766,31 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; #include <__algorithm/search.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> -#include <__iterator/access.h> #include <__iterator/back_insert_iterator.h> #include <__iterator/wrap_iter.h> #include <__locale> #include <__utility/move.h> #include <__utility/swap.h> -#include <compare> #include <deque> -#include <initializer_list> -#include <iterator> // TODO: Remove this include #include <memory> #include <stdexcept> #include <string> #include <vector> #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [re.syn] +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/set b/contrib/libs/cxxsupp/libcxx/include/set index af035dc6b5..be14a150c2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/set +++ b/contrib/libs/cxxsupp/libcxx/include/set @@ -483,10 +483,20 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 #include <__node_handle> #include <__tree> #include <__utility/forward.h> +#include <version> + +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [associative.set.syn] #include <compare> #include <initializer_list> -#include <iterator> // TODO: Remove this include -#include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/span b/contrib/libs/cxxsupp/libcxx/include/span index 7950396137..ec8b1cd755 100644 --- a/contrib/libs/cxxsupp/libcxx/include/span +++ b/contrib/libs/cxxsupp/libcxx/include/span @@ -143,11 +143,19 @@ template<class R> #include <__utility/forward.h> #include <array> // for array #include <cstddef> // for byte -#include <iterator> // TODO: Remove this include #include <limits> #include <type_traits> // for remove_cv, etc #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif @@ -199,6 +207,15 @@ concept __span_compatible_range = is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>; #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +template <class _From, class _To> +concept __span_array_convertible = is_convertible_v<_From(*)[], _To(*)[]>; + +template <class _It, class _Tp> +concept __span_compatible_iterator = contiguous_iterator<_It> && __span_array_convertible<remove_reference_t<iter_reference_t<_It>>, _Tp>; + +template <class _Sentinel, class _It> +concept __span_compatible_sentinel_for = sized_sentinel_for<_Sentinel, _It> && !is_convertible_v<_Sentinel, size_t>; + #if defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) # define _LIBCPP_SPAN_USE_POINTER_ITERATOR #endif @@ -225,16 +242,13 @@ public: static constexpr size_type extent = _Extent; // [span.cons], span constructors, copy, assignment, and destructor - template <size_t _Sz = _Extent, enable_if_t<_Sz == 0, nullptr_t> = nullptr> + template <size_t _Sz = _Extent> requires(_Sz == 0) _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {} constexpr span (const span&) noexcept = default; constexpr span& operator=(const span&) noexcept = default; - template <class _It, - enable_if_t<contiguous_iterator<_It> && - is_convertible_v<remove_reference_t<iter_reference_t<_It>>(*)[], element_type (*)[]>, - nullptr_t> = nullptr> + template <__span_compatible_iterator<element_type> _It> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(_It __first, size_type __count) : __data{_VSTD::to_address(__first)} { @@ -242,11 +256,7 @@ public: _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (iterator, len)"); } - template < - class _It, class _End, - enable_if_t<is_convertible_v<remove_reference_t<iter_reference_t<_It> > (*)[], element_type (*)[]> && - contiguous_iterator<_It> && sized_sentinel_for<_End, _It> && !is_convertible_v<_End, size_t>, - nullptr_t> = nullptr> + template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(_It __first, _End __last) : __data{_VSTD::to_address(__first)} { (void)__last; @@ -257,13 +267,12 @@ public: _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data{__arr} {} - template <class _OtherElementType, - enable_if_t<is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr> + template <__span_array_convertible<element_type> _OtherElementType> _LIBCPP_INLINE_VISIBILITY constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {} - template <class _OtherElementType, - enable_if_t<is_convertible_v<const _OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr> + template <class _OtherElementType> + requires __span_array_convertible<const _OtherElementType, element_type> _LIBCPP_INLINE_VISIBILITY constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {} @@ -288,20 +297,14 @@ public: } #endif - template <class _OtherElementType> + template <__span_array_convertible<element_type> _OtherElementType> _LIBCPP_INLINE_VISIBILITY - constexpr span(const span<_OtherElementType, _Extent>& __other, - enable_if_t< - is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, - nullptr_t> = nullptr) + constexpr span(const span<_OtherElementType, _Extent>& __other) : __data{__other.data()} {} - template <class _OtherElementType> + template <__span_array_convertible<element_type> _OtherElementType> _LIBCPP_INLINE_VISIBILITY - constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other, - enable_if_t< - is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, - nullptr_t> = nullptr) noexcept + constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other) noexcept : __data{__other.data()} { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); } @@ -412,14 +415,11 @@ public: private: pointer __data; - }; template <typename _Tp> class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> { -private: - public: // constants and types using element_type = _Tp; @@ -445,19 +445,12 @@ public: constexpr span (const span&) noexcept = default; constexpr span& operator=(const span&) noexcept = default; - template <class _It, - enable_if_t<contiguous_iterator<_It> && - is_convertible_v<remove_reference_t<iter_reference_t<_It> > (*)[], element_type (*)[]>, - nullptr_t> = nullptr> + template <__span_compatible_iterator<element_type> _It> _LIBCPP_INLINE_VISIBILITY constexpr span(_It __first, size_type __count) : __data{_VSTD::to_address(__first)}, __size{__count} {} - template < - class _It, class _End, - enable_if_t<is_convertible_v<remove_reference_t<iter_reference_t<_It> > (*)[], element_type (*)[]> && - contiguous_iterator<_It> && sized_sentinel_for<_End, _It> && !is_convertible_v<_End, size_t>, - nullptr_t> = nullptr> + template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End> _LIBCPP_INLINE_VISIBILITY constexpr span(_It __first, _End __last) : __data(_VSTD::to_address(__first)), __size(__last - __first) {} @@ -466,13 +459,12 @@ public: _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {} - template <class _OtherElementType, size_t _Sz, - enable_if_t<is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr> + template <__span_array_convertible<element_type> _OtherElementType, size_t _Sz> _LIBCPP_INLINE_VISIBILITY constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {} - template <class _OtherElementType, size_t _Sz, - enable_if_t<is_convertible_v<const _OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr> + template <class _OtherElementType, size_t _Sz> + requires __span_array_convertible<const _OtherElementType, element_type> _LIBCPP_INLINE_VISIBILITY constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {} @@ -491,12 +483,9 @@ public: constexpr span(_Range&& __r) : __data(ranges::data(__r)), __size{ranges::size(__r)} {} #endif - template <class _OtherElementType, size_t _OtherExtent> + template <__span_array_convertible<element_type> _OtherElementType, size_t _OtherExtent> _LIBCPP_INLINE_VISIBILITY - constexpr span(const span<_OtherElementType, _OtherExtent>& __other, - enable_if_t< - is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, - nullptr_t> = nullptr) noexcept + constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept : __data{__other.data()}, __size{__other.size()} {} // ~span() noexcept = default; @@ -622,13 +611,11 @@ inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true; template <class _Tp, size_t _Extent> _LIBCPP_INLINE_VISIBILITY auto as_bytes(span<_Tp, _Extent> __s) noexcept --> decltype(__s.__as_bytes()) -{ return __s.__as_bytes(); } +{ return __s.__as_bytes(); } -template <class _Tp, size_t _Extent> +template <class _Tp, size_t _Extent> requires(!is_const_v<_Tp>) _LIBCPP_INLINE_VISIBILITY auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept --> enable_if_t<!is_const_v<_Tp>, decltype(__s.__as_writable_bytes())> { return __s.__as_writable_bytes(); } #if _LIBCPP_STD_VER > 17 diff --git a/contrib/libs/cxxsupp/libcxx/include/stack b/contrib/libs/cxxsupp/libcxx/include/stack index 7405896001..59878c1d84 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stack +++ b/contrib/libs/cxxsupp/libcxx/include/stack @@ -107,6 +107,10 @@ template <class T, class Container> #include <type_traits> #include <version> +// standard-mandated includes +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index 4233cdd8cb..e595fc0960 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -539,13 +539,11 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); #include <__utility/swap.h> #include <__utility/unreachable.h> #include <climits> -#include <compare> +#include <cstdint> #include <cstdio> // EOF #include <cstdlib> #include <cstring> -#include <initializer_list> #include <iosfwd> -#include <iterator> // TODO: Remove this include #include <limits> #include <memory> #include <stdexcept> @@ -557,9 +555,18 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); # include <cwchar> #endif -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS -# include <cstdint> -#endif +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [string.syn] +#include <compare> +#include <initializer_list> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -625,11 +632,8 @@ struct __can_be_converted_to_string_view : public _BoolConstant< #ifndef _LIBCPP_HAS_NO_CHAR8_T typedef basic_string<char8_t> u8string; #endif - -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS typedef basic_string<char16_t> u16string; typedef basic_string<char32_t> u32string; -#endif struct __uninitialized_size_tag {}; @@ -639,10 +643,8 @@ class #ifndef _LIBCPP_HAS_NO_CHAR8_T _LIBCPP_PREFERRED_NAME(u8string) #endif -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS _LIBCPP_PREFERRED_NAME(u16string) _LIBCPP_PREFERRED_NAME(u32string) -#endif basic_string { static_assert(sizeof(_CharT) <= 4, "libc++ implementation of std::basic_string does not support extra-wide character types"); diff --git a/contrib/libs/cxxsupp/libcxx/include/string_view b/contrib/libs/cxxsupp/libcxx/include/string_view index 187dfa3a15..1b0ac29ae5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string_view +++ b/contrib/libs/cxxsupp/libcxx/include/string_view @@ -212,14 +212,24 @@ namespace std { #include <__ranges/enable_view.h> #include <__ranges/size.h> #include <__string/char_traits.h> -#include <compare> #include <iosfwd> -#include <iterator> // TODO: Remove this include #include <limits> #include <stdexcept> #include <type_traits> #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [string.view.synop] +#include <compare> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/system_error b/contrib/libs/cxxsupp/libcxx/include/system_error index 770092ebe6..d9fe8b211b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/system_error +++ b/contrib/libs/cxxsupp/libcxx/include/system_error @@ -147,12 +147,14 @@ template <> struct hash<std::error_condition>; #include <__errc> #include <__functional/hash.h> #include <__functional/unary_function.h> -#include <compare> #include <stdexcept> #include <string> #include <type_traits> #include <version> +// standard-mandated includes +#include <compare> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/thread b/contrib/libs/cxxsupp/libcxx/include/thread index 4bb3c7a004..b4f782455e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/thread +++ b/contrib/libs/cxxsupp/libcxx/include/thread @@ -98,6 +98,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); #include <type_traits> #include <version> +// standard-mandated includes +#include <compare> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/tuple b/contrib/libs/cxxsupp/libcxx/include/tuple index ce0abeb5e0..b434dae753 100644 --- a/contrib/libs/cxxsupp/libcxx/include/tuple +++ b/contrib/libs/cxxsupp/libcxx/include/tuple @@ -215,11 +215,13 @@ template <class... Types> #include <__utility/pair.h> #include <__utility/piecewise_construct.h> #include <__utility/swap.h> -#include <compare> #include <cstddef> #include <type_traits> #include <version> +// standard-mandated includes +#include <compare> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/typeindex b/contrib/libs/cxxsupp/libcxx/include/typeindex index a92375ab75..416e48b8d3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/typeindex +++ b/contrib/libs/cxxsupp/libcxx/include/typeindex @@ -47,10 +47,12 @@ struct hash<type_index> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/unary_function.h> -#include <compare> #include <typeinfo> #include <version> +// standard-mandated includes +#include <compare> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map index 4fc068d6e6..12b4e5af63 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_map +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map @@ -527,12 +527,23 @@ template <class Key, class T, class Hash, class Pred, class Alloc> #include <__memory/addressof.h> #include <__node_handle> #include <__utility/forward.h> -#include <compare> -#include <iterator> // TODO: Remove this include #include <stdexcept> #include <tuple> #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [unord.map.syn] +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_set b/contrib/libs/cxxsupp/libcxx/include/unordered_set index 48c6ff48df..3fc686c8d3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_set +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_set @@ -472,10 +472,21 @@ template <class Value, class Hash, class Pred, class Alloc> #include <__memory/addressof.h> #include <__node_handle> #include <__utility/forward.h> -#include <compare> -#include <iterator> // TODO: Remove this include #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [unord.set.syn] +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/utility b/contrib/libs/cxxsupp/libcxx/include/utility index 9fa867f96c..fc7909aef1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/utility +++ b/contrib/libs/cxxsupp/libcxx/include/utility @@ -240,11 +240,13 @@ template <class T> #include <__utility/to_underlying.h> #include <__utility/transaction.h> #include <__utility/unreachable.h> -#include <compare> -#include <initializer_list> #include <type_traits> #include <version> +// standard-mandated includes +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/valarray b/contrib/libs/cxxsupp/libcxx/include/valarray index 300298a1bf..48262b7281 100644 --- a/contrib/libs/cxxsupp/libcxx/include/valarray +++ b/contrib/libs/cxxsupp/libcxx/include/valarray @@ -357,10 +357,12 @@ template <class T> unspecified2 end(const valarray<T>& v); #include <__utility/swap.h> #include <cmath> #include <cstddef> -#include <initializer_list> #include <new> #include <version> +// standard-mandated includes +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/variant b/contrib/libs/cxxsupp/libcxx/include/variant index eb120c18e7..316a1c3329 100644 --- a/contrib/libs/cxxsupp/libcxx/include/variant +++ b/contrib/libs/cxxsupp/libcxx/include/variant @@ -211,7 +211,6 @@ namespace std { #include <__utility/move.h> #include <__utility/swap.h> #include <__variant/monostate.h> -#include <compare> #include <exception> #include <initializer_list> #include <limits> @@ -220,6 +219,9 @@ namespace std { #include <type_traits> #include <version> +// standard-mandated includes +#include <compare> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector index 79b40ed666..940443b8d7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/vector +++ b/contrib/libs/cxxsupp/libcxx/include/vector @@ -296,10 +296,8 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 #include <__utility/move.h> #include <__utility/swap.h> #include <climits> -#include <compare> #include <cstdlib> #include <cstring> -#include <initializer_list> #include <iosfwd> // for forward declaration of vector #include <limits> #include <memory> @@ -307,6 +305,19 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 #include <type_traits> #include <version> +// standard-mandated includes + +// [iterator.range] +#include <__iterator/access.h> +#include <__iterator/data.h> +#include <__iterator/empty.h> +#include <__iterator/reverse_access.h> +#include <__iterator/size.h> + +// [vector.syn] +#include <compare> +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/version b/contrib/libs/cxxsupp/libcxx/include/version index 9e89375d62..217d1a0148 100644 --- a/contrib/libs/cxxsupp/libcxx/include/version +++ b/contrib/libs/cxxsupp/libcxx/include/version @@ -241,7 +241,7 @@ __cpp_lib_void_t 201411L <type_traits> # define __cpp_lib_as_const 201510L # define __cpp_lib_atomic_is_always_lock_free 201603L # define __cpp_lib_bool_constant 201505L -// # define __cpp_lib_boyer_moore_searcher 201603L +# define __cpp_lib_boyer_moore_searcher 201603L # define __cpp_lib_byte 201603L # define __cpp_lib_chrono 201611L # define __cpp_lib_clamp 201603L diff --git a/contrib/libs/cxxsupp/libcxx/src/algorithm.cpp b/contrib/libs/cxxsupp/libcxx/src/algorithm.cpp index decc8419fa..bd47e08b38 100644 --- a/contrib/libs/cxxsupp/libcxx/src/algorithm.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/algorithm.cpp @@ -10,6 +10,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD +// TODO(varconst): this currently doesn't benefit `ranges::sort` because it uses `ranges::less` instead of `__less`. + template void __sort<__less<char>&, char*>(char*, char*, __less<char>&); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&); diff --git a/contrib/libs/cxxsupp/libcxx/ya.make b/contrib/libs/cxxsupp/libcxx/ya.make index 9e43be3294..ee3fe7bcea 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-06-14) +VERSION(2022-06-18) -ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/1cf4113952ae3e4cc75decdf6feb3ce5dd8ca4a1.tar.gz) +ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/3766992291fde4b7f5d1ba45be9969e6ad5c6cf1.tar.gz) ADDINCL( GLOBAL contrib/libs/cxxsupp/libcxx/include |