diff options
author | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-10-09 12:29:46 +0300 |
---|---|---|
committer | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-10-09 13:14:22 +0300 |
commit | 9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch) | |
tree | a8fb3181d5947c0d78cf402aa56e686130179049 /contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches | |
parent | a44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff) | |
download | ydb-9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80.tar.gz |
publishFullContrib: true for ydb
<HIDDEN_URL>
commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches')
63 files changed, 5856 insertions, 0 deletions
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/01-commit-e0e82fc-initial.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/01-commit-e0e82fc-initial.patch new file mode 100644 index 0000000000..4632acc234 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/01-commit-e0e82fc-initial.patch @@ -0,0 +1,85 @@ +diff --git a/include/__config b/include/__config +index acedbdb..fdb3b18 100644 +--- a/include/__config ++++ b/include/__config +@@ -91,7 +91,12 @@ + // Previously libc++ used "unsigned int" exclusively. + # 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 ++#endif + // All the regex constants must be distinct and nonzero. + # define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO + // Use raw pointers, not wrapped ones, for std::span's iterator type. +diff --git a/include/typeinfo b/include/typeinfo +index 3d23458..e46956e 100644 +--- a/include/typeinfo ++++ b/include/typeinfo +@@ -106,6 +106,11 @@ public: + + size_t hash_code() const _NOEXCEPT; + ++#ifdef __EMSCRIPTEN__ ++ // XXX Emscripten: adding `always_inline` fixes ++ // https://github.com/emscripten-core/emscripten/issues/13330 ++ __attribute__((always_inline)) ++#endif + _LIBCPP_INLINE_VISIBILITY + bool operator==(const type_info& __arg) const _NOEXCEPT { + return __compare(__arg) == 0; +diff --git a/src/new.cpp b/src/new.cpp +index 48d6f99..cfef148 100644 +--- a/src/new.cpp ++++ b/src/new.cpp +@@ -74,8 +74,17 @@ operator new(std::size_t size) _THROW_BAD_ALLOC + else + #ifndef _LIBCPP_NO_EXCEPTIONS + throw std::bad_alloc(); ++#else ++#ifdef __EMSCRIPTEN__ ++ // Abort here so that when exceptions are disabled, we do not just ++ // return 0 when malloc returns 0. ++ // We could also do this with set_new_handler, but that adds a ++ // global constructor and a table entry, overhead that we can avoid ++ // by doing it this way. ++ abort(); + #else + break; ++#endif + #endif + } + return p; +diff --git a/src/support/runtime/exception_fallback.ipp b/src/support/runtime/exception_fallback.ipp +index ade9335..100ee6d 100644 +--- a/src/support/runtime/exception_fallback.ipp ++++ b/src/support/runtime/exception_fallback.ipp +@@ -47,6 +47,7 @@ get_terminate() noexcept + return __libcpp_atomic_load(&__terminate_handler); + } + ++#ifndef __EMSCRIPTEN__ // We provide this in JS + _LIBCPP_NORETURN + void + terminate() noexcept +@@ -69,7 +70,9 @@ terminate() noexcept + } + #endif // _LIBCPP_NO_EXCEPTIONS + } ++#endif // !__EMSCRIPTEN__ + ++#if !defined(__EMSCRIPTEN__) + bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; } + + int uncaught_exceptions() noexcept +@@ -78,6 +81,7 @@ int uncaught_exceptions() noexcept + fprintf(stderr, "uncaught_exceptions not yet implemented\n"); + ::abort(); + } ++#endif // !__EMSCRIPTEN__ + + + exception::~exception() noexcept diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/02-comp_ref_type.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/02-comp_ref_type.patch new file mode 100644 index 0000000000..c8ef916e75 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/02-comp_ref_type.patch @@ -0,0 +1,13 @@ +diff --git a/include/__algorithm/comp_ref_type.h b/include/__algorithm/comp_ref_type.h +index ed0ed59..3e90e9a 100644 +--- a/include/__algorithm/comp_ref_type.h ++++ b/include/__algorithm/comp_ref_type.h +@@ -51,7 +51,7 @@ struct __debug_less + _LIBCPP_CONSTEXPR_AFTER_CXX11 + inline _LIBCPP_INLINE_VISIBILITY + decltype((void)declval<_Compare&>()( +- declval<_LHS &>(), declval<_RHS &>())) ++ declval<_LHS const&>(), declval<_RHS const&>())) + __do_compare_assert(int, _LHS & __l, _RHS & __r) { + _LIBCPP_ASSERT(!__comp_(__l, __r), + "Comparator does not induce a strict weak ordering"); diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/03-missed-include.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/03-missed-include.patch new file mode 100644 index 0000000000..4510d4b0af --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/03-missed-include.patch @@ -0,0 +1,84 @@ +diff --git a/include/__bit/bit_cast.h b/include/__bit/bit_cast.h +index fbb70b3..fc29a74 100644 +--- a/include/__bit/bit_cast.h ++++ b/include/__bit/bit_cast.h +@@ -11,6 +11,7 @@ + #define _LIBCPP___BIT_BIT_CAST_H + + #include <__config> ++#include <cstring> + #include <type_traits> + + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +diff --git a/include/__locale b/include/__locale +index ad97be0..514cb4a 100644 +--- a/include/__locale ++++ b/include/__locale +@@ -12,6 +12,7 @@ + + #include <__availability> + #include <__config> ++#include <atomic> + #include <cctype> + #include <cstdint> + #include <locale.h> +diff --git a/include/__memory/unique_ptr.h b/include/__memory/unique_ptr.h +index 348c903..e9d4189 100644 +--- a/include/__memory/unique_ptr.h ++++ b/include/__memory/unique_ptr.h +@@ -18,6 +18,7 @@ + #include <__utility/forward.h> + #include <__utility/move.h> + #include <cstddef> ++#include <stlfwd> + #include <type_traits> + + #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) +diff --git a/include/__random/log2.h b/include/__random/log2.h +index b077d21..f4f8377 100644 +--- a/include/__random/log2.h ++++ b/include/__random/log2.h +@@ -11,6 +11,7 @@ + + #include <__config> + #include <cstddef> ++#include <limits> + #include <type_traits> + + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +diff --git a/include/memory b/include/memory +index 3bc31d2..088cf21 100644 +--- a/include/memory ++++ b/include/memory +@@ -830,6 +830,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); + #include <iterator> + #include <new> + #include <stdexcept> ++#include <stlfwd> + #include <tuple> + #include <type_traits> + #include <typeinfo> +diff --git a/include/type_traits b/include/type_traits +index 54df709..86bc5fa 100644 +--- a/include/type_traits ++++ b/include/type_traits +@@ -419,6 +419,7 @@ namespace std + #include <__config> + #include <cstddef> + #include <version> ++#include <__utility/declval.h> + + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) + # pragma GCC system_header +diff --git a/src/support/runtime/exception_fallback.ipp b/src/support/runtime/exception_fallback.ipp +index 100ee6d..ebdca7e 100644 +--- a/src/support/runtime/exception_fallback.ipp ++++ b/src/support/runtime/exception_fallback.ipp +@@ -8,6 +8,7 @@ + //===----------------------------------------------------------------------===// + + #include <cstdio> ++#include "../../include/atomic_support.h" + + namespace std { + diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/04-libcpp-std-ver-14.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/04-libcpp-std-ver-14.patch new file mode 100644 index 0000000000..1780f6676e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/04-libcpp-std-ver-14.patch @@ -0,0 +1,24 @@ +diff --git a/include/__bit/bit_cast.h b/include/__bit/bit_cast.h +index fc29a74..10c2c94 100644 +--- a/include/__bit/bit_cast.h ++++ b/include/__bit/bit_cast.h +@@ -31,6 +31,19 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI + constexpr _ToType bit_cast(_FromType const& __from) noexcept { + return __builtin_bit_cast(_ToType, __from); + } ++#else _LIBCPP_STD_VER > 14 ++ ++template<class _ToType, class _FromType, class = enable_if_t< ++ sizeof(_ToType) == sizeof(_FromType) && ++ is_trivially_copyable<_ToType>::value && ++ is_trivially_copyable<_FromType>::value ++>> ++_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI ++constexpr _ToType bit_cast(_FromType const& __from) noexcept { ++ _ToType __to; ++ ::memcpy(&__to, &__from, sizeof(__from)); ++ return __to; ++} + + #endif // _LIBCPP_STD_VER > 17 + diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/05-compiler-msvc.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/05-compiler-msvc.patch new file mode 100644 index 0000000000..c871f96564 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/05-compiler-msvc.patch @@ -0,0 +1,998 @@ +diff --git a/include/__chrono/calendar.h b/include/__chrono/calendar.h +index 9e5642f..0320d50 100644 +--- a/include/__chrono/calendar.h ++++ b/include/__chrono/calendar.h +@@ -1247,6 +1247,11 @@ constexpr hours make24(const hours& __h, bool __is_pm) noexcept + + } // namespace chrono + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4455) ++#endif ++ + inline namespace literals + { + inline namespace chrono_literals +@@ -1263,6 +1268,10 @@ inline namespace literals + } // namespace chrono_literals + } // namespace literals + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif ++ + namespace chrono { // hoist the literals into namespace std::chrono + using namespace literals::chrono_literals; + } // namespace chrono +diff --git a/include/__chrono/duration.h b/include/__chrono/duration.h +index f520759..452543b 100644 +--- a/include/__chrono/duration.h ++++ b/include/__chrono/duration.h +@@ -528,6 +528,12 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2 + } // namespace chrono + + #if _LIBCPP_STD_VER > 11 ++ ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4455) ++#endif ++ + // Suffixes for duration literals [time.duration.literals] + inline namespace literals + { +@@ -602,6 +608,10 @@ inline namespace literals + } // namespace chrono_literals + } // namespace literals + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif ++ + namespace chrono { // hoist the literals into namespace std::chrono + using namespace literals::chrono_literals; + } // namespace chrono +diff --git a/include/__config b/include/__config +index fdb3b18..0a8af3c 100644 +--- a/include/__config ++++ b/include/__config +@@ -150,7 +150,7 @@ + #define _LIBCPP_TOSTRING2(x) #x + #define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) + +-#if __cplusplus < 201103L ++#if __cplusplus < 201103L && !defined(_LIBCPP_COMPILER_MSVC) + #define _LIBCPP_CXX03_LANG + #endif + +@@ -762,8 +762,12 @@ typedef __char32_t char32_t; + // 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. ++#ifdef _LIBCPP_COMPILER_MSVC ++# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION ++#else + # define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE + #endif ++#endif + + #ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU + # ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT +@@ -851,7 +855,8 @@ typedef unsigned int char32_t; + # define _LIBCPP_CONSTEVAL consteval + #endif + +-#if _LIBCPP_STD_VER <= 17 || !defined(__cpp_concepts) || __cpp_concepts < 201907L ++// Even modern versions of MSVC toolkit have issues compiling libc++'s concepts-related code ++#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_COMPILER_MSVC) || !defined(__cpp_concepts) || __cpp_concepts < 201907L + #define _LIBCPP_HAS_NO_CONCEPTS + #endif + +@@ -1211,6 +1216,7 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( + + #if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \ + !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \ ++ !defined(_LIBCPP_COMPILER_MSVC) && \ + !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP) + # define _LIBCPP_HAS_NO_ATOMIC_HEADER + #else +@@ -1378,6 +1384,12 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( + # define _LIBCPP_FOPEN_CLOEXEC_MODE + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#define _LIBCPP_BUILTIN_CONSTANT_P(x) false ++#else ++#define _LIBCPP_BUILTIN_CONSTANT_P(x) __builtin_constant_p(x) ++#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. +diff --git a/include/__functional/bind.h b/include/__functional/bind.h +index c352406..a5b0c0e 100644 +--- a/include/__functional/bind.h ++++ b/include/__functional/bind.h +@@ -191,6 +191,11 @@ struct __mu_return_impl<_Ti, false, false, false, _TupleUj> + typedef _Ti& type; + }; + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4296 ) ++#endif ++ + template <class _Ti, class _TupleUj> + struct __mu_return + : public __mu_return_impl<_Ti, +@@ -202,6 +207,10 @@ struct __mu_return + { + }; + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif ++ + template <class _Fp, class _BoundArgs, class _TupleUj> + struct __is_valid_bind_return + { +@@ -263,6 +272,11 @@ __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, + return _VSTD::__invoke(__f, _VSTD::__mu(_VSTD::get<_Indx>(__bound_args), __args)...); + } + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4296 ) ++#endif ++ + template<class _Fp, class ..._BoundArgs> + class __bind + #if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES) +@@ -309,6 +323,14 @@ public: + } + }; + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif ++ ++#if defined(__CUDACC__) && defined(_MSC_VER) ++# define Y_CUDAFE_MSVC_BUG ++#endif ++ + template<class _Fp, class ..._BoundArgs> + struct is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {}; + +@@ -318,7 +340,11 @@ class __bind_r + { + typedef __bind<_Fp, _BoundArgs...> base; + typedef typename base::_Fd _Fd; ++#if !defined(Y_CUDAFE_MSVC_BUG) + typedef typename base::_Td _Td; ++#else ++ typedef typename tuple<typename decay<_BoundArgs>::type...> _Td; ++#endif + public: + typedef _Rp result_type; + +diff --git a/include/__functional/function.h b/include/__functional/function.h +index 4698c8c..895d1c3 100644 +--- a/include/__functional/function.h ++++ b/include/__functional/function.h +@@ -965,11 +965,18 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)> + + __func __f_; + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4348 ) ++#endif + template <class _Fp, bool = _And< + _IsNotSame<__uncvref_t<_Fp>, function>, + __invokable<_Fp, _ArgTypes...> + >::value> + struct __callable; ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif + template <class _Fp> + struct __callable<_Fp, true> + { +diff --git a/include/__functional/hash.h b/include/__functional/hash.h +index 2b3b96e..89cb02a 100644 +--- a/include/__functional/hash.h ++++ b/include/__functional/hash.h +@@ -411,12 +411,20 @@ struct _PairT { + size_t second; + }; + ++// Disable double inline warning. ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4141 ) ++#endif + _LIBCPP_INLINE_VISIBILITY + inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT { + typedef __scalar_hash<_PairT> _HashT; + const _PairT __p = {__lhs, __rhs}; + return _HashT()(__p); + } ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif + + _LIBCPP_SUPPRESS_DEPRECATED_PUSH + template<class _Tp> +diff --git a/include/__hash_table b/include/__hash_table +index 36f2ef7..e802dd2 100644 +--- a/include/__hash_table ++++ b/include/__hash_table +@@ -91,6 +91,10 @@ struct __hash_node_base + _LIBCPP_INLINE_VISIBILITY __hash_node_base() _NOEXCEPT : __next_(nullptr) {} + }; + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning( push ) ++#pragma warning( disable: 4624 ) ++#endif // _LIBCPP_COMPILER_MSVC + template <class _Tp, class _VoidPtr> + struct _LIBCPP_STANDALONE_DEBUG __hash_node + : public __hash_node_base +@@ -103,6 +107,9 @@ struct _LIBCPP_STANDALONE_DEBUG __hash_node + size_t __hash_; + __node_value_type __value_; + }; ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning( pop ) ++#endif // _LIBCPP_COMPILER_MSVC + + inline _LIBCPP_INLINE_VISIBILITY + bool +diff --git a/include/__locale b/include/__locale +index 514cb4a..9675e4b 100644 +--- a/include/__locale ++++ b/include/__locale +@@ -276,6 +276,11 @@ public: + return do_compare(__lo1, __hi1, __lo2, __hi2); + } + ++// Disable double inline warning. ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4141 ) ++#endif + // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work + // around a dllimport bug that expects an external instantiation. + _LIBCPP_INLINE_VISIBILITY +@@ -284,6 +289,9 @@ public: + { + return do_transform(__lo, __hi); + } ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif + + _LIBCPP_INLINE_VISIBILITY + long hash(const char_type* __lo, const char_type* __hi) const +diff --git a/include/__memory/shared_ptr.h b/include/__memory/shared_ptr.h +index 0f28bcd..ff8e601 100644 +--- a/include/__memory/shared_ptr.h ++++ b/include/__memory/shared_ptr.h +@@ -98,6 +98,7 @@ _ValueType __libcpp_acquire_load(_ValueType const* __value) { + #endif + } + ++#ifndef _LIBCPP_COMPILER_MSVC + template <class _Tp> + inline _LIBCPP_INLINE_VISIBILITY _Tp + __libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT +@@ -119,6 +120,7 @@ __libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT + return __t -= 1; + #endif + } ++#endif + + class _LIBCPP_EXCEPTION_ABI bad_weak_ptr + : public std::exception +diff --git a/include/__utility/declval.h b/include/__utility/declval.h +index 97fd1eb..e2fcf48 100644 +--- a/include/__utility/declval.h ++++ b/include/__utility/declval.h +@@ -26,8 +26,27 @@ template <class _Tp> + _Tp __declval(long); + _LIBCPP_SUPPRESS_DEPRECATED_POP + ++#ifdef _LIBCPP_COMPILER_MSVC + template <class _Tp> +-decltype(__declval<_Tp>(0)) declval() _NOEXCEPT; ++using __declval_void = void; ++ ++template <class _Tp, class = void> ++struct __declval_add_rvalue_reference { ++ using type = _Tp; ++}; ++template <class _Tp> ++struct __declval_add_rvalue_reference<_Tp, __declval_void<_Tp&>> { ++ using type = _Tp&&; ++}; ++#endif ++ ++template <class _Tp> ++#ifdef _LIBCPP_COMPILER_MSVC ++typename __declval_add_rvalue_reference<_Tp>::type ++#else ++decltype(__declval<_Tp>(0)) ++#endif ++declval() _NOEXCEPT; + + _LIBCPP_END_NAMESPACE_STD + +diff --git a/include/__utility/integer_sequence.h b/include/__utility/integer_sequence.h +index 633f133..6c56e74 100644 +--- a/include/__utility/integer_sequence.h ++++ b/include/__utility/integer_sequence.h +@@ -52,9 +52,16 @@ struct __make_integer_sequence_checked + static_assert(is_integral<_Tp>::value, + "std::make_integer_sequence can only be instantiated with an integral type" ); + static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length"); ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4296 ) ++#endif + // Workaround GCC bug by preventing bad installations when 0 <= _Ep + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929 + typedef _LIBCPP_NODEBUG __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type; ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif + }; + + template <class _Tp, _Tp _Ep> +diff --git a/include/__utility/transaction.h b/include/__utility/transaction.h +index 87e51c0..79e6c3f 100644 +--- a/include/__utility/transaction.h ++++ b/include/__utility/transaction.h +@@ -76,7 +76,10 @@ struct __transaction { + } + + _LIBCPP_HIDE_FROM_ABI +- _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__transaction() { ++#if !defined(_LIBCPP_COMPILER_MSVC) ++ _LIBCPP_CONSTEXPR_AFTER_CXX17 ++#endif ++ ~__transaction() { + if (!__completed_) + __rollback_(); + } +diff --git a/include/atomic b/include/atomic +index 4a5c484..09e3dd3 100644 +--- a/include/atomic ++++ b/include/atomic +@@ -889,7 +889,13 @@ _Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, + + #define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0) + +-#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP) ++#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP) || defined(_LIBCPP_COMPILER_MSVC) ++ ++#if defined(_LIBCPP_COMPILER_MSVC) ++_LIBCPP_END_NAMESPACE_STD ++#include <__support/win32/atomic_win32.h> ++_LIBCPP_BEGIN_NAMESPACE_STD ++#endif + + template <typename _Tp> + struct __cxx_atomic_base_impl { +@@ -907,6 +913,10 @@ struct __cxx_atomic_base_impl { + + #define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s) + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4141 ) ++#endif + _LIBCPP_INLINE_VISIBILITY inline + void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT { + __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order)); +@@ -916,6 +926,9 @@ _LIBCPP_INLINE_VISIBILITY inline + void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT { + __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order)); + } ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif + + template<class _Tp> + _LIBCPP_INLINE_VISIBILITY +@@ -963,12 +976,20 @@ _Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> * __a, _Tp __value, memory + return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order)); + } + ++// Disable double inline warning ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4141 ) ++#endif + _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR memory_order __to_failure_order(memory_order __order) { + // Avoid switch statement to make this a constexpr. + return __order == memory_order_release ? memory_order_relaxed: + (__order == memory_order_acq_rel ? memory_order_acquire: + __order); + } ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif + + template<class _Tp> + _LIBCPP_INLINE_VISIBILITY +@@ -1651,7 +1672,14 @@ struct __atomic_base // false + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {} + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4522 ) ++#endif + __atomic_base(const __atomic_base&) = delete; ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif + }; + + #if defined(__cpp_lib_atomic_is_always_lock_free) +@@ -2433,9 +2461,16 @@ typedef struct atomic_flag + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4522 ) ++#endif + atomic_flag(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) volatile = delete; ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif + + } atomic_flag; + +diff --git a/include/complex.h b/include/complex.h +index a281466..58cbbaa 100644 +--- a/include/complex.h ++++ b/include/complex.h +@@ -29,7 +29,11 @@ + + #else // __cplusplus + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(complex.h) ++#else + #include_next <complex.h> ++#endif + + #endif // __cplusplus + +diff --git a/include/ctype.h b/include/ctype.h +index ba09250..b163750 100644 +--- a/include/ctype.h ++++ b/include/ctype.h +@@ -35,7 +35,11 @@ int toupper(int c); + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(ctype.h) ++#else + #include_next <ctype.h> ++#endif + + #ifdef __cplusplus + +diff --git a/include/errno.h b/include/errno.h +index ea0559f..907a4f1 100644 +--- a/include/errno.h ++++ b/include/errno.h +@@ -28,7 +28,20 @@ Macros: + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++// errno is defined in several files so we can't use #ifndef errno here ++#ifdef errno ++// undefine errno to avoid substitution in errno.h include file name. ++#pragma push_macro("errno") ++#undef errno ++#include Y_UCRT_INCLUDE_NEXT(errno.h) ++#pragma pop_macro("errno") ++#else ++#include Y_UCRT_INCLUDE_NEXT(errno.h) ++#endif ++#else + #include_next <errno.h> ++#endif + + #ifdef __cplusplus + +diff --git a/include/fenv.h b/include/fenv.h +index a9ba680..5a8cebf 100644 +--- a/include/fenv.h ++++ b/include/fenv.h +@@ -56,7 +56,11 @@ int feupdateenv(const fenv_t* envp); + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(fenv.h) ++#else + #include_next <fenv.h> ++#endif + + #ifdef __cplusplus + +diff --git a/include/float.h b/include/float.h +index 6060812..6479a01 100644 +--- a/include/float.h ++++ b/include/float.h +@@ -76,7 +76,11 @@ Macros: + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(float.h) ++#else + #include_next <float.h> ++#endif + + #ifdef __cplusplus + +diff --git a/include/initializer_list b/include/initializer_list +index e61318e..827f137 100644 +--- a/include/initializer_list ++++ b/include/initializer_list +@@ -45,6 +45,13 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in + #include <__config> + #include <cstddef> + ++#if defined(_LIBCPP_COMPILER_MSVC) && !defined(__clang__) ++ ++#include Y_MSVC_INCLUDE_NEXT(yvals.h) ++#include Y_MSVC_INCLUDE_NEXT(initializer_list) ++ ++#else ++ + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) + # pragma GCC system_header + #endif +@@ -79,6 +86,11 @@ public: + _LIBCPP_CONSTEXPR_AFTER_CXX11 + initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {} + ++ initializer_list(const initializer_list&) = default; ++ initializer_list(initializer_list&&) = default; ++ initializer_list& operator=(const initializer_list&) = delete; ++ initializer_list& operator=(initializer_list&&) = delete; ++ + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX11 + size_t size() const _NOEXCEPT {return __size_;} +@@ -114,4 +126,6 @@ end(initializer_list<_Ep> __il) _NOEXCEPT + + } // namespace std + ++#endif // _LIBCPP_COMPILER_MSVC ++ + #endif // _LIBCPP_INITIALIZER_LIST +diff --git a/include/inttypes.h b/include/inttypes.h +index e0fd71f..5873e3f 100644 +--- a/include/inttypes.h ++++ b/include/inttypes.h +@@ -248,7 +248,11 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int + # define __STDC_FORMAT_MACROS + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(inttypes.h) ++#else + #include_next <inttypes.h> ++#endif + + #ifdef __cplusplus + +diff --git a/include/limits.h b/include/limits.h +index 3e1e85a..51ff28e 100644 +--- a/include/limits.h ++++ b/include/limits.h +@@ -44,7 +44,11 @@ Macros: + #endif + + #ifndef __GNUC__ ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_MSVC_INCLUDE_NEXT(limits.h) ++#else + #include_next <limits.h> ++#endif + #else + // GCC header limits.h recursively includes itself through another header called + // syslimits.h for some reason. This setup breaks down if we directly +diff --git a/include/locale b/include/locale +index fd605e3..7e00dfe 100644 +--- a/include/locale ++++ b/include/locale +@@ -1684,6 +1684,13 @@ public: + enum dateorder {no_order, dmy, mdy, ymd, ydm}; + }; + ++#ifdef _LIBCPP_COMPILER_MSVC ++// __time_get_c_storage should only be used for private inheritance to avoid ++// problems with non-virtual destructor ++#pragma warning ( push ) ++#pragma warning ( disable : 4265 ) ++#endif ++ + template <class _CharT> + class _LIBCPP_TEMPLATE_VIS __time_get_c_storage + { +@@ -1702,6 +1709,10 @@ protected: + ~__time_get_c_storage() {} + }; + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif ++ + template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage<char>::__weeks() const; + template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage<char>::__months() const; + template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage<char>::__am_pm() const; +diff --git a/include/locale.h b/include/locale.h +index 3a05c18..83b4bdf 100644 +--- a/include/locale.h ++++ b/include/locale.h +@@ -43,6 +43,10 @@ Functions: + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(locale.h) ++#else + #include_next <locale.h> ++#endif + + #endif // _LIBCPP_LOCALE_H +diff --git a/include/math.h b/include/math.h +index e2fd576..0a1d223 100644 +--- a/include/math.h ++++ b/include/math.h +@@ -297,7 +297,11 @@ long double truncl(long double x); + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(math.h) ++#else + #include_next <math.h> ++#endif + + #ifdef __cplusplus + +@@ -1757,7 +1761,11 @@ trunc(_A1 __lcpp_x) _NOEXCEPT + // and receive the definitions of mathematical constants, even if <math.h> + // has previously been included. + #if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES) ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(math.h) ++#else + #include_next <math.h> + #endif ++#endif + + #endif // _LIBCPP_MATH_H +diff --git a/include/setjmp.h b/include/setjmp.h +index de4f9ed..fca41aa 100644 +--- a/include/setjmp.h ++++ b/include/setjmp.h +@@ -31,7 +31,11 @@ void longjmp(jmp_buf env, int val); + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_MSVC_INCLUDE_NEXT(setjmp.h) ++#else + #include_next <setjmp.h> ++#endif + + #ifdef __cplusplus + +diff --git a/include/stdbool.h b/include/stdbool.h +index 369f8b3..c596f24 100644 +--- a/include/stdbool.h ++++ b/include/stdbool.h +@@ -25,7 +25,11 @@ Macros: + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_MSVC_INCLUDE_NEXT(stdbool.h) ++#else + #include_next <stdbool.h> ++#endif + + #ifdef __cplusplus + #undef bool +diff --git a/include/stddef.h b/include/stddef.h +index 19e344f..7b2c646 100644 +--- a/include/stddef.h ++++ b/include/stddef.h +@@ -14,7 +14,11 @@ + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(stddef.h) ++#else + #include_next <stddef.h> ++#endif + + #elif !defined(_LIBCPP_STDDEF_H) + #define _LIBCPP_STDDEF_H +@@ -42,7 +46,12 @@ Types: + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(stddef.h) ++typedef double max_align_t; ++#else + #include_next <stddef.h> ++#endif + + #ifdef __cplusplus + typedef decltype(nullptr) nullptr_t; +diff --git a/include/stdint.h b/include/stdint.h +index ee71f62..c9342a3 100644 +--- a/include/stdint.h ++++ b/include/stdint.h +@@ -120,6 +120,10 @@ Macros: + # define __STDC_CONSTANT_MACROS + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_MSVC_INCLUDE_NEXT(stdint.h) ++#else + #include_next <stdint.h> ++#endif + + #endif // _LIBCPP_STDINT_H +diff --git a/include/stdio.h b/include/stdio.h +index ad1b4c0..d0ffec5 100644 +--- a/include/stdio.h ++++ b/include/stdio.h +@@ -13,7 +13,11 @@ + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(stdio.h) ++#else + #include_next <stdio.h> ++#endif + + #elif !defined(_LIBCPP_STDIO_H) + #define _LIBCPP_STDIO_H +@@ -104,7 +108,11 @@ void perror(const char* s); + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(stdio.h) ++#else + #include_next <stdio.h> ++#endif + + #ifdef __cplusplus + +diff --git a/include/stdlib.h b/include/stdlib.h +index e4dce9c..a5c4986 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h +@@ -13,7 +13,11 @@ + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(stdlib.h) ++#else + #include_next <stdlib.h> ++#endif + + #elif !defined(_LIBCPP_STDLIB_H) + #define _LIBCPP_STDLIB_H +@@ -90,7 +94,20 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(stdlib.h) ++#ifdef __cplusplus ++extern "C" { ++#endif ++float fabsf(float); ++double fabs(double); ++long double fabsl(long double); ++#ifdef __cplusplus ++} ++#endif ++#else + #include_next <stdlib.h> ++#endif + + #ifdef __cplusplus + extern "C++" { +@@ -118,16 +135,28 @@ inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT { + + #if !defined(__sun__) + inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT { ++#ifdef _LIBCPP_COMPILER_MSVC ++ return fabsf(__lcpp_x); ++#else + return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h ++#endif + } + + inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT { ++#ifdef _LIBCPP_COMPILER_MSVC ++ return fabs(__lcpp_x); ++#else + return __builtin_fabs(__lcpp_x); ++#endif + } + + inline _LIBCPP_INLINE_VISIBILITY long double + abs(long double __lcpp_x) _NOEXCEPT { ++#ifdef _LIBCPP_COMPILER_MSVC ++ return fabsl(__lcpp_x); ++#else + return __builtin_fabsl(__lcpp_x); ++#endif + } + #endif // !defined(__sun__) + +diff --git a/include/string b/include/string +index d33f6ed..53cf9ab 100644 +--- a/include/string ++++ b/include/string +@@ -566,6 +566,10 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1 + _LIBCPP_PUSH_MACROS + #include <__undef_macros> + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4455 ) ++#endif + + _LIBCPP_BEGIN_NAMESPACE_STD + +diff --git a/include/string.h b/include/string.h +index 082c632..099b661 100644 +--- a/include/string.h ++++ b/include/string.h +@@ -57,7 +57,11 @@ size_t strlen(const char* s); + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(string.h) ++#else + #include_next <string.h> ++#endif + + // MSVCRT, GNU libc and its derivates may already have the correct prototype in + // <string.h>. This macro can be defined by users if their C library provides +diff --git a/include/tuple b/include/tuple +index 08ded9c..e499aff 100644 +--- a/include/tuple ++++ b/include/tuple +@@ -411,6 +411,23 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. + __tuple_leaf<_Ul, _Tl>()... + {} + ++#if defined(__NVCC__) && defined(_LIBCPP_COMPILER_MSVC) ++ // Yandex-specific: specialize the preceding constructor for the ++ // case of empty _Ul and _Tl to work around nvcc+msvc bug ++ // compiling libcxx std::map<int, int> m; m[1] = 2. ++ template <size_t ..._Uf, class ..._Tf, ++ class ..._Up> ++ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 ++ explicit ++ __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>, ++ __tuple_indices<>, __tuple_types<>, ++ _Up&&... __u) ++ _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value)) : ++ __tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))... ++ {} ++ // End of Yandex-specific ++#endif ++ + template <class _Alloc, size_t ..._Uf, class ..._Tf, + size_t ..._Ul, class ..._Tl, class ..._Up> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +diff --git a/include/wchar.h b/include/wchar.h +index ce63cf2..fd22a27 100644 +--- a/include/wchar.h ++++ b/include/wchar.h +@@ -13,7 +13,11 @@ + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(wchar.h) ++#else + #include_next <wchar.h> ++#endif + + #elif !defined(_LIBCPP_WCHAR_H) + #define _LIBCPP_WCHAR_H +@@ -120,7 +124,11 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, + #define __CORRECT_ISO_CPP_WCHAR_H_PROTO + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#include Y_UCRT_INCLUDE_NEXT(wchar.h) ++#else + #include_next <wchar.h> ++#endif + + // Determine whether we have const-correct overloads for wcschr and friends. + #if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_) +diff --git a/include/wctype.h b/include/wctype.h +index e4dc61a..98d6473 100644 +--- a/include/wctype.h ++++ b/include/wctype.h +@@ -54,6 +54,10 @@ wctrans_t wctrans(const char* property); + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++# include Y_UCRT_INCLUDE_NEXT(wctype.h) ++# define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H ++#else + // TODO: + // In the future, we should unconditionally include_next <wctype.h> here and instead + // have a mode under which the library does not need libc++'s <wctype.h> or <cwctype> +@@ -67,6 +71,7 @@ wctrans_t wctrans(const char* property); + # include_next <wctype.h> + # define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H + #endif ++#endif + + #ifdef __cplusplus + +diff --git a/src/support/runtime/exception_msvc.ipp b/src/support/runtime/exception_msvc.ipp +index 7e36c70..409d675 100644 +--- a/src/support/runtime/exception_msvc.ipp ++++ b/src/support/runtime/exception_msvc.ipp +@@ -14,6 +14,15 @@ + #include <stdio.h> + #include <stdlib.h> + ++#include <__config> ++ ++#ifdef _LIBCPP_COMPILER_MSVC ++// We don't want to depend on MSVC headers but ++// we have conflicting definitions otherwise due to ++// some other dependency on eh.h. ++#include Y_MSVC_INCLUDE_NEXT(eh.h) ++ ++#else + extern "C" { + typedef void (__cdecl* terminate_handler)(); + _LIBCPP_CRT_FUNC terminate_handler __cdecl set_terminate( +@@ -27,6 +36,7 @@ unexpected_handler __cdecl _get_unexpected(); + + int __cdecl __uncaught_exceptions(); + } ++#endif + + namespace std { + diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/06-no-spaceship-operator.sh b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/06-no-spaceship-operator.sh new file mode 100644 index 0000000000..64633e6143 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/06-no-spaceship-operator.sh @@ -0,0 +1 @@ +sed -i 's/#if _LIBCPP_STD_VER > 17/#if _LIBCPP_STD_VER > 17 \&\& !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)/' include/__compare/is_eq.h
\ No newline at end of file diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/07-concepts-arithmetic.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/07-concepts-arithmetic.patch new file mode 100644 index 0000000000..87a531cd4f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/07-concepts-arithmetic.patch @@ -0,0 +1,26 @@ +diff --git a/include/__concepts/arithmetic.h b/include/__concepts/arithmetic.h +index f86908c..e1ec8fc 100644 +--- a/include/__concepts/arithmetic.h ++++ b/include/__concepts/arithmetic.h +@@ -39,6 +39,8 @@ concept floating_point = is_floating_point_v<_Tp>; + template <class _Tp> + concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value; + template <class _Tp> ++concept __libcpp_not_integral = !is_integral_v<_Tp>; ++template <class _Tp> + concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value; + + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) +diff --git a/include/__format/format_arg.h b/include/__format/format_arg.h +index 5e1565b..443c9e3 100644 +--- a/include/__format/format_arg.h ++++ b/include/__format/format_arg.h +@@ -250,7 +250,7 @@ private: + requires is_void_v<_Tp> _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(_Tp* __p) noexcept + : __ptr(__p), __type_(__format::__arg_t::__ptr) {} + +- template <class _Tp> ++ template <__libcpp_not_integral _Tp> + _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(const _Tp& __v) noexcept + : __handle(__v), __type_(__format::__arg_t::__handle) {} + }; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/08-libcpp-constexpr.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/08-libcpp-constexpr.patch new file mode 100644 index 0000000000..2f9de34bd9 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/08-libcpp-constexpr.patch @@ -0,0 +1,13 @@ +diff --git a/include/__functional/function.h b/include/__functional/function.h +index 895d1c3..b1faed9 100644 +--- a/include/__functional/function.h ++++ b/include/__functional/function.h +@@ -610,7 +610,7 @@ struct __policy + _LIBCPP_INLINE_VISIBILITY + static const __policy* __create_empty() + { +- static const _LIBCPP_CONSTEXPR __policy __policy_ = {nullptr, nullptr, ++ static const /*_LIBCPP_CONSTEXPR*/ __policy __policy_ = {nullptr, nullptr, + true, + #ifndef _LIBCPP_NO_RTTI + &typeid(void) diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/09-msc-ver.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/09-msc-ver.patch new file mode 100644 index 0000000000..7bd7d4bfb7 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/09-msc-ver.patch @@ -0,0 +1,129 @@ +diff --git a/include/__compare/ordering.h b/include/__compare/ordering.h +index 1d466d6..337b562 100644 +--- a/include/__compare/ordering.h ++++ b/include/__compare/ordering.h +@@ -16,7 +16,14 @@ + # pragma GCC system_header + #endif + ++#if defined(_MSC_VER) && !defined(__clang__) ++// Omit inline namespace __y1, as MSVC2019 fails to find ordering classes ++// inside the inlined namespace when compiling the <=> operators. ++// See CROWDFUNDING-6 for the details. ++namespace std { ++#else + _LIBCPP_BEGIN_NAMESPACE_STD ++#endif + + #if _LIBCPP_STD_VER > 17 + +@@ -314,6 +321,10 @@ inline constexpr strong_ordering strong_ordering::greater(_OrdResult::__greater) + + #endif // _LIBCPP_STD_VER > 17 + ++#if defined(_MSC_VER) && !defined(__clang__) ++} ++#else + _LIBCPP_END_NAMESPACE_STD ++#endif + + #endif // _LIBCPP___COMPARE_ORDERING_H +diff --git a/include/__config b/include/__config +index 0a8af3c..0f32067 100644 +--- a/include/__config ++++ b/include/__config +@@ -1250,7 +1250,7 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( + # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) + #endif + +-#if _LIBCPP_STD_VER > 17 ++#if _LIBCPP_STD_VER > 17 && (!defined(_MSC_VER) || _MSC_VER >= 1929) + # define _LIBCPP_CONSTINIT constinit + #elif __has_attribute(require_constant_initialization) + # define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) +diff --git a/include/iostream b/include/iostream +index 10d17d6..dbabf3a 100644 +--- a/include/iostream ++++ b/include/iostream +@@ -46,17 +46,43 @@ extern wostream wclog; + + _LIBCPP_BEGIN_NAMESPACE_STD + ++#if defined(_MSC_VER) && !defined(__clang__) ++extern _LIBCPP_FUNC_VIS istream& cin; ++#else + extern _LIBCPP_FUNC_VIS istream cin; ++#endif ++#if defined(_MSC_VER) && !defined(__clang__) ++extern _LIBCPP_FUNC_VIS ostream& cout; ++#else + extern _LIBCPP_FUNC_VIS ostream cout; ++#endif ++#if defined(_MSC_VER) && !defined(__clang__) ++extern _LIBCPP_FUNC_VIS ostream& cerr; ++extern _LIBCPP_FUNC_VIS ostream& clog; ++#else + extern _LIBCPP_FUNC_VIS ostream cerr; + extern _LIBCPP_FUNC_VIS ostream clog; ++#endif + + #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS ++#if defined(_MSC_VER) && !defined(__clang__) ++extern _LIBCPP_FUNC_VIS wistream& wcin; ++#else + extern _LIBCPP_FUNC_VIS wistream wcin; ++#endif ++#if defined(_MSC_VER) && !defined(__clang__) ++extern _LIBCPP_FUNC_VIS wostream& wcout; ++#else + extern _LIBCPP_FUNC_VIS wostream wcout; ++#endif ++#if defined(_MSC_VER) && !defined(__clang__) ++extern _LIBCPP_FUNC_VIS wostream& wcerr; ++extern _LIBCPP_FUNC_VIS wostream& wclog; ++#else + extern _LIBCPP_FUNC_VIS wostream wcerr; + extern _LIBCPP_FUNC_VIS wostream wclog; + #endif ++#endif + + _LIBCPP_END_NAMESPACE_STD + +diff --git a/include/locale b/include/locale +index 7e00dfe..1e43702 100644 +--- a/include/locale ++++ b/include/locale +@@ -2577,8 +2577,12 @@ public: + : time_put<_CharT, _OutputIterator>(__nm, __refs) {} + + protected: ++#if defined(_MSC_VER) && defined(__clang__) ++ ~time_put_byname() {} ++#else + _LIBCPP_INLINE_VISIBILITY + ~time_put_byname() {} ++#endif + }; + + _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>) +diff --git a/src/filesystem/filesystem_common.h b/src/filesystem/filesystem_common.h +index c98d144..f6ba686 100644 +--- a/src/filesystem/filesystem_common.h ++++ b/src/filesystem/filesystem_common.h +@@ -138,6 +138,16 @@ size_t error_value<size_t>() { + return size_t(-1); + } + #endif ++ ++#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_IX86) ++// FIXME thegeorg@ MSVC on i686 somehow depends on this function presence. ++// Further investigation is needed in order to understand the logic behind this. ++template <> ++unsigned int error_value<unsigned int>() { ++ return unsigned int(-1); ++} ++#endif ++ + template <> + uintmax_t error_value<uintmax_t>() { + return uintmax_t(-1); diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/10-no-builtin-is-constant-evaluted.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/10-no-builtin-is-constant-evaluted.patch new file mode 100644 index 0000000000..064d85539d --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/10-no-builtin-is-constant-evaluted.patch @@ -0,0 +1,13 @@ +diff --git a/include/__format/format_parse_context.h b/include/__format/format_parse_context.h +index 3147be8..d16859c 100644 +--- a/include/__format/format_parse_context.h ++++ b/include/__format/format_parse_context.h +@@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD + // If the compiler has no concepts support, the format header will be disabled. + // Without concepts support enable_if needs to be used and that too much effort + // to support compilers with partial C++20 support. +-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) ++#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED) + + template <class _CharT> + class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_parse_context { diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/11-msvc-specific-patches.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/11-msvc-specific-patches.patch new file mode 100644 index 0000000000..5f8348a62f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/11-msvc-specific-patches.patch @@ -0,0 +1,59 @@ +diff --git a/include/__bsd_locale_defaults.h b/include/__bsd_locale_defaults.h +index ce86b41..f537aa0 100644 +--- a/include/__bsd_locale_defaults.h ++++ b/include/__bsd_locale_defaults.h +@@ -29,8 +29,9 @@ + #define __libcpp_mbrlen_l(s, n, ps, l) mbrlen_l(s, n, ps, l) + #define __libcpp_localeconv_l(l) localeconv_l(l) + #define __libcpp_mbsrtowcs_l(dest, src, len, ps, l) mbsrtowcs_l(dest, src, len, ps, l) +-#define __libcpp_snprintf_l(...) snprintf_l(__VA_ARGS__) +-#define __libcpp_asprintf_l(...) asprintf_l(__VA_ARGS__) +-#define __libcpp_sscanf_l(...) sscanf_l(__VA_ARGS__) ++// Workaround for Visual Studio preprocessor bug - explicitly mention all non-variadic parameters. ++#define __libcpp_snprintf_l(__s, __n, __l, __f, ...) snprintf_l(__s, __n, __l, __f, ##__VA_ARGS__) ++#define __libcpp_asprintf_l(__ret, __l, __f, ...) asprintf_l(__ret, __l, __f, ##__VA_ARGS__) ++#define __libcpp_sscanf_l(__s, __l, __f, ...) sscanf_l(__s, __l, __f, ##__VA_ARGS__) + + #endif // _LIBCPP_BSD_LOCALE_DEFAULTS_H +diff --git a/include/__functional/weak_result_type.h b/include/__functional/weak_result_type.h +index e1c553e..1ab9008 100644 +--- a/include/__functional/weak_result_type.h ++++ b/include/__functional/weak_result_type.h +@@ -27,7 +27,8 @@ struct __has_result_type + private: + struct __two {char __lx; char __lxx;}; + template <class _Up> static __two __test(...); +- template <class _Up> static char __test(typename _Up::result_type* = 0); ++ // Fix for MSVC which allows to reference private types. Wrap into declval to prevent that. ++ template <class _Up> static char __test(decltype(std::declval<typename _Up::result_type*>()) = 0); + public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; + }; +diff --git a/include/__memory/pointer_traits.h b/include/__memory/pointer_traits.h +index f1e8070..0316649 100644 +--- a/include/__memory/pointer_traits.h ++++ b/include/__memory/pointer_traits.h +@@ -74,7 +74,8 @@ private: + struct __two {char __lx; char __lxx;}; + template <class _Xp> static __two __test(...); + _LIBCPP_SUPPRESS_DEPRECATED_PUSH +- template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0); ++ // Fix for MSVC which allows to reference private types. Wrap into declval to prevent that. ++ template <class _Xp> static char __test(decltype(_VSTD::declval<typename _Xp::template rebind<_Up>*>()) = 0); + _LIBCPP_SUPPRESS_DEPRECATED_POP + public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; +diff --git a/include/__memory/uses_allocator.h b/include/__memory/uses_allocator.h +index 05c500c..20147c5 100644 +--- a/include/__memory/uses_allocator.h ++++ b/include/__memory/uses_allocator.h +@@ -26,7 +26,8 @@ struct __has_allocator_type + private: + struct __two {char __lx; char __lxx;}; + template <class _Up> static __two __test(...); +- template <class _Up> static char __test(typename _Up::allocator_type* = 0); ++ // Fix for MSVC which allows to reference private types. Wrap into declval to prevent that. ++ template <class _Up> static char __test(decltype(_VSTD::declval<typename _Up::allocator_type*>()) = 0); + public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; + }; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/12-allocator-fix.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/12-allocator-fix.patch new file mode 100644 index 0000000000..8907f411dd --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/12-allocator-fix.patch @@ -0,0 +1,13 @@ +diff --git a/include/__memory/allocator.h b/include/__memory/allocator.h +index 915ff7c..318c19d 100644 +--- a/include/__memory/allocator.h ++++ b/include/__memory/allocator.h +@@ -109,7 +109,7 @@ public: + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + void deallocate(_Tp* __p, size_t __n) _NOEXCEPT { + if (__libcpp_is_constant_evaluated()) { +- ::operator delete(__p); ++ ::operator delete((void*)__p); + } else { + _VSTD::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); + } diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/13-removed-allocator-members.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/13-removed-allocator-members.patch new file mode 100644 index 0000000000..0ff407b6d0 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/13-removed-allocator-members.patch @@ -0,0 +1,13 @@ +diff --git a/include/__memory/allocator.h b/include/__memory/allocator.h +index 318c19d..cd02a22 100644 +--- a/include/__memory/allocator.h ++++ b/include/__memory/allocator.h +@@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD + + template <class _Tp> class allocator; + +-#if _LIBCPP_STD_VER <= 17 ++#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) + template <> + class _LIBCPP_TEMPLATE_VIS allocator<void> + { diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/14-has-no-threads.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/14-has-no-threads.patch new file mode 100644 index 0000000000..26cdce22f6 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/14-has-no-threads.patch @@ -0,0 +1,84 @@ +diff --git a/include/__memory/shared_ptr.h b/include/__memory/shared_ptr.h +index ff8e601..828513a 100644 +--- a/include/__memory/shared_ptr.h ++++ b/include/__memory/shared_ptr.h +@@ -30,7 +30,7 @@ + #include <stdexcept> + #include <type_traits> + #include <typeinfo> +-#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) ++#if !defined(_LIBCPP_HAS_NO_THREADS) // !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) + # include <atomic> + #endif + +@@ -150,7 +150,12 @@ class _LIBCPP_TYPE_VIS __shared_count + __shared_count& operator=(const __shared_count&); + + protected: +- long __shared_owners_; ++#ifdef _LIBCPP_HAS_NO_THREADS ++ typedef long __atomic_count; ++#else ++ typedef atomic<long> __atomic_count; ++#endif ++ __atomic_count __shared_owners_; + virtual ~__shared_count(); + private: + virtual void __on_zero_shared() _NOEXCEPT = 0; +@@ -167,11 +172,19 @@ public: + #else + _LIBCPP_INLINE_VISIBILITY + void __add_shared() _NOEXCEPT { ++#ifdef _LIBCPP_HAS_NO_THREADS + __libcpp_atomic_refcount_increment(__shared_owners_); ++#else ++ __shared_owners_++; ++#endif + } + _LIBCPP_INLINE_VISIBILITY + bool __release_shared() _NOEXCEPT { ++#ifdef _LIBCPP_HAS_NO_THREADS + if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) { ++#else ++ if (--__shared_owners_ == -1) { ++#endif + __on_zero_shared(); + return true; + } +@@ -180,14 +193,23 @@ public: + #endif + _LIBCPP_INLINE_VISIBILITY + long use_count() const _NOEXCEPT { ++#ifdef _LIBCPP_HAS_NO_THREADS + return __libcpp_relaxed_load(&__shared_owners_) + 1; ++#else ++ return __shared_owners_.load(memory_order_relaxed) + 1; ++#endif + } + }; + + class _LIBCPP_TYPE_VIS __shared_weak_count + : private __shared_count + { +- long __shared_weak_owners_; ++#ifdef _LIBCPP_HAS_NO_THREADS ++ typedef long __atomic_count; ++#else ++ typedef atomic<long> __atomic_count; ++#endif ++ __atomic_count __shared_weak_owners_; + + public: + _LIBCPP_INLINE_VISIBILITY +@@ -210,7 +232,11 @@ public: + } + _LIBCPP_INLINE_VISIBILITY + void __add_weak() _NOEXCEPT { ++#ifdef _LIBCPP_HAS_NO_THREADS + __libcpp_atomic_refcount_increment(__shared_weak_owners_); ++#else ++ __shared_weak_owners_++; ++#endif + } + _LIBCPP_INLINE_VISIBILITY + void __release_shared() _NOEXCEPT { diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/15-unique-ptr.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/15-unique-ptr.patch new file mode 100644 index 0000000000..2a5428a684 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/15-unique-ptr.patch @@ -0,0 +1,13 @@ +diff --git a/include/__memory/unique_ptr.h b/include/__memory/unique_ptr.h +index e9d4189..2c1f0aa 100644 +--- a/include/__memory/unique_ptr.h ++++ b/include/__memory/unique_ptr.h +@@ -114,7 +114,7 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> { + # define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI + #endif + +-template <class _Tp, class _Dp = default_delete<_Tp> > ++template <class _Tp, class _Dp> + class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr { + public: + typedef _Tp element_type; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/16-android-locale_bionic.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/16-android-locale_bionic.patch new file mode 100644 index 0000000000..c1a370ab5b --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/16-android-locale_bionic.patch @@ -0,0 +1,15 @@ +diff --git a/include/__support/android/locale_bionic.h b/include/__support/android/locale_bionic.h +index 8c6d4bd..733eb83 100644 +--- a/include/__support/android/locale_bionic.h ++++ b/include/__support/android/locale_bionic.h +@@ -26,7 +26,9 @@ extern "C" { + #if defined(__ANDROID__) + + #include <android/api-level.h> +-#include <android/ndk-version.h> ++#if defined(__has_include) && __has_include(<android/ndk-version.h>) ++# include <android/ndk-version.h> ++#endif + #if __ANDROID_API__ < 21 + #include <__support/xlocale/__posix_l_fallback.h> + #endif diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/17-limits-msvc-win32.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/17-limits-msvc-win32.patch new file mode 100644 index 0000000000..4a4424fbff --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/17-limits-msvc-win32.patch @@ -0,0 +1,24 @@ +diff --git a/include/__support/win32/limits_msvc_win32.h b/include/__support/win32/limits_msvc_win32.h +index 87e4e7d..9f693d9 100644 +--- a/include/__support/win32/limits_msvc_win32.h ++++ b/include/__support/win32/limits_msvc_win32.h +@@ -20,7 +20,6 @@ + #include <float.h> // limit constants + #include <limits.h> // CHAR_BIT + #include <math.h> // HUGE_VAL +-#include <ymath.h> // internal MSVC header providing the needed functionality + + #define __CHAR_BIT__ CHAR_BIT + +@@ -64,8 +63,8 @@ + #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L + + // __builtin replacements/workarounds +-#define __builtin_huge_vall() _LInf._Long_double +-#define __builtin_nanl(__dummmy) _LNan._Long_double +-#define __builtin_nansl(__dummy) _LSnan._Long_double ++#define __builtin_huge_vall() ((long double)__builtin_huge_val()) ++#define __builtin_nanl(__dummy) ((long double)__builtin_nan(__dummy)) ++#define __builtin_nansl(__dummy) ((long double)__builtin_nans(__dummy)) + + #endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/18-locale-win32.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/18-locale-win32.patch new file mode 100644 index 0000000000..189f0cf864 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/18-locale-win32.patch @@ -0,0 +1,124 @@ +diff --git a/include/__support/win32/locale_win32.h b/include/__support/win32/locale_win32.h +index 3824d66..8456b05 100644 +--- a/include/__support/win32/locale_win32.h ++++ b/include/__support/win32/locale_win32.h +@@ -40,12 +40,8 @@ + #define LC_NUMERIC_MASK _M_NUMERIC + #define LC_TIME_MASK _M_TIME + #define LC_MESSAGES_MASK _M_MESSAGES +-#define LC_ALL_MASK ( LC_COLLATE_MASK \ +- | LC_CTYPE_MASK \ +- | LC_MESSAGES_MASK \ +- | LC_MONETARY_MASK \ +- | LC_NUMERIC_MASK \ +- | LC_TIME_MASK ) ++#define LC_MESSAGES _X_MESSAGES ++#define LC_ALL_MASK _M_ALL + + class __lconv_storage { + public: +@@ -193,21 +189,21 @@ locale_t newlocale( int mask, const char * locale, locale_t base ); + // We can still implement raii even without uselocale though. + + +-lconv *localeconv_l( locale_t &loc ); +-size_t mbrlen_l( const char *__restrict s, size_t n, +- mbstate_t *__restrict ps, locale_t loc); +-size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, +- size_t len, mbstate_t *__restrict ps, locale_t loc ); +-size_t wcrtomb_l( char *__restrict s, wchar_t wc, mbstate_t *__restrict ps, +- locale_t loc); +-size_t mbrtowc_l( wchar_t *__restrict pwc, const char *__restrict s, +- size_t n, mbstate_t *__restrict ps, locale_t loc); +-size_t mbsnrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, +- size_t nms, size_t len, mbstate_t *__restrict ps, locale_t loc); +-size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src, +- size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc); +-wint_t btowc_l( int c, locale_t loc ); +-int wctob_l( wint_t c, locale_t loc ); ++lconv *localeconv_l( locale_t &__loc ); ++size_t mbrlen_l( const char *__restrict __s, size_t __n, ++ mbstate_t *__restrict __ps, locale_t __loc); ++size_t mbsrtowcs_l( wchar_t *__restrict __dst, const char **__restrict __src, ++ size_t __len, mbstate_t *__restrict __ps, locale_t __loc ); ++size_t wcrtomb_l( char *__restrict s, wchar_t __wc, mbstate_t *__restrict __ps, ++ locale_t __loc); ++size_t mbrtowc_l( wchar_t *__restrict __pwc, const char *__restrict __s, ++ size_t __n, mbstate_t *__restrict __ps, locale_t __loc); ++size_t mbsnrtowcs_l( wchar_t *__restrict __dst, const char **__restrict __src, ++ size_t __nms, size_t __len, mbstate_t *__restrict __ps, locale_t __loc); ++size_t wcsnrtombs_l( char *__restrict __dst, const wchar_t **__restrict __src, ++ size_t __nwc, size_t __len, mbstate_t *__restrict __ps, locale_t __loc); ++wint_t btowc_l( int __c, locale_t __loc ); ++int wctob_l( wint_t __c, locale_t __loc ); + + decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ); + +@@ -218,25 +214,14 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ); + #define strtod_l _strtod_l + #if defined(_LIBCPP_MSVCRT) + #define strtof_l _strtof_l +-#define strtold_l _strtold_l ++#define strtold_l _strtod_l + #else + _LIBCPP_FUNC_VIS float strtof_l(const char*, char**, locale_t); + _LIBCPP_FUNC_VIS long double strtold_l(const char*, char**, locale_t); + #endif +-inline _LIBCPP_INLINE_VISIBILITY +-int +-islower_l(int c, _locale_t loc) +-{ +- return _islower_l((int)c, loc); +-} +- +-inline _LIBCPP_INLINE_VISIBILITY +-int +-isupper_l(int c, _locale_t loc) +-{ +- return _isupper_l((int)c, loc); +-} +- ++#define isupper_l _isupper_l ++#define islower_l _islower_l ++#define isblank_l _isblank_l + #define isdigit_l _isdigit_l + #define isxdigit_l _isxdigit_l + #define strcoll_l _strcoll_l +@@ -250,6 +235,7 @@ isupper_l(int c, _locale_t loc) + #define iswcntrl_l _iswcntrl_l + #define iswupper_l _iswupper_l + #define iswlower_l _iswlower_l ++#define iswblank_l _iswblank_l + #define iswalpha_l _iswalpha_l + #define iswdigit_l _iswdigit_l + #define iswpunct_l _iswpunct_l +@@ -262,22 +248,12 @@ _LIBCPP_FUNC_VIS size_t strftime_l(char *ret, size_t n, const char *format, + #else + #define strftime_l _strftime_l + #endif +-#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ ) +-#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ ) +-#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ ) +-#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ ) +-_LIBCPP_FUNC_VIS int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...); +-_LIBCPP_FUNC_VIS int asprintf_l( char **ret, locale_t loc, const char *format, ... ); +-_LIBCPP_FUNC_VIS int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ); +- +-// not-so-pressing FIXME: use locale to determine blank characters +-inline int isblank_l( int c, locale_t /*loc*/ ) +-{ +- return ( c == ' ' || c == '\t' ); +-} +-inline int iswblank_l( wint_t c, locale_t /*loc*/ ) +-{ +- return ( c == L' ' || c == L'\t' ); +-} ++#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, ##__VA_ARGS__ ) ++#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, ##__VA_ARGS__ ) ++#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, ##__VA_ARGS__ ) ++#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, ##__VA_ARGS__ ) ++#define snprintf_l(__s, __n, __l, __f, ...) _snprintf_l( __s, __n, __f, __l, ##__VA_ARGS__ ) ++_LIBCPP_FUNC_VIS int asprintf_l( char **__ret, locale_t __loc, const char *__format, ... ); ++_LIBCPP_FUNC_VIS int vasprintf_l( char **__ret, locale_t __loc, const char *__format, va_list __ap ); + + #endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/19-integer_sequence.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/19-integer_sequence.patch new file mode 100644 index 0000000000..c40ee33342 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/19-integer_sequence.patch @@ -0,0 +1,23 @@ +diff --git a/include/__utility/integer_sequence.h b/include/__utility/integer_sequence.h +index 6c56e74..a74b1a0 100644 +--- a/include/__utility/integer_sequence.h ++++ b/include/__utility/integer_sequence.h +@@ -43,8 +43,17 @@ using __make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_seque + + #else + ++template <class _Tp, class _T> struct __integer_sequence_convert { ++ using type = integer_sequence<_Tp>; ++}; ++ ++template<class _Tp, class _Tp2, _Tp... _Values> ++struct __integer_sequence_convert<_Tp, __integer_sequence<_Tp2, _Values...>> { ++ using type = integer_sequence<_Tp, _Values...>; ++}; ++ + template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked _LIBCPP_NODEBUG = +- typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>; ++ typename __integer_sequence_convert<_Tp, typename __detail::__make<_Np>::type>::type; + + template <class _Tp, _Tp _Ep> + struct __make_integer_sequence_checked diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/20-compiler-msvc-with-pair.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/20-compiler-msvc-with-pair.patch new file mode 100644 index 0000000000..213977ca6d --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/20-compiler-msvc-with-pair.patch @@ -0,0 +1,281 @@ +diff --git a/include/__utility/pair.h b/include/__utility/pair.h +index 15532f6..258e653 100644 +--- a/include/__utility/pair.h ++++ b/include/__utility/pair.h +@@ -73,85 +73,95 @@ struct _LIBCPP_TEMPLATE_VIS pair + return *this; + } + #else +- struct _CheckArgs { +- template <int&...> +- static constexpr bool __enable_explicit_default() { +- return is_default_constructible<_T1>::value +- && is_default_constructible<_T2>::value +- && !__enable_implicit_default<>(); +- } +- +- template <int&...> +- static constexpr bool __enable_implicit_default() { +- return __is_implicitly_default_constructible<_T1>::value +- && __is_implicitly_default_constructible<_T2>::value; +- } +- +- template <class _U1, class _U2> +- static constexpr bool __enable_explicit() { +- return is_constructible<first_type, _U1>::value +- && is_constructible<second_type, _U2>::value +- && (!is_convertible<_U1, first_type>::value +- || !is_convertible<_U2, second_type>::value); +- } +- +- template <class _U1, class _U2> +- static constexpr bool __enable_implicit() { +- return is_constructible<first_type, _U1>::value +- && is_constructible<second_type, _U2>::value +- && is_convertible<_U1, first_type>::value +- && is_convertible<_U2, second_type>::value; +- } ++ template<bool _Dummy = true, int&... _Args> ++ struct _EnableImplicitDefaultConstructor { ++ static constexpr bool value = __is_implicitly_default_constructible<_T1>::value ++ && __is_implicitly_default_constructible<_T2>::value; + }; + +- template <bool _MaybeEnable> +- using _CheckArgsDep _LIBCPP_NODEBUG = typename conditional< +- _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type; +- +- struct _CheckTupleLikeConstructor { +- template <class _Tuple> +- static constexpr bool __enable_implicit() { +- return __tuple_convertible<_Tuple, pair>::value; +- } +- +- template <class _Tuple> +- static constexpr bool __enable_explicit() { +- return __tuple_constructible<_Tuple, pair>::value +- && !__tuple_convertible<_Tuple, pair>::value; +- } +- +- template <class _Tuple> +- static constexpr bool __enable_assign() { +- return __tuple_assignable<_Tuple, pair>::value; +- } ++ template<bool _Dummy = true, int&... _Args> ++ struct _EnableExplicitDefaultConstructor { ++ static constexpr bool value = is_default_constructible<_T1>::value ++ && is_default_constructible<_T2>::value ++ && !_EnableImplicitDefaultConstructor<_Dummy, _Args...>::value; ++ }; ++ ++ template <class _U1, class _U2, bool _Dummy = true> ++ struct _EnableExplicitConstructor { ++ static constexpr bool value = is_constructible<first_type, _U1>::value ++ && is_constructible<second_type, _U2>::value ++ && (!is_convertible<_U1, first_type>::value ++ || !is_convertible<_U2, second_type>::value); ++ }; ++ ++ template <class _U1, class _U2, bool _Dummy = true> ++ struct _EnableImplicitConstructor { ++ static constexpr bool value = is_constructible<first_type, _U1>::value ++ && is_constructible<second_type, _U2>::value ++ && is_convertible<_U1, first_type>::value ++ && is_convertible<_U2, second_type>::value; ++ }; ++ ++ template <class _Tuple, bool _Enable = __tuple_like_with_size<_Tuple, 2>::value ++ && !is_same<typename decay<_Tuple>::type, pair>::value> ++ struct _EnableImplicitTupleLikeConstructor { ++ static constexpr bool value = false; ++ }; ++ ++ template <class _Tuple, bool _Enable = __tuple_like_with_size<_Tuple, 2>::value ++ && !is_same<typename decay<_Tuple>::type, pair>::value> ++ struct _EnableExplicitTupleLikeConstructor { ++ static constexpr bool value = false; ++ }; ++ ++ template <class _Tuple, bool _Enable = __tuple_like_with_size<_Tuple, 2>::value ++ && !is_same<typename decay<_Tuple>::type, pair>::value> ++ struct _EnableTupleLikeAssign { ++ static constexpr bool value = false; ++ }; ++ ++ template <class _Tuple> ++ struct _EnableImplicitTupleLikeConstructor<_Tuple, true> { ++ static constexpr bool value = __tuple_convertible<_Tuple, pair>::value; ++ }; ++ ++ template <class _Tuple> ++ struct _EnableExplicitTupleLikeConstructor<_Tuple, true> { ++ static constexpr bool value = __tuple_constructible<_Tuple, pair>::value ++ && !__tuple_convertible<_Tuple, pair>::value; + }; + + template <class _Tuple> +- using _CheckTLC _LIBCPP_NODEBUG = typename conditional< +- __tuple_like_with_size<_Tuple, 2>::value +- && !is_same<typename decay<_Tuple>::type, pair>::value, +- _CheckTupleLikeConstructor, +- __check_tuple_constructor_fail +- >::type; ++ struct _EnableTupleLikeAssign<_Tuple, true> { ++ static constexpr bool value = __tuple_assignable<_Tuple, pair>::value; ++ }; + + template<bool _Dummy = true, typename enable_if< +- _CheckArgsDep<_Dummy>::__enable_explicit_default() ++ _EnableExplicitDefaultConstructor<_Dummy>::value + >::type* = nullptr> + explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +- pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && +- is_nothrow_default_constructible<second_type>::value) ++ pair() ++// danlark@ if you remove this define, MSVC gets into ICE ++#if !defined(_LIBCPP_COMPILER_MSVC) ++ _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && ++ is_nothrow_default_constructible<second_type>::value) ++#endif + : first(), second() {} + + template<bool _Dummy = true, typename enable_if< +- _CheckArgsDep<_Dummy>::__enable_implicit_default() ++ _EnableImplicitDefaultConstructor<_Dummy>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +- pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && +- is_nothrow_default_constructible<second_type>::value) ++ pair() ++// danlark@ if you remove this define, MSVC gets into ICE ++#if !defined(_LIBCPP_COMPILER_MSVC) ++ _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && ++ is_nothrow_default_constructible<second_type>::value) ++#endif + : first(), second() {} + + template <bool _Dummy = true, typename enable_if< +- _CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>() ++ _EnableExplicitConstructor<_T1 const&, _T2 const&, _Dummy>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(_T1 const& __t1, _T2 const& __t2) +@@ -159,8 +169,8 @@ struct _LIBCPP_TEMPLATE_VIS pair + is_nothrow_copy_constructible<second_type>::value) + : first(__t1), second(__t2) {} + +- template<bool _Dummy = true, typename enable_if< +- _CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>() ++ template<bool _Dummy = true, bool _Dummy2 = true, typename enable_if< ++ _EnableImplicitConstructor<_T1 const&, _T2 const&, _Dummy>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(_T1 const& __t1, _T2 const& __t2) +@@ -174,7 +184,7 @@ struct _LIBCPP_TEMPLATE_VIS pair + #else + class _U1, class _U2, + #endif +- typename enable_if<_CheckArgs::template __enable_explicit<_U1, _U2>()>::type* = nullptr ++ typename enable_if<_EnableExplicitConstructor<_U1, _U2>::value>::type* = nullptr + > + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(_U1&& __u1, _U2&& __u2) +@@ -182,13 +192,13 @@ struct _LIBCPP_TEMPLATE_VIS pair + is_nothrow_constructible<second_type, _U2>::value)) + : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} + +- template < ++ template< + #if _LIBCPP_STD_VER > 20 // http://wg21.link/P1951 + class _U1 = _T1, class _U2 = _T2, + #else + class _U1, class _U2, + #endif +- typename enable_if<_CheckArgs::template __enable_implicit<_U1, _U2>()>::type* = nullptr ++ bool _Dummy = true, typename enable_if<_EnableImplicitConstructor<_U1, _U2, _Dummy>::value>::type* = nullptr + > + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(_U1&& __u1, _U2&& __u2) +@@ -197,7 +207,7 @@ struct _LIBCPP_TEMPLATE_VIS pair + : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} + + template<class _U1, class _U2, typename enable_if< +- _CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>() ++ _EnableExplicitConstructor<_U1 const&, _U2 const&>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(pair<_U1, _U2> const& __p) +@@ -205,8 +215,8 @@ struct _LIBCPP_TEMPLATE_VIS pair + is_nothrow_constructible<second_type, _U2 const&>::value)) + : first(__p.first), second(__p.second) {} + +- template<class _U1, class _U2, typename enable_if< +- _CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>() ++ template<class _U1, class _U2, bool _Dummy = true, typename enable_if< ++ _EnableImplicitConstructor<_U1 const&, _U2 const&, _Dummy>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(pair<_U1, _U2> const& __p) +@@ -215,7 +225,7 @@ struct _LIBCPP_TEMPLATE_VIS pair + : first(__p.first), second(__p.second) {} + + template<class _U1, class _U2, typename enable_if< +- _CheckArgs::template __enable_explicit<_U1, _U2>() ++ _EnableExplicitConstructor<_U1, _U2>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(pair<_U1, _U2>&&__p) +@@ -223,8 +233,8 @@ struct _LIBCPP_TEMPLATE_VIS pair + is_nothrow_constructible<second_type, _U2&&>::value)) + : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} + +- template<class _U1, class _U2, typename enable_if< +- _CheckArgs::template __enable_implicit<_U1, _U2>() ++ template<class _U1, class _U2, bool _Dummy = true, typename enable_if< ++ _EnableImplicitConstructor<_U1, _U2>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(pair<_U1, _U2>&& __p) +@@ -233,15 +243,15 @@ struct _LIBCPP_TEMPLATE_VIS pair + : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} + + template<class _Tuple, typename enable_if< +- _CheckTLC<_Tuple>::template __enable_explicit<_Tuple>() ++ _EnableExplicitTupleLikeConstructor<_Tuple>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(_Tuple&& __p) + : first(_VSTD::get<0>(_VSTD::forward<_Tuple>(__p))), + second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} + +- template<class _Tuple, typename enable_if< +- _CheckTLC<_Tuple>::template __enable_implicit<_Tuple>() ++ template<class _Tuple, bool _Dummy = true, typename enable_if< ++ _EnableImplicitTupleLikeConstructor<_Tuple>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(_Tuple&& __p) +@@ -284,8 +294,8 @@ struct _LIBCPP_TEMPLATE_VIS pair + return *this; + } + +- template <class _Tuple, typename enable_if< +- _CheckTLC<_Tuple>::template __enable_assign<_Tuple>() ++ template <class _Tuple, bool _Dummy = true, typename enable_if< ++ _EnableTupleLikeAssign<_Tuple>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + pair& operator=(_Tuple&& __p) { +@@ -309,9 +319,9 @@ private: + #ifndef _LIBCPP_CXX03_LANG + template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +- pair(piecewise_construct_t, +- tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, +- __tuple_indices<_I1...>, __tuple_indices<_I2...>); ++ pair(piecewise_construct_t, ++ tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, ++ __tuple_indices<_I1...>, __tuple_indices<_I2...>); + #endif + }; + diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/21-bits.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/21-bits.patch new file mode 100644 index 0000000000..c6e8f0f03b --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/21-bits.patch @@ -0,0 +1,47 @@ +diff --git a/include/__bit_reference b/include/__bit_reference +index 423acee..60e7786 100644 +--- a/include/__bit_reference ++++ b/include/__bit_reference +@@ -28,7 +28,7 @@ _LIBCPP_PUSH_MACROS + + _LIBCPP_BEGIN_NAMESPACE_STD + +-template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator; ++template <class _Cp, bool _IsConst, class = typename _Cp::__storage_type> class __bit_iterator; + template <class _Cp> class __bit_const_reference; + + template <class _Tp> +@@ -1102,7 +1102,7 @@ equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __b + } + + template <class _Cp, bool _IsConst, +- typename _Cp::__storage_type> ++ class> + class __bit_iterator + { + public: +diff --git a/include/__bits b/include/__bits +index 1eee8f5..f6835aa 100644 +--- a/include/__bits ++++ b/include/__bits +@@ -69,7 +69,7 @@ int __libcpp_ctz(unsigned __x) { + inline _LIBCPP_INLINE_VISIBILITY + int __libcpp_ctz(unsigned long __x) { + static_assert(sizeof(unsigned long) == sizeof(unsigned), ""); +- return __ctz(static_cast<unsigned>(__x)); ++ return __libcpp_ctz(static_cast<unsigned>(__x)); + } + + inline _LIBCPP_INLINE_VISIBILITY +@@ -133,7 +133,11 @@ inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) { + + inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) { + static_assert(sizeof(unsigned long long) == 8, ""); ++#if defined(_M_IX86) ++ return __popcnt(__x) + __popcnt(__x >> 32); ++#else + return __popcnt64(__x); ++#endif + } + + #endif // _LIBCPP_COMPILER_MSVC diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/22__config.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/22__config.patch new file mode 100644 index 0000000000..9ee08d070c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/22__config.patch @@ -0,0 +1,236 @@ +diff --git a/include/__config b/include/__config +index 0f32067..2914d9a 100644 +--- a/include/__config ++++ b/include/__config +@@ -9,8 +9,7 @@ + + #ifndef _LIBCPP_CONFIG + #define _LIBCPP_CONFIG +- +-#include <__config_site> ++#include <__wrappers_config> + + #if defined(_MSC_VER) && !defined(__clang__) + # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +@@ -22,6 +21,33 @@ + # pragma GCC system_header + #endif + ++// Move outside #ifdef __cplusplus because this needs to work in both C and C++ headers. ++#if defined(__apple_build_version__) ++# 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_BASED ++# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) ++#elif defined(__GNUC__) ++#define _LIBCPP_COMPILER_GCC ++#elif defined(_MSC_VER) ++#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 ++ ++#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 ++#endif ++ + #ifdef __cplusplus + + #define _LIBCPP_VERSION 15000 +@@ -48,7 +74,7 @@ + # define _LIBCPP_OBJECT_FORMAT_ELF 1 + #elif defined(__MACH__) + # define _LIBCPP_OBJECT_FORMAT_MACHO 1 +-#elif defined(_WIN32) ++#elif defined(_WIN32) || defined(__CYGWIN__) + # define _LIBCPP_OBJECT_FORMAT_COFF 1 + #elif defined(__wasm__) + # define _LIBCPP_OBJECT_FORMAT_WASM 1 +@@ -190,20 +216,6 @@ + #define __has_include(...) 0 + #endif + +-#if defined(__apple_build_version__) +-# define _LIBCPP_COMPILER_CLANG_BASED +-# define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000) +-#elif defined(__clang__) +-# define _LIBCPP_COMPILER_CLANG_BASED +-# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) +-#elif defined(__GNUC__) +-# define _LIBCPP_COMPILER_GCC +-#elif defined(_MSC_VER) +-# define _LIBCPP_COMPILER_MSVC +-#elif defined(__IBMCPP__) +-# define _LIBCPP_COMPILER_IBM +-#endif +- + #if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L + #error "libc++ does not support using GCC with C++03. Please enable C++11" + #endif +@@ -405,7 +417,9 @@ + #if __has_attribute(using_if_exists) + # define _LIBCPP_HAS_TIMESPEC_GET + # define _LIBCPP_HAS_QUICK_EXIT +-# define _LIBCPP_HAS_ALIGNED_ALLOC ++# ifndef _LIBCPP_MSVCRT ++# define _LIBCPP_HAS_ALIGNED_ALLOC ++# endif + #else + #if (defined(__ISO_C_VISIBLE) && (__ISO_C_VISIBLE >= 2011)) || __cplusplus >= 201103L + # if defined(__FreeBSD__) +@@ -575,11 +589,50 @@ typedef __char32_t char32_t; + #error "MSVC versions prior to Visual Studio 2015 are not supported" + #endif + ++#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_WEAK + + #define _LIBCPP_HAS_NO_ASAN +@@ -1023,7 +1076,6 @@ typedef unsigned int char32_t; + # 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") \ +@@ -1125,7 +1177,8 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( + defined(__APPLE__) || \ + defined(__sun__) || \ + defined(__MVS__) || \ +- defined(_AIX) ++ defined(_AIX) || \ ++ defined(__CYGWIN__) + # define _LIBCPP_HAS_THREAD_API_PTHREAD + # elif defined(__Fuchsia__) + // TODO(44575): Switch to C11 thread API when possible. +@@ -1258,6 +1311,10 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( + # 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_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) + # define _LIBCPP_DIAGNOSE_WARNING(...) \ + __attribute__((diagnose_if(__VA_ARGS__, "warning"))) +@@ -1279,7 +1336,13 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( + # define _LIBCPP_FALLTHROUGH() ((void)0) + #endif + +-#if __has_attribute(__nodebug__) ++#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 +@@ -1308,7 +1371,8 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( + #endif + + #if defined(_LIBCPP_ABI_MICROSOFT) && \ +- (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) ++ (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 +@@ -1333,7 +1397,11 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( + #define _LIBCPP_HAS_NO_CXX20_COROUTINES + #endif + +-#if defined(_LIBCPP_COMPILER_IBM) ++// Yandex-specific: We build our own libc++, so it has everything available ++#define _LIBCPP_DISABLE_AVAILABILITY ++// End of Yandex-specific ++ ++#if defined(_LIBCPP_COMPILER_IBM) || defined(__CUDACC__) + #define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO + #endif + +@@ -1418,6 +1486,28 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( + # 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 geenrally 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.) diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/23__locale.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/23__locale.patch new file mode 100644 index 0000000000..5af5b247a4 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/23__locale.patch @@ -0,0 +1,23 @@ +diff --git a/include/__locale b/include/__locale +index 9675e4b..323ed3e 100644 +--- a/include/__locale ++++ b/include/__locale +@@ -204,8 +204,7 @@ private: + + class _LIBCPP_TYPE_VIS locale::id + { +- once_flag __flag_; +- int32_t __id_; ++ std::atomic<int32_t> __id_; + + static int32_t __next_id; + public: +@@ -213,8 +212,6 @@ public: + void operator=(const id&) = delete; + id(const id&) = delete; + +-private: +- void __init(); + public: // only needed for tests + long __get(); + diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/24__string.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/24__string.patch new file mode 100644 index 0000000000..c2e0f535c1 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/24__string.patch @@ -0,0 +1,217 @@ +diff --git a/include/__string b/include/__string +index 26aa619..57ac537 100644 +--- a/include/__string ++++ b/include/__string +@@ -57,20 +57,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD + // must never be removed from the stable list. + #define _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_Func, _CharType) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, allocator<_CharType> const&)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS const _CharType& basic_string<_CharType>::at(size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*, size_type)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::reserve(size_type)) \ +@@ -78,24 +78,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by(size_type, size_type, size_type, size_type, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by_and_replace(size_type, size_type, size_type, size_type, size_type, size_type, value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::push_back(value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(size_type, value_type)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const) \ +- _Func(_LIBCPP_FUNC_VIS const basic_string<_CharType>::size_type basic_string<_CharType>::npos) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::erase(size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(basic_string const&, size_type, size_type)) \ +- _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const) \ ++ _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*) const) \ + _Func(_LIBCPP_FUNC_VIS _CharType& basic_string<_CharType>::at(size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(value_type const*)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, basic_string const&, size_type, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(basic_string const&)) \ +@@ -103,23 +102,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::iterator basic_string<_CharType>::insert(basic_string::const_iterator, value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::resize(size_type, value_type)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) \ ++ _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) + + #define _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_Func, _CharType) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init_copy_ctor_external(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS const _CharType& basic_string<_CharType>::at(size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*, size_type)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_external(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_external(value_type const*)) \ +@@ -128,33 +128,40 @@ _LIBCPP_BEGIN_NAMESPACE_STD + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by(size_type, size_type, size_type, size_type, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by_and_replace(size_type, size_type, size_type, size_type, size_type, size_type, value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_no_alias<false>(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_no_alias<true>(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::push_back(value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(size_type, value_type)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const) \ +- _Func(_LIBCPP_FUNC_VIS const basic_string<_CharType>::size_type basic_string<_CharType>::npos) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__erase_external_with_move(size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(basic_string const&, size_type, size_type)) \ +- _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const) \ ++ _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*) const) \ + _Func(_LIBCPP_FUNC_VIS _CharType& basic_string<_CharType>::at(size_type)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const) \ ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, basic_string const&, size_type, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::iterator basic_string<_CharType>::insert(basic_string::const_iterator, value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::resize(size_type, value_type)) \ +- _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) ++ _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) \ ++ _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) + ++// Workaround for CUDA which doesn't like extern templates for variables. ++#ifdef __CUDACC__ ++#define _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) ++#else ++#define _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) \ ++ _Func(_LIBCPP_FUNC_VIS const basic_string<_CharType>::size_type basic_string<_CharType>::npos) ++#endif + + // char_traits + +@@ -340,11 +347,10 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> + + static _LIBCPP_CONSTEXPR_AFTER_CXX14 + int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; +- + static inline size_t _LIBCPP_CONSTEXPR_AFTER_CXX14 length(const char_type* __s) _NOEXCEPT { + // GCC currently does not support __builtin_strlen during constant evaluation. + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70816 +-#ifdef _LIBCPP_COMPILER_GCC ++#if defined(_LIBCPP_COMPILER_GCC) || defined(_LIBCPP_COMPILER_MSVC) + if (__libcpp_is_constant_evaluated()) { + size_t __i = 0; + for (; __s[__i] != char_type('\0'); ++__i) +@@ -352,7 +358,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> + return __i; + } + #endif +- return __builtin_strlen(__s); ++ return __builtin_strlen(__s); + } + + static _LIBCPP_CONSTEXPR_AFTER_CXX14 +@@ -422,7 +428,7 @@ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a) + { + if (__n == 0) + return nullptr; +-#if __has_feature(cxx_constexpr_string_builtins) ++#if __has_feature(cxx_constexpr_string_builtins) && !defined(__CUDACC__) + return __builtin_char_memchr(__s, to_int_type(__a), __n); + #elif _LIBCPP_STD_VER <= 14 + return (const char_type*) _VSTD::memchr(__s, to_int_type(__a), __n); +@@ -505,7 +511,7 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size + { + if (__n == 0) + return 0; +-#if __has_feature(cxx_constexpr_string_builtins) ++#if __has_feature(cxx_constexpr_string_builtins) && !defined(__CUDACC__) + return __builtin_wmemcmp(__s1, __s2, __n); + #elif _LIBCPP_STD_VER <= 14 + return _VSTD::wmemcmp(__s1, __s2, __n); +@@ -525,7 +531,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX14 + size_t + char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT + { +-#if __has_feature(cxx_constexpr_string_builtins) ++#if __has_feature(cxx_constexpr_string_builtins) && !defined(__CUDACC__) + return __builtin_wcslen(__s); + #elif _LIBCPP_STD_VER <= 14 + return _VSTD::wcslen(__s); +@@ -543,7 +549,7 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __ + { + if (__n == 0) + return nullptr; +-#if __has_feature(cxx_constexpr_string_builtins) ++#if __has_feature(cxx_constexpr_string_builtins) && !defined(__CUDACC__) + return __builtin_wmemchr(__s, __a, __n); + #elif _LIBCPP_STD_VER <= 14 + return _VSTD::wmemchr(__s, __a, __n); +@@ -559,6 +565,11 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __ + } + #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS + ++// Disable double inline warning. ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4141 ) ++#endif + template <class _Traits> + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR +@@ -569,6 +580,9 @@ inline size_t __char_traits_length_checked(const typename _Traits::char_type* __ + return _Traits::length(__s); + #endif + } ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif + + #ifndef _LIBCPP_HAS_NO_CHAR8_T + diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/25__tuple.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/25__tuple.patch new file mode 100644 index 0000000000..4dbfe061bd --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/25__tuple.patch @@ -0,0 +1,277 @@ +diff --git a/include/__tuple b/include/__tuple +index 6d13bb2..89448b0 100644 +--- a/include/__tuple ++++ b/include/__tuple +@@ -21,36 +21,36 @@ + + _LIBCPP_BEGIN_NAMESPACE_STD + +-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size; ++template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size; + + #if !defined(_LIBCPP_CXX03_LANG) + template <class _Tp, class...> + using __enable_if_tuple_size_imp = _Tp; + + template <class _Tp> +-struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< ++class _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< + const _Tp, + typename enable_if<!is_volatile<_Tp>::value>::type, + integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> + : public integral_constant<size_t, tuple_size<_Tp>::value> {}; + + template <class _Tp> +-struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< ++class _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< + volatile _Tp, + typename enable_if<!is_const<_Tp>::value>::type, + integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> + : public integral_constant<size_t, tuple_size<_Tp>::value> {}; + + template <class _Tp> +-struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< ++class _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< + const volatile _Tp, + integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> + : public integral_constant<size_t, tuple_size<_Tp>::value> {}; + + #else +-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {}; +-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {}; +-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {}; ++template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {}; ++template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {}; ++template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {}; + #endif + + template <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element; +@@ -87,14 +87,11 @@ template <size_t...> struct __tuple_indices {}; + + template <class _IdxType, _IdxType... _Values> + struct __integer_sequence { +- template <template <class _OIdxType, _OIdxType...> class _ToIndexSeq, class _ToIndexType> +- using __convert = _ToIndexSeq<_ToIndexType, _Values...>; +- + template <size_t _Sp> + using __to_tuple_indices = __tuple_indices<(_Values + _Sp)...>; + }; + +-#if !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) ++#if defined(__CUDACC__) || !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) + namespace __detail { + + template<typename _Tp, size_t ..._Extra> struct __repeat; +@@ -136,7 +133,7 @@ template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<t + + #endif // !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) + +-#if __has_builtin(__make_integer_seq) ++#if __has_builtin(__make_integer_seq) && !defined(__CUDACC__) + template <size_t _Ep, size_t _Sp> + using __make_indices_imp = + typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template +@@ -161,7 +158,7 @@ template <class ..._Tp> class _LIBCPP_TEMPLATE_VIS tuple; + template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {}; + + template <class ..._Tp> +-struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > ++class _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > + : public integral_constant<size_t, sizeof...(_Tp)> + { + }; +@@ -267,6 +264,7 @@ __indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&); + + } // namespace __indexer_detail + ++#if !defined(__CUDACC__) || !defined(_MSC_VER) + template <size_t _Idx, class ..._Types> + using __type_pack_element _LIBCPP_NODEBUG = typename decltype( + __indexer_detail::__at_index<_Idx>( +@@ -275,7 +273,22 @@ using __type_pack_element _LIBCPP_NODEBUG = typename decltype( + typename __make_tuple_indices<sizeof...(_Types)>::type + >{}) + )::type; +-#endif ++ ++#else // !defined(__CUDACC__) || !defined(_MSC_VER) ++template <size_t _Idx, class ..._Types> ++struct __y_type_pack_element { ++ using __t1 = typename __make_tuple_indices<sizeof...(_Types)>::type; ++ using __t2 = __indexer_detail::__indexer<__tuple_types<_Types...>, __t1>; ++ using __t3 = decltype(__indexer_detail::__at_index<_Idx>(__t2{})); ++ using __t4 = typename __t3::type; ++}; ++ ++template <size_t _Idx, class ..._Types> ++using __type_pack_element = typename __y_type_pack_element<_Idx, _Types...>::__t4; ++ ++#endif // !defined(__CUDACC__) || !defined(_MSC_VER) ++ ++#endif // __has_builtin(__type_pack_element) + + template <size_t _Ip, class ..._Types> + struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > +@@ -286,7 +299,7 @@ struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > + + + template <class ..._Tp> +-struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > ++class _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > + : public integral_constant<size_t, sizeof...(_Tp)> + { + }; +@@ -340,6 +353,70 @@ using __apply_cv_t _LIBCPP_NODEBUG = __apply_cv_mf< + // _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a + // lvalue_reference type, then __tuple_types<_Types&...> is the result. + ++#ifdef _LIBCPP_COMPILER_MSVC ++ ++template<class _TupleTypes, class _Tp> ++struct __make_tuple_types_append_front; ++ ++template<class ..._Types, class _Tp> ++struct __make_tuple_types_append_front<__tuple_types<_Types...>, _Tp> { ++ using type = __tuple_types<_Tp, _Types...>; ++}; ++ ++template<class _TupleTypes, class _Apply, size_t _Ep, size_t _Sp, class = void> ++struct __make_tuple_types_flat; ++ ++template<class _Tuple, class _Apply> ++struct __make_tuple_types_flat<_Tuple, _Apply, 0, 0, void> { ++ using type = __tuple_types<>; ++}; ++ ++template<template<class...> class _Tuple, class _Tp, class ..._Types, class _Apply, size_t _Ep> ++struct __make_tuple_types_flat<_Tuple<_Tp, _Types...>, _Apply, _Ep, 0, enable_if_t<(_Ep > 0)>> { ++ using type = typename __make_tuple_types_append_front< ++ typename __make_tuple_types_flat<__tuple_types<_Types...>, _Apply, _Ep - 1, 0>::type, ++ typename _Apply::template __apply<_Tp>>::type; ++}; ++ ++template<template <class...> class _Tuple, class _Tp, class ..._Types, class _Apply, size_t _Ep, size_t _Sp> ++struct __make_tuple_types_flat<_Tuple<_Tp, _Types...>, _Apply, _Ep, _Sp, enable_if_t<(_Ep > 0 && _Sp > 0)>> { ++ using type = typename __make_tuple_types_flat<__tuple_types<_Types...>, _Apply, _Ep - 1, _Sp - 1>::type; ++}; ++ ++template<class _Tp, size_t _Np, class _Apply, size_t _Ep> ++struct __make_tuple_types_flat<array<_Tp, _Np>, _Apply, _Ep, 0, enable_if_t<(_Ep > 0)>> { ++ using type = typename __make_tuple_types_append_front< ++ typename __make_tuple_types_flat<array<_Tp, _Np>, _Apply, _Ep - 1, 0>::type, ++ typename _Apply::template __apply<_Tp>>::type; ++}; ++ ++template<class _Tp, size_t _Np, class _Apply, size_t _Ep, size_t _Sp> ++struct __make_tuple_types_flat<array<_Tp, _Np>, _Apply, _Ep, _Sp, enable_if_t<(_Sp > 0)>> { ++ using type = typename __make_tuple_types_flat<array<_Tp, _Np>, _Apply, _Ep - _Sp, 0>::type; ++}; ++ ++template<class _Tp, ++ size_t _Ep = tuple_size<remove_reference_t<_Tp>>::value, ++ size_t _Sp = 0, ++ bool _SameSize = (_Ep == tuple_size<typename remove_reference<_Tp>::type>::value)> ++struct __make_tuple_types { ++ static_assert(_Sp <= _Ep, "__make_tuple_types input error"); ++ using _RawTp = typename remove_cv<typename remove_reference<_Tp>::type>::type; ++ using type = typename __make_tuple_types_flat<_RawTp, __apply_cv_t<_Tp>, _Ep, _Sp>::type; ++}; ++ ++template <class ..._Types, size_t _Ep> ++struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> { ++ typedef __tuple_types<_Types...> type; ++}; ++ ++template <class ..._Types, size_t _Ep> ++struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> { ++ typedef __tuple_types<_Types...> type; ++}; ++ ++#else ++ + template <class _TupleTypes, class _TupleIndices> + struct __make_tuple_types_flat; + +@@ -383,37 +460,41 @@ struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> { + typedef _LIBCPP_NODEBUG __tuple_types<_Types...> type; + }; + ++#endif // _LIBCPP_COMPILER_MSVC ++ + template <bool ..._Preds> + struct __all_dummy; + + template <bool ..._Pred> +-struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>> {}; ++struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<(_Pred | true)...>>{}; + + struct __tuple_sfinae_base { + template <template <class, class...> class _Trait, + class ..._LArgs, class ..._RArgs> + static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>) +- -> __all<typename enable_if<_Trait<_LArgs, _RArgs>::value, bool>::type{true}...>; ++ -> __all<_Trait<_LArgs, _RArgs>::value...>; + template <template <class...> class> + static auto __do_test(...) -> false_type; + + template <class _FromArgs, class _ToArgs> +- using __constructible = decltype(__do_test<is_constructible>(_ToArgs{}, _FromArgs{})); ++ using __constructible = decltype(__do_test<is_constructible>(declval<_ToArgs>(), declval<_FromArgs>())); + template <class _FromArgs, class _ToArgs> +- using __convertible = decltype(__do_test<is_convertible>(_FromArgs{}, _ToArgs{})); ++ using __convertible = decltype(__do_test<is_convertible>(declval<_FromArgs>(), declval<_ToArgs>())); + template <class _FromArgs, class _ToArgs> +- using __assignable = decltype(__do_test<is_assignable>(_ToArgs{}, _FromArgs{})); ++ using __assignable = decltype(__do_test<is_assignable>(declval<_ToArgs>(), declval<_FromArgs>())); + }; + + // __tuple_convertible + + template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, +- bool = __tuple_like<_Up>::value> ++ bool = __tuple_like<_Up>::value, ++ class = void> + struct __tuple_convertible + : public false_type {}; + + template <class _Tp, class _Up> +-struct __tuple_convertible<_Tp, _Up, true, true> ++struct __tuple_convertible<_Tp, _Up, true, true, ++ typename enable_if<(tuple_size<typename remove_reference<_Tp>::type>::value == tuple_size<_Up>::value)>::type> + : public __tuple_sfinae_base::__convertible< + typename __make_tuple_types<_Tp>::type + , typename __make_tuple_types<_Up>::type +@@ -423,12 +504,14 @@ struct __tuple_convertible<_Tp, _Up, true, true> + // __tuple_constructible + + template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, +- bool = __tuple_like<_Up>::value> ++ bool = __tuple_like<_Up>::value, ++ class = void> + struct __tuple_constructible + : public false_type {}; + + template <class _Tp, class _Up> +-struct __tuple_constructible<_Tp, _Up, true, true> ++struct __tuple_constructible<_Tp, _Up, true, true, ++ typename enable_if<(tuple_size<typename remove_reference<_Tp>::type>::value == tuple_size<_Up>::value)>::type> + : public __tuple_sfinae_base::__constructible< + typename __make_tuple_types<_Tp>::type + , typename __make_tuple_types<_Up>::type +@@ -438,12 +521,14 @@ struct __tuple_constructible<_Tp, _Up, true, true> + // __tuple_assignable + + template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, +- bool = __tuple_like<_Up>::value> ++ bool = __tuple_like<_Up>::value, ++ class = void> + struct __tuple_assignable + : public false_type {}; + + template <class _Tp, class _Up> +-struct __tuple_assignable<_Tp, _Up, true, true> ++struct __tuple_assignable<_Tp, _Up, true, true, ++ typename enable_if<(tuple_size<typename remove_reference<_Tp>::type>::value == tuple_size<_Up>::value)>::type> + : public __tuple_sfinae_base::__assignable< + typename __make_tuple_types<_Tp>::type + , typename __make_tuple_types<_Up&>::type diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/26-removed-includes.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/26-removed-includes.patch new file mode 100644 index 0000000000..8add4a2e0d --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/26-removed-includes.patch @@ -0,0 +1,13 @@ +diff --git a/src/new.cpp b/src/new.cpp +index cfef148..7dd17bc 100644 +--- a/src/new.cpp ++++ b/src/new.cpp +@@ -9,8 +9,6 @@ + #include <new> + #include <stdlib.h> + +-#include "include/atomic_support.h" +- + #if defined(_LIBCPP_ABI_MICROSOFT) + # if !defined(_LIBCPP_ABI_VCRUNTIME) + # include "support/runtime/new_handler_fallback.ipp" diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/27-bitset.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/27-bitset.patch new file mode 100644 index 0000000000..8e21d87934 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/27-bitset.patch @@ -0,0 +1,27 @@ +diff --git a/include/bitset b/include/bitset +index 875e8ef..d5c4299 100644 +--- a/include/bitset ++++ b/include/bitset +@@ -131,6 +131,10 @@ _LIBCPP_PUSH_MACROS + #include <__undef_macros> + + ++#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) ++#pragma GCC system_header ++#endif ++ + _LIBCPP_BEGIN_NAMESPACE_STD + + template <size_t _N_words, size_t _Size> +@@ -267,9 +271,9 @@ inline + _LIBCPP_CONSTEXPR + __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT + #ifndef _LIBCPP_CXX03_LANG +-#if __SIZEOF_SIZE_T__ == 8 ++#if SIZE_MAX == 0xffffffffffffffffULL + : __first_{__v} +-#elif __SIZEOF_SIZE_T__ == 4 ++#elif SIZE_MAX == 0xffffffffULL + : __first_{static_cast<__storage_type>(__v), + _Size >= 2 * __bits_per_word ? static_cast<__storage_type>(__v >> __bits_per_word) + : static_cast<__storage_type>((__v >> __bits_per_word) & (__storage_type(1) << (_Size - __bits_per_word)) - 1)} diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/28-cudacc.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/28-cudacc.patch new file mode 100644 index 0000000000..cf895503ff --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/28-cudacc.patch @@ -0,0 +1,55 @@ +diff --git a/include/complex b/include/complex +index 8384ed8..a11334f 100644 +--- a/include/complex ++++ b/include/complex +@@ -1476,6 +1476,7 @@ inline namespace literals + } + + ++#if !defined(__CUDACC__) + constexpr complex<float> operator""if(long double __im) + { + return { 0.0f, static_cast<float>(__im) }; +@@ -1485,6 +1486,7 @@ inline namespace literals + { + return { 0.0f, static_cast<float>(__im) }; + } ++#endif + } // namespace complex_literals + } // namespace literals + #endif +diff --git a/include/math.h b/include/math.h +index 0a1d223..62fcc62 100644 +--- a/include/math.h ++++ b/include/math.h +@@ -504,7 +504,7 @@ typename std::enable_if< + isinf(_A1) _NOEXCEPT + { return false; } + +-#ifdef _LIBCPP_PREFERRED_OVERLOAD ++#if defined(_LIBCPP_PREFERRED_OVERLOAD) && !defined(__CUDACC__) + inline _LIBCPP_INLINE_VISIBILITY + bool + isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } +@@ -552,7 +552,7 @@ typename std::enable_if<std::is_integral<_A1>::value, bool>::type + isnan(_A1) _NOEXCEPT + { return false; } + +-#ifdef _LIBCPP_PREFERRED_OVERLOAD ++#if defined(_LIBCPP_PREFERRED_OVERLOAD) && !defined(__CUDACC__) + inline _LIBCPP_INLINE_VISIBILITY + bool + isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } +diff --git a/include/tuple b/include/tuple +index e499aff..1334d04 100644 +--- a/include/tuple ++++ b/include/tuple +@@ -223,7 +223,7 @@ class __tuple_leaf + + template <class _Tp> + static constexpr bool __can_bind_reference() { +-#if __has_keyword(__reference_binds_to_temporary) ++#if __has_keyword(__reference_binds_to_temporary) && !defined(__CUDACC__) + return !__reference_binds_to_temporary(_Hp, _Tp); + #else + return true; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/29-abi.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/29-abi.patch new file mode 100644 index 0000000000..3c90ae3a40 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/29-abi.patch @@ -0,0 +1,15 @@ +diff --git a/include/cstddef b/include/cstddef +index 57cecc7..5dce7c0 100644 +--- a/include/cstddef ++++ b/include/cstddef +@@ -41,6 +41,10 @@ Types: + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_ABI_VCRUNTIME ++typedef double max_align_t; ++#endif ++ + _LIBCPP_BEGIN_NAMESPACE_STD + + using ::nullptr_t; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/31-iosfwd.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/31-iosfwd.patch new file mode 100644 index 0000000000..1e6739f98b --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/31-iosfwd.patch @@ -0,0 +1,12 @@ +diff --git a/include/iosfwd b/include/iosfwd +index 263a667..63850f2 100644 +--- a/include/iosfwd ++++ b/include/iosfwd +@@ -251,6 +251,7 @@ typedef basic_string<char, char_traits<char>, allocator<char> > string; + #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS + typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring; + #endif ++typedef basic_string<char16_t, char_traits<char16_t>, allocator<char16_t> > u16string; + + template <class _CharT, class _Traits, class _Allocator> + class _LIBCPP_PREFERRED_NAME(string) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstring)) basic_string; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/32-perfect_forward.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/32-perfect_forward.patch new file mode 100644 index 0000000000..e8f2677b85 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/32-perfect_forward.patch @@ -0,0 +1,119 @@ +diff --git a/include/__functional/perfect_forward.h b/include/__functional/perfect_forward.h +index 9acaa7e..9ffea1a 100644 +--- a/include/__functional/perfect_forward.h ++++ b/include/__functional/perfect_forward.h +@@ -25,63 +25,62 @@ _LIBCPP_BEGIN_NAMESPACE_STD + + #if _LIBCPP_STD_VER > 14 + +-template <class _Op, class _Indices, class ..._Bound> ++template <class _Op, class _Indices, class... _BoundArgs> + struct __perfect_forward_impl; + +-template <class _Op, size_t ..._Idx, class ..._Bound> +-struct __perfect_forward_impl<_Op, index_sequence<_Idx...>, _Bound...> { ++template <class _Op, size_t... _Idx, class... _BoundArgs> ++struct __perfect_forward_impl<_Op, index_sequence<_Idx...>, _BoundArgs...> { + private: +- tuple<_Bound...> __bound_; ++ tuple<_BoundArgs...> __bound_args_; + + public: +- template <class ..._BoundArgs, class = enable_if_t< +- is_constructible_v<tuple<_Bound...>, _BoundArgs&&...> +- >> +- explicit constexpr __perfect_forward_impl(_BoundArgs&& ...__bound) +- : __bound_(_VSTD::forward<_BoundArgs>(__bound)...) +- { } +- +- __perfect_forward_impl(__perfect_forward_impl const&) = default; +- __perfect_forward_impl(__perfect_forward_impl&&) = default; +- +- __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default; +- __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default; +- +- template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound&..., _Args...>>> +- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) & +- noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...))) +- -> decltype( _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...)) +- { return _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...); } +- +- template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound&..., _Args...>>> +- auto operator()(_Args&&...) & = delete; +- +- template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound const&..., _Args...>>> +- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const& +- noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...))) +- -> decltype( _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...)) +- { return _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...); } +- +- template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound const&..., _Args...>>> +- auto operator()(_Args&&...) const& = delete; +- +- template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound..., _Args...>>> +- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) && +- noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...))) +- -> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...)) +- { return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...); } +- +- template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound..., _Args...>>> +- auto operator()(_Args&&...) && = delete; +- +- template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound const..., _Args...>>> +- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&& +- noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...))) +- -> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...)) +- { return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...); } +- +- template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound const..., _Args...>>> +- auto operator()(_Args&&...) const&& = delete; ++ template <class... _Args, class = enable_if_t< ++ is_constructible_v<tuple<_BoundArgs...>, _Args&&...> ++ >> ++ explicit constexpr __perfect_forward_impl(_Args&&... __bound_args) ++ : __bound_args_(_VSTD::forward<_Args>(__bound_args)...) {} ++ ++ __perfect_forward_impl(__perfect_forward_impl const&) = default; ++ __perfect_forward_impl(__perfect_forward_impl&&) = default; ++ ++ __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default; ++ __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default; ++ ++ template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs&..., _Args...>>> ++ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) & ++ noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...))) ++ -> decltype( _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...)) ++ { return _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...); } ++ ++ template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs&..., _Args...>>> ++ auto operator()(_Args&&...) & = delete; ++ ++ template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const&..., _Args...>>> ++ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const& ++ noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...))) ++ -> decltype( _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...)) ++ { return _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...); } ++ ++ template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const&..., _Args...>>> ++ auto operator()(_Args&&...) const& = delete; ++ ++ template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs..., _Args...>>> ++ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) && ++ noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...))) ++ -> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...)) ++ { return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...); } ++ ++ template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs..., _Args...>>> ++ auto operator()(_Args&&...) && = delete; ++ ++ template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const..., _Args...>>> ++ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&& ++ noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...))) ++ -> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...)) ++ { return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...); } ++ ++ template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const..., _Args...>>> ++ auto operator()(_Args&&...) const&& = delete; + }; + + // __perfect_forward implements a perfect-forwarding call wrapper as explained in [func.require]. diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/33__split_buffer.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/33__split_buffer.patch new file mode 100644 index 0000000000..0074253612 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/33__split_buffer.patch @@ -0,0 +1,26 @@ +diff --git a/include/__split_buffer b/include/__split_buffer +index 9565e16..dd789e8 100644 +--- a/include/__split_buffer ++++ b/include/__split_buffer +@@ -107,6 +107,7 @@ public: + _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);} + _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);} + ++ void __uninitialized_at_end(size_type __n); + void __construct_at_end(size_type __n); + void __construct_at_end(size_type __n, const_reference __x); + template <class _InputIter> +@@ -197,6 +198,13 @@ __split_buffer<_Tp, _Allocator>::__invariants() const + return true; + } + ++template <class _Tp, class _Allocator> ++void ++__split_buffer<_Tp, _Allocator>::__uninitialized_at_end(size_type __n) ++{ ++ this->__end_ += __n; ++} ++ + // Default constructs __n objects starting at __end_ + // throws if construction throws + // Precondition: __n > 0 diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/34-list.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/34-list.patch new file mode 100644 index 0000000000..a743e77983 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/34-list.patch @@ -0,0 +1,13 @@ +diff --git a/include/list b/include/list +index ac2e466..b1f6c57 100644 +--- a/include/list ++++ b/include/list +@@ -1968,7 +1968,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) + __cn1->__add(*__ip); + (*__ip)->__c_ = __cn1; + if (--__cn2->end_ != __ip) +- _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); ++ memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); + } + } + __db->unlock(); diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/35-set-map.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/35-set-map.patch new file mode 100644 index 0000000000..0d342336d4 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/35-set-map.patch @@ -0,0 +1,44 @@ +diff --git a/include/map b/include/map +index 551edc5..9a9826f 100644 +--- a/include/map ++++ b/include/map +@@ -1370,7 +1370,7 @@ public: + _LIBCPP_INLINE_VISIBILITY + iterator erase(const_iterator __f, const_iterator __l) + {return __tree_.erase(__f.__i_, __l.__i_);} +- _LIBCPP_INLINE_VISIBILITY ++ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT {__tree_.clear();} + + #if _LIBCPP_STD_VER > 14 +@@ -2112,7 +2112,7 @@ public: + } + #endif + +- _LIBCPP_INLINE_VISIBILITY ++ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT {__tree_.clear();} + + _LIBCPP_INLINE_VISIBILITY +diff --git a/include/set b/include/set +index be117d0..176369e 100644 +--- a/include/set ++++ b/include/set +@@ -745,7 +745,7 @@ public: + _LIBCPP_INLINE_VISIBILITY + iterator erase(const_iterator __f, const_iterator __l) + {return __tree_.erase(__f, __l);} +- _LIBCPP_INLINE_VISIBILITY ++ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT {__tree_.clear();} + + #if _LIBCPP_STD_VER > 14 +@@ -1276,7 +1276,7 @@ public: + _LIBCPP_INLINE_VISIBILITY + iterator erase(const_iterator __f, const_iterator __l) + {return __tree_.erase(__f, __l);} +- _LIBCPP_INLINE_VISIBILITY ++ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT {__tree_.clear();} + + #if _LIBCPP_STD_VER > 14 diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/36-math.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/36-math.patch new file mode 100644 index 0000000000..b959e68227 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/36-math.patch @@ -0,0 +1,32 @@ +diff --git a/include/math.h b/include/math.h +index 62fcc62..a409b61 100644 +--- a/include/math.h ++++ b/include/math.h +@@ -1658,10 +1658,10 @@ rint(_A1 __lcpp_x) _NOEXCEPT + + inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT + { +-#if __has_builtin(__builtin_round) +- return __builtin_round(__lcpp_x); ++#if __has_builtin(__builtin_roundf) ++ return __builtin_roundf(__lcpp_x); + #else +- return ::round(__lcpp_x); ++ return ::roundf(__lcpp_x); + #endif + } + inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT +@@ -1719,10 +1719,10 @@ tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);} + + inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT + { +-#if __has_builtin(__builtin_trunc) +- return __builtin_trunc(__lcpp_x); ++#if __has_builtin(__builtin_truncf) ++ return __builtin_truncf(__lcpp_x); + #else +- return ::trunc(__lcpp_x); ++ return ::truncf(__lcpp_x); + #endif + } + inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/37-mutex.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/37-mutex.patch new file mode 100644 index 0000000000..f21f41b43e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/37-mutex.patch @@ -0,0 +1,78 @@ +diff --git a/include/mutex b/include/mutex +index 536cf9c..1093f55 100644 +--- a/include/mutex ++++ b/include/mutex +@@ -198,6 +198,10 @@ template<class Callable, class ...Args> + #endif + #include <version> + ++#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_CXX03_LANG) ++#include <atomic> ++#endif ++ + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) + # pragma GCC system_header + #endif +@@ -581,7 +585,11 @@ struct _LIBCPP_TEMPLATE_VIS once_flag + #endif + + private: ++#if defined(_LIBCPP_ABI_MICROSOFT) ++ atomic<_State_type> __state_; ++#else + _State_type __state_; ++#endif + + #ifndef _LIBCPP_CXX03_LANG + template<class _Callable, class... _Args> +@@ -651,8 +659,13 @@ __call_once_proxy(void* __vp) + (*__p)(); + } + ++#ifdef _LIBCPP_ABI_MICROSOFT ++_LIBCPP_FUNC_VIS void __call_once(volatile atomic<once_flag::_State_type>&, void*, ++ void (*)(void*)); ++#else + _LIBCPP_FUNC_VIS void __call_once(volatile once_flag::_State_type&, void*, + void (*)(void*)); ++#endif + + #ifndef _LIBCPP_CXX03_LANG + +@@ -661,7 +674,11 @@ inline _LIBCPP_INLINE_VISIBILITY + void + call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) + { ++#if defined(_LIBCPP_ABI_MICROSOFT) ++ if (__flag.__state_.load(memory_order_acquire) != ~once_flag::_State_type(0)) ++#else + if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0)) ++#endif + { + typedef tuple<_Callable&&, _Args&&...> _Gp; + _Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...); +@@ -677,7 +694,11 @@ inline _LIBCPP_INLINE_VISIBILITY + void + call_once(once_flag& __flag, _Callable& __func) + { ++#if defined(_LIBCPP_ABI_MICROSOFT) ++ if (__flag.__state_.load(memory_order_acquire) != ~once_flag::_State_type(0)) ++#else + if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0)) ++#endif + { + __call_once_param<_Callable> __p(__func); + __call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>); +@@ -689,7 +710,11 @@ inline _LIBCPP_INLINE_VISIBILITY + void + call_once(once_flag& __flag, const _Callable& __func) + { +- if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0)) ++#if defined(_LIBCPP_ABI_MICROSOFT) ++ if (__flag.__state_.load(memory_order_relaxed) != ~once_flag::_State_type(0)) ++#else ++ if (__flag.__state_ != ~once_flag::_State_type(0)) ++#endif + { + __call_once_param<const _Callable> __p(__func); + __call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>); diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/38-numbers.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/38-numbers.patch new file mode 100644 index 0000000000..625f15ae31 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/38-numbers.patch @@ -0,0 +1,37 @@ +diff --git a/include/numbers b/include/numbers +index 3e95b1e..9a52d14 100644 +--- a/include/numbers ++++ b/include/numbers +@@ -96,19 +96,19 @@ template <class _Tp> inline constexpr _Tp inv_sqrt3_v = __illformed<_Tp>{}; + template <class _Tp> inline constexpr _Tp egamma_v = __illformed<_Tp>{}; + template <class _Tp> inline constexpr _Tp phi_v = __illformed<_Tp>{}; + +-template <floating_point _Tp> inline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662; +-template <floating_point _Tp> inline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892; +-template <floating_point _Tp> inline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605; +-template <floating_point _Tp> inline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502; +-template <floating_point _Tp> inline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028; +-template <floating_point _Tp> inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772; +-template <floating_point _Tp> inline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176; +-template <floating_point _Tp> inline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364; +-template <floating_point _Tp> inline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698; +-template <floating_point _Tp> inline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872; +-template <floating_point _Tp> inline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957; +-template <floating_point _Tp> inline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402; +-template <floating_point _Tp> inline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638; ++template <floating_point _Tp> inline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662L; ++template <floating_point _Tp> inline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892L; ++template <floating_point _Tp> inline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605L; ++template <floating_point _Tp> inline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502L; ++template <floating_point _Tp> inline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028L; ++template <floating_point _Tp> inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772L; ++template <floating_point _Tp> inline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176L; ++template <floating_point _Tp> inline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364L; ++template <floating_point _Tp> inline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698L; ++template <floating_point _Tp> inline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872L; ++template <floating_point _Tp> inline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957L; ++template <floating_point _Tp> inline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402L; ++template <floating_point _Tp> inline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638L; + + inline constexpr double e = e_v<double>; + inline constexpr double log2e = log2e_v<double>; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/39-optional.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/39-optional.patch new file mode 100644 index 0000000000..1468884e6d --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/39-optional.patch @@ -0,0 +1,150 @@ +diff --git a/include/optional b/include/optional +index b20081d..fd17b08 100644 +--- a/include/optional ++++ b/include/optional +@@ -236,7 +236,7 @@ struct __optional_destruct_base<_Tp, false> + bool __engaged_; + + _LIBCPP_INLINE_VISIBILITY +- _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__optional_destruct_base() ++ /* _LIBCPP_CONSTEXPR_AFTER_CXX17 */ ~__optional_destruct_base() + { + if (__engaged_) + __val_.~value_type(); +@@ -647,16 +647,14 @@ private: + // LWG2756: conditionally explicit conversion from _Up + struct _CheckOptionalArgsConstructor { + template <class _Up> +- static constexpr bool __enable_implicit() { +- return is_constructible_v<_Tp, _Up&&> && +- is_convertible_v<_Up&&, _Tp>; +- } ++ static constexpr bool __enable_implicit = ++ is_constructible_v<_Tp, _Up&&> && ++ is_convertible_v<_Up&&, _Tp>; + + template <class _Up> +- static constexpr bool __enable_explicit() { +- return is_constructible_v<_Tp, _Up&&> && +- !is_convertible_v<_Up&&, _Tp>; +- } ++ static constexpr bool __enable_explicit = ++ is_constructible_v<_Tp, _Up&&> && ++ !is_convertible_v<_Up&&, _Tp>; + }; + template <class _Up> + using _CheckOptionalArgsCtor = _If< +@@ -686,22 +684,19 @@ private: + is_assignable<_Tp&, _Opt const&&> + >; + template <class _Up, class _QUp = _QualUp> +- static constexpr bool __enable_implicit() { +- return is_convertible<_QUp, _Tp>::value && +- !__check_constructible_from_opt<_Up>::value; +- } ++ static constexpr bool __enable_implicit = ++ is_convertible<_QUp, _Tp>::value && ++ !__check_constructible_from_opt<_Up>::value; ++ + template <class _Up, class _QUp = _QualUp> +- static constexpr bool __enable_explicit() { +- return !is_convertible<_QUp, _Tp>::value && +- !__check_constructible_from_opt<_Up>::value; +- } ++ static constexpr bool __enable_explicit = ++ !is_convertible<_QUp, _Tp>::value && ++ !__check_constructible_from_opt<_Up>::value; ++ + template <class _Up, class _QUp = _QualUp> +- static constexpr bool __enable_assign() { +- // Construction and assignability of _QUp to _Tp has already been +- // checked. +- return !__check_constructible_from_opt<_Up>::value && +- !__check_assignable_from_opt<_Up>::value; +- } ++ static constexpr bool __enable_assign = ++ !__check_constructible_from_opt<_Up>::value && ++ !__check_assignable_from_opt<_Up>::value; + }; + + template <class _Up, class _QualUp> +@@ -734,7 +729,7 @@ public: + template <class _InPlaceT, class... _Args, class = enable_if_t< + _And< + _IsSame<_InPlaceT, in_place_t>, +- is_constructible<value_type, _Args...> ++ is_constructible<value_type, _Args...> + >::value + > + > +@@ -750,14 +745,14 @@ public: + : __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {} + + template <class _Up = value_type, enable_if_t< +- _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>() ++ _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up> + , int> = 0> + _LIBCPP_INLINE_VISIBILITY + constexpr optional(_Up&& __v) + : __base(in_place, _VSTD::forward<_Up>(__v)) {} + + template <class _Up, enable_if_t< +- _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>() ++ _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up> + , int> = 0> + _LIBCPP_INLINE_VISIBILITY + constexpr explicit optional(_Up&& __v) +@@ -765,7 +760,7 @@ public: + + // LWG2756: conditionally explicit conversion from const optional<_Up>& + template <class _Up, enable_if_t< +- _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>() ++ _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up> + , int> = 0> + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 optional(const optional<_Up>& __v) +@@ -773,7 +768,7 @@ public: + this->__construct_from(__v); + } + template <class _Up, enable_if_t< +- _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>() ++ _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up> + , int> = 0> + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit optional(const optional<_Up>& __v) +@@ -783,7 +778,7 @@ public: + + // LWG2756: conditionally explicit conversion from optional<_Up>&& + template <class _Up, enable_if_t< +- _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>() ++ _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up> + , int> = 0> + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 optional(optional<_Up>&& __v) +@@ -791,7 +786,7 @@ public: + this->__construct_from(_VSTD::move(__v)); + } + template <class _Up, enable_if_t< +- _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>() ++ _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up> + , int> = 0> + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit optional(optional<_Up>&& __v) +@@ -843,7 +838,7 @@ public: + + // LWG2756 + template <class _Up, enable_if_t< +- _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>() ++ _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up> + , int> = 0> + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& +@@ -855,7 +850,7 @@ public: + + // LWG2756 + template <class _Up, enable_if_t< +- _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>() ++ _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up> + , int> = 0> + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/40-deque.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/40-deque.patch new file mode 100644 index 0000000000..4cb7f81344 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/40-deque.patch @@ -0,0 +1,50 @@ +diff --git a/include/deque b/include/deque +index b0fd148..a4ab230 100644 +--- a/include/deque ++++ b/include/deque +@@ -289,7 +289,9 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, + + template <class _ValueType, class _DiffType> + struct __deque_block_size { +- static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16; ++ static const _DiffType __buf_size = 64 * sizeof(void*); ++ static const _DiffType value = (__buf_size / sizeof(_ValueType)) > 2 ? (__buf_size / sizeof(_ValueType)) : 2; ++ //static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16; + }; + + template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, +@@ -1465,7 +1467,7 @@ public: + _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || + __is_nothrow_swappable<allocator_type>::value); + #endif +- _LIBCPP_INLINE_VISIBILITY ++ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT; + + _LIBCPP_INLINE_VISIBILITY +@@ -2413,7 +2415,7 @@ void + deque<_Tp, _Allocator>::__add_front_capacity() + { + allocator_type& __a = __base::__alloc(); +- if (__back_spare() >= __base::__block_size) ++ if (__back_spare() >= size_type(__base::__block_size)) + { + __base::__start_ += __base::__block_size; + pointer __pt = __base::__map_.back(); +@@ -2558,7 +2560,7 @@ void + deque<_Tp, _Allocator>::__add_back_capacity() + { + allocator_type& __a = __base::__alloc(); +- if (__front_spare() >= __base::__block_size) ++ if (__front_spare() >= size_type(__base::__block_size)) + { + __base::__start_ -= __base::__block_size; + pointer __pt = __base::__map_.front(); +@@ -2946,6 +2948,7 @@ deque<_Tp, _Allocator>::swap(deque& __c) + } + + template <class _Tp, class _Allocator> ++_LIBCPP_REINITIALIZES_OBJECT + inline + void + deque<_Tp, _Allocator>::clear() _NOEXCEPT diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/41-exception.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/41-exception.patch new file mode 100644 index 0000000000..70e1dfc646 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/41-exception.patch @@ -0,0 +1,78 @@ +diff --git a/include/exception b/include/exception +index 5460b73..a5a1f99 100644 +--- a/include/exception ++++ b/include/exception +@@ -138,8 +138,6 @@ class _LIBCPP_TYPE_VIS exception_ptr; + _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; + _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); + +-#ifndef _LIBCPP_ABI_MICROSOFT +- + class _LIBCPP_TYPE_VIS exception_ptr + { + void* __ptr_; +@@ -162,10 +160,19 @@ public: + bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT + {return !(__x == __y);} + ++ friend _LIBCPP_FUNC_VIS void swap(exception_ptr& __x, exception_ptr& __y) _NOEXCEPT ++ { ++ void* __tmp = __x.__ptr_; ++ __x.__ptr_ = __y.__ptr_; ++ __y.__ptr_ = __tmp; ++ } ++ + friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; + friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); + }; + ++#ifndef _LIBCPP_ABI_MICROSOFT ++ + template<class _Ep> + _LIBCPP_INLINE_VISIBILITY exception_ptr + make_exception_ptr(_Ep __e) _NOEXCEPT +@@ -187,42 +194,14 @@ make_exception_ptr(_Ep __e) _NOEXCEPT + + #else // _LIBCPP_ABI_MICROSOFT + +-class _LIBCPP_TYPE_VIS exception_ptr +-{ +-_LIBCPP_DIAGNOSTIC_PUSH +-_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field") +- void* __ptr1_; +- void* __ptr2_; +-_LIBCPP_DIAGNOSTIC_POP +-public: +- exception_ptr() _NOEXCEPT; +- exception_ptr(nullptr_t) _NOEXCEPT; +- exception_ptr(const exception_ptr& __other) _NOEXCEPT; +- exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT; +- exception_ptr& operator=(nullptr_t) _NOEXCEPT; +- ~exception_ptr() _NOEXCEPT; +- explicit operator bool() const _NOEXCEPT; +-}; +- +-_LIBCPP_FUNC_VIS +-bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT; +- +-inline _LIBCPP_INLINE_VISIBILITY +-bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT +- {return !(__x == __y);} +- +-_LIBCPP_FUNC_VIS void swap(exception_ptr&, exception_ptr&) _NOEXCEPT; +- +-_LIBCPP_FUNC_VIS exception_ptr __copy_exception_ptr(void *__except, const void* __ptr); +-_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; +-_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr p); ++_LIBCPP_FUNC_VIS exception_ptr __copy_exception_ptr(void *__exception, const void* __ptr); + + // This is a built-in template function which automagically extracts the required + // information. + template <class _E> void *__GetExceptionInfo(_E); + + template<class _Ep> +-_LIBCPP_INLINE_VISIBILITY exception_ptr ++exception_ptr + make_exception_ptr(_Ep __e) _NOEXCEPT + { + return __copy_exception_ptr(_VSTD::addressof(__e), __GetExceptionInfo(__e)); diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/42-span.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/42-span.patch new file mode 100644 index 0000000000..76af4fa297 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/42-span.patch @@ -0,0 +1,126 @@ +diff --git a/include/span b/include/span +index 46df783..0101dcb 100644 +--- a/include/span ++++ b/include/span +@@ -181,6 +181,29 @@ concept __span_compatible_range = + !__is_std_array<remove_cvref_t<_Range>>::value && + !is_array_v<remove_cvref_t<_Range>> && + is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>; ++#else ++template <class _Tp, class _ElementType, class = void> ++struct __is_span_compatible_container : public false_type {}; ++ ++template <class _Tp, class _ElementType> ++struct __is_span_compatible_container<_Tp, _ElementType, ++ void_t< ++ // is not a specialization of span ++ enable_if_t<!__is_std_span<_Tp>::value, nullptr_t>, ++ // is not a specialization of array ++ enable_if_t<!__is_std_array<_Tp>::value, nullptr_t>, ++ // is_array_v<Container> is false, ++ enable_if_t<!is_array_v<_Tp>, nullptr_t>, ++ // data(cont) and size(cont) are well formed ++ decltype(data(declval<_Tp>())), ++ decltype(size(declval<_Tp>())), ++ // remove_pointer_t<decltype(data(cont))>(*)[] is convertible to ElementType(*)[] ++ enable_if_t< ++ is_convertible_v<remove_pointer_t<decltype(data(declval<_Tp &>()))>(*)[], ++ _ElementType(*)[]>, ++ nullptr_t> ++ >> ++ : public true_type {}; + #endif + + template <typename _Tp, size_t _Extent> +@@ -235,6 +258,11 @@ public: + _LIBCPP_ASSERT(__last - __first == _Extent, + "invalid range in span's constructor (iterator, sentinel): last - first != extent"); + } ++#else ++ _LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __ptr, size_type __count) : __data{__ptr} ++ { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); } ++ _LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __f, pointer __l) : __data{__f} ++ { (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); } + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) + + _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data{__arr} {} +@@ -255,6 +283,22 @@ public: + constexpr explicit span(_Range&& __r) : __data{ranges::data(__r)} { + _LIBCPP_ASSERT(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)"); + } ++#else ++ template <class _Container> ++ _LIBCPP_INLINE_VISIBILITY ++ constexpr explicit span( _Container& __c, ++ enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr) ++ : __data{_VSTD::data(__c)} { ++ _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)"); ++ } ++ ++ template <class _Container> ++ _LIBCPP_INLINE_VISIBILITY ++ constexpr explicit span(const _Container& __c, ++ enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr) ++ : __data{_VSTD::data(__c)} { ++ _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)"); ++ } + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + + template <class _OtherElementType> +@@ -419,6 +463,9 @@ public: + _LIBCPP_INLINE_VISIBILITY + constexpr span(_It __first, _End __last) + : __data(_VSTD::to_address(__first)), __size(__last - __first) {} ++#else ++ _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}, __size{__count} {} ++ _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {} + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) + + template <size_t _Sz> +@@ -439,6 +486,18 @@ public: + template <__span_compatible_range<element_type> _Range> + _LIBCPP_INLINE_VISIBILITY + constexpr span(_Range&& __r) : __data(ranges::data(__r)), __size{ranges::size(__r)} {} ++#else ++ template <class _Container> ++ _LIBCPP_INLINE_VISIBILITY ++ constexpr span( _Container& __c, ++ enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr) ++ : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} ++ ++ template <class _Container> ++ _LIBCPP_INLINE_VISIBILITY ++ constexpr span(const _Container& __c, ++ enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr) ++ : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + + template <class _OtherElementType, size_t _OtherExtent> +@@ -533,17 +592,23 @@ public: + _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } + _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } + +- _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept +- { return {reinterpret_cast<const byte *>(data()), size_bytes()}; } ++ inline _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept; + +- _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept +- { return {reinterpret_cast<byte *>(data()), size_bytes()}; } ++ inline _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept; + + private: + pointer __data; + size_type __size; + }; + ++template<typename _Tp> ++inline _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> span<_Tp, dynamic_extent>::__as_bytes() const noexcept ++{ return {reinterpret_cast<const byte *>(data()), size_bytes()}; } ++ ++template<typename _Tp> ++inline _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> span<_Tp, dynamic_extent>::__as_writable_bytes() const noexcept ++{ return {reinterpret_cast<byte *>(data()), size_bytes()}; } ++ + #if !defined(_LIBCPP_HAS_NO_CONCEPTS) + template <class _Tp, size_t _Extent> + inline constexpr bool ranges::enable_borrowed_range<span<_Tp, _Extent> > = true; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/43-string.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/43-string.patch new file mode 100644 index 0000000000..ffbff2794c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/43-string.patch @@ -0,0 +1,134 @@ +diff --git a/include/string b/include/string +index 53cf9ab..a1bfff1 100644 +--- a/include/string ++++ b/include/string +@@ -652,6 +652,7 @@ class + #endif + basic_string + { ++ static_assert(sizeof(_CharT) <= 4, "libc++ implementation of std::basic_string does not support extra-wide character types"); + public: + typedef basic_string __self; + typedef basic_string_view<_CharT, _Traits> __self_view; +@@ -674,8 +675,13 @@ public: + static_assert(( is_same<typename allocator_type::value_type, value_type>::value), + "Allocator::value_type must be same type as value_type"); + ++#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 ++ typedef pointer iterator; ++ typedef const_pointer const_iterator; ++#else + typedef __wrap_iter<pointer> iterator; + typedef __wrap_iter<const_pointer> const_iterator; ++#endif + typedef _VSTD::reverse_iterator<iterator> reverse_iterator; + typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; + +@@ -790,6 +796,10 @@ public: + _NOEXCEPT; + #endif + ++#if _LIBCPP_STD_VER > 17 ++ basic_string(nullptr_t) = delete; ++#endif ++ + _LIBCPP_INLINE_VISIBILITY + basic_string(basic_string&& __str, const allocator_type& __a); + #endif // _LIBCPP_CXX03_LANG +@@ -806,14 +816,18 @@ public: + _LIBCPP_INLINE_VISIBILITY + basic_string(const _CharT* __s, const _Allocator& __a); + +-#if _LIBCPP_STD_VER > 20 +- basic_string(nullptr_t) = delete; +-#endif ++ _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY ++ basic_string(nullptr_t, size_t) = delete; + + _LIBCPP_INLINE_VISIBILITY + basic_string(const _CharT* __s, size_type __n); ++ ++ _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY ++ basic_string(nullptr_t, size_t, const _Allocator&) = delete; ++ + _LIBCPP_INLINE_VISIBILITY + basic_string(const _CharT* __s, size_type __n, const _Allocator& __a); ++ + _LIBCPP_INLINE_VISIBILITY + basic_string(size_type __n, _CharT __c); + +@@ -861,6 +875,8 @@ public: + + basic_string& operator=(const basic_string& __str); + ++ basic_string& operator=(nullptr_t) = delete; ++ + template <class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> > + basic_string& operator=(const _Tp& __t) + {__self_view __sv = __t; return assign(__sv);} +@@ -939,6 +955,14 @@ public: + {return (__is_long() ? __get_long_cap() + : static_cast<size_type>(__min_cap)) - 1;} + ++ ++#if _YNDX_LIBCXX_ENABLE_STRING_RESIZE_UNINITIALIZED == 1 ++ inline void resize_uninitialized(size_type __n) ++ { ++ __resize_default_init(__n); ++ } ++#endif ++ + void resize(size_type __n, value_type __c); + _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());} + +@@ -1375,7 +1399,8 @@ public: + int compare(size_type __pos1, size_type __n1, const value_type* __s) const; + int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const; + +-#if _LIBCPP_STD_VER > 17 ++//WARN: disabled std guards in order to allow using these options without switching to new std ++//#if _LIBCPP_STD_VER > 17 + constexpr _LIBCPP_INLINE_VISIBILITY + bool starts_with(__self_view __sv) const noexcept + { return __self_view(data(), size()).starts_with(__sv); } +@@ -1399,9 +1424,9 @@ public: + constexpr _LIBCPP_INLINE_VISIBILITY + bool ends_with(const value_type* __s) const noexcept + { return ends_with(__self_view(__s)); } +-#endif ++//#endif + +-#if _LIBCPP_STD_VER > 20 ++#if _LIBCPP_STD_VER >= 20 + constexpr _LIBCPP_INLINE_VISIBILITY + bool contains(__self_view __sv) const noexcept + { return __self_view(data(), size()).contains(__sv); } +@@ -2316,7 +2341,7 @@ basic_string<_CharT, _Traits, _Allocator>& + basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) + { + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr"); +- return (__builtin_constant_p(__n) && __fits_in_sso(__n)) ++ return (_LIBCPP_BUILTIN_CONSTANT_P(__n) && __fits_in_sso(__n)) + ? __assign_short(__s, __n) + : __assign_external(__s, __n); + } +@@ -2518,7 +2543,7 @@ basic_string<_CharT, _Traits, _Allocator>& + basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) + { + _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr"); +- return __builtin_constant_p(*__s) ++ return _LIBCPP_BUILTIN_CONSTANT_P(*__s) + ? (__fits_in_sso(traits_type::length(__s)) + ? __assign_short(__s, traits_type::length(__s)) + : __assign_external(__s, traits_type::length(__s))) +@@ -4494,6 +4519,10 @@ inline namespace literals + + _LIBCPP_END_NAMESPACE_STD + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif ++ + _LIBCPP_POP_MACROS + + #endif // _LIBCPP_STRING diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/44-tuple.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/44-tuple.patch new file mode 100644 index 0000000000..861b4aac0f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/44-tuple.patch @@ -0,0 +1,13 @@ +diff --git a/include/tuple b/include/tuple +index 1334d04..868b66d 100644 +--- a/include/tuple ++++ b/include/tuple +@@ -1608,6 +1608,8 @@ pair<_T1, _T2>::pair(piecewise_construct_t, + : first(_VSTD::forward<_Args1>(_VSTD::get<_I1>( __first_args))...), + second(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) + { ++ (void)__first_args; ++ (void)__second_args; + } + + #if _LIBCPP_STD_VER > 14 diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/45-type-traits.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/45-type-traits.patch new file mode 100644 index 0000000000..7903fa0fda --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/45-type-traits.patch @@ -0,0 +1,446 @@ +diff --git a/include/type_traits b/include/type_traits +index 86bc5fa..df31e76 100644 +--- a/include/type_traits ++++ b/include/type_traits +@@ -424,6 +424,10 @@ namespace std + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) + # pragma GCC system_header + #endif ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning(push) ++#pragma warning(disable: 4296) ++#endif + + _LIBCPP_BEGIN_NAMESPACE_STD + +@@ -484,6 +488,8 @@ struct _MetaBase<true> { + using _SecondImpl _LIBCPP_NODEBUG = _Second; + template <class _Result, class _First, class ..._Rest> + using _OrImpl _LIBCPP_NODEBUG = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>; ++ template <class _Result, class _First, class ..._Rest> ++ using _AndImpl _LIBCPP_NODEBUG = typename _MetaBase<_First::value == true && sizeof...(_Rest) != 0>::template _AndImpl<_First, _Rest...>; + }; + + template <> +@@ -494,25 +500,45 @@ struct _MetaBase<false> { + using _SelectApplyImpl _LIBCPP_NODEBUG = _SecondFn<_Args...>; + template <class _Result, class ...> + using _OrImpl _LIBCPP_NODEBUG = _Result; ++ template <class _Result, class ...> ++ using _AndImpl _LIBCPP_NODEBUG = _Result; + }; ++// Workaround for MSVC. Sometimes compiler thinks that sizeof...(Type) is parameter pack rather than the number. ++// So it doesn't allow sizeof...(Type) in expression that goes into the boolean template parameter of _MetaBase. ++// This simple wrapper allows us to hide sizeof... from the compiler. ++template<class... _Pack> ++struct _Sizeof { ++ static constexpr size_t value = sizeof...(_Pack); ++}; ++// CUDA headers use libc++ internals. ++#ifdef __CUDACC__ ++template <bool _Cond, class _Ret = void> ++using __lazy_enable_if _LIBCPP_NODEBUG = __enable_if_t<_Cond, _Ret>; ++#endif + template <bool _Cond, class _IfRes, class _ElseRes> + using _If _LIBCPP_NODEBUG = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>; + template <class ..._Rest> +-using _Or _LIBCPP_NODEBUG = typename _MetaBase< sizeof...(_Rest) != 0 >::template _OrImpl<false_type, _Rest...>; ++using _Or _LIBCPP_NODEBUG = typename _MetaBase< _Sizeof<_Rest...>::value != 0 >::template _OrImpl<false_type, _Rest...>; + template <class _Pred> + struct _Not : _BoolConstant<!_Pred::value> {}; + template <class ..._Args> +-using _FirstType _LIBCPP_NODEBUG = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>; ++using _FirstType _LIBCPP_NODEBUG = typename _MetaBase<(_Sizeof<_Args...>::value >= 1)>::template _FirstImpl<_Args...>; + template <class ..._Args> +-using _SecondType _LIBCPP_NODEBUG = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>; ++using _SecondType _LIBCPP_NODEBUG = typename _MetaBase<(_Sizeof<_Args...>::value >= 2)>::template _SecondImpl<_Args...>; + ++// fold-based implementation fails on multiple compilers. ++#if 1 ++template <class ..._Rest> ++using _And _LIBCPP_NODEBUG = typename _MetaBase< _Sizeof<_Rest...>::value != 0 >::template _AndImpl<true_type, _Rest...>; ++#else + template <class ...> using __expand_to_true = true_type; + template <class ..._Pred> +-__expand_to_true<__enable_if_t<_Pred::value>...> __and_helper(int); ++__expand_to_true<__enable_if_t<std::bool_constant<_Pred::value>::value>...> __and_helper(int); + template <class ...> + false_type __and_helper(...); + template <class ..._Pred> +-using _And _LIBCPP_NODEBUG = decltype(__and_helper<_Pred...>(0)); ++using _And _LIBCPP_NODEBUG = decltype(__and_helper<std::bool_constant<_Pred::value>...>(0)); ++#endif + + template <template <class...> class _Func, class ..._Args> + struct _Lazy : _Func<_Args...> {}; +@@ -551,6 +577,8 @@ template <bool _Bp, class _If, class _Then> using conditional_t = typename condi + + // is_same + ++#if __has_keyword(__is_same) && !defined(__CUDACC__) ++ + template <class _Tp, class _Up> + struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { }; + +@@ -559,6 +587,17 @@ template <class _Tp, class _Up> + inline constexpr bool is_same_v = __is_same(_Tp, _Up); + #endif + ++#else ++ ++template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {}; ++template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {}; ++ ++#if _LIBCPP_STD_VER > 14 ++template <class _Tp, class _Up> ++inline constexpr bool is_same_v = is_same<_Tp, _Up>::value; ++#endif ++ ++#endif // __is_same + // _IsSame<T,U> has the same effect as is_same<T,U> but instantiates fewer types: + // is_same<A,B> and is_same<C,D> are guaranteed to be different types, but + // _IsSame<A,B> and _IsSame<C,D> are the same type (namely, false_type). +@@ -567,10 +606,23 @@ inline constexpr bool is_same_v = __is_same(_Tp, _Up); + // (such as in a dependent return type). + + template <class _Tp, class _Up> +-using _IsSame = _BoolConstant<__is_same(_Tp, _Up)>; ++using _IsSame = _BoolConstant< ++#if defined(__clang__) && !defined(__CUDACC__) ++ __is_same(_Tp, _Up) ++#else ++ is_same<_Tp, _Up>::value ++#endif ++>; + + template <class _Tp, class _Up> +-using _IsNotSame = _BoolConstant<!__is_same(_Tp, _Up)>; ++using _IsNotSame = _BoolConstant< ++#if defined(__clang__) && !defined(__CUDACC__) ++ !__is_same(_Tp, _Up) ++#else ++ !is_same<_Tp, _Up>::value ++#endif ++>; ++ + + template <class _Tp> + using __test_for_primary_template = __enable_if_t< +@@ -587,7 +639,7 @@ struct __two {char __lx[2];}; + + // is_const + +-#if __has_keyword(__is_const) ++#if __has_keyword(__is_const) && !defined(__CUDACC__) + + template <class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { }; +@@ -611,7 +663,7 @@ inline constexpr bool is_const_v = is_const<_Tp>::value; + + // is_volatile + +-#if __has_keyword(__is_volatile) ++#if __has_keyword(__is_volatile) && !defined(__CUDACC__) + + template <class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { }; +@@ -659,7 +711,7 @@ template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; + + // is_void + +-#if __has_keyword(__is_void) ++#if __has_keyword(__is_void) && !defined(__CUDACC__) + + template <class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { }; +@@ -701,7 +753,7 @@ inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; + + // is_integral + +-#if __has_keyword(__is_integral) ++#if __has_keyword(__is_integral) && !defined(__CUDACC__) + + template <class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { }; +@@ -766,7 +818,7 @@ inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; + + // is_array + +-#if __has_keyword(__is_array) ++#if __has_keyword(__is_array) && !defined(__CUDACC__) + + template <class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { }; +@@ -796,7 +848,8 @@ inline constexpr bool is_array_v = is_array<_Tp>::value; + + // Before AppleClang 12.0.5, __is_pointer didn't work for Objective-C types. + #if __has_keyword(__is_pointer) && \ +- !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1205) ++ !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1205) && \ ++ !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { }; +@@ -833,7 +886,7 @@ inline constexpr bool is_pointer_v = is_pointer<_Tp>::value; + + #if __has_keyword(__is_lvalue_reference) && \ + __has_keyword(__is_rvalue_reference) && \ +- __has_keyword(__is_reference) ++ __has_keyword(__is_reference) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { }; +@@ -925,15 +978,24 @@ inline constexpr bool is_class_v = is_class<_Tp>::value; + + // is_function + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning(push) ++#pragma warning(disable: 4180) ++#endif ++ + template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function + : public _BoolConstant< +-#ifdef __clang__ ++#if defined(__clang__) && !defined(__CUDACC__) + __is_function(_Tp) + #else + !(is_reference<_Tp>::value || is_const<const _Tp>::value) + #endif + > {}; + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning(pop) ++#endif ++ + + #if _LIBCPP_STD_VER > 14 + template <class _Tp> +@@ -955,7 +1017,7 @@ template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> { + }; + }; + +-#if __has_keyword(__is_member_function_pointer) ++#if __has_keyword(__is_member_function_pointer) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer +@@ -980,7 +1042,7 @@ inline constexpr bool is_member_function_pointer_v = is_member_function_pointer< + + // is_member_pointer + +-#if __has_keyword(__is_member_pointer) ++#if __has_keyword(__is_member_pointer) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> { }; +@@ -1004,7 +1066,7 @@ inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; + + // is_member_object_pointer + +-#if __has_keyword(__is_member_object_pointer) ++#if __has_keyword(__is_member_object_pointer) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer +@@ -1078,7 +1140,7 @@ inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; + // In C++03 nullptr_t is library-provided but must still count as "fundamental." + #if __has_keyword(__is_fundamental) && \ + !(defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1000) && \ +- !defined(_LIBCPP_CXX03_LANG) ++ !defined(_LIBCPP_CXX03_LANG) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { }; +@@ -1105,7 +1167,7 @@ inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; + // is_scalar + + // In C++03 nullptr_t is library-provided but must still count as "scalar." +-#if __has_keyword(__is_scalar) && !defined(_LIBCPP_CXX03_LANG) ++#if __has_keyword(__is_scalar) && !defined(_LIBCPP_CXX03_LANG) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { }; +@@ -1141,7 +1203,7 @@ inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; + + // is_object + +-#if __has_keyword(__is_object) ++#if __has_keyword(__is_object) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> { }; +@@ -1169,7 +1231,7 @@ inline constexpr bool is_object_v = is_object<_Tp>::value; + // is_compound + + // >= 11 because in C++03 nullptr isn't actually nullptr +-#if __has_keyword(__is_compound) && !defined(_LIBCPP_CXX03_LANG) ++#if __has_keyword(__is_compound) && !defined(_LIBCPP_CXX03_LANG) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> { }; +@@ -1264,17 +1326,6 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference + template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; + #endif + +-// Suppress deprecation notice for volatile-qualified return type resulting +-// from volatile-qualified types _Tp. +-_LIBCPP_SUPPRESS_DEPRECATED_PUSH +-template <class _Tp> _Tp&& __declval(int); +-template <class _Tp> _Tp __declval(long); +-_LIBCPP_SUPPRESS_DEPRECATED_POP +- +-template <class _Tp> +-decltype(__declval<_Tp>(0)) +-declval() _NOEXCEPT; +- + template <class _Tp> + struct __unconstref { + typedef _LIBCPP_NODEBUG typename remove_const<typename remove_reference<_Tp>::type>::type type; +@@ -1288,7 +1339,8 @@ using __uncvref_t _LIBCPP_NODEBUG = typename remove_cv<typename remove_reference + template <class _Tp, class _Up> + struct __is_same_uncvref : _IsSame<__uncvref_t<_Tp>, __uncvref_t<_Up> > {}; + +-#if _LIBCPP_STD_VER > 17 ++// C++20, enabled for C++17 in Arcadia ++#if _LIBCPP_STD_VER > 14 + // remove_cvref - same as __uncvref + template <class _Tp> + struct remove_cvref { +@@ -1341,7 +1393,7 @@ template<class _Tp> using type_identity_t = typename type_identity<_Tp>::type; + + // is_signed + +-#if __has_keyword(__is_signed) ++#if __has_keyword(__is_signed) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> { }; +@@ -1379,7 +1431,7 @@ inline constexpr bool is_signed_v = is_signed<_Tp>::value; + // No currently-released version of AppleClang contains the fixed intrinsic. + #if __has_keyword(__is_unsigned) && \ + !(defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1300) && \ +- !defined(_LIBCPP_APPLE_CLANG_VER) ++ !defined(_LIBCPP_APPLE_CLANG_VER) && !defined(__CUDACC__) + + template<class _Tp> + struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { }; +@@ -1427,7 +1479,7 @@ inline constexpr size_t rank_v = rank<_Tp>::value; + + // extent + +-#if __has_keyword(__array_extent) ++#if __has_keyword(__array_extent) && !defined(__CUDACC__) + + template<class _Tp, size_t _Dim = 0> + struct _LIBCPP_TEMPLATE_VIS extent +@@ -1915,6 +1967,17 @@ template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::valu + using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; + #endif + ++// MSVC compiler doesn't support more that 4 byte alignment on the stack on Win32. ++// If you try to pass parameter which is aligned by alignas to 8 or more bytes ++// on Win32, MSVC throws compile error C2719. ++// To avoid this compile error we delete all alignas specializations and use ++// union alignment instead. Just like for double, this will mean that 8 bytes ++// aligned types will only be aligned to 4 bytes on the stack. ++// Larger alignments will generate assert error which is allowed by the standard ++// since it is implementation-defined behavior. Default _Align argument will never ++// be more than 8 bytes on Win32 and so will not generate assert errors. ++#if !(defined(_LIBCPP_COMPILER_MSVC) && defined(_M_IX86)) ++ + #define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ + template <size_t _Len>\ + struct _LIBCPP_TEMPLATE_VIS aligned_storage<_Len, n>\ +@@ -1945,6 +2008,7 @@ _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); + #endif // !defined(_LIBCPP_OBJECT_FORMAT_COFF) + + #undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION ++#endif // !(defined(_LIBCPP_COMPILER_MSVC) && defined(_M_IX86)) + + + // aligned_union +@@ -2307,14 +2371,13 @@ template <class _Tp> + struct _LIBCPP_TEMPLATE_VIS common_type<_Tp> + : public common_type<_Tp, _Tp> {}; + +-// bullet 3 - sizeof...(Tp) == 2 +- + // sub-bullet 1 - "If is_same_v<T1, D1> is false or ..." + template <class _Tp, class _Up> + struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up> + : conditional< + _IsSame<_Tp, typename decay<_Tp>::type>::value && _IsSame<_Up, typename decay<_Up>::type>::value, +- __common_type2_imp<_Tp, _Up>, ++ // Fix for MSVC which thinks that std::common_type<int, void>::type == void. ++ __common_type2_imp<_Tp, _Up, typename conditional<is_void<_Tp>::value ^ is_void<_Up>::value, int, void>::type>, + common_type<typename decay<_Tp>::type, typename decay<_Up>::type> + >::type + {}; +@@ -2577,9 +2640,15 @@ struct __is_assignable_imp<_Tp, _Arg, true> + { + }; + ++#ifdef _LIBCPP_COMPILER_MSVC ++template <class _Tp, class _Arg> ++struct is_assignable ++ : public _VSTD::integral_constant<bool, __is_assignable(_Tp, _Arg)> {}; ++#else + template <class _Tp, class _Arg> + struct is_assignable + : public __is_assignable_imp<_Tp, _Arg> {}; ++#endif + + #if _LIBCPP_STD_VER > 14 + template <class _Tp, class _Arg> +@@ -2631,6 +2700,13 @@ inline constexpr bool is_destructible_v = __is_destructible(_Tp); + // Otherwise, return "declval<_Up&>().~_Up()" is well-formed + // where _Up is remove_all_extents<_Tp>::type + ++#if defined(_LIBCPP_COMPILER_MSVC) ++ ++template <typename _Tp> ++struct is_destructible : integral_constant<bool, __is_destructible(_Tp)> {}; ++ ++#else ++ + template <class> + struct __is_destructible_apply { typedef int type; }; + +@@ -2680,6 +2756,8 @@ template <> + struct is_destructible<void> + : public false_type {}; + ++#endif ++ + #if _LIBCPP_STD_VER > 14 + template <class _Tp> + inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; +@@ -4074,6 +4152,7 @@ template <class _ValTy, class _Key, class _RawValTy> + struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> + : false_type {}; + ++#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED + #if _LIBCPP_STD_VER > 17 + _LIBCPP_INLINE_VISIBILITY + inline constexpr bool is_constant_evaluated() noexcept { +@@ -4083,6 +4162,10 @@ inline constexpr bool is_constant_evaluated() noexcept { + + inline _LIBCPP_CONSTEXPR + bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); } ++#else ++inline _LIBCPP_CONSTEXPR ++bool __libcpp_is_constant_evaluated() _NOEXCEPT { return false; } ++#endif + + template <class _CharT> + using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >; +@@ -4097,4 +4180,8 @@ using __maybe_const = conditional_t<_Const, const _Tp, _Tp>; + + _LIBCPP_END_NAMESPACE_STD + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning(pop) ++#endif ++ + #endif // _LIBCPP_TYPE_TRAITS diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/46-typeinfo-variant-valarray.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/46-typeinfo-variant-valarray.patch new file mode 100644 index 0000000000..43cf562906 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/46-typeinfo-variant-valarray.patch @@ -0,0 +1,97 @@ +diff --git a/include/typeinfo b/include/typeinfo +index e46956e..7efe626 100644 +--- a/include/typeinfo ++++ b/include/typeinfo +@@ -350,24 +350,46 @@ public: + class _LIBCPP_EXCEPTION_ABI bad_cast + : public exception + { +- public: ++public: ++#ifdef _LIBCPP_ABI_MICROSOFT ++ bad_cast() _NOEXCEPT {} ++ virtual ~bad_cast() _NOEXCEPT {} ++ virtual const char* what() const _NOEXCEPT ++ { ++ return "std::bad_cast"; ++ } ++#else + bad_cast() _NOEXCEPT; + bad_cast(const bad_cast&) _NOEXCEPT = default; + virtual ~bad_cast() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; ++#endif + }; + + class _LIBCPP_EXCEPTION_ABI bad_typeid + : public exception + { +- public: ++public: ++#ifdef _LIBCPP_ABI_MICROSOFT ++ bad_typeid() _NOEXCEPT {} ++ virtual ~bad_typeid() _NOEXCEPT {} ++ virtual const char* what() const _NOEXCEPT ++ { ++ return "std::bad_typeid"; ++ } ++#else + bad_typeid() _NOEXCEPT; + virtual ~bad_typeid() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; ++#endif + }; + + } // namespace std + ++#ifdef _LIBCPP_ABI_MICROSOFT ++class type_info : public std::type_info {}; ++#endif ++ + #endif // defined(_LIBCPP_ABI_VCRUNTIME) + + _LIBCPP_BEGIN_NAMESPACE_STD +diff --git a/include/valarray b/include/valarray +index ac1ca9b..90740f2 100644 +--- a/include/valarray ++++ b/include/valarray +@@ -2779,7 +2779,7 @@ public: + }; + + template<class _ValExpr> +-__val_expr<_ValExpr>::operator valarray<__val_expr::__result_type>() const ++__val_expr<_ValExpr>::operator valarray<typename __val_expr<_ValExpr>::__result_type>() const + { + valarray<__result_type> __r; + size_t __n = __expr_.size(); +diff --git a/include/variant b/include/variant +index d102196..be8e44b 100644 +--- a/include/variant ++++ b/include/variant +@@ -1246,18 +1246,21 @@ struct __all_overloads : _Bases... { + using _Bases::operator()...; + }; + +-template <class IdxSeq> ++// Change metaprogramming to satisfy MSVC. It doesn't like expression ++// __overload<_Types, _Idx>... when _Types comes from using parameter but ++// _Idx comes from structure template parameter. So I made them both ++// structure template parameters. ++template <class _IdxSeq, class ..._Types> + struct __make_overloads_imp; + +-template <size_t ..._Idx> +-struct __make_overloads_imp<__tuple_indices<_Idx...> > { +- template <class ..._Types> ++template <size_t ..._Idx, class ..._Types> ++struct __make_overloads_imp<__tuple_indices<_Idx...>, _Types... > { + using _Apply _LIBCPP_NODEBUG = __all_overloads<__overload<_Types, _Idx>...>; + }; + + template <class ..._Types> + using _MakeOverloads _LIBCPP_NODEBUG = typename __make_overloads_imp< +- __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>; ++ __make_indices_imp<_Sizeof<_Types...>::value, 0>, _Types...>::_Apply; + + template <class _Tp, class... _Types> + using __best_match_t = diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/47-vector.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/47-vector.patch new file mode 100644 index 0000000000..939721ea1b --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/47-vector.patch @@ -0,0 +1,179 @@ +diff --git a/include/vector b/include/vector +index 57d3506..9810ac7 100644 +--- a/include/vector ++++ b/include/vector +@@ -336,8 +336,13 @@ public: + typedef typename __alloc_traits::difference_type difference_type; + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; ++#if _YNDX_LIBCPP_MAKE_VECTOR_ITERATOR_POINTERS == 1 ++ typedef pointer iterator; ++ typedef const_pointer const_iterator; ++#else + typedef __wrap_iter<pointer> iterator; + typedef __wrap_iter<const_pointer> const_iterator; ++#endif + typedef _VSTD::reverse_iterator<iterator> reverse_iterator; + typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; + +@@ -632,7 +637,7 @@ public: + _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); + iterator erase(const_iterator __first, const_iterator __last); + +- _LIBCPP_INLINE_VISIBILITY ++ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT + { + size_type __old_size = size(); +@@ -641,6 +646,10 @@ public: + __invalidate_all_iterators(); + } + ++#if _YNDX_LIBCXX_ENABLE_VECTOR_POD_RESIZE_UNINITIALIZED ++ void resize_uninitialized(size_type __sz); ++#endif ++ + void resize(size_type __sz); + void resize(size_type __sz, const_reference __x); + +@@ -684,6 +693,7 @@ private: + void + >::type + __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n); ++ void __append_uninitialized(size_type __n); + void __append(size_type __n); + void __append(size_type __n, const_reference __x); + _LIBCPP_INLINE_VISIBILITY +@@ -706,6 +716,11 @@ private: + __annotate_shrink(__old_size); + } + ++// Disable double inline warning. ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4141 ) ++#endif + #ifndef _LIBCPP_CXX03_LANG + template <class _Up> + _LIBCPP_INLINE_VISIBILITY +@@ -718,6 +733,9 @@ private: + template <class _Up> + _LIBCPP_INLINE_VISIBILITY + inline void __push_back_slow_path(_Up& __x); ++#endif ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) + #endif + + // The following functions are no-ops outside of AddressSanitizer mode. +@@ -1024,6 +1042,23 @@ vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIt + _VSTD::__construct_range_forward(this->__alloc(), __first, __last, __tx.__pos_); + } + ++template <class _Tp, class _Allocator> ++void ++vector<_Tp, _Allocator>::__append_uninitialized(size_type __n) ++{ ++ if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n) { ++ __annotate_increase(__n); ++ this->__end_ += __n; ++ } ++ else ++ { ++ allocator_type& __a = this->__alloc(); ++ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a); ++ __v.__uninitialized_at_end(__n); ++ __swap_out_circular_buffer(__v); ++ } ++} ++ + // Default constructs __n objects starting at __end_ + // throws if construction throws + // Postcondition: size() == size() + __n +@@ -1659,9 +1694,9 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe + _ConstructTransaction __tx(*this, __from_e - __i); + for (pointer __pos = __tx.__pos_; __i < __from_e; + ++__i, (void) ++__pos, __tx.__pos_ = __pos) { +- __alloc_traits::construct(this->__alloc(), +- _VSTD::__to_address(__pos), +- _VSTD::move(*__i)); ++ __alloc_traits::construct(this->__alloc(), ++ _VSTD::__to_address(__pos), ++ _VSTD::move(*__i)); + } + } + _VSTD::move_backward(__from_s, __from_s + __n, __old_last); +@@ -1902,6 +1937,23 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi + return __make_iter(__p); + } + ++#if _YNDX_LIBCXX_ENABLE_VECTOR_POD_RESIZE_UNINITIALIZED ++ ++template <class _Tp, class _Allocator> ++void ++vector<_Tp, _Allocator>::resize_uninitialized(size_type __sz) ++{ ++ size_type __cs = size(); ++ if (__cs < __sz) ++ this->__append_uninitialized(__sz - __cs); ++ else if (__cs > __sz) { ++ this->__end_ = this->__begin_ + __sz; ++ __annotate_shrink(__cs); ++ } ++} ++ ++#endif ++ + template <class _Tp, class _Allocator> + void + vector<_Tp, _Allocator>::resize(size_type __sz) +@@ -2035,6 +2087,7 @@ vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) { + #endif + } + ++#if _YNDX_LIBCXX_ENABLE_VECTOR_BOOL_COMPRESSION == 1 + // vector<bool> + + template <class _Allocator> class vector<bool, _Allocator>; +@@ -2299,7 +2352,7 @@ public: + _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); + iterator erase(const_iterator __first, const_iterator __last); + +- _LIBCPP_INLINE_VISIBILITY ++ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT {__size_ = 0;} + + void swap(vector&) +@@ -3228,6 +3281,32 @@ struct _LIBCPP_TEMPLATE_VIS hash<vector<bool, _Allocator> > + size_t operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT + {return __vec.__hash_code();} + }; ++#else // _YNDX_LIBCXX_ENABLE_VECTOR_BOOL_COMPRESSION ++// Hash function implementation for uncompressed std::vector<bool> which returns the same result. ++template <class _Allocator> ++struct _LIBCPP_TEMPLATE_VIS hash<vector<bool, _Allocator> > ++ : public unary_function<vector<bool, _Allocator>, size_t> ++{ ++ _LIBCPP_INLINE_VISIBILITY ++ size_t operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT ++ { ++ size_t __h = 0; ++ size_t __idx = 0; ++ size_t __n = __vec.size(); ++ constexpr size_t __bits_per_word = sizeof(typename allocator_traits<_Allocator>::size_type) * CHAR_BIT; ++ static_assert(sizeof(typename allocator_traits<_Allocator>::size_type) <= sizeof(size_t), "size_type constraint violated"); ++ for (;__idx + __bits_per_word <= __n;) { ++ for (size_t __bit = 0; __bit < __bits_per_word; __bit++, __idx++) { ++ __h ^= static_cast<size_t>(__vec[__idx]) << __bit; ++ } ++ } ++ for (size_t __bit = 0; __idx < __n; __bit++, __idx++) { ++ __h ^= static_cast<size_t>(__vec[__idx]) << __bit; ++ } ++ return __h; ++ } ++}; ++#endif // _YNDX_LIBCXX_ENABLE_VECTOR_BOOL_COMPRESSION + + template <class _Tp, class _Allocator> + inline _LIBCPP_INLINE_VISIBILITY diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/48-version.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/48-version.patch new file mode 100644 index 0000000000..2c124f761f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/48-version.patch @@ -0,0 +1,57 @@ +diff --git a/include/version b/include/version +index 3aed750..25d112a 100644 +--- a/include/version ++++ b/include/version +@@ -47,7 +47,7 @@ __cpp_lib_bounded_array_traits 201902L <type_traits> + __cpp_lib_boyer_moore_searcher 201603L <functional> + __cpp_lib_byte 201603L <cstddef> + __cpp_lib_byteswap 202110L <bit> +-__cpp_lib_char8_t 201811L <atomic> <filesystem> <istream> ++__cpp_lib_char8_t 201907L <atomic> <filesystem> <istream> + <limits> <locale> <ostream> + <string> <string_view> + __cpp_lib_chrono 201611L <chrono> +@@ -231,7 +231,11 @@ __cpp_lib_void_t 201411L <type_traits> + # define __cpp_lib_allocator_traits_is_always_equal 201411L + # define __cpp_lib_any 201606L + # define __cpp_lib_apply 201603L +-# define __cpp_lib_array_constexpr 201603L ++# if defined(_MSC_VER) && _MSC_VER >= 1926 ++# define __cpp_lib_array_constexpr 201803L ++# else ++# define __cpp_lib_array_constexpr 201603L ++# endif + # define __cpp_lib_as_const 201510L + # define __cpp_lib_atomic_is_always_lock_free 201603L + # define __cpp_lib_bool_constant 201505L +@@ -242,7 +246,7 @@ __cpp_lib_void_t 201411L <type_traits> + # define __cpp_lib_enable_shared_from_this 201603L + // # define __cpp_lib_execution 201603L + # if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) +-# define __cpp_lib_filesystem 201703L ++# define __cpp_lib_filesystem 201703L + # endif + # define __cpp_lib_gcd_lcm 201606L + // # define __cpp_lib_hardware_interference_size 201703L +@@ -272,7 +276,11 @@ __cpp_lib_void_t 201411L <type_traits> + # endif + # define __cpp_lib_shared_ptr_arrays 201611L + # define __cpp_lib_shared_ptr_weak_type 201606L +-# define __cpp_lib_string_view 201606L ++# if defined(_MSC_VER) && _MSC_VER >= 1926 ++# define __cpp_lib_string_view 201803L ++# else ++# define __cpp_lib_string_view 201606L ++# endif + // # define __cpp_lib_to_chars 201611L + # undef __cpp_lib_transparent_operators + # define __cpp_lib_transparent_operators 201510L +@@ -304,7 +312,7 @@ __cpp_lib_void_t 201411L <type_traits> + // # define __cpp_lib_bitops 201907L + # define __cpp_lib_bounded_array_traits 201902L + # if !defined(_LIBCPP_HAS_NO_CHAR8_T) +-# define __cpp_lib_char8_t 201811L ++# define __cpp_lib_char8_t 201907L + # endif + # define __cpp_lib_concepts 202002L + # define __cpp_lib_constexpr_algorithms 201806L diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/49-string-view.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/49-string-view.patch new file mode 100644 index 0000000000..38852879b4 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/49-string-view.patch @@ -0,0 +1,68 @@ +diff --git a/include/string_view b/include/string_view +index dd9239a..81d8c8a 100644 +--- a/include/string_view ++++ b/include/string_view +@@ -216,6 +216,11 @@ namespace std { + # pragma GCC system_header + #endif + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( push ) ++#pragma warning ( disable : 4455 ) ++#endif ++ + _LIBCPP_PUSH_MACROS + #include <__undef_macros> + +@@ -277,6 +282,9 @@ public: + _LIBCPP_INLINE_VISIBILITY + basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default; + ++ _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY ++ basic_string_view(nullptr_t, size_t) = delete; ++ + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT + : __data(__s), __size(__len) +@@ -319,7 +327,7 @@ public: + basic_string_view(const _CharT* __s) + : __data(__s), __size(_VSTD::__char_traits_length_checked<_Traits>(__s)) {} + +-#if _LIBCPP_STD_VER > 20 ++#if _LIBCPP_STD_VER > 17 + basic_string_view(nullptr_t) = delete; + #endif + +@@ -662,7 +670,8 @@ public: + (data(), size(), __s, __pos, traits_type::length(__s)); + } + +-#if _LIBCPP_STD_VER > 17 ++//WARN: disabled std guards in order to allow using these options without switching to new std ++//#if _LIBCPP_STD_VER > 17 + constexpr _LIBCPP_INLINE_VISIBILITY + bool starts_with(basic_string_view __s) const noexcept + { return size() >= __s.size() && compare(0, __s.size(), __s) == 0; } +@@ -686,9 +695,9 @@ public: + constexpr _LIBCPP_INLINE_VISIBILITY + bool ends_with(const value_type* __s) const noexcept + { return ends_with(basic_string_view(__s)); } +-#endif ++//#endif + +-#if _LIBCPP_STD_VER > 20 ++#if _LIBCPP_STD_VER >= 20 + constexpr _LIBCPP_INLINE_VISIBILITY + bool contains(basic_string_view __sv) const noexcept + { return find(__sv) != npos; } +@@ -952,6 +961,10 @@ inline namespace literals + #endif + _LIBCPP_END_NAMESPACE_STD + ++#ifdef _LIBCPP_COMPILER_MSVC ++#pragma warning ( pop ) ++#endif ++ + _LIBCPP_POP_MACROS + + #endif // _LIBCPP_STRING_VIEW diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/50-operations.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/50-operations.patch new file mode 100644 index 0000000000..9aba557515 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/50-operations.patch @@ -0,0 +1,26 @@ +diff --git a/src/filesystem/operations.cpp b/src/filesystem/operations.cpp +index 0e2ebdf..9e0abc8 100644 +--- a/src/filesystem/operations.cpp ++++ b/src/filesystem/operations.cpp +@@ -375,15 +375,19 @@ private: + return consumeNSeparators(consumeName(P, End), End, 2); + } + +- PosPtr consumeRootName(PosPtr P, PosPtr End) const noexcept { + #if defined(_LIBCPP_WIN32API) ++ PosPtr consumeRootName(PosPtr P, PosPtr End) const noexcept { + if (PosPtr Ret = consumeDriveLetter(P, End)) + return Ret; + if (PosPtr Ret = consumeNetworkRoot(P, End)) + return Ret; +-#endif + return nullptr; + } ++#else ++ PosPtr consumeRootName(PosPtr /*P*/, PosPtr /*End*/) const noexcept { ++ return nullptr; ++ } ++#endif + }; + + string_view_pair separate_filename(string_view_t const& s) { diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/51-refstring.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/51-refstring.patch new file mode 100644 index 0000000000..1d1661b416 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/51-refstring.patch @@ -0,0 +1,75 @@ +diff --git a/src/include/refstring.h b/src/include/refstring.h +index 0675b39..6a0ebda 100644 +--- a/src/include/refstring.h ++++ b/src/include/refstring.h +@@ -13,7 +13,13 @@ + #include <stdexcept> + #include <cstddef> + #include <cstring> ++ ++#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_USE_ATOMIC) ++#define _LIBCPP_USE_ATOMIC ++#include <atomic> ++#else + #include "atomic_support.h" ++#endif + + // MacOS and iOS used to ship with libstdc++, and still support old applications + // linking against libstdc++. The libc++ and libstdc++ exceptions are supposed +@@ -40,7 +46,11 @@ typedef int count_t; + struct _Rep_base { + std::size_t len; + std::size_t cap; ++#ifdef _LIBCPP_USE_ATOMIC ++ std::atomic<count_t> count; ++#else + count_t count; ++#endif + }; + + inline _Rep_base* rep_from_data(const char *data_) noexcept { +@@ -96,7 +106,11 @@ __libcpp_refstring::__libcpp_refstring(const __libcpp_refstring &s) noexcept + : __imp_(s.__imp_) + { + if (__uses_refcount()) ++#ifdef _LIBCPP_USE_ATOMIC ++ rep_from_data(__imp_)->count.fetch_add(1); ++#else + __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1); ++#endif + } + + inline +@@ -105,10 +119,19 @@ __libcpp_refstring& __libcpp_refstring::operator=(__libcpp_refstring const& s) n + struct _Rep_base *old_rep = rep_from_data(__imp_); + __imp_ = s.__imp_; + if (__uses_refcount()) ++#ifdef _LIBCPP_USE_ATOMIC ++ rep_from_data(__imp_)->count.fetch_add(1); ++#else + __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1); ++#endif ++ + if (adjust_old_count) + { ++#ifdef _LIBCPP_USE_ATOMIC ++ if (old_rep->count.fetch_sub(1) == 0) ++#else + if (__libcpp_atomic_add(&old_rep->count, count_t(-1)) < 0) ++#endif + { + ::operator delete(old_rep); + } +@@ -120,7 +143,11 @@ inline + __libcpp_refstring::~__libcpp_refstring() { + if (__uses_refcount()) { + _Rep_base* rep = rep_from_data(__imp_); +- if (__libcpp_atomic_add(&rep->count, count_t(-1)) < 0) { ++#ifdef _LIBCPP_USE_ATOMIC ++ if (rep->count.fetch_sub(1) == 0) { ++#else ++ if (__sync_add_and_fetch(&rep->count, count_t(-1)) < 0) { ++#endif + ::operator delete(rep); + } + } diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/52-libcxxrt.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/52-libcxxrt.patch new file mode 100644 index 0000000000..bf14ba1e71 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/52-libcxxrt.patch @@ -0,0 +1,81 @@ +diff --git a/src/exception.cpp b/src/exception.cpp +index e5d6b9e..915ab3f 100644 +--- a/src/exception.cpp ++++ b/src/exception.cpp +@@ -10,7 +10,7 @@ + #include <new> + #include <typeinfo> + +-#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) ++#if defined(LIBCXX_BUILDING_LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) + #include <cxxabi.h> + using namespace __cxxabiv1; + #define HAVE_DEPENDENT_EH_ABI 1 +@@ -22,14 +22,13 @@ + #elif defined(_LIBCPPABI_VERSION) + #include "support/runtime/exception_libcxxabi.ipp" + #include "support/runtime/exception_pointer_cxxabi.ipp" +-#elif defined(LIBCXXRT) ++#elif defined(LIBCXX_BUILDING_LIBCXXRT) + #include "support/runtime/exception_libcxxrt.ipp" + #include "support/runtime/exception_pointer_cxxabi.ipp" + #elif defined(__GLIBCXX__) + #include "support/runtime/exception_glibcxx.ipp" + #include "support/runtime/exception_pointer_glibcxx.ipp" + #else +-#include "include/atomic_support.h" + #include "support/runtime/exception_fallback.ipp" + #include "support/runtime/exception_pointer_unimplemented.ipp" + #endif +diff --git a/src/new.cpp b/src/new.cpp +index 7dd17bc..937e860 100644 +--- a/src/new.cpp ++++ b/src/new.cpp +@@ -15,7 +15,7 @@ + # endif + #elif defined(LIBCXX_BUILDING_LIBCXXABI) + # include <cxxabi.h> +-#elif defined(LIBCXXRT) ++#elif defined(LIBCXX_BUILDING_LIBCXXRT) + # include <cxxabi.h> + # include "support/runtime/new_handler_fallback.ipp" + #elif defined(__GLIBCXX__) +diff --git a/src/support/runtime/exception_libcxxrt.ipp b/src/support/runtime/exception_libcxxrt.ipp +index 62aa322..4e428d2 100644 +--- a/src/support/runtime/exception_libcxxrt.ipp ++++ b/src/support/runtime/exception_libcxxrt.ipp +@@ -7,7 +7,7 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef LIBCXXRT ++#ifndef LIBCXX_BUILDING_LIBCXXRT + #error this header may only be used when targeting libcxxrt + #endif + +diff --git a/src/support/runtime/stdexcept_default.ipp b/src/support/runtime/stdexcept_default.ipp +index 99d3045..d0218bf 100644 +--- a/src/support/runtime/stdexcept_default.ipp ++++ b/src/support/runtime/stdexcept_default.ipp +@@ -10,7 +10,7 @@ + + /* For _LIBCPPABI_VERSION */ + #if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \ +- (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXXRT)) ++ (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXX_BUILDING_LIBCXXRT)) + #include <cxxabi.h> + #endif + +diff --git a/src/typeinfo.cpp b/src/typeinfo.cpp +index c7f0a70..a98ceb0 100644 +--- a/src/typeinfo.cpp ++++ b/src/typeinfo.cpp +@@ -48,7 +48,7 @@ size_t std::type_info::hash_code() const noexcept { + + // FIXME: Remove the _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY configuration. + #if (!defined(LIBCXX_BUILDING_LIBCXXABI) && \ +- !defined(LIBCXXRT) && \ ++ !defined(LIBCXX_BUILDING_LIBCXXRT) && \ + !defined(__GLIBCXX__) && \ + !defined(_LIBCPP_ABI_VCRUNTIME)) || \ + defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/53-exception_pointer_msvc.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/53-exception_pointer_msvc.patch new file mode 100644 index 0000000000..7584edf033 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/53-exception_pointer_msvc.patch @@ -0,0 +1,293 @@ +diff --git a/src/support/runtime/exception_pointer_msvc.ipp b/src/support/runtime/exception_pointer_msvc.ipp +index 9e7f392..300acbf 100644 +--- a/src/support/runtime/exception_pointer_msvc.ipp ++++ b/src/support/runtime/exception_pointer_msvc.ipp +@@ -7,70 +7,242 @@ + // + //===----------------------------------------------------------------------===// + +-#include <stdio.h> +-#include <stdlib.h> +- +-_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCreate(void*); +-_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrDestroy(void*); +-_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCopy(void*, const void*); +-_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrAssign(void*, const void*); +-_LIBCPP_CRT_FUNC bool __cdecl __ExceptionPtrCompare(const void*, const void*); +-_LIBCPP_CRT_FUNC bool __cdecl __ExceptionPtrToBool(const void*); +-_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrSwap(void*, void*); +-_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCurrentException(void*); +-[[noreturn]] _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrRethrow(const void*); +-_LIBCPP_CRT_FUNC void __cdecl +-__ExceptionPtrCopyException(void*, const void*, const void*); ++#include <atomic> ++#include <cstdint> ++#include <cstring> ++#include <malloc.h> ++#include <windows.h> // For RtlPcToFileHeader function + +-namespace std { ++struct EHCatchableType { ++ uint32_t properties; ++ int32_t type_info; ++ uint32_t non_virtual_adjustment; ++ uint32_t offset_to_virtual_base_ptr; ++ uint32_t virtual_base_table_index; ++ uint32_t size; ++ int32_t copy_function; ++}; + +-exception_ptr::exception_ptr() noexcept { __ExceptionPtrCreate(this); } +-exception_ptr::exception_ptr(nullptr_t) noexcept { __ExceptionPtrCreate(this); } ++struct EHCatchableTypeArray { ++ uint32_t catchable_types; ++ // It is variable size but we only need the first element of this array ++ int32_t array_of_catchable_types[1]; ++}; + +-exception_ptr::exception_ptr(const exception_ptr& __other) noexcept { +- __ExceptionPtrCopy(this, &__other); +-} +-exception_ptr& exception_ptr::operator=(const exception_ptr& __other) noexcept { +- __ExceptionPtrAssign(this, &__other); +- return *this; +-} ++struct EHThrowInfo { ++ uint32_t attributes; ++ int32_t unwind; ++ int32_t forward_compat; ++ int32_t catchable_type_array; ++}; + +-exception_ptr& exception_ptr::operator=(nullptr_t) noexcept { +- exception_ptr dummy; +- __ExceptionPtrAssign(this, &dummy); +- return *this; +-} ++struct EHParameters { ++ uint32_t magic_number; ++ void* exception_object; ++ EHThrowInfo* throw_info; ++#ifdef _M_AMD64 ++ uintptr_t throw_image_base; ++#endif ++}; + +-exception_ptr::~exception_ptr() noexcept { __ExceptionPtrDestroy(this); } ++struct EHExceptionRecord { ++ uint32_t exception_code; ++ uint32_t exception_flags; ++ void* exception_record; ++ void* exception_address; ++ uint32_t number_of_parameters; ++ EHParameters parameters; ++}; + +-exception_ptr::operator bool() const noexcept { +- return __ExceptionPtrToBool(this); +-} ++// defined in vcruntime<ver>.dll ++extern "C" EHExceptionRecord** __current_exception(); ++ ++// This is internal compiler definition for MSVC but not for clang. ++// We use our own EHThrowInfo because _ThrowInfo doesn't match actual ++// compiler-generated structures in 64-bit mode. ++#ifdef __clang__ ++struct _ThrowInfo; ++// defined in vcruntime<ver>.dll ++_LIBCPP_NORETURN extern "C" void __stdcall _CxxThrowException( ++ void* __exc, _ThrowInfo* __throw_info); ++#endif ++ ++namespace { ++struct ExceptionPtr { ++ void* exception_object; ++ const EHThrowInfo* throw_info; ++ std::atomic<size_t> counter; ++#ifdef _M_AMD64 ++ PVOID image_base; ++#endif ++ template <class T> ++ T convert(int32_t offset) { ++#ifdef _M_AMD64 ++ uintptr_t value = reinterpret_cast<uintptr_t>(image_base) + ++ static_cast<uintptr_t>(offset); ++#else ++ uintptr_t value = static_cast<uintptr_t>(offset); ++#endif ++ T res; ++ static_assert( ++ sizeof(value) == sizeof(res), ++ "Can only convert to pointers or pointers to member functions"); ++ memcpy(&res, &value, sizeof(value)); ++ return res; ++ } ++ ++ void copy(void* dst, const void* src, const EHCatchableType* exc_type) { ++ struct Temp {}; ++ constexpr uint32_t virtual_base = 4; ++ if (exc_type->copy_function == 0) { ++ memcpy(dst, src, exc_type->size); ++ } else if (exc_type->properties & virtual_base) { ++ auto copy_constructor = ++ convert<void (Temp::*)(const void*, int)>(exc_type->copy_function); ++ ((Temp*)dst->*copy_constructor)(src, 1); ++ } else { ++ auto copy_constructor = ++ convert<void (Temp::*)(const void*)>(exc_type->copy_function); ++ ((Temp*)dst->*copy_constructor)(src); ++ } ++ } ++ ++ EHCatchableType* exception_type() { ++ return convert<EHCatchableType*>( ++ convert<EHCatchableTypeArray*>(throw_info->catchable_type_array) ++ ->array_of_catchable_types[0]); ++ } ++ ++ ExceptionPtr(const void* exception_object_, const EHThrowInfo* throw_info_) ++ : exception_object(nullptr), throw_info(throw_info_), counter(1) { ++#ifdef _M_AMD64 ++ RtlPcToFileHeader( ++ reinterpret_cast<PVOID>(const_cast<EHThrowInfo*>(throw_info)), ++ &image_base); ++#endif ++ EHCatchableType* exc_type = exception_type(); ++ this->exception_object = malloc(exc_type->size); ++ if (this->exception_object == nullptr) { ++ throw std::bad_alloc(); ++ } ++ copy(exception_object, exception_object_, exc_type); ++ } ++ ++ ~ExceptionPtr() { ++ if (throw_info->unwind && exception_object) { ++ struct Temp {}; ++ auto destructor = convert<void (Temp::*)()>(throw_info->unwind); ++ ((Temp*)exception_object->*destructor)(); ++ } ++ free(exception_object); ++ } + +-bool operator==(const exception_ptr& __x, const exception_ptr& __y) noexcept { +- return __ExceptionPtrCompare(&__x, &__y); ++ // _bad_alloc_storage must be initialized before bad_alloc, so we declare and define it first. ++ static std::bad_alloc _bad_alloc_storage; ++ static ExceptionPtr bad_alloc; ++ //static ExceptionPtr bad_exception; ++}; ++ ++#ifdef __clang__ ++#pragma clang diagnostic push ++#pragma clang diagnostic ignored "-Waddress-of-temporary" ++#endif ++ ++std::bad_alloc ExceptionPtr::_bad_alloc_storage; ++ ++ExceptionPtr ExceptionPtr::bad_alloc( ++ &ExceptionPtr::_bad_alloc_storage, ++ reinterpret_cast<const EHThrowInfo*>(__GetExceptionInfo(ExceptionPtr::_bad_alloc_storage))); ++ ++/* ExceptionPtr ++ExceptionPtr::bad_exception(&std::bad_exception(), ++ reinterpret_cast<const EHThrowInfo*>( ++ __GetExceptionInfo(std::bad_exception()))); */ ++ ++#ifdef __clang__ ++#pragma clang diagnostic pop ++#endif ++ ++} // namespace ++ ++namespace std { ++ ++exception_ptr::exception_ptr(const exception_ptr& __other) noexcept ++ : __ptr_(__other.__ptr_) { ++ if (__ptr_) { ++ reinterpret_cast<ExceptionPtr*>(__ptr_)->counter.fetch_add(1); ++ } + } + ++exception_ptr& exception_ptr:: ++operator=(const exception_ptr& __other) noexcept { ++ auto before = __ptr_; ++ __ptr_ = __other.__ptr_; ++ if (__ptr_) { ++ reinterpret_cast<ExceptionPtr*>(__ptr_)->counter.fetch_add(1); ++ } ++ if (before) { ++ if (reinterpret_cast<ExceptionPtr*>(before)->counter.fetch_sub(1) == 1) { ++ delete reinterpret_cast<ExceptionPtr*>(before); ++ } ++ } ++ return *this; ++} + +-void swap(exception_ptr& lhs, exception_ptr& rhs) noexcept { +- __ExceptionPtrSwap(&rhs, &lhs); ++exception_ptr::~exception_ptr() noexcept { ++ if (__ptr_) { ++ if (reinterpret_cast<ExceptionPtr*>(__ptr_)->counter.fetch_sub(1) == 1) { ++ delete reinterpret_cast<ExceptionPtr*>(__ptr_); ++ } ++ } + } + +-exception_ptr __copy_exception_ptr(void* __except, const void* __ptr) { +- exception_ptr __ret = nullptr; +- if (__ptr) +- __ExceptionPtrCopyException(&__ret, __except, __ptr); +- return __ret; ++exception_ptr __copy_exception_ptr(void* exception_object, ++ const void* throw_info) { ++ ExceptionPtr* ptr; ++ try { ++ ptr = new ExceptionPtr(exception_object, ++ reinterpret_cast<const EHThrowInfo*>(throw_info)); ++ } catch (const std::bad_alloc&) { ++ ptr = &ExceptionPtr::bad_alloc; ++ ptr->counter.fetch_add(1); ++ } catch (...) { ++ //ptr = &ExceptionPtr::bad_exception; ++ //ptr->counter.fetch_add(1); ++ std::terminate(); ++ } ++ exception_ptr res; ++ memcpy(&res, &ptr, sizeof(ptr)); ++ return res; + } + + exception_ptr current_exception() noexcept { +- exception_ptr __ret; +- __ExceptionPtrCurrentException(&__ret); +- return __ret; ++ EHExceptionRecord** record = __current_exception(); ++ if (*record && !std::uncaught_exception()) { ++ return __copy_exception_ptr((*record)->parameters.exception_object, ++ (*record)->parameters.throw_info); ++ } ++ return exception_ptr(); + } + + _LIBCPP_NORETURN +-void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); } ++void rethrow_exception(exception_ptr p) { ++ if (!p) { ++ throw std::bad_exception(); ++ } ++ ExceptionPtr* exc_ptr = reinterpret_cast<ExceptionPtr*>(p.__ptr_); ++ EHCatchableType* exc_type = exc_ptr->exception_type(); ++ // _CxxThrowException doesn't call free on exception object so we must ++ // allocate it on the stack. ++ void* dst = _alloca(exc_type->size); ++ exc_ptr->copy(dst, exc_ptr->exception_object, exc_type); ++ auto throw_info = reinterpret_cast<_ThrowInfo*>( ++ const_cast<EHThrowInfo*>(exc_ptr->throw_info)); ++ // For some reason clang doesn't call p destructor during unwinding. ++ // So we must clear it ourselves. ++ p = nullptr; ++ _CxxThrowException(dst, throw_info); ++} + + nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {} + diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/54-new_handler_fallback.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/54-new_handler_fallback.patch new file mode 100644 index 0000000000..e16a8572cd --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/54-new_handler_fallback.patch @@ -0,0 +1,17 @@ +diff --git a/src/support/runtime/new_handler_fallback.ipp b/src/support/runtime/new_handler_fallback.ipp +index 2ec4083..7556f69 100644 +--- a/src/support/runtime/new_handler_fallback.ipp ++++ b/src/support/runtime/new_handler_fallback.ipp +@@ -7,9 +7,11 @@ + // + //===----------------------------------------------------------------------===// + ++#include "../../include/atomic_support.h" ++ + namespace std { + +-static constinit std::new_handler __new_handler = nullptr; ++static _LIBCPP_CONSTINIT std::new_handler __new_handler = nullptr; + + new_handler + set_new_handler(new_handler handler) noexcept diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/55-assert.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/55-assert.patch new file mode 100644 index 0000000000..2f98f29e4a --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/55-assert.patch @@ -0,0 +1,13 @@ +diff --git a/src/assert.cpp b/src/assert.cpp +index 40c51f8..21a3863 100644 +--- a/src/assert.cpp ++++ b/src/assert.cpp +@@ -28,7 +28,7 @@ _LIBCPP_NORETURN void __libcpp_abort_debug_function(__libcpp_debug_info const& i + std::abort(); + } + +-constinit __libcpp_debug_function_type __libcpp_debug_function = __libcpp_abort_debug_function; ++_LIBCPP_CONSTINIT __libcpp_debug_function_type __libcpp_debug_function = __libcpp_abort_debug_function; + + bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) { + __libcpp_debug_function = __func; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/56-iostream.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/56-iostream.patch new file mode 100644 index 0000000000..1cf6e0170b --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/56-iostream.patch @@ -0,0 +1,165 @@ +diff --git a/src/iostream.cpp b/src/iostream.cpp +index a8948ac..79dbd9a 100644 +--- a/src/iostream.cpp ++++ b/src/iostream.cpp +@@ -17,72 +17,112 @@ + + _LIBCPP_BEGIN_NAMESPACE_STD + ++#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) ++_ALIGNAS_TYPE (istream) char _cin [sizeof(istream)]; ++_LIBCPP_FUNC_VIS istream& cin = *reinterpret_cast<istream*>(_cin); ++#else + _ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin[sizeof(istream)] + #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + __asm__("?cin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") + #endif + ; ++#endif + _ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin[sizeof(__stdinbuf <char>)]; + static mbstate_t mb_cin; + + #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS ++#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) ++_ALIGNAS_TYPE (wistream) char _wcin [sizeof(wistream)]; ++_LIBCPP_FUNC_VIS wistream& wcin = *reinterpret_cast<wistream*>(_wcin); ++#else + _ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin[sizeof(wistream)] + #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + __asm__("?wcin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") + #endif + ; ++#endif + _ALIGNAS_TYPE (__stdinbuf<wchar_t> ) static char __wcin[sizeof(__stdinbuf <wchar_t>)]; + static mbstate_t mb_wcin; + #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS + ++#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) ++_ALIGNAS_TYPE (ostream) char _cout[sizeof(ostream)]; ++_LIBCPP_FUNC_VIS ostream& cout = *reinterpret_cast<ostream*>(_cout); ++#else + _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)] + #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + __asm__("?cout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") + #endif + ; ++#endif + _ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)]; + static mbstate_t mb_cout; + + #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS ++#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) ++_ALIGNAS_TYPE (wostream) char _wcout[sizeof(wostream)]; ++_LIBCPP_FUNC_VIS wostream& wcout = *reinterpret_cast<wostream*>(_wcout); ++#else + _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)] + #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + __asm__("?wcout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") + #endif + ; ++#endif + _ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)]; + static mbstate_t mb_wcout; + #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS + ++#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) ++_ALIGNAS_TYPE (ostream) char _cerr[sizeof(ostream)]; ++_LIBCPP_FUNC_VIS ostream& cerr = *reinterpret_cast<ostream*>(_cerr); ++#else + _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)] + #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + __asm__("?cerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") + #endif + ; ++#endif + _ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)]; + static mbstate_t mb_cerr; + + #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS ++#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) ++_ALIGNAS_TYPE (wostream) char _wcerr[sizeof(wostream)]; ++_LIBCPP_FUNC_VIS wostream& wcerr = *reinterpret_cast<wostream*>(_wcerr); ++#else + _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)] + #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + __asm__("?wcerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") + #endif + ; ++#endif + _ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)]; + static mbstate_t mb_wcerr; + #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS + ++#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) ++_ALIGNAS_TYPE (ostream) char _clog[sizeof(ostream)]; ++_LIBCPP_FUNC_VIS ostream& clog = *reinterpret_cast<ostream*>(_clog); ++#else + _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)] + #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + __asm__("?clog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") + #endif + ; ++#endif + + #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS ++#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) ++_ALIGNAS_TYPE (wostream) char _wclog[sizeof(wostream)]; ++_LIBCPP_FUNC_VIS wostream& wclog = *reinterpret_cast<wostream*>(_wclog); ++#else + _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)] + #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + __asm__("?wclog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") + #endif + ; ++#endif + #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS + + // Pretend we're inside a system header so the compiler doesn't flag the use of the init_priority +@@ -117,19 +157,19 @@ DoIOSInit::DoIOSInit() + { + force_locale_initialization(); + +- istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin, &mb_cin)); +- ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout, &mb_cout)); +- ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr, &mb_cerr)); +- ::new(clog) ostream(cerr_ptr->rdbuf()); ++ istream* cin_ptr = ::new(&cin) istream(::new(__cin) __stdinbuf <char>(stdin, &mb_cin)); ++ ostream* cout_ptr = ::new(&cout) ostream(::new(__cout) __stdoutbuf<char>(stdout, &mb_cout)); ++ ostream* cerr_ptr = ::new(&cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr, &mb_cerr)); ++ ::new(&clog) ostream(cerr_ptr->rdbuf()); + cin_ptr->tie(cout_ptr); + _VSTD::unitbuf(*cerr_ptr); + cerr_ptr->tie(cout_ptr); + + #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +- wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, &mb_wcin)); +- wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout, &mb_wcout)); +- wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr, &mb_wcerr)); +- ::new(wclog) wostream(wcerr_ptr->rdbuf()); ++ wistream* wcin_ptr = ::new(&wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, &mb_wcin)); ++ wostream* wcout_ptr = ::new(&wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout, &mb_wcout)); ++ wostream* wcerr_ptr = ::new(&wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr, &mb_wcerr)); ++ ::new(&wclog) wostream(wcerr_ptr->rdbuf()); + + wcin_ptr->tie(wcout_ptr); + _VSTD::unitbuf(*wcerr_ptr); +@@ -139,15 +179,15 @@ DoIOSInit::DoIOSInit() + + DoIOSInit::~DoIOSInit() + { +- ostream* cout_ptr = reinterpret_cast<ostream*>(cout); ++ ostream* cout_ptr = reinterpret_cast<ostream*>(&cout); + cout_ptr->flush(); +- ostream* clog_ptr = reinterpret_cast<ostream*>(clog); ++ ostream* clog_ptr = reinterpret_cast<ostream*>(&clog); + clog_ptr->flush(); + + #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +- wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout); ++ wostream* wcout_ptr = reinterpret_cast<wostream*>(&wcout); + wcout_ptr->flush(); +- wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog); ++ wostream* wclog_ptr = reinterpret_cast<wostream*>(&wclog); + wclog_ptr->flush(); + #endif + } diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/57-locale.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/57-locale.patch new file mode 100644 index 0000000000..bb41bf5fff --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/57-locale.patch @@ -0,0 +1,203 @@ +diff --git a/src/locale.cpp b/src/locale.cpp +index 220caee..fc95dad 100644 +--- a/src/locale.cpp ++++ b/src/locale.cpp +@@ -43,7 +43,7 @@ + # include <langinfo.h> + #endif + +-#include "include/atomic_support.h" ++#include "atomic" + #include "include/sso_allocator.h" + + // On Linux, wint_t and wchar_t have different signed-ness, and this causes +@@ -141,14 +141,7 @@ class _LIBCPP_HIDDEN locale::__imp + : public facet + { + enum {N = 30}; +-#if defined(_LIBCPP_COMPILER_MSVC) +-// FIXME: MSVC doesn't support aligned parameters by value. +-// I can't get the __sso_allocator to work here +-// for MSVC I think for this reason. +- vector<facet*> facets_; +-#else + vector<facet*, __sso_allocator<facet*, N> > facets_; +-#endif + string name_; + public: + explicit __imp(size_t refs = 0); +@@ -701,8 +694,6 @@ locale::facet::__on_zero_shared() noexcept + + // locale::id + +-int32_t locale::id::__next_id = 0; +- + namespace + { + +@@ -722,17 +713,22 @@ public: + + } + ++int32_t locale::id::__next_id; ++ + long + locale::id::__get() + { +- call_once(__flag_, __fake_bind(&locale::id::__init, this)); +- return __id_ - 1; +-} +- +-void +-locale::id::__init() +-{ +- __id_ = __libcpp_atomic_add(&__next_id, 1); ++ int32_t result = __id_.load(std::memory_order_acquire); ++ if (result == 0) { ++ static std::mutex m; ++ std::lock_guard<std::mutex> guard(m); ++ result = __id_.load(std::memory_order_acquire); ++ if (result == 0) { ++ result = ++__next_id; ++ __id_.store(result, std::memory_order_release); ++ } ++ } ++ return result - 1; + } + + // template <> class collate_byname<char> +@@ -1106,6 +1102,11 @@ extern "C" const int ** __ctype_tolower_loc(); + extern "C" const int ** __ctype_toupper_loc(); + #endif + ++#if defined(__ANDROID__) ++// See src/support/android/android_locale.cpp ++extern "C" const unsigned short* const _ctype_android; ++#endif ++ + #ifdef _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE + const ctype<char>::mask* + ctype<char>::classic_table() noexcept +@@ -1205,6 +1206,8 @@ ctype<char>::classic_table() noexcept + #elif defined(_NEWLIB_VERSION) + // Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1]. + return _ctype_ + 1; ++#elif defined(__ANDROID__) ++ return _ctype_android; + #elif defined(_AIX) + return (const unsigned int *)__lc_ctype_ptr->obj->mask; + #elif defined(__MVS__) +@@ -4218,14 +4221,25 @@ __codecvt_utf16<char32_t, true>::do_out(state_type&, + const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt, + extern_type* to, extern_type* to_end, extern_type*& to_nxt) const + { ++#if defined(_LIBCPP_SHORT_WCHAR) ++ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm); ++ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end); ++ const uint16_t* _frm_nxt = _frm; ++#else + const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm); + const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end); + const uint32_t* _frm_nxt = _frm; ++#endif + uint8_t* _to = reinterpret_cast<uint8_t*>(to); + uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); + uint8_t* _to_nxt = _to; ++#if defined(_LIBCPP_SHORT_WCHAR) ++ result r = ucs2_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, ++ _Maxcode_, _Mode_); ++#else + result r = ucs4_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, + _Maxcode_, _Mode_); ++#endif + frm_nxt = frm + (_frm_nxt - _frm); + to_nxt = to + (_to_nxt - _to); + return r; +@@ -4294,7 +4308,7 @@ __codecvt_utf8_utf16<wchar_t>::do_out(state_type&, + const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt, + extern_type* to, extern_type* to_end, extern_type*& to_nxt) const + { +-#if defined(_LIBCPP_SHORT_WCHAR) ++#ifdef _WIN32 + const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm); + const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end); + const uint16_t* _frm_nxt = _frm; +@@ -4321,7 +4335,7 @@ __codecvt_utf8_utf16<wchar_t>::do_in(state_type&, + const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); + const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); + const uint8_t* _frm_nxt = _frm; +-#if defined(_LIBCPP_SHORT_WCHAR) ++#ifdef _WIN32 + uint16_t* _to = reinterpret_cast<uint16_t*>(to); + uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); + uint16_t* _to_nxt = _to; +@@ -4478,9 +4492,15 @@ __codecvt_utf8_utf16<char32_t>::do_in(state_type&, + const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); + const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); + const uint8_t* _frm_nxt = _frm; ++#if defined(_LIBCPP_SHORT_WCHAR) ++ uint16_t* _to = reinterpret_cast<uint16_t*>(to); ++ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); ++ uint16_t* _to_nxt = _to; ++#else + uint32_t* _to = reinterpret_cast<uint32_t*>(to); + uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end); + uint32_t* _to_nxt = _to; ++#endif + result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, + _Maxcode_, _Mode_); + frm_nxt = frm + (_frm_nxt - _frm); +@@ -5950,7 +5970,7 @@ __init_pat(money_base::pattern& pat, basic_string<charT>& __curr_symbol_, + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. +- __curr_symbol_.insert(0, 1, space_char); ++ __curr_symbol_.insert((size_t)0, 1, space_char); + } + return; + default: +@@ -5973,7 +5993,7 @@ __init_pat(money_base::pattern& pat, basic_string<charT>& __curr_symbol_, + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. +- __curr_symbol_.insert(0, 1, space_char); ++ __curr_symbol_.insert((size_t)0, 1, space_char); + } + return; + case 2: // Space between sign and currency or value. +@@ -6003,7 +6023,7 @@ __init_pat(money_base::pattern& pat, basic_string<charT>& __curr_symbol_, + // We insert the space into the symbol instead of + // setting pat.field[1]=space so that when + // showbase is not set, the space goes away too. +- __curr_symbol_.insert(0, 1, space_char); ++ __curr_symbol_.insert((size_t)0, 1, space_char); + } + pat.field[1] = none; + pat.field[2] = symbol; +@@ -6046,7 +6066,7 @@ __init_pat(money_base::pattern& pat, basic_string<charT>& __curr_symbol_, + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. +- __curr_symbol_.insert(0, 1, space_char); ++ __curr_symbol_.insert((size_t)0, 1, space_char); + } + return; + default: +@@ -6069,7 +6089,7 @@ __init_pat(money_base::pattern& pat, basic_string<charT>& __curr_symbol_, + // We insert the space into the symbol instead of + // setting pat.field[1]=space so that when + // showbase is not set, the space goes away too. +- __curr_symbol_.insert(0, 1, space_char); ++ __curr_symbol_.insert((size_t)0, 1, space_char); + } + return; + case 2: // Space between sign and currency or value. +@@ -6110,7 +6130,7 @@ __init_pat(money_base::pattern& pat, basic_string<charT>& __curr_symbol_, + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. +- __curr_symbol_.insert(0, 1, space_char); ++ __curr_symbol_.insert((size_t)0, 1, space_char); + } + return; + default: diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/58-memory.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/58-memory.patch new file mode 100644 index 0000000000..3005c7050e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/58-memory.patch @@ -0,0 +1,111 @@ +diff --git a/src/memory.cpp b/src/memory.cpp +index 1b8c6b7..e493388 100644 +--- a/src/memory.cpp ++++ b/src/memory.cpp +@@ -16,7 +16,11 @@ + # endif + #endif + ++#if !defined(_LIBCPP_HAS_NO_THREADS) ++#include <atomic> ++#else + #include "include/atomic_support.h" ++#endif + + _LIBCPP_BEGIN_NAMESPACE_STD + +@@ -42,13 +46,21 @@ __shared_weak_count::~__shared_weak_count() + void + __shared_count::__add_shared() noexcept + { ++#ifdef _LIBCPP_HAS_NO_THREADS + __libcpp_atomic_refcount_increment(__shared_owners_); ++#else ++ ++__shared_owners_; ++#endif + } + + bool + __shared_count::__release_shared() noexcept + { ++#ifdef _LIBCPP_HAS_NO_THREADS + if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) ++#else ++ if (--__shared_owners_ == -1) ++#endif + { + __on_zero_shared(); + return true; +@@ -65,7 +77,11 @@ __shared_weak_count::__add_shared() noexcept + void + __shared_weak_count::__add_weak() noexcept + { ++#ifdef _LIBCPP_HAS_NO_THREADS + __libcpp_atomic_refcount_increment(__shared_weak_owners_); ++#else ++ ++__shared_weak_owners_; ++#endif + } + + void +@@ -101,26 +117,42 @@ __shared_weak_count::__release_weak() noexcept + // threads, and have them all get copied at once. The argument + // also doesn't apply for __release_shared, because an outstanding + // weak_ptr::lock() could read / modify the shared count. ++#ifdef _LIBCPP_HAS_NO_THREADS + if (__libcpp_atomic_load(&__shared_weak_owners_, _AO_Acquire) == 0) ++#else ++ if (__shared_weak_owners_.load(memory_order_acquire) == 0) ++#endif + { + // no need to do this store, because we are about + // to destroy everything. + //__libcpp_atomic_store(&__shared_weak_owners_, -1, _AO_Release); + __on_zero_shared_weak(); + } ++#ifdef _LIBCPP_HAS_NO_THREADS + else if (__libcpp_atomic_refcount_decrement(__shared_weak_owners_) == -1) ++#else ++ else if (--__shared_weak_owners_ == -1) ++#endif + __on_zero_shared_weak(); + } + + __shared_weak_count* + __shared_weak_count::lock() noexcept + { ++#ifdef _LIBCPP_HAS_NO_THREADS + long object_owners = __libcpp_atomic_load(&__shared_owners_); ++#else ++ long object_owners = __shared_owners_.load(); ++#endif + while (object_owners != -1) + { ++#ifdef _LIBCPP_HAS_NO_THREADS + if (__libcpp_atomic_compare_exchange(&__shared_owners_, + &object_owners, + object_owners+1)) ++#else ++ if (__shared_owners_.compare_exchange_weak(object_owners, object_owners+1)) ++#endif + return this; + } + return nullptr; +@@ -135,7 +167,7 @@ __shared_weak_count::__get_deleter(const type_info&) const noexcept + #if !defined(_LIBCPP_HAS_NO_THREADS) + + static constexpr std::size_t __sp_mut_count = 16; +-static constinit __libcpp_mutex_t mut_back[__sp_mut_count] = ++static _LIBCPP_CONSTINIT __libcpp_mutex_t mut_back[__sp_mut_count] = + { + _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, + _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, +@@ -173,7 +205,7 @@ __sp_mut::unlock() noexcept + __sp_mut& + __get_sp_mut(const void* p) + { +- static constinit __sp_mut muts[__sp_mut_count] = { ++ static _LIBCPP_CONSTINIT __sp_mut muts[__sp_mut_count] = { + &mut_back[ 0], &mut_back[ 1], &mut_back[ 2], &mut_back[ 3], + &mut_back[ 4], &mut_back[ 5], &mut_back[ 6], &mut_back[ 7], + &mut_back[ 8], &mut_back[ 9], &mut_back[10], &mut_back[11], diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/59-mutex.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/59-mutex.patch new file mode 100644 index 0000000000..08f1d3f1b0 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/59-mutex.patch @@ -0,0 +1,67 @@ +diff --git a/src/mutex.cpp b/src/mutex.cpp +index 01b7420..c247225 100644 +--- a/src/mutex.cpp ++++ b/src/mutex.cpp +@@ -11,7 +11,9 @@ + #include <mutex> + #include <system_error> + ++#if !defined(_LIBCPP_ABI_MICROSOFT) + #include "include/atomic_support.h" ++#endif + + #ifndef _LIBCPP_HAS_NO_THREADS + # if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) +@@ -201,12 +203,17 @@ recursive_timed_mutex::unlock() noexcept + // keep in sync with: 7741191. + + #ifndef _LIBCPP_HAS_NO_THREADS +-static constinit __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER; +-static constinit __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER; ++static _LIBCPP_CONSTINIT __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER; ++static _LIBCPP_CONSTINIT __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER; + #endif + ++#ifdef _LIBCPP_ABI_MICROSOFT ++void __call_once(volatile std::atomic<once_flag::_State_type>& flag, void* arg, ++ void (*func)(void*)) ++#else + void __call_once(volatile once_flag::_State_type& flag, void* arg, + void (*func)(void*)) ++#endif + { + #if defined(_LIBCPP_HAS_NO_THREADS) + if (flag == 0) +@@ -237,12 +244,20 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, + try + { + #endif // _LIBCPP_NO_EXCEPTIONS ++#ifdef _LIBCPP_ABI_MICROSOFT ++ flag.store(once_flag::_State_type(1)); ++#else + __libcpp_relaxed_store(&flag, once_flag::_State_type(1)); ++#endif + __libcpp_mutex_unlock(&mut); + func(arg); + __libcpp_mutex_lock(&mut); ++#ifdef _LIBCPP_ABI_MICROSOFT ++ flag.store(~once_flag::_State_type(0), memory_order_release); ++#else + __libcpp_atomic_store(&flag, ~once_flag::_State_type(0), + _AO_Release); ++#endif + __libcpp_mutex_unlock(&mut); + __libcpp_condvar_broadcast(&cv); + #ifndef _LIBCPP_NO_EXCEPTIONS +@@ -250,7 +265,11 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, + catch (...) + { + __libcpp_mutex_lock(&mut); ++#ifdef _LIBCPP_ABI_MICROSOFT ++ flag.store(once_flag::_State_type(0), memory_order_relaxed); ++#else + __libcpp_relaxed_store(&flag, once_flag::_State_type(0)); ++#endif + __libcpp_mutex_unlock(&mut); + __libcpp_condvar_broadcast(&cv); + throw; diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/60-random-shuffle.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/60-random-shuffle.patch new file mode 100644 index 0000000000..e533407c83 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/60-random-shuffle.patch @@ -0,0 +1,13 @@ +diff --git a/src/random_shuffle.cpp b/src/random_shuffle.cpp +index e9087a9..a673035 100644 +--- a/src/random_shuffle.cpp ++++ b/src/random_shuffle.cpp +@@ -19,7 +19,7 @@ + _LIBCPP_BEGIN_NAMESPACE_STD + + #ifndef _LIBCPP_HAS_NO_THREADS +-static constinit __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; ++static _LIBCPP_CONSTINIT __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; + #endif + unsigned __rs_default::__c_ = 0; + diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/61-remove-includes.sh b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/61-remove-includes.sh new file mode 100644 index 0000000000..86769628e1 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/61-remove-includes.sh @@ -0,0 +1,5 @@ +sed -i 's/# include <__pstl_algorithm>/\/\/# include <__pstl_algorithm>/' include/algorithm +sed -i 's/# include <__pstl_execution>/\/\/# include <__pstl_execution>/' include/execution +sed -i 's/# include <__external_threading>/#error #include <__external_threading>/' include/__threading_support +sed -i 's/# include <__pstl_memory>/\/\/# include <__pstl_memory>/' include/memory +sed -i 's/# include <__pstl_numeric>/\/\/ # include <__pstl_numeric>/' include/numeric
\ No newline at end of file diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/62-__bound-for-win-clang.sh b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/62-__bound-for-win-clang.sh new file mode 100644 index 0000000000..52587c4550 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/62-__bound-for-win-clang.sh @@ -0,0 +1 @@ +find include/__iterator -type f | xargs sed -e 's/__bound/___bound/g' -i diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/63-iterator-traits-pointer.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/63-iterator-traits-pointer.patch new file mode 100644 index 0000000000..24eaf98abc --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/63-iterator-traits-pointer.patch @@ -0,0 +1,49 @@ +diff --git a/include/__iterator/iterator_traits.h b/include/__iterator/iterator_traits.h +index 6ffb2ab..6ae391b 100644 +--- a/include/__iterator/iterator_traits.h ++++ b/include/__iterator/iterator_traits.h +@@ -401,10 +401,11 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits + }; + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) + +-template<class _Tp> ++ + #if !defined(_LIBCPP_HAS_NO_CONCEPTS) ++ ++template<class _Tp> + requires is_object_v<_Tp> +-#endif + struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> + { + typedef ptrdiff_t difference_type; +@@ -417,6 +418,30 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> + #endif + }; + ++#else // !defined(_LIBCPP_HAS_NO_CONCEPTS) ++ ++template <class _Tp, bool is_pointer_to_object> ++struct _LIBCPP_TEMPLATE_VIS __iterator_traits_pointer ++{ ++ typedef ptrdiff_t difference_type; ++ typedef typename remove_cv<_Tp>::type value_type; ++ typedef _Tp* pointer; ++ typedef _Tp& reference; ++ typedef random_access_iterator_tag iterator_category; ++#if _LIBCPP_STD_VER > 17 ++ typedef contiguous_iterator_tag iterator_concept; ++#endif ++}; ++ ++template <class _Tp> ++struct _LIBCPP_TEMPLATE_VIS __iterator_traits_pointer<_Tp, false> {}; ++ ++template <class _Tp> ++struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> : public __iterator_traits_pointer<_Tp, is_object<_Tp>::value> {}; ++ ++#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) ++ ++ + template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value> + struct __has_iterator_category_convertible_to + : is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up> diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/64-__cpp_lib_concepts.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/64-__cpp_lib_concepts.patch new file mode 100644 index 0000000000..e32fcbf3a3 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/64-__cpp_lib_concepts.patch @@ -0,0 +1,33 @@ +diff --git a/include/initializer_list b/include/initializer_list +index 827f137..66b0575 100644 +--- a/include/initializer_list ++++ b/include/initializer_list +@@ -47,7 +47,13 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in + + #if defined(_LIBCPP_COMPILER_MSVC) && !defined(__clang__) + ++// save __cpp_lib_concepts because it can be redefined inside MSVC standard headers ++#pragma push_macro("__cpp_lib_concepts") ++ + #include Y_MSVC_INCLUDE_NEXT(yvals.h) ++ ++#pragma pop_macro("__cpp_lib_concepts") ++ + #include Y_MSVC_INCLUDE_NEXT(initializer_list) + + #else +diff --git a/include/version b/include/version +index 25d112a..0dadcfb 100644 +--- a/include/version ++++ b/include/version +@@ -314,7 +314,9 @@ __cpp_lib_void_t 201411L <type_traits> + # if !defined(_LIBCPP_HAS_NO_CHAR8_T) + # define __cpp_lib_char8_t 201907L + # endif +-# define __cpp_lib_concepts 202002L ++# if !defined(_LIBCPP_HAS_NO_CONCEPTS) ++# define __cpp_lib_concepts 202002L ++# endif + # define __cpp_lib_constexpr_algorithms 201806L + // # define __cpp_lib_constexpr_complex 201711L + # define __cpp_lib_constexpr_dynamic_alloc 201907L |