diff options
author | mikhnenko <mikhnenko@yandex-team.com> | 2025-01-20 01:34:08 +0300 |
---|---|---|
committer | mikhnenko <mikhnenko@yandex-team.com> | 2025-01-20 01:51:09 +0300 |
commit | 2ab2ef14e493133a483a7210a0133c1d8918eee2 (patch) | |
tree | b25a613d75999386160a0ffe41a4f69282a592b3 /contrib/libs | |
parent | 11def371ff569cef09101fa40c00e6180c3885bc (diff) | |
download | ydb-2ab2ef14e493133a483a7210a0133c1d8918eee2.tar.gz |
Update libcxx to 5 Mar 2024 80f9458cf30d13eef21b09042ea590945c5e64db
commit_hash:c45aa2ed98c2a01fa86b69bac97f40a32bd68ae2
Diffstat (limited to 'contrib/libs')
512 files changed, 9311 insertions, 4525 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/.yandex_meta/build.ym b/contrib/libs/cxxsupp/libcxx/.yandex_meta/build.ym index be4f2e29e1..2c5840b9eb 100644 --- a/contrib/libs/cxxsupp/libcxx/.yandex_meta/build.ym +++ b/contrib/libs/cxxsupp/libcxx/.yandex_meta/build.ym @@ -1,7 +1,7 @@ {% extends '//builtin/run.ym' %} -{% block current_version %}9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7{% endblock %} -{% block current_date %}2023-12-18{% endblock %} +{% block current_version %}80f9458cf30d13eef21b09042ea590945c5e64db{% endblock %} +{% block current_date %}2024-03-05{% endblock %} {% block keep_sources %} .yandex_meta/scripts/sysincls.py @@ -58,6 +58,7 @@ rsync --recursive ${RESOURCES}/libcxx/src . cp ${RESOURCES}/libcxx/.clang-format . cp ${RESOURCES}/libcxx/CREDITS.TXT . cp ${RESOURCES}/libcxx/LICENSE.TXT . +cp ${RESOURCES}/libcxx/vendor/llvm/default_assertion_handler.in include/__assertion_handler {% endblock %} {% block build_source %} @@ -284,6 +285,7 @@ SRCS( src/filesystem/filesystem_error.cpp src/filesystem/operations.cpp src/filesystem/path.cpp + src/fstream.cpp src/functional.cpp src/future.cpp src/hash.cpp @@ -297,6 +299,7 @@ SRCS( src/mutex.cpp src/mutex_destructor.cpp src/optional.cpp + src/ostream.cpp src/print.cpp src/random.cpp src/random_shuffle.cpp @@ -327,7 +330,8 @@ ENDIF() IF (OS_LINUX) SRCS( - src/tz.cpp + src/time_zone.cpp + src/tzdb.cpp src/tzdb_list.cpp ) ENDIF() diff --git a/contrib/libs/cxxsupp/libcxx/.yandex_meta/devtools.licenses.report b/contrib/libs/cxxsupp/libcxx/.yandex_meta/devtools.licenses.report index aa1256d1c2..084968d353 100644 --- a/contrib/libs/cxxsupp/libcxx/.yandex_meta/devtools.licenses.report +++ b/contrib/libs/cxxsupp/libcxx/.yandex_meta/devtools.licenses.report @@ -154,6 +154,7 @@ BELONGS ya.make include/__algorithm/find_if.h [4:5] include/__algorithm/find_if_not.h [4:5] include/__algorithm/find_segment_if.h [3:4] + include/__algorithm/fold.h [4:5] include/__algorithm/for_each.h [4:5] include/__algorithm/for_each_n.h [4:5] include/__algorithm/for_each_segment.h [3:4] @@ -239,6 +240,8 @@ BELONGS ya.make include/__algorithm/ranges_any_of.h [3:4] include/__algorithm/ranges_binary_search.h [3:4] include/__algorithm/ranges_clamp.h [3:4] + include/__algorithm/ranges_contains.h [3:4] + include/__algorithm/ranges_contains_subrange.h [3:4] include/__algorithm/ranges_copy.h [3:4] include/__algorithm/ranges_copy_backward.h [3:4] include/__algorithm/ranges_copy_if.h [3:4] @@ -359,6 +362,7 @@ BELONGS ya.make include/__algorithm/unwrap_range.h [3:4] include/__algorithm/upper_bound.h [3:4] include/__assert [4:5] + include/__assertion_handler [4:5] include/__atomic/aliases.h [3:4] include/__atomic/atomic.h [3:4] include/__atomic/atomic_base.h [3:4] @@ -419,6 +423,8 @@ BELONGS ya.make include/__chrono/steady_clock.h [4:5] include/__chrono/system_clock.h [4:5] include/__chrono/time_point.h [4:5] + include/__chrono/time_zone.h [4:5] + include/__chrono/time_zone_link.h [4:5] include/__chrono/tzdb.h [4:5] include/__chrono/tzdb_list.h [4:5] include/__chrono/weekday.h [4:5] @@ -556,9 +562,9 @@ BELONGS ya.make include/__functional/weak_result_type.h [4:5] include/__fwd/array.h [3:4] include/__fwd/bit_reference.h [3:4] + include/__fwd/complex.h [3:4] include/__fwd/fstream.h [3:4] - include/__fwd/get.h [3:4] - include/__fwd/hash.h [3:4] + include/__fwd/functional.h [3:4] include/__fwd/ios.h [3:4] include/__fwd/istream.h [3:4] include/__fwd/mdspan.h [4:5] @@ -617,9 +623,17 @@ BELONGS ya.make include/__iterator/unreachable_sentinel.h [4:5] include/__iterator/wrap_iter.h [4:5] include/__locale [4:5] + include/__locale_dir/locale_base_api.h [3:4] + include/__locale_dir/locale_base_api/android.h [4:5] include/__locale_dir/locale_base_api/bsd_locale_defaults.h [4:5] include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h [4:5] + include/__locale_dir/locale_base_api/fuchsia.h [4:5] + include/__locale_dir/locale_base_api/ibm.h [4:5] include/__locale_dir/locale_base_api/locale_guard.h [3:4] + include/__locale_dir/locale_base_api/musl.h [4:5] + include/__locale_dir/locale_base_api/newlib.h [3:4] + include/__locale_dir/locale_base_api/openbsd.h [4:5] + include/__locale_dir/locale_base_api/win32.h [4:5] include/__math/abs.h [3:4] include/__math/copysign.h [3:4] include/__math/error_functions.h [3:4] @@ -700,6 +714,7 @@ BELONGS ya.make include/__numeric/pstl_reduce.h [3:4] include/__numeric/pstl_transform_reduce.h [3:4] include/__numeric/reduce.h [4:5] + include/__numeric/saturation_arithmetic.h [4:5] include/__numeric/transform_exclusive_scan.h [4:5] include/__numeric/transform_inclusive_scan.h [4:5] include/__numeric/transform_reduce.h [4:5] @@ -796,16 +811,9 @@ BELONGS ya.make include/__string/char_traits.h [3:4] include/__string/constexpr_c_functions.h [3:4] include/__string/extern_template_lists.h [3:4] - include/__support/android/locale_bionic.h [4:5] - include/__support/fuchsia/xlocale.h [4:5] include/__support/ibm/gettod_zos.h [4:5] include/__support/ibm/locale_mgmt_zos.h [4:5] include/__support/ibm/nanosleep.h [4:5] - include/__support/ibm/xlocale.h [4:5] - include/__support/musl/xlocale.h [4:5] - include/__support/newlib/xlocale.h [3:4] - include/__support/openbsd/xlocale.h [4:5] - include/__support/win32/locale_win32.h [4:5] include/__support/xlocale/__nop_locale_mgmt.h [4:5] include/__support/xlocale/__posix_l_fallback.h [4:5] include/__support/xlocale/__strtonum_fallback.h [4:5] @@ -818,10 +826,14 @@ BELONGS ya.make include/__thread/id.h [4:5] include/__thread/jthread.h [4:5] include/__thread/poll_with_backoff.h [4:5] + include/__thread/support.h [4:5] + include/__thread/support/c11.h [4:5] + include/__thread/support/external.h [4:5] + include/__thread/support/pthread.h [4:5] + include/__thread/support/windows.h [4:5] include/__thread/this_thread.h [4:5] include/__thread/thread.h [4:5] include/__thread/timed_backoff_policy.h [4:5] - include/__threading_support [4:5] include/__tree [4:5] include/__tuple/make_tuple_types.h [3:4] include/__tuple/pair_like.h [3:4] @@ -934,6 +946,7 @@ BELONGS ya.make include/__type_traits/is_trivially_lexicographically_comparable.h [3:4] include/__type_traits/is_trivially_move_assignable.h [3:4] include/__type_traits/is_trivially_move_constructible.h [3:4] + include/__type_traits/is_trivially_relocatable.h [3:4] include/__type_traits/is_unbounded_array.h [3:4] include/__type_traits/is_union.h [3:4] include/__type_traits/is_unsigned.h [3:4] @@ -1044,11 +1057,8 @@ BELONGS ya.make include/execution [4:5] include/expected [4:5] include/experimental/__config [4:5] - include/experimental/__memory [4:5] - include/experimental/__simd/abi_tag.h [4:5] include/experimental/__simd/aligned_tag.h [4:5] include/experimental/__simd/declaration.h [4:5] - include/experimental/__simd/internal_declaration.h [4:5] include/experimental/__simd/reference.h [4:5] include/experimental/__simd/scalar.h [4:5] include/experimental/__simd/simd.h [4:5] @@ -1168,12 +1178,14 @@ BELONGS ya.make src/filesystem/path_parser.h [3:4] src/filesystem/posix_compat.h [3:4] src/filesystem/time_utils.h [3:4] + src/fstream.cpp [3:4] src/functional.cpp [3:4] src/future.cpp [3:4] src/hash.cpp [3:4] src/include/apple_availability.h [3:4] src/include/atomic_support.h [3:4] src/include/config_elast.h [3:4] + src/include/overridable_function.h [4:5] src/include/refstring.h [3:4] src/include/ryu/common.h [3:4] src/include/ryu/d2fixed.h [3:4] @@ -1186,6 +1198,11 @@ BELONGS ya.make src/include/ryu/ryu.h [4:5] src/include/sso_allocator.h [4:5] src/include/to_chars_floating_point.h [3:4] + src/include/tzdb/time_zone_link_private.h [4:5] + src/include/tzdb/time_zone_private.h [4:5] + src/include/tzdb/types_private.h [4:5] + src/include/tzdb/tzdb_list_private.h [3:4] + src/include/tzdb/tzdb_private.h [3:4] src/ios.cpp [3:4] src/ios.instantiations.cpp [3:4] src/iostream.cpp [3:4] @@ -1199,6 +1216,7 @@ BELONGS ya.make src/new_handler.cpp [3:4] src/new_helpers.cpp [3:4] src/optional.cpp [3:4] + src/ostream.cpp [3:4] src/print.cpp [3:4] src/pstl/libdispatch.cpp [3:4] src/random.cpp [3:4] @@ -1231,8 +1249,9 @@ BELONGS ya.make src/support/win32/thread_win32.cpp [3:4] src/system_error.cpp [3:4] src/thread.cpp [3:4] + src/time_zone.cpp [3:4] src/typeinfo.cpp [3:4] - src/tz.cpp [3:4] + src/tzdb.cpp [3:4] src/tzdb_list.cpp [3:4] src/valarray.cpp [3:4] src/variant.cpp [3:4] @@ -1268,6 +1287,7 @@ BELONGS ya.make include/__algorithm/find_if.h [4:5] include/__algorithm/find_if_not.h [4:5] include/__algorithm/find_segment_if.h [3:4] + include/__algorithm/fold.h [4:5] include/__algorithm/for_each.h [4:5] include/__algorithm/for_each_n.h [4:5] include/__algorithm/for_each_segment.h [3:4] @@ -1353,6 +1373,8 @@ BELONGS ya.make include/__algorithm/ranges_any_of.h [3:4] include/__algorithm/ranges_binary_search.h [3:4] include/__algorithm/ranges_clamp.h [3:4] + include/__algorithm/ranges_contains.h [3:4] + include/__algorithm/ranges_contains_subrange.h [3:4] include/__algorithm/ranges_copy.h [3:4] include/__algorithm/ranges_copy_backward.h [3:4] include/__algorithm/ranges_copy_if.h [3:4] @@ -1473,6 +1495,7 @@ BELONGS ya.make include/__algorithm/unwrap_range.h [3:4] include/__algorithm/upper_bound.h [3:4] include/__assert [4:5] + include/__assertion_handler [4:5] include/__atomic/aliases.h [3:4] include/__atomic/atomic.h [3:4] include/__atomic/atomic_base.h [3:4] @@ -1533,6 +1556,8 @@ BELONGS ya.make include/__chrono/steady_clock.h [4:5] include/__chrono/system_clock.h [4:5] include/__chrono/time_point.h [4:5] + include/__chrono/time_zone.h [4:5] + include/__chrono/time_zone_link.h [4:5] include/__chrono/tzdb.h [4:5] include/__chrono/tzdb_list.h [4:5] include/__chrono/weekday.h [4:5] @@ -1670,9 +1695,9 @@ BELONGS ya.make include/__functional/weak_result_type.h [4:5] include/__fwd/array.h [3:4] include/__fwd/bit_reference.h [3:4] + include/__fwd/complex.h [3:4] include/__fwd/fstream.h [3:4] - include/__fwd/get.h [3:4] - include/__fwd/hash.h [3:4] + include/__fwd/functional.h [3:4] include/__fwd/ios.h [3:4] include/__fwd/istream.h [3:4] include/__fwd/mdspan.h [4:5] @@ -1731,9 +1756,17 @@ BELONGS ya.make include/__iterator/unreachable_sentinel.h [4:5] include/__iterator/wrap_iter.h [4:5] include/__locale [4:5] + include/__locale_dir/locale_base_api.h [3:4] + include/__locale_dir/locale_base_api/android.h [4:5] include/__locale_dir/locale_base_api/bsd_locale_defaults.h [4:5] include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h [4:5] + include/__locale_dir/locale_base_api/fuchsia.h [4:5] + include/__locale_dir/locale_base_api/ibm.h [4:5] include/__locale_dir/locale_base_api/locale_guard.h [3:4] + include/__locale_dir/locale_base_api/musl.h [4:5] + include/__locale_dir/locale_base_api/newlib.h [3:4] + include/__locale_dir/locale_base_api/openbsd.h [4:5] + include/__locale_dir/locale_base_api/win32.h [4:5] include/__math/abs.h [3:4] include/__math/copysign.h [3:4] include/__math/error_functions.h [3:4] @@ -1814,6 +1847,7 @@ BELONGS ya.make include/__numeric/pstl_reduce.h [3:4] include/__numeric/pstl_transform_reduce.h [3:4] include/__numeric/reduce.h [4:5] + include/__numeric/saturation_arithmetic.h [4:5] include/__numeric/transform_exclusive_scan.h [4:5] include/__numeric/transform_inclusive_scan.h [4:5] include/__numeric/transform_reduce.h [4:5] @@ -1910,16 +1944,9 @@ BELONGS ya.make include/__string/char_traits.h [3:4] include/__string/constexpr_c_functions.h [3:4] include/__string/extern_template_lists.h [3:4] - include/__support/android/locale_bionic.h [4:5] - include/__support/fuchsia/xlocale.h [4:5] include/__support/ibm/gettod_zos.h [4:5] include/__support/ibm/locale_mgmt_zos.h [4:5] include/__support/ibm/nanosleep.h [4:5] - include/__support/ibm/xlocale.h [4:5] - include/__support/musl/xlocale.h [4:5] - include/__support/newlib/xlocale.h [3:4] - include/__support/openbsd/xlocale.h [4:5] - include/__support/win32/locale_win32.h [4:5] include/__support/xlocale/__nop_locale_mgmt.h [4:5] include/__support/xlocale/__posix_l_fallback.h [4:5] include/__support/xlocale/__strtonum_fallback.h [4:5] @@ -1932,10 +1959,14 @@ BELONGS ya.make include/__thread/id.h [4:5] include/__thread/jthread.h [4:5] include/__thread/poll_with_backoff.h [4:5] + include/__thread/support.h [4:5] + include/__thread/support/c11.h [4:5] + include/__thread/support/external.h [4:5] + include/__thread/support/pthread.h [4:5] + include/__thread/support/windows.h [4:5] include/__thread/this_thread.h [4:5] include/__thread/thread.h [4:5] include/__thread/timed_backoff_policy.h [4:5] - include/__threading_support [4:5] include/__tree [4:5] include/__tuple/make_tuple_types.h [3:4] include/__tuple/pair_like.h [3:4] @@ -2048,6 +2079,7 @@ BELONGS ya.make include/__type_traits/is_trivially_lexicographically_comparable.h [3:4] include/__type_traits/is_trivially_move_assignable.h [3:4] include/__type_traits/is_trivially_move_constructible.h [3:4] + include/__type_traits/is_trivially_relocatable.h [3:4] include/__type_traits/is_unbounded_array.h [3:4] include/__type_traits/is_union.h [3:4] include/__type_traits/is_unsigned.h [3:4] @@ -2158,11 +2190,8 @@ BELONGS ya.make include/execution [4:5] include/expected [4:5] include/experimental/__config [4:5] - include/experimental/__memory [4:5] - include/experimental/__simd/abi_tag.h [4:5] include/experimental/__simd/aligned_tag.h [4:5] include/experimental/__simd/declaration.h [4:5] - include/experimental/__simd/internal_declaration.h [4:5] include/experimental/__simd/reference.h [4:5] include/experimental/__simd/scalar.h [4:5] include/experimental/__simd/simd.h [4:5] @@ -2282,12 +2311,14 @@ BELONGS ya.make src/filesystem/path_parser.h [3:4] src/filesystem/posix_compat.h [3:4] src/filesystem/time_utils.h [3:4] + src/fstream.cpp [3:4] src/functional.cpp [3:4] src/future.cpp [3:4] src/hash.cpp [3:4] src/include/apple_availability.h [3:4] src/include/atomic_support.h [3:4] src/include/config_elast.h [3:4] + src/include/overridable_function.h [4:5] src/include/refstring.h [3:4] src/include/ryu/common.h [3:4] src/include/ryu/d2fixed.h [3:4] @@ -2300,6 +2331,11 @@ BELONGS ya.make src/include/ryu/ryu.h [4:5] src/include/sso_allocator.h [4:5] src/include/to_chars_floating_point.h [3:4] + src/include/tzdb/time_zone_link_private.h [4:5] + src/include/tzdb/time_zone_private.h [4:5] + src/include/tzdb/types_private.h [4:5] + src/include/tzdb/tzdb_list_private.h [3:4] + src/include/tzdb/tzdb_private.h [3:4] src/ios.cpp [3:4] src/ios.instantiations.cpp [3:4] src/iostream.cpp [3:4] @@ -2313,6 +2349,7 @@ BELONGS ya.make src/new_handler.cpp [3:4] src/new_helpers.cpp [3:4] src/optional.cpp [3:4] + src/ostream.cpp [3:4] src/print.cpp [3:4] src/pstl/libdispatch.cpp [3:4] src/random.cpp [3:4] @@ -2345,8 +2382,9 @@ BELONGS ya.make src/support/win32/thread_win32.cpp [3:4] src/system_error.cpp [3:4] src/thread.cpp [3:4] + src/time_zone.cpp [3:4] src/typeinfo.cpp [3:4] - src/tz.cpp [3:4] + src/tzdb.cpp [3:4] src/tzdb_list.cpp [3:4] src/valarray.cpp [3:4] src/variant.cpp [3:4] @@ -2364,7 +2402,7 @@ BELONGS ya.make Match type : NOTICE Links : http://www.linfo.org/publicdomain.html, https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/public-domain.LICENSE Files with this license: - src/tz.cpp [19:20] + src/tzdb.cpp [26:27] KEEP Apache-2.0 WITH LLVM-exception 8494a9caed330d9a4f40e19cce7dc770 BELONGS ya.make @@ -2441,6 +2479,7 @@ BELONGS ya.make include/__algorithm/find_if.h [6:6] include/__algorithm/find_if_not.h [6:6] include/__algorithm/find_segment_if.h [5:5] + include/__algorithm/fold.h [6:6] include/__algorithm/for_each.h [6:6] include/__algorithm/for_each_n.h [6:6] include/__algorithm/for_each_segment.h [5:5] @@ -2526,6 +2565,8 @@ BELONGS ya.make include/__algorithm/ranges_any_of.h [5:5] include/__algorithm/ranges_binary_search.h [5:5] include/__algorithm/ranges_clamp.h [5:5] + include/__algorithm/ranges_contains.h [5:5] + include/__algorithm/ranges_contains_subrange.h [5:5] include/__algorithm/ranges_copy.h [5:5] include/__algorithm/ranges_copy_backward.h [5:5] include/__algorithm/ranges_copy_if.h [5:5] @@ -2646,6 +2687,7 @@ BELONGS ya.make include/__algorithm/unwrap_range.h [5:5] include/__algorithm/upper_bound.h [5:5] include/__assert [6:6] + include/__assertion_handler [6:6] include/__atomic/aliases.h [5:5] include/__atomic/atomic.h [5:5] include/__atomic/atomic_base.h [5:5] @@ -2706,6 +2748,8 @@ BELONGS ya.make include/__chrono/steady_clock.h [6:6] include/__chrono/system_clock.h [6:6] include/__chrono/time_point.h [6:6] + include/__chrono/time_zone.h [6:6] + include/__chrono/time_zone_link.h [6:6] include/__chrono/tzdb.h [6:6] include/__chrono/tzdb_list.h [6:6] include/__chrono/weekday.h [6:6] @@ -2843,9 +2887,9 @@ BELONGS ya.make include/__functional/weak_result_type.h [6:6] include/__fwd/array.h [5:5] include/__fwd/bit_reference.h [5:5] + include/__fwd/complex.h [5:5] include/__fwd/fstream.h [5:5] - include/__fwd/get.h [5:5] - include/__fwd/hash.h [5:5] + include/__fwd/functional.h [5:5] include/__fwd/ios.h [5:5] include/__fwd/istream.h [5:5] include/__fwd/mdspan.h [6:6] @@ -2904,9 +2948,17 @@ BELONGS ya.make include/__iterator/unreachable_sentinel.h [6:6] include/__iterator/wrap_iter.h [6:6] include/__locale [6:6] + include/__locale_dir/locale_base_api.h [5:5] + include/__locale_dir/locale_base_api/android.h [6:6] include/__locale_dir/locale_base_api/bsd_locale_defaults.h [6:6] include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h [6:6] + include/__locale_dir/locale_base_api/fuchsia.h [6:6] + include/__locale_dir/locale_base_api/ibm.h [6:6] include/__locale_dir/locale_base_api/locale_guard.h [5:5] + include/__locale_dir/locale_base_api/musl.h [6:6] + include/__locale_dir/locale_base_api/newlib.h [5:5] + include/__locale_dir/locale_base_api/openbsd.h [6:6] + include/__locale_dir/locale_base_api/win32.h [6:6] include/__math/abs.h [5:5] include/__math/copysign.h [5:5] include/__math/error_functions.h [5:5] @@ -2987,6 +3039,7 @@ BELONGS ya.make include/__numeric/pstl_reduce.h [5:5] include/__numeric/pstl_transform_reduce.h [5:5] include/__numeric/reduce.h [6:6] + include/__numeric/saturation_arithmetic.h [6:6] include/__numeric/transform_exclusive_scan.h [6:6] include/__numeric/transform_inclusive_scan.h [6:6] include/__numeric/transform_reduce.h [6:6] @@ -3083,16 +3136,9 @@ BELONGS ya.make include/__string/char_traits.h [5:5] include/__string/constexpr_c_functions.h [5:5] include/__string/extern_template_lists.h [5:5] - include/__support/android/locale_bionic.h [6:6] - include/__support/fuchsia/xlocale.h [6:6] include/__support/ibm/gettod_zos.h [6:6] include/__support/ibm/locale_mgmt_zos.h [6:6] include/__support/ibm/nanosleep.h [6:6] - include/__support/ibm/xlocale.h [6:6] - include/__support/musl/xlocale.h [6:6] - include/__support/newlib/xlocale.h [5:5] - include/__support/openbsd/xlocale.h [6:6] - include/__support/win32/locale_win32.h [6:6] include/__support/xlocale/__nop_locale_mgmt.h [6:6] include/__support/xlocale/__posix_l_fallback.h [6:6] include/__support/xlocale/__strtonum_fallback.h [6:6] @@ -3105,10 +3151,14 @@ BELONGS ya.make include/__thread/id.h [6:6] include/__thread/jthread.h [6:6] include/__thread/poll_with_backoff.h [6:6] + include/__thread/support.h [6:6] + include/__thread/support/c11.h [6:6] + include/__thread/support/external.h [6:6] + include/__thread/support/pthread.h [6:6] + include/__thread/support/windows.h [6:6] include/__thread/this_thread.h [6:6] include/__thread/thread.h [6:6] include/__thread/timed_backoff_policy.h [6:6] - include/__threading_support [6:6] include/__tree [6:6] include/__tuple/make_tuple_types.h [5:5] include/__tuple/pair_like.h [5:5] @@ -3221,6 +3271,7 @@ BELONGS ya.make include/__type_traits/is_trivially_lexicographically_comparable.h [5:5] include/__type_traits/is_trivially_move_assignable.h [5:5] include/__type_traits/is_trivially_move_constructible.h [5:5] + include/__type_traits/is_trivially_relocatable.h [5:5] include/__type_traits/is_unbounded_array.h [5:5] include/__type_traits/is_union.h [5:5] include/__type_traits/is_unsigned.h [5:5] @@ -3331,11 +3382,8 @@ BELONGS ya.make include/execution [6:6] include/expected [6:6] include/experimental/__config [6:6] - include/experimental/__memory [6:6] - include/experimental/__simd/abi_tag.h [6:6] include/experimental/__simd/aligned_tag.h [6:6] include/experimental/__simd/declaration.h [6:6] - include/experimental/__simd/internal_declaration.h [6:6] include/experimental/__simd/reference.h [6:6] include/experimental/__simd/scalar.h [6:6] include/experimental/__simd/simd.h [6:6] @@ -3456,12 +3504,14 @@ BELONGS ya.make src/filesystem/path_parser.h [5:5] src/filesystem/posix_compat.h [5:5] src/filesystem/time_utils.h [5:5] + src/fstream.cpp [5:5] src/functional.cpp [5:5] src/future.cpp [5:5] src/hash.cpp [5:5] src/include/apple_availability.h [5:5] src/include/atomic_support.h [5:5] src/include/config_elast.h [5:5] + src/include/overridable_function.h [6:6] src/include/refstring.h [5:5] src/include/ryu/common.h [5:5] src/include/ryu/common.h [10:10] @@ -3484,6 +3534,11 @@ BELONGS ya.make src/include/sso_allocator.h [6:6] src/include/to_chars_floating_point.h [5:5] src/include/to_chars_floating_point.h [10:10] + src/include/tzdb/time_zone_link_private.h [6:6] + src/include/tzdb/time_zone_private.h [6:6] + src/include/tzdb/types_private.h [6:6] + src/include/tzdb/tzdb_list_private.h [5:5] + src/include/tzdb/tzdb_private.h [5:5] src/ios.cpp [5:5] src/ios.instantiations.cpp [5:5] src/iostream.cpp [5:5] @@ -3497,6 +3552,7 @@ BELONGS ya.make src/new_handler.cpp [5:5] src/new_helpers.cpp [5:5] src/optional.cpp [5:5] + src/ostream.cpp [5:5] src/print.cpp [5:5] src/pstl/libdispatch.cpp [5:5] src/random.cpp [5:5] @@ -3532,8 +3588,9 @@ BELONGS ya.make src/support/win32/thread_win32.cpp [5:5] src/system_error.cpp [5:5] src/thread.cpp [5:5] + src/time_zone.cpp [5:5] src/typeinfo.cpp [5:5] - src/tz.cpp [5:5] + src/tzdb.cpp [5:5] src/tzdb_list.cpp [5:5] src/valarray.cpp [5:5] src/variant.cpp [5:5] @@ -3569,6 +3626,7 @@ BELONGS ya.make include/__algorithm/find_if.h [6:6] include/__algorithm/find_if_not.h [6:6] include/__algorithm/find_segment_if.h [5:5] + include/__algorithm/fold.h [6:6] include/__algorithm/for_each.h [6:6] include/__algorithm/for_each_n.h [6:6] include/__algorithm/for_each_segment.h [5:5] @@ -3654,6 +3712,8 @@ BELONGS ya.make include/__algorithm/ranges_any_of.h [5:5] include/__algorithm/ranges_binary_search.h [5:5] include/__algorithm/ranges_clamp.h [5:5] + include/__algorithm/ranges_contains.h [5:5] + include/__algorithm/ranges_contains_subrange.h [5:5] include/__algorithm/ranges_copy.h [5:5] include/__algorithm/ranges_copy_backward.h [5:5] include/__algorithm/ranges_copy_if.h [5:5] @@ -3774,6 +3834,7 @@ BELONGS ya.make include/__algorithm/unwrap_range.h [5:5] include/__algorithm/upper_bound.h [5:5] include/__assert [6:6] + include/__assertion_handler [6:6] include/__atomic/aliases.h [5:5] include/__atomic/atomic.h [5:5] include/__atomic/atomic_base.h [5:5] @@ -3834,6 +3895,8 @@ BELONGS ya.make include/__chrono/steady_clock.h [6:6] include/__chrono/system_clock.h [6:6] include/__chrono/time_point.h [6:6] + include/__chrono/time_zone.h [6:6] + include/__chrono/time_zone_link.h [6:6] include/__chrono/tzdb.h [6:6] include/__chrono/tzdb_list.h [6:6] include/__chrono/weekday.h [6:6] @@ -3971,9 +4034,9 @@ BELONGS ya.make include/__functional/weak_result_type.h [6:6] include/__fwd/array.h [5:5] include/__fwd/bit_reference.h [5:5] + include/__fwd/complex.h [5:5] include/__fwd/fstream.h [5:5] - include/__fwd/get.h [5:5] - include/__fwd/hash.h [5:5] + include/__fwd/functional.h [5:5] include/__fwd/ios.h [5:5] include/__fwd/istream.h [5:5] include/__fwd/mdspan.h [6:6] @@ -4032,9 +4095,17 @@ BELONGS ya.make include/__iterator/unreachable_sentinel.h [6:6] include/__iterator/wrap_iter.h [6:6] include/__locale [6:6] + include/__locale_dir/locale_base_api.h [5:5] + include/__locale_dir/locale_base_api/android.h [6:6] include/__locale_dir/locale_base_api/bsd_locale_defaults.h [6:6] include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h [6:6] + include/__locale_dir/locale_base_api/fuchsia.h [6:6] + include/__locale_dir/locale_base_api/ibm.h [6:6] include/__locale_dir/locale_base_api/locale_guard.h [5:5] + include/__locale_dir/locale_base_api/musl.h [6:6] + include/__locale_dir/locale_base_api/newlib.h [5:5] + include/__locale_dir/locale_base_api/openbsd.h [6:6] + include/__locale_dir/locale_base_api/win32.h [6:6] include/__math/abs.h [5:5] include/__math/copysign.h [5:5] include/__math/error_functions.h [5:5] @@ -4115,6 +4186,7 @@ BELONGS ya.make include/__numeric/pstl_reduce.h [5:5] include/__numeric/pstl_transform_reduce.h [5:5] include/__numeric/reduce.h [6:6] + include/__numeric/saturation_arithmetic.h [6:6] include/__numeric/transform_exclusive_scan.h [6:6] include/__numeric/transform_inclusive_scan.h [6:6] include/__numeric/transform_reduce.h [6:6] @@ -4211,16 +4283,9 @@ BELONGS ya.make include/__string/char_traits.h [5:5] include/__string/constexpr_c_functions.h [5:5] include/__string/extern_template_lists.h [5:5] - include/__support/android/locale_bionic.h [6:6] - include/__support/fuchsia/xlocale.h [6:6] include/__support/ibm/gettod_zos.h [6:6] include/__support/ibm/locale_mgmt_zos.h [6:6] include/__support/ibm/nanosleep.h [6:6] - include/__support/ibm/xlocale.h [6:6] - include/__support/musl/xlocale.h [6:6] - include/__support/newlib/xlocale.h [5:5] - include/__support/openbsd/xlocale.h [6:6] - include/__support/win32/locale_win32.h [6:6] include/__support/xlocale/__nop_locale_mgmt.h [6:6] include/__support/xlocale/__posix_l_fallback.h [6:6] include/__support/xlocale/__strtonum_fallback.h [6:6] @@ -4233,10 +4298,14 @@ BELONGS ya.make include/__thread/id.h [6:6] include/__thread/jthread.h [6:6] include/__thread/poll_with_backoff.h [6:6] + include/__thread/support.h [6:6] + include/__thread/support/c11.h [6:6] + include/__thread/support/external.h [6:6] + include/__thread/support/pthread.h [6:6] + include/__thread/support/windows.h [6:6] include/__thread/this_thread.h [6:6] include/__thread/thread.h [6:6] include/__thread/timed_backoff_policy.h [6:6] - include/__threading_support [6:6] include/__tree [6:6] include/__tuple/make_tuple_types.h [5:5] include/__tuple/pair_like.h [5:5] @@ -4349,6 +4418,7 @@ BELONGS ya.make include/__type_traits/is_trivially_lexicographically_comparable.h [5:5] include/__type_traits/is_trivially_move_assignable.h [5:5] include/__type_traits/is_trivially_move_constructible.h [5:5] + include/__type_traits/is_trivially_relocatable.h [5:5] include/__type_traits/is_unbounded_array.h [5:5] include/__type_traits/is_union.h [5:5] include/__type_traits/is_unsigned.h [5:5] @@ -4459,11 +4529,8 @@ BELONGS ya.make include/execution [6:6] include/expected [6:6] include/experimental/__config [6:6] - include/experimental/__memory [6:6] - include/experimental/__simd/abi_tag.h [6:6] include/experimental/__simd/aligned_tag.h [6:6] include/experimental/__simd/declaration.h [6:6] - include/experimental/__simd/internal_declaration.h [6:6] include/experimental/__simd/reference.h [6:6] include/experimental/__simd/scalar.h [6:6] include/experimental/__simd/simd.h [6:6] @@ -4584,12 +4651,14 @@ BELONGS ya.make src/filesystem/path_parser.h [5:5] src/filesystem/posix_compat.h [5:5] src/filesystem/time_utils.h [5:5] + src/fstream.cpp [5:5] src/functional.cpp [5:5] src/future.cpp [5:5] src/hash.cpp [5:5] src/include/apple_availability.h [5:5] src/include/atomic_support.h [5:5] src/include/config_elast.h [5:5] + src/include/overridable_function.h [6:6] src/include/refstring.h [5:5] src/include/ryu/common.h [5:5] src/include/ryu/common.h [10:10] @@ -4612,6 +4681,11 @@ BELONGS ya.make src/include/sso_allocator.h [6:6] src/include/to_chars_floating_point.h [5:5] src/include/to_chars_floating_point.h [10:10] + src/include/tzdb/time_zone_link_private.h [6:6] + src/include/tzdb/time_zone_private.h [6:6] + src/include/tzdb/types_private.h [6:6] + src/include/tzdb/tzdb_list_private.h [5:5] + src/include/tzdb/tzdb_private.h [5:5] src/ios.cpp [5:5] src/ios.instantiations.cpp [5:5] src/iostream.cpp [5:5] @@ -4625,6 +4699,7 @@ BELONGS ya.make src/new_handler.cpp [5:5] src/new_helpers.cpp [5:5] src/optional.cpp [5:5] + src/ostream.cpp [5:5] src/print.cpp [5:5] src/pstl/libdispatch.cpp [5:5] src/random.cpp [5:5] @@ -4660,8 +4735,9 @@ BELONGS ya.make src/support/win32/thread_win32.cpp [5:5] src/system_error.cpp [5:5] src/thread.cpp [5:5] + src/time_zone.cpp [5:5] src/typeinfo.cpp [5:5] - src/tz.cpp [5:5] + src/tzdb.cpp [5:5] src/tzdb_list.cpp [5:5] src/valarray.cpp [5:5] src/variant.cpp [5:5] diff --git a/contrib/libs/cxxsupp/libcxx/.yandex_meta/licenses.list.txt b/contrib/libs/cxxsupp/libcxx/.yandex_meta/licenses.list.txt index 0ea8193607..17823c2647 100644 --- a/contrib/libs/cxxsupp/libcxx/.yandex_meta/licenses.list.txt +++ b/contrib/libs/cxxsupp/libcxx/.yandex_meta/licenses.list.txt @@ -576,7 +576,6 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__memory/allocator.h> @@ -594,6 +593,7 @@ namespace std { #include <__type_traits/is_nothrow_move_constructible.h> #include <__type_traits/is_reference.h> #include <__type_traits/is_same.h> +#include <__type_traits/is_void.h> #include <__type_traits/remove_cv.h> #include <__type_traits/remove_cvref.h> #include <__type_traits/remove_reference.h> @@ -1051,6 +1051,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType template <class _ValueType> inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) _NOEXCEPT { + static_assert(!is_void_v<_ValueType>, "_ValueType may not be void."); static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference."); return std::any_cast<_ValueType>(const_cast<any*>(__any)); } @@ -1068,6 +1069,7 @@ inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void*, /*IsFunction template <class _ValueType> _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT { using __any_imp::_Action; + static_assert(!is_void_v<_ValueType>, "_ValueType may not be void."); static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference."); typedef add_pointer_t<_ValueType> _ReturnType; if (__any && __any->__h_) { diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/clamp.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/clamp.h index 1631b2673c..003bf70dd4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/clamp.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/clamp.h @@ -26,7 +26,7 @@ clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v, _LIBCPP_LIFETIMEBOUND const _Tp& __lo, _LIBCPP_LIFETIMEBOUND const _Tp& __hi, _Compare __comp) { - _LIBCPP_ASSERT_UNCATEGORIZED(!__comp(__hi, __lo), "Bad bounds passed to std::clamp"); + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__comp(__hi, __lo), "Bad bounds passed to std::clamp"); return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h index 15f4a535a3..aa9350c38c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h @@ -44,7 +44,7 @@ struct __debug_less { _LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI decltype((void)std::declval<_Compare&>()( std::declval<_LHS&>(), std::declval<_RHS&>())) __do_compare_assert(int, _LHS& __l, _RHS& __r) { - _LIBCPP_ASSERT_UNCATEGORIZED(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering"); + _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering"); (void)__l; (void)__r; } @@ -53,8 +53,7 @@ struct __debug_less { _LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI void __do_compare_assert(long, _LHS&, _RHS&) {} }; -// Pass the comparator by lvalue reference. Or in debug mode, using a -// debugging wrapper that stores a reference. +// Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference. #if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG template <class _Comp> using __comp_ref_type = __debug_less<_Comp>; diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy_move_common.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy_move_common.h index b350507e32..0fc7a5e3ce 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy_move_common.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy_move_common.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD // Type traits. @@ -132,4 +135,6 @@ __dispatch_copy_or_move(_InIter __first, _Sent __last, _OutIter __out_first) { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal.h index f03f010aa5..3c0e3060e3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal.h @@ -30,6 +30,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> @@ -162,4 +165,6 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_EQUAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h index 7ce54965ff..a942904319 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _Compare, class _Iter, class _Sent, class _Tp, class _Proj> @@ -77,4 +80,6 @@ equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_EQUAL_RANGE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find.h index 754e597130..7d7631b6e9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find.h @@ -21,8 +21,11 @@ #include <__fwd/bit_reference.h> #include <__iterator/segmented_iterator.h> #include <__string/constexpr_c_functions.h> +#include <__type_traits/is_integral.h> #include <__type_traits/is_same.h> +#include <__type_traits/is_signed.h> #include <__utility/move.h> +#include <limits> #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS # include <cwchar> @@ -76,6 +79,22 @@ __find_impl(_Tp* __first, _Tp* __last, const _Up& __value, _Proj&) { } #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +// TODO: This should also be possible to get right with different signedness +// cast integral types to allow vectorization +template <class _Tp, + class _Up, + class _Proj, + __enable_if_t<__is_identity<_Proj>::value && !__libcpp_is_trivially_equality_comparable<_Tp, _Up>::value && + is_integral<_Tp>::value && is_integral<_Up>::value && + is_signed<_Tp>::value == is_signed<_Up>::value, + int> = 0> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* +__find_impl(_Tp* __first, _Tp* __last, const _Up& __value, _Proj& __proj) { + if (__value < numeric_limits<_Tp>::min() || __value > numeric_limits<_Tp>::max()) + return __last; + return std::__find_impl(__first, __last, _Tp(__value), __proj); +} + // __bit_iterator implementation template <bool _ToFind, class _Cp, bool _IsConst> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, _IsConst> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/fold.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/fold.h new file mode 100644 index 0000000000..1a9d76b50d --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/fold.h @@ -0,0 +1,130 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___ALGORITHM_FOLD_H +#define _LIBCPP___ALGORITHM_FOLD_H + +#include <__concepts/assignable.h> +#include <__concepts/convertible_to.h> +#include <__concepts/invocable.h> +#include <__concepts/movable.h> +#include <__config> +#include <__functional/invoke.h> +#include <__functional/reference_wrapper.h> +#include <__iterator/concepts.h> +#include <__iterator/iterator_traits.h> +#include <__iterator/next.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/dangling.h> +#include <__type_traits/decay.h> +#include <__type_traits/invoke.h> +#include <__utility/forward.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 23 + +namespace ranges { +template <class _Ip, class _Tp> +struct in_value_result { + _LIBCPP_NO_UNIQUE_ADDRESS _Ip in; + _LIBCPP_NO_UNIQUE_ADDRESS _Tp value; + + template <class _I2, class _T2> + requires convertible_to<const _Ip&, _I2> && convertible_to<const _Tp&, _T2> + _LIBCPP_HIDE_FROM_ABI constexpr operator in_value_result<_I2, _T2>() const& { + return {in, value}; + } + + template <class _I2, class _T2> + requires convertible_to<_Ip, _I2> && convertible_to<_Tp, _T2> + _LIBCPP_HIDE_FROM_ABI constexpr operator in_value_result<_I2, _T2>() && { + return {std::move(in), std::move(value)}; + } +}; + +template <class _Ip, class _Tp> +using fold_left_with_iter_result = in_value_result<_Ip, _Tp>; + +template <class _Fp, class _Tp, class _Ip, class _Rp, class _Up = decay_t<_Rp>> +concept __indirectly_binary_left_foldable_impl = + convertible_to<_Rp, _Up> && // + movable<_Tp> && // + movable<_Up> && // + convertible_to<_Tp, _Up> && // + invocable<_Fp&, _Up, iter_reference_t<_Ip>> && // + assignable_from<_Up&, invoke_result_t<_Fp&, _Up, iter_reference_t<_Ip>>>; + +template <class _Fp, class _Tp, class _Ip> +concept __indirectly_binary_left_foldable = + copy_constructible<_Fp> && // + invocable<_Fp&, _Tp, iter_reference_t<_Ip>> && // + __indirectly_binary_left_foldable_impl<_Fp, _Tp, _Ip, invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>; + +struct __fold_left_with_iter { + template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp> + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto + operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) { + using _Up = decay_t<invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>; + + if (__first == __last) { + return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), _Up(std::move(__init))}; + } + + _Up __result = std::invoke(__f, std::move(__init), *__first); + for (++__first; __first != __last; ++__first) { + __result = std::invoke(__f, std::move(__result), *__first); + } + + return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), std::move(__result)}; + } + + template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp> + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) { + auto __result = operator()(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f)); + + using _Up = decay_t<invoke_result_t<_Fp&, _Tp, range_reference_t<_Rp>>>; + return fold_left_with_iter_result<borrowed_iterator_t<_Rp>, _Up>{std::move(__result.in), std::move(__result.value)}; + } +}; + +inline constexpr auto fold_left_with_iter = __fold_left_with_iter(); + +struct __fold_left { + template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp> + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto + operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) { + return fold_left_with_iter(std::move(__first), std::move(__last), std::move(__init), std::ref(__f)).value; + } + + template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp> + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) { + return fold_left_with_iter(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f)).value; + } +}; + +inline constexpr auto fold_left = __fold_left(); +} // namespace ranges + +#endif // _LIBCPP_STD_VER >= 23 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___ALGORITHM_FOLD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_found_result.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_found_result.h index 88a0255d16..a67ae38797 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_found_result.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_found_result.h @@ -18,6 +18,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -46,4 +49,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_IN_FOUND_RESULT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_fun_result.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_fun_result.h index 6110c1cf86..a22069a9a8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_fun_result.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_fun_result.h @@ -18,6 +18,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -46,4 +49,6 @@ struct in_fun_result { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_IN_FUN_RESULT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_out_result.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_out_result.h index 95ce4f4fd5..ba0380b5c6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_out_result.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_out_result.h @@ -18,6 +18,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -51,4 +54,6 @@ struct in_in_out_result { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_IN_IN_OUT_RESULT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_result.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_result.h index d1d62dae7f..994573fc70 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_result.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_result.h @@ -18,6 +18,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -48,4 +51,6 @@ struct in_in_result { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_IN_IN_RESULT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_out_out_result.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_out_out_result.h index 1436423687..8ceb452841 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_out_out_result.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_out_out_result.h @@ -18,6 +18,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -49,4 +52,6 @@ struct in_out_out_result { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_IN_OUT_OUT_RESULT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/includes.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/includes.h index 531752e931..05d45365eb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/includes.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/includes.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Comp, class _Proj1, class _Proj2> @@ -71,4 +74,6 @@ includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_INCLUDES_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/next_permutation.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/next_permutation.h index d66ea9b973..011ee028cc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/next_permutation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/next_permutation.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel> @@ -67,4 +70,6 @@ next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_NEXT_PERMUTATION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h index a059705125..da748d7255 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Compare, class _RandomAccessIterator> @@ -114,12 +117,12 @@ __nth_element( while (true) { while (!__comp(*__first, *__i)) { ++__i; - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __i != __last, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } do { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __j != __first, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__j; @@ -150,13 +153,13 @@ __nth_element( // __m still guards upward moving __i while (__comp(*__i, *__m)) { ++__i; - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __i != __last, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } // It is now known that a guard exists for downward moving __j do { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __j != __first, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__j; @@ -253,4 +256,6 @@ nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomA _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_NTH_ELEMENT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h index 27511a1242..85a8fdc77a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel> @@ -83,4 +86,6 @@ partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PARTIAL_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h index e7d8df4de8..ef7c9d34d9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, @@ -98,4 +101,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PARTIAL_SORT_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h index e2ceb07bf1..824e49b9ec 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h @@ -19,6 +19,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Predicate, class _AlgPolicy, class _ForwardIterator, class _Sentinel> @@ -82,4 +85,6 @@ partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PARTITION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h index a93a9875f7..798a1d0993 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h @@ -36,7 +36,8 @@ __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len) { - _LIBCPP_ASSERT_UNCATEGORIZED(__len > 0, "The heap given to pop_heap must be non-empty"); + // Calling `pop_heap` on an empty range is undefined behavior, but in practice it will be a no-op. + _LIBCPP_ASSERT_PEDANTIC(__len > 0, "The heap given to pop_heap must be non-empty"); __comp_ref_type<_Compare> __comp_ref = __comp; diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/prev_permutation.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/prev_permutation.h index 3e4bbb3fbb..8d15b68064 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/prev_permutation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/prev_permutation.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel> @@ -67,4 +70,6 @@ prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PREV_PERMUTATION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_any_all_none_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_any_all_none_of.h index d93fdba222..4b1e0e61b5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_any_all_none_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_any_all_none_of.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -144,4 +147,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_ANY_ALL_NONE_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_backends/cpu_backends/transform_reduce.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_backends/cpu_backends/transform_reduce.h index ab2e3172b8..14a0d76741 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_backends/cpu_backends/transform_reduce.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_backends/cpu_backends/transform_reduce.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -194,4 +197,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKENDS_TRANSFORM_REDUCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_copy.h index 19f275a0d5..1069dcec0e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_copy.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -113,4 +116,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_count.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_count.h index 28806fca06..2781f6bfd3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_count.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_count.h @@ -29,6 +29,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -113,4 +116,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_COUNT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_equal.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_equal.h index b343d26759..d235c0f4f4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_equal.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_equal.h @@ -21,6 +21,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -167,4 +170,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_EQUAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_fill.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_fill.h index 3057dcc04f..488b49a0fe 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_fill.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_fill.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -108,4 +111,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_FILL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_find.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_find.h index adc05ea1a9..5b694db68a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_find.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_find.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -133,4 +136,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_FIND_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_for_each.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_for_each.h index 819a43d685..bb7b5a61a6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_for_each.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_for_each.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -100,4 +103,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_FOR_EACH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_generate.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_generate.h index 56538392d5..7133c6f4f4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_generate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_generate.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -106,4 +109,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_GENERATE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_is_partitioned.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_is_partitioned.h index 39cf636933..b654302122 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_is_partitioned.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_is_partitioned.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -69,4 +72,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_IS_PARITTIONED diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_merge.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_merge.h index ed80145108..3d262db6bc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_merge.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_merge.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -84,4 +87,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_MERGE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_move.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_move.h index 52baab5759..d8441f1a6c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_move.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_move.h @@ -27,6 +27,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -76,4 +79,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_MOVE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_replace.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_replace.h index 05dee3f6a4..b1caf3fd4a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_replace.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_replace.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -239,4 +242,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_REPLACE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_rotate_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_rotate_copy.h index 33dc9a3635..346aab1d4a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_rotate_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_rotate_copy.h @@ -19,6 +19,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -77,4 +80,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_ROTATE_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_sort.h index 3e71e0aa5a..a931f76811 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_sort.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -74,4 +77,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_stable_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_stable_sort.h index c9d375535f..8ea0bb3f9a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_stable_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_stable_sort.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -53,4 +56,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_STABLE_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_transform.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_transform.h index aad59d1f30..f95938782f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_transform.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl_transform.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -112,4 +115,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_PSTL_TRANSFORM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h index 39a2ae4de0..8976541d59 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -66,4 +69,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_ALL_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h index 2ca8531102..7c775f5f64 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -66,4 +69,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_ANY_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h index 22008e0f1b..f3b7842d5c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -65,4 +68,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_BINARY_SEARCH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_clamp.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_clamp.h index e6c8620725..f5ef5fd7f2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_clamp.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_clamp.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -34,8 +37,9 @@ struct __fn { indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr const _Type& operator()( const _Type& __value, const _Type& __low, const _Type& __high, _Comp __comp = {}, _Proj __proj = {}) const { - _LIBCPP_ASSERT_UNCATEGORIZED(!bool(std::invoke(__comp, std::invoke(__proj, __high), std::invoke(__proj, __low))), - "Bad bounds passed to std::ranges::clamp"); + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( + !bool(std::invoke(__comp, std::invoke(__proj, __high), std::invoke(__proj, __low))), + "Bad bounds passed to std::ranges::clamp"); auto&& __projected = std::invoke(__proj, __value); if (std::invoke(__comp, std::forward<decltype(__projected)>(__projected), std::invoke(__proj, __low))) @@ -57,4 +61,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_CLAMP_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains.h new file mode 100644 index 0000000000..00d0e54019 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains.h @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H +#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H + +#include <__algorithm/ranges_find.h> +#include <__config> +#include <__functional/identity.h> +#include <__functional/ranges_operations.h> +#include <__functional/reference_wrapper.h> +#include <__iterator/concepts.h> +#include <__iterator/indirectly_comparable.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +#if _LIBCPP_STD_VER >= 23 + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __contains { +struct __fn { + template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*> + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool static + operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) { + return ranges::find(std::move(__first), __last, __value, std::ref(__proj)) != __last; + } + + template <input_range _Range, class _Type, class _Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*> + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool static + operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) { + return ranges::find(ranges::begin(__range), ranges::end(__range), __value, std::ref(__proj)) != + ranges::end(__range); + } +}; +} // namespace __contains + +inline namespace __cpo { +inline constexpr auto contains = __contains::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER >= 23 + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains_subrange.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains_subrange.h new file mode 100644 index 0000000000..4cd03cbb53 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains_subrange.h @@ -0,0 +1,99 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H +#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H + +#include <__algorithm/ranges_search.h> +#include <__config> +#include <__functional/identity.h> +#include <__functional/ranges_operations.h> +#include <__functional/reference_wrapper.h> +#include <__iterator/concepts.h> +#include <__iterator/distance.h> +#include <__iterator/indirectly_comparable.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/subrange.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +#if _LIBCPP_STD_VER >= 23 + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __contains_subrange { +struct __fn { + template <forward_iterator _Iter1, + sentinel_for<_Iter1> _Sent1, + forward_iterator _Iter2, + sentinel_for<_Iter2> _Sent2, + class _Pred = ranges::equal_to, + class _Proj1 = identity, + class _Proj2 = identity> + requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2> + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool static operator()( + _Iter1 __first1, + _Sent1 __last1, + _Iter2 __first2, + _Sent2 __last2, + _Pred __pred = {}, + _Proj1 __proj1 = {}, + _Proj2 __proj2 = {}) { + auto __n2 = ranges::distance(__first2, __last2); + if (__n2 == 0) + return true; + + auto __ret = ranges::search( + std::move(__first1), __last1, std::move(__first2), __last2, __pred, std::ref(__proj1), std::ref(__proj2)); + return __ret.empty() == false; + } + + template <forward_range _Range1, + forward_range _Range2, + class _Pred = ranges::equal_to, + class _Proj1 = identity, + class _Proj2 = identity> + requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool static + operator()(_Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) { + auto __n2 = 0; + if constexpr (sized_range<_Range2>) { + __n2 = ranges::size(__range2); + } else { + __n2 = std::distance(cbegin(__range2), cend(__range2)); + } + if (__n2 == 0) + return true; + + auto __ret = ranges::search(__range1, __range2, __pred, std::ref(__proj1), std::ref(__proj2)); + return __ret.empty() == false; + } +}; +} // namespace __contains_subrange + +inline namespace __cpo { +inline constexpr auto contains_subrange = __contains_subrange::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER >= 23 + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy.h index 1c87f074e7..e1d6d32f05 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -63,4 +66,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_backward.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_backward.h index 865e944d43..93e3260425 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_backward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_backward.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -61,4 +64,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_COPY_BACKWARD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_if.h index b77dbd37fc..4b41d2154e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_if.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -79,4 +82,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_COPY_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_n.h index 99e8eee14d..4353fa9927 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_n.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -73,4 +76,6 @@ inline constexpr auto copy_n = __copy_n::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_COPY_N_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h index 4c8f1b2cbe..a8965c1b96 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -58,4 +61,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_COUNT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h index 92f37d049e..71b942dd53 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -71,4 +74,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_COUNT_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_ends_with.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_ends_with.h index 2afb74bff0..c2a3cae9f3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_ends_with.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_ends_with.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 23 _LIBCPP_BEGIN_NAMESPACE_STD @@ -193,4 +196,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 23 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_ENDS_WITH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h index 4cb1f7df19..31c7ee261d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -101,4 +104,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal_range.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal_range.h index 1ff8856ca0..4c1c3834ba 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal_range.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal_range.h @@ -30,6 +30,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -72,4 +75,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_RANGE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h index 88a892f5c2..7a177d85e9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h @@ -20,6 +20,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -54,4 +57,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_FILL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h index dbd8ec27ae..a6e988c008 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h @@ -17,6 +17,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -45,4 +48,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_FILL_N_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h index de870e3811..7459fad717 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -72,4 +75,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_FIND_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h index 2c57ad424b..0bda4f3e1c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h @@ -27,6 +27,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -95,4 +98,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_FIND_END_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h index ec6d52c632..63a7b8335f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -98,4 +101,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_FIND_FIRST_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h index af54a5007e..52ae55ce96 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -67,4 +70,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h index a18bea4316..60c6796cbb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -61,4 +64,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h index 7878ed2670..225dc774c8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,4 +76,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h index 53ccb9a603..d1fdca34cc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -56,4 +59,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_N_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate.h index 3ff1e13c42..e6467198e6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -65,4 +68,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate_n.h index c025c621a1..cd5fd7483a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate_n.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -57,4 +60,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_includes.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_includes.h index aa35080c8c..0bc4c043bd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_includes.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_includes.h @@ -27,6 +27,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -90,4 +93,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_INCLUDES_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_inplace_merge.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_inplace_merge.h index 86001b003d..d94c0ad465 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_inplace_merge.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_inplace_merge.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -76,4 +79,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_INPLACE_MERGE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap.h index f298c347b7..122368c90d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,4 +76,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap_until.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap_until.h index 73f13fb504..b2705d37a6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap_until.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap_until.h @@ -27,6 +27,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,4 +76,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_UNTIL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h index 76db870efc..c6a585c9f5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -78,4 +81,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_IS_PARTITIONED_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_permutation.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_permutation.h index 2b99839bc6..e0423d722b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_permutation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_permutation.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -99,4 +102,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_IS_PERMUTATION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h index 3eb2c768d6..d71035d5aa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -59,4 +62,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h index 19e9875d27..dcfb6a4e18 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -74,4 +77,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_UNTIL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_iterator_concept.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_iterator_concept.h index 9a92030403..2af891d3af 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_iterator_concept.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_iterator_concept.h @@ -18,6 +18,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -48,4 +51,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h index 5b843dfd7b..90e96b5465 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -98,4 +101,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h index 58b3f815b9..ab1f80e7ab 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h @@ -27,6 +27,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -65,4 +68,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h index f17eabff43..fe9c024fbf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h @@ -32,6 +32,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -77,4 +80,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_MAKE_HEAP_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h index 782ce2670f..c63656de51 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h @@ -54,7 +54,8 @@ struct __fn { indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const { - _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list must contain at least one element"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + __il.begin() != __il.end(), "initializer_list must contain at least one element"); auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool { return std::invoke(__comp, __rhs, __lhs); }; return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp_lhs_rhs_swapped, __proj); @@ -69,7 +70,7 @@ struct __fn { auto __first = ranges::begin(__r); auto __last = ranges::end(__r); - _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range must contain at least one element"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range must contain at least one element"); if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) { auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool { @@ -97,6 +98,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER >= 20 && +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MAX_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h index 2ba97042f1..83adf49b61 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -61,4 +64,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_MAX_ELEMENT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_merge.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_merge.h index 7f49154ec9..bdf9a62d90 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_merge.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_merge.h @@ -27,6 +27,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -130,4 +133,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_MERGE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h index be15b45367..e8f97f2754 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h @@ -53,7 +53,8 @@ struct __fn { indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const { - _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list must contain at least one element"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + __il.begin() != __il.end(), "initializer_list must contain at least one element"); return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp, __proj); } @@ -65,7 +66,7 @@ struct __fn { operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { auto __first = ranges::begin(__r); auto __last = ranges::end(__r); - _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range must contain at least one element"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range must contain at least one element"); if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) { return *ranges::__min_element_impl(__first, __last, __comp, __proj); } else { @@ -89,6 +90,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER >= 20 && +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MIN_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h index 07826a0e6b..4b9cb76da5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,4 +76,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_MIN_ELEMENT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax.h index a5b5cf9bd0..22a62b620c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax.h @@ -65,7 +65,8 @@ struct __fn { indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<_Type> operator()(initializer_list<_Type> __il, _Comp __comp = {}, _Proj __proj = {}) const { - _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list has to contain at least one element"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + __il.begin() != __il.end(), "initializer_list has to contain at least one element"); auto __iters = std::__minmax_element_impl(__il.begin(), __il.end(), __comp, __proj); return ranges::minmax_result<_Type>{*__iters.first, *__iters.second}; } @@ -80,7 +81,7 @@ struct __fn { auto __last = ranges::end(__r); using _ValueT = range_value_t<_Range>; - _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range has to contain at least one element"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range has to contain at least one element"); if constexpr (forward_range<_Range>) { // Special-case the one element case. Avoid repeatedly initializing objects from the result of an iterator diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax_element.h index a52319f6b5..5132856ebc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax_element.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -70,4 +73,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_MINMAX_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h index db9bfc8e87..037af39126 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -86,4 +89,6 @@ constexpr inline auto mismatch = __mismatch::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_MISMATCH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move.h index 8bd2409f89..be869f36c9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -66,4 +69,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_MOVE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move_backward.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move_backward.h index ee390a40e4..6d4071a33b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move_backward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move_backward.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -68,4 +71,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_MOVE_BACKWARD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_next_permutation.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_next_permutation.h index 9ebab3ea7c..18535e0a62 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_next_permutation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_next_permutation.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -70,4 +73,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_NEXT_PERMUTATION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h index b0d363895e..59bd87997d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -67,4 +70,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_NONE_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h index 7abdbd0889..90ade9efe1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -76,4 +79,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_NTH_ELEMENT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h index 9ec8882097..c67247d2e0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h @@ -33,6 +33,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -74,4 +77,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort_copy.h index eba7d9ac41..b3bdeb78fb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort_copy.h @@ -30,6 +30,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -106,4 +109,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h index 89d192b51f..a67ac4c967 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h @@ -32,6 +32,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -80,4 +83,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h index 6a16b02db3..d60c865dd2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -102,4 +105,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h index 6fc20e7d00..c5b11b5fed 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h @@ -27,6 +27,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -85,4 +88,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_POINT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h index 364cfe94b1..01f92c0f22 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h @@ -32,6 +32,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -78,4 +81,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_POP_HEAP_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_prev_permutation.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_prev_permutation.h index ae7a68cce5..225cee9b75 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_prev_permutation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_prev_permutation.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -70,4 +73,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_PREV_PERMUTATION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h index 1ed9c953f5..9d187af38c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h @@ -32,6 +32,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -77,4 +80,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_PUSH_HEAP_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove.h index e27c4bdd73..315bed8fba 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -60,4 +63,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy.h index 5158a78e48..84529eceac 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,4 +76,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy_if.h index c07b4813d7..56fe017533 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy_if.h @@ -29,6 +29,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -87,4 +90,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_if.h index 4b7aa2d2be..943dbdd738 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_if.h @@ -27,6 +27,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -81,4 +84,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h index b66a41aa8d..2b88dc0329 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -60,4 +63,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy.h index a762702481..633f993e5c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -85,4 +88,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy_if.h index 10ed1fda6c..e065c3ac0a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy_if.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -90,4 +93,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_COPY_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h index 519fa32029..6445f42aea 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,4 +76,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse_copy.h index 35b9edba0b..60043787a7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse_copy.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -62,4 +65,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_REVERSE_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate.h index ebed9bbd54..8d33a6f079 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -63,4 +66,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_ROTATE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate_copy.h index ab76c0944c..26fe110b53 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate_copy.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -60,4 +63,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_ROTATE_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sample.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sample.h index d347d82205..e4f60a7b66 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sample.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sample.h @@ -27,6 +27,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -66,4 +69,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SAMPLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h index 4e53f30f71..4c1d73d8e6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -108,4 +111,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SEARCH_N_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_difference.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_difference.h index a9453ed336..0841fb4ffd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_difference.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_difference.h @@ -30,6 +30,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -100,4 +103,7 @@ inline constexpr auto set_difference = __set_difference::__fn{}; _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 + +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SET_DIFFERENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h index 4cdcbb7505..9427379745 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -105,4 +108,7 @@ inline constexpr auto set_intersection = __set_intersection::__fn{}; _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 + +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SET_INTERSECTION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h index d8710a1c47..995eb0999d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -105,4 +108,7 @@ inline constexpr auto set_symmetric_difference = __set_symmetric_difference::__f _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 + +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h index c627166fff..e870e390cc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -107,4 +110,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SET_UNION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_shuffle.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_shuffle.h index fca420058d..ab98ea22ca 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_shuffle.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_shuffle.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -64,4 +67,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h index 2ad0e0c233..0296c146b3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -76,4 +79,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h index 365c7dba61..bab30df170 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h @@ -32,6 +32,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -77,4 +80,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SORT_HEAP_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h index 44937fa589..f34027ff77 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h @@ -34,6 +34,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -84,4 +87,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_STABLE_PARTITION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h index a4eed38363..93909e253c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -74,4 +77,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_STABLE_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_starts_with.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_starts_with.h index 7da78001d8..90e184aa9b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_starts_with.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_starts_with.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 23 _LIBCPP_BEGIN_NAMESPACE_STD @@ -87,4 +90,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 23 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_STARTS_WITH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h index 1d0ebc0d52..b6d9f61839 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -62,4 +65,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_SWAP_RANGES_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_transform.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_transform.h index f66a07ac02..7850ec4f84 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_transform.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_transform.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -169,4 +172,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_TRANSFORM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique.h index b17e01fc50..7340310eb3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique.h @@ -32,6 +32,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -74,4 +77,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique_copy.h index 7e89f9d97a..61133885ae 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique_copy.h @@ -32,6 +32,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -112,4 +115,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h index 2b9d4ff26e..1498852c43 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h @@ -18,6 +18,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _ForwardIterator, class _Tp> @@ -38,4 +41,6 @@ remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_REMOVE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_if.h index 6eceddce8d..c77b78023f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_if.h @@ -17,6 +17,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _ForwardIterator, class _Predicate> @@ -37,4 +40,6 @@ remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_REMOVE_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/reverse.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/reverse.h index 6bd0aa3932..4167c9116d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/reverse.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/reverse.h @@ -19,6 +19,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _BidirectionalIterator> @@ -54,4 +57,6 @@ reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_REVERSE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h index d8162b1a94..9a4d07883e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _ForwardIterator> @@ -190,4 +193,6 @@ rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __l _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_ROTATE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sample.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sample.h index cc29dd686f..ebe5180b7e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sample.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sample.h @@ -89,7 +89,7 @@ _LIBCPP_HIDE_FROM_ABI _SampleIterator __sample( _SampleIterator __output_iter, _Distance __n, _UniformRandomNumberGenerator& __g) { - _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0, "N must be a positive number."); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n >= 0, "N must be a positive number."); using _PopIterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_PopulationIterator>; using _Difference = typename _IterOps<_AlgPolicy>::template __difference_type<_PopulationIterator>; diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h index 75f936d0f2..8557c76f80 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h @@ -117,17 +117,18 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __searc } } -template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2> +template <class _Iter1, + class _Sent1, + class _Iter2, + class _Sent2, + class _Pred, + class _Proj1, + class _Proj2, + __enable_if_t<__has_random_access_iterator_category<_Iter1>::value && + __has_random_access_iterator_category<_Iter2>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_impl( - _Iter1 __first1, - _Sent1 __last1, - _Iter2 __first2, - _Sent2 __last2, - _Pred& __pred, - _Proj1& __proj1, - _Proj2& __proj2, - __enable_if_t<__has_random_access_iterator_category<_Iter1>::value && - __has_random_access_iterator_category<_Iter2>::value>* = nullptr) { + _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { auto __size2 = __last2 - __first2; if (__size2 == 0) return std::make_pair(__first1, __first1); @@ -141,18 +142,20 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __searc __first1, __last1, __first2, __last2, __pred, __proj1, __proj2, __size1, __size2); } -template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_impl( - _Iter1 __first1, - _Sent1 __last1, - _Iter2 __first2, - _Sent2 __last2, - _Pred& __pred, - _Proj1& __proj1, - _Proj2& __proj2, +template < + class _Iter1, + class _Sent1, + class _Iter2, + class _Sent2, + class _Pred, + class _Proj1, + class _Proj2, __enable_if_t<__has_forward_iterator_category<_Iter1>::value && __has_forward_iterator_category<_Iter2>::value && - !(__has_random_access_iterator_category<_Iter1>::value && - __has_random_access_iterator_category<_Iter2>::value)>* = nullptr) { + !(__has_random_access_iterator_category<_Iter1>::value && + __has_random_access_iterator_category<_Iter2>::value), + int> = 0> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_impl( + _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { return std::__search_forward_impl<_ClassicAlgPolicy>(__first1, __last1, __first2, __last2, __pred, __proj1, __proj2); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h index c3c01e700b..12007fa7de 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h @@ -108,29 +108,30 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 std::pair<_Iter, _Iter> __se } } -template <class _Iter, class _Sent, class _DiffT, class _Type, class _Pred, class _Proj> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter> __search_n_impl( - _Iter __first, - _Sent __last, - _DiffT __count, - const _Type& __value, - _Pred& __pred, - _Proj& __proj, - __enable_if_t<__has_random_access_iterator_category<_Iter>::value>* = nullptr) { +template <class _Iter, + class _Sent, + class _DiffT, + class _Type, + class _Pred, + class _Proj, + __enable_if_t<__has_random_access_iterator_category<_Iter>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter> +__search_n_impl(_Iter __first, _Sent __last, _DiffT __count, const _Type& __value, _Pred& __pred, _Proj& __proj) { return std::__search_n_random_access_impl<_ClassicAlgPolicy>( __first, __last, __count, __value, __pred, __proj, __last - __first); } -template <class _Iter1, class _Sent1, class _DiffT, class _Type, class _Pred, class _Proj> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_n_impl( - _Iter1 __first, - _Sent1 __last, - _DiffT __count, - const _Type& __value, - _Pred& __pred, - _Proj& __proj, - __enable_if_t<__has_forward_iterator_category<_Iter1>::value && - !__has_random_access_iterator_category<_Iter1>::value>* = nullptr) { +template <class _Iter1, + class _Sent1, + class _DiffT, + class _Type, + class _Pred, + class _Proj, + __enable_if_t<__has_forward_iterator_category<_Iter1>::value && + !__has_random_access_iterator_category<_Iter1>::value, + int> = 0> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> +__search_n_impl(_Iter1 __first, _Sent1 __last, _DiffT __count, const _Type& __value, _Pred& __pred, _Proj& __proj) { return std::__search_n_forward_impl<_ClassicAlgPolicy>(__first, __last, __count, __value, __pred, __proj); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_difference.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_difference.h index a924702ce5..f414bcecb5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_difference.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_difference.h @@ -25,6 +25,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _Comp, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> @@ -71,4 +74,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_SET_DIFFERENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h index f2603fe136..73d888d1b0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h @@ -21,6 +21,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _InIter1, class _InIter2, class _OutIter> @@ -95,4 +98,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_i _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_SET_INTERSECTION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_symmetric_difference.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_symmetric_difference.h index 832c3979bf..db36665a61 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_symmetric_difference.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_symmetric_difference.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _InIter1, class _InIter2, class _OutIter> @@ -101,4 +104,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_symmetri _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_SET_SYMMETRIC_DIFFERENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_union.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_union.h index cf48adae03..a79c50fd3c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_union.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_union.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _InIter1, class _InIter2, class _OutIter> @@ -97,4 +100,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_union( _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_SET_UNION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/shift_left.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/shift_left.h index 645c58c291..06cd7c5f87 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/shift_left.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/shift_left.h @@ -17,6 +17,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -51,4 +54,6 @@ shift_left(_ForwardIterator __first, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_SHIFT_LEFT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/shift_right.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/shift_right.h index 73ef98bd39..01853057fc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/shift_right.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/shift_right.h @@ -20,6 +20,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -97,4 +100,6 @@ shift_right(_ForwardIterator __first, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_SHIFT_RIGHT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h index 7f152e4dbd..42803e3063 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h @@ -85,7 +85,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator __floy _Compare&& __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len) { using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type; - _LIBCPP_ASSERT_UNCATEGORIZED(__len >= 2, "shouldn't be called unless __len >= 2"); + _LIBCPP_ASSERT_INTERNAL(__len >= 2, "shouldn't be called unless __len >= 2"); _RandomAccessIterator __hole = __first; _RandomAccessIterator __child_i = __first; diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h index 1b878c33c7..8a5e0211cd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h @@ -39,6 +39,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD // stable, 2-3 compares, 0-2 swaps @@ -325,7 +328,7 @@ __insertion_sort_unguarded(_RandomAccessIterator const __first, _RandomAccessIte do { *__j = _Ops::__iter_move(__k); __j = __k; - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __k != __leftmost, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (__comp(__t, *--__k)); // No need for bounds check due to the assumption stated above. @@ -533,7 +536,7 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last, using _Ops = _IterOps<_AlgPolicy>; typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type; typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type; - _LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >= difference_type(3), ""); + _LIBCPP_ASSERT_INTERNAL(__last - __first >= difference_type(3), ""); const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around const _RandomAccessIterator __end = __last; (void)__end; // @@ -544,7 +547,7 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last, // Not guarded since we know the last element is greater than the pivot. do { ++__first; - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (!__comp(__pivot, *__first)); @@ -557,7 +560,7 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last, // It will be always guarded because __introsort will do the median-of-three // before calling this. do { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; @@ -625,7 +628,7 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte using _Ops = _IterOps<_AlgPolicy>; typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type; - _LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >= difference_type(3), ""); + _LIBCPP_ASSERT_INTERNAL(__last - __first >= difference_type(3), ""); const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around const _RandomAccessIterator __end = __last; (void)__end; // @@ -635,7 +638,7 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte // this. do { ++__first; - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (__comp(*__first, __pivot)); @@ -647,7 +650,7 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte } else { // Guarded. do { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; @@ -665,12 +668,12 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte _Ops::iter_swap(__first, __last); do { ++__first; - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (__comp(*__first, __pivot)); do { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; @@ -702,7 +705,7 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter // Guarded. do { ++__first; - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (!__comp(__pivot, *__first)); @@ -715,7 +718,7 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter // It will be always guarded because __introsort will do the // median-of-three before calling this. do { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; @@ -725,12 +728,12 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter _Ops::iter_swap(__first, __last); do { ++__first; - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (!__comp(__pivot, *__first)); do { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; @@ -1009,4 +1012,6 @@ sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort_heap.h index 0a6d992d00..060fc33c3c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort_heap.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> @@ -55,4 +58,6 @@ sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_SORT_HEAP_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h index 8762abcf18..8bb1eaf2d2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _Distance, class _Pair> @@ -299,4 +302,6 @@ stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate _ _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_STABLE_PARTITION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h index ffc6e4ce28..9be192bd65 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h @@ -29,6 +29,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _AlgPolicy, class _Compare, class _BidirectionalIterator> @@ -265,4 +268,6 @@ inline _LIBCPP_HIDE_FROM_ABI void stable_sort(_RandomAccessIterator __first, _Ra _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_STABLE_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/swap_ranges.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/swap_ranges.h index 7fab5c49a6..54b453b723 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/swap_ranges.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/swap_ranges.h @@ -18,6 +18,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD // 2+2 iterators: the shorter size will be used. @@ -54,4 +57,6 @@ swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardItera _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_SWAP_RANGES_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/three_way_comp_ref_type.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/three_way_comp_ref_type.h index 8fd15c5d66..70c5818976 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/three_way_comp_ref_type.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/three_way_comp_ref_type.h @@ -50,14 +50,14 @@ struct __debug_three_way_comp { __expected = _Order::greater; if (__o == _Order::greater) __expected = _Order::less; - _LIBCPP_ASSERT_UNCATEGORIZED(__comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering"); + _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT( + __comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering"); (void)__l; (void)__r; } }; -// Pass the comparator by lvalue reference. Or in debug mode, using a -// debugging wrapper that stores a reference. +// Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference. # if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG template <class _Comp> using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>; diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique.h index 1717a00c8a..056373d06f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique.h @@ -21,6 +21,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD // unique @@ -56,4 +59,6 @@ unique(_ForwardIterator __first, _ForwardIterator __last) { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_UNIQUE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique_copy.h index 81fcd50f01..16ce80cab3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique_copy.h @@ -23,6 +23,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD namespace __unique_copy_tags { @@ -119,4 +122,6 @@ unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __res _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_UNIQUE_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h index a298a2b271..50d815c970 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h @@ -80,6 +80,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter __orig _LIBCPP_END_NAMESPACE_STD -_LIBCPP_PUSH_MACROS +_LIBCPP_POP_MACROS #endif // _LIBCPP___ALGORITHM_UNWRAP_ITER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_range.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_range.h index 053fd550b3..2d4b9bb554 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_range.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_range.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD // __unwrap_range and __rewrap_range are used to unwrap ranges which may have different iterator and sentinel types. @@ -91,4 +94,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __rewrap_range(_Iter __orig_iter, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_UNWRAP_RANGE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__assert b/contrib/libs/cxxsupp/libcxx/include/__assert index d4af7e6c71..49769fb4d4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__assert +++ b/contrib/libs/cxxsupp/libcxx/include/__assert @@ -10,8 +10,8 @@ #ifndef _LIBCPP___ASSERT #define _LIBCPP___ASSERT +#include <__assertion_handler> // Note: this include is generated by CMake and is potentially vendor-provided. #include <__config> -#include <__verbose_abort> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,8 +20,8 @@ #define _LIBCPP_ASSERT(expression, message) \ (__builtin_expect(static_cast<bool>(expression), 1) \ ? (void)0 \ - : _LIBCPP_VERBOSE_ABORT( \ - "%s:%d: assertion %s failed: %s\n", __builtin_FILE(), __builtin_LINE(), #expression, message)) + : _LIBCPP_ASSERTION_HANDLER(__FILE__ ":" _LIBCPP_TOSTRING(__LINE__) ": assertion " _LIBCPP_TOSTRING( \ + expression) " failed: " message "\n")) // TODO: __builtin_assume can currently inhibit optimizations. Until this has been fixed and we can add // assumptions without a clear optimization intent, disable that to avoid worsening the code generation. @@ -34,4 +34,85 @@ # define _LIBCPP_ASSUME(expression) ((void)0) #endif +// clang-format off +// Fast hardening mode checks. + +#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST + +// Enabled checks. +# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message) +// Disabled checks. +// On most modern platforms, dereferencing a null pointer does not lead to an actual memory access. +# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSUME(expression) +// Overlapping ranges will make algorithms produce incorrect results but don't directly lead to a security +// vulnerability. +# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) + +// Extensive hardening mode checks. + +#elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE + +// Enabled checks. +# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) +// Disabled checks. +# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) + +// Debug hardening mode checks. + +#elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG + +// All checks enabled. +# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSERT(expression, message) +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) + +// Disable all checks if hardening is not enabled. + +#else + +// All checks disabled. +# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) + +#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST +// clang-format on + #endif // _LIBCPP___ASSERT diff --git a/contrib/libs/cxxsupp/libcxx/include/__assertion_handler b/contrib/libs/cxxsupp/libcxx/include/__assertion_handler new file mode 100644 index 0000000000..8bc0553c07 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__assertion_handler @@ -0,0 +1,31 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___ASSERTION_HANDLER +#define _LIBCPP___ASSERTION_HANDLER + +#include <__config> +#include <__verbose_abort> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG + +# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message) + +#else + +// TODO(hardening): use `__builtin_verbose_trap(message)` once that becomes available. +# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap()) + +#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG + +#endif // _LIBCPP___ASSERTION_HANDLER diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/aliases.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/aliases.h index 0fa289de54..e27e09af6b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/aliases.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/aliases.h @@ -18,7 +18,6 @@ #include <__type_traits/make_unsigned.h> #include <cstddef> #include <cstdint> -#include <cstdlib> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -92,7 +91,7 @@ using __largest_lock_free_type = short; # elif ATOMIC_CHAR_LOCK_FREE == 2 using __largest_lock_free_type = char; # else -# define _LIBCPP_NO_LOCK_FREE_TYPES // There are no lockfree types (this can happen in freestanding) +# define _LIBCPP_NO_LOCK_FREE_TYPES // There are no lockfree types (this can happen on unusual platforms) # endif # ifndef _LIBCPP_NO_LOCK_FREE_TYPES diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_base.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_base.h index 3ad3b562c5..6ca01a7f1b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_base.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_base.h @@ -104,24 +104,20 @@ struct __atomic_base // false _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { - std::__cxx_atomic_wait(std::addressof(__a_), __v, __m); + std::__atomic_wait(*this, __v, __m); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT { - std::__cxx_atomic_wait(std::addressof(__a_), __v, __m); + std::__atomic_wait(*this, __v, __m); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { - std::__cxx_atomic_notify_one(std::addressof(__a_)); - } - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { - std::__cxx_atomic_notify_one(std::addressof(__a_)); + std::__atomic_notify_one(*this); } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT { - std::__cxx_atomic_notify_all(std::addressof(__a_)); - } - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { - std::__cxx_atomic_notify_all(std::addressof(__a_)); + std::__atomic_notify_all(*this); } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); } #if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {} @@ -200,6 +196,32 @@ struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> { _LIBCPP_HIDE_FROM_ABI _Tp operator^=(_Tp __op) _NOEXCEPT { return fetch_xor(__op) ^ __op; } }; +// Here we need _IsIntegral because the default template argument is not enough +// e.g __atomic_base<int> is __atomic_base<int, true>, which inherits from +// __atomic_base<int, false> and the caller of the wait function is +// __atomic_base<int, false>. So specializing __atomic_base<_Tp> does not work +template <class _Tp, bool _IsIntegral> +struct __atomic_waitable_traits<__atomic_base<_Tp, _IsIntegral> > { + static _LIBCPP_HIDE_FROM_ABI _Tp __atomic_load(const __atomic_base<_Tp, _IsIntegral>& __a, memory_order __order) { + return __a.load(__order); + } + + static _LIBCPP_HIDE_FROM_ABI _Tp + __atomic_load(const volatile __atomic_base<_Tp, _IsIntegral>& __this, memory_order __order) { + return __this.load(__order); + } + + static _LIBCPP_HIDE_FROM_ABI const __cxx_atomic_impl<_Tp>* + __atomic_contention_address(const __atomic_base<_Tp, _IsIntegral>& __a) { + return std::addressof(__a.__a_); + } + + static _LIBCPP_HIDE_FROM_ABI const volatile __cxx_atomic_impl<_Tp>* + __atomic_contention_address(const volatile __atomic_base<_Tp, _IsIntegral>& __this) { + return std::addressof(__this.__a_); + } +}; + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___ATOMIC_ATOMIC_BASE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_flag.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_flag.h index d76e5e45c0..084366237c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_flag.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_flag.h @@ -13,9 +13,11 @@ #include <__atomic/contention_t.h> #include <__atomic/cxx_atomic_impl.h> #include <__atomic/memory_order.h> +#include <__availability> #include <__chrono/duration.h> #include <__config> -#include <__threading_support> +#include <__memory/addressof.h> +#include <__thread/support.h> #include <cstdint> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -49,20 +51,20 @@ struct atomic_flag { _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { - __cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); + std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT { - __cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); + std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { - __cxx_atomic_notify_one(&__a_); + std::__atomic_notify_one(*this); } - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { __cxx_atomic_notify_one(&__a_); } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT { - __cxx_atomic_notify_all(&__a_); + std::__atomic_notify_all(*this); } - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { __cxx_atomic_notify_all(&__a_); } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); } #if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr atomic_flag() _NOEXCEPT : __a_(false) {} @@ -77,6 +79,28 @@ struct atomic_flag { atomic_flag& operator=(const atomic_flag&) volatile = delete; }; +template <> +struct __atomic_waitable_traits<atomic_flag> { + static _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATOMIC_FLAG_TYPE __atomic_load(const atomic_flag& __a, memory_order __order) { + return std::__cxx_atomic_load(&__a.__a_, __order); + } + + static _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATOMIC_FLAG_TYPE + __atomic_load(const volatile atomic_flag& __a, memory_order __order) { + return std::__cxx_atomic_load(&__a.__a_, __order); + } + + static _LIBCPP_HIDE_FROM_ABI const __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE>* + __atomic_contention_address(const atomic_flag& __a) { + return std::addressof(__a.__a_); + } + + static _LIBCPP_HIDE_FROM_ABI const volatile __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE>* + __atomic_contention_address(const volatile atomic_flag& __a) { + return std::addressof(__a.__a_); + } +}; + inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test(const volatile atomic_flag* __o) _NOEXCEPT { return __o->test(); } inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test(const atomic_flag* __o) _NOEXCEPT { return __o->test(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_sync.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_sync.h index 3d20d6a8ce..e583dca38c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_sync.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_sync.h @@ -17,8 +17,12 @@ #include <__config> #include <__memory/addressof.h> #include <__thread/poll_with_backoff.h> -#include <__threading_support> +#include <__thread/support.h> +#include <__type_traits/conjunction.h> #include <__type_traits/decay.h> +#include <__type_traits/invoke.h> +#include <__type_traits/void_t.h> +#include <__utility/declval.h> #include <cstring> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -27,6 +31,44 @@ _LIBCPP_BEGIN_NAMESPACE_STD +// The customisation points to enable the following functions: +// - __atomic_wait +// - __atomic_wait_unless +// - __atomic_notify_one +// - __atomic_notify_all +// Note that std::atomic<T>::wait was back-ported to C++03 +// The below implementations look ugly to support C++03 +template <class _Tp, class = void> +struct __atomic_waitable_traits { + template <class _AtomicWaitable> + static void __atomic_load(_AtomicWaitable&&, memory_order) = delete; + + template <class _AtomicWaitable> + static void __atomic_contention_address(_AtomicWaitable&&) = delete; +}; + +template <class _Tp, class = void> +struct __atomic_waitable : false_type {}; + +template <class _Tp> +struct __atomic_waitable< _Tp, + __void_t<decltype(__atomic_waitable_traits<__decay_t<_Tp> >::__atomic_load( + std::declval<const _Tp&>(), std::declval<memory_order>())), + decltype(__atomic_waitable_traits<__decay_t<_Tp> >::__atomic_contention_address( + std::declval<const _Tp&>()))> > : true_type {}; + +template <class _AtomicWaitable, class _Poll> +struct __atomic_wait_poll_impl { + const _AtomicWaitable& __a_; + _Poll __poll_; + memory_order __order_; + + _LIBCPP_HIDE_FROM_ABI bool operator()() const { + auto __current_val = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__atomic_load(__a_, __order_); + return __poll_(__current_val); + } +}; + #ifndef _LIBCPP_HAS_NO_THREADS _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*); @@ -43,17 +85,45 @@ __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*); _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t); -template <class _Atp, class _Fn> -struct __libcpp_atomic_wait_backoff_impl { - _Atp* __a; - _Fn __test_fn; +template <class _AtomicWaitable, class _Poll> +struct __atomic_wait_backoff_impl { + const _AtomicWaitable& __a_; + _Poll __poll_; + memory_order __order_; + + using __waitable_traits = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >; + + _LIBCPP_AVAILABILITY_SYNC + _LIBCPP_HIDE_FROM_ABI bool + __update_monitor_val_and_poll(__cxx_atomic_contention_t const volatile*, __cxx_contention_t& __monitor_val) const { + // In case the contention type happens to be __cxx_atomic_contention_t, i.e. __cxx_atomic_impl<int64_t>, + // the platform wait is directly monitoring the atomic value itself. + // `__poll_` takes the current value of the atomic as an in-out argument + // to potentially modify it. After it returns, `__monitor` has a value + // which can be safely waited on by `std::__libcpp_atomic_wait` without any + // ABA style issues. + __monitor_val = __waitable_traits::__atomic_load(__a_, __order_); + return __poll_(__monitor_val); + } + + _LIBCPP_AVAILABILITY_SYNC + _LIBCPP_HIDE_FROM_ABI bool + __update_monitor_val_and_poll(void const volatile* __contention_address, __cxx_contention_t& __monitor_val) const { + // In case the contention type is anything else, platform wait is monitoring a __cxx_atomic_contention_t + // from the global pool, the monitor comes from __libcpp_atomic_monitor + __monitor_val = std::__libcpp_atomic_monitor(__contention_address); + auto __current_val = __waitable_traits::__atomic_load(__a_, __order_); + return __poll_(__current_val); + } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const { if (__elapsed > chrono::microseconds(64)) { - auto const __monitor = std::__libcpp_atomic_monitor(__a); - if (__test_fn()) + auto __contention_address = __waitable_traits::__atomic_contention_address(__a_); + __cxx_contention_t __monitor_val; + if (__update_monitor_val_and_poll(__contention_address, __monitor_val)) return true; - std::__libcpp_atomic_wait(__a, __monitor); + std::__libcpp_atomic_wait(__contention_address, __monitor_val); } else if (__elapsed > chrono::microseconds(4)) __libcpp_thread_yield(); else { @@ -62,23 +132,49 @@ struct __libcpp_atomic_wait_backoff_impl { } }; -template <class _Atp, class _Fn> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Fn&& __test_fn) { - __libcpp_atomic_wait_backoff_impl<_Atp, __decay_t<_Fn> > __backoff_fn = {__a, __test_fn}; - return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn); +// The semantics of this function are similar to `atomic`'s +// `.wait(T old, std::memory_order order)`, but instead of having a hardcoded +// predicate (is the loaded value unequal to `old`?), the predicate function is +// specified as an argument. The loaded value is given as an in-out argument to +// the predicate. If the predicate function returns `true`, +// `__atomic_wait_unless` will return. If the predicate function returns +// `false`, it must set the argument to its current understanding of the atomic +// value. The predicate function must not return `false` spuriously. +template <class _AtomicWaitable, class _Poll> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void +__atomic_wait_unless(const _AtomicWaitable& __a, _Poll&& __poll, memory_order __order) { + static_assert(__atomic_waitable<_AtomicWaitable>::value, ""); + __atomic_wait_poll_impl<_AtomicWaitable, __decay_t<_Poll> > __poll_impl = {__a, __poll, __order}; + __atomic_wait_backoff_impl<_AtomicWaitable, __decay_t<_Poll> > __backoff_fn = {__a, __poll, __order}; + std::__libcpp_thread_poll_with_backoff(__poll_impl, __backoff_fn); +} + +template <class _AtomicWaitable> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void __atomic_notify_one(const _AtomicWaitable& __a) { + static_assert(__atomic_waitable<_AtomicWaitable>::value, ""); + std::__cxx_atomic_notify_one(__atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__atomic_contention_address(__a)); +} + +template <class _AtomicWaitable> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void __atomic_notify_all(const _AtomicWaitable& __a) { + static_assert(__atomic_waitable<_AtomicWaitable>::value, ""); + std::__cxx_atomic_notify_all(__atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__atomic_contention_address(__a)); } #else // _LIBCPP_HAS_NO_THREADS -template <class _Tp> -_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp> const volatile*) {} -template <class _Tp> -_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp> const volatile*) {} -template <class _Atp, class _Fn> -_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp*, _Fn&& __test_fn) { - return std::__libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy()); +template <class _AtomicWaitable, class _Poll> +_LIBCPP_HIDE_FROM_ABI void __atomic_wait_unless(const _AtomicWaitable& __a, _Poll&& __poll, memory_order __order) { + __atomic_wait_poll_impl<_AtomicWaitable, __decay_t<_Poll> > __poll_fn = {__a, __poll, __order}; + std::__libcpp_thread_poll_with_backoff(__poll_fn, __spinning_backoff_policy()); } +template <class _AtomicWaitable> +_LIBCPP_HIDE_FROM_ABI void __atomic_notify_one(const _AtomicWaitable&) {} + +template <class _AtomicWaitable> +_LIBCPP_HIDE_FROM_ABI void __atomic_notify_all(const _AtomicWaitable&) {} + #endif // _LIBCPP_HAS_NO_THREADS template <typename _Tp> @@ -86,21 +182,20 @@ _LIBCPP_HIDE_FROM_ABI bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp c return std::memcmp(std::addressof(__lhs), std::addressof(__rhs), sizeof(_Tp)) == 0; } -template <class _Atp, class _Tp> -struct __cxx_atomic_wait_test_fn_impl { - _Atp* __a; - _Tp __val; - memory_order __order; - _LIBCPP_HIDE_FROM_ABI bool operator()() const { - return !std::__cxx_nonatomic_compare_equal(std::__cxx_atomic_load(__a, __order), __val); +template <class _Tp> +struct __atomic_compare_unequal_to { + _Tp __val_; + _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __arg) const { + return !std::__cxx_nonatomic_compare_equal(__arg, __val_); } }; -template <class _Atp, class _Tp> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool -__cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order) { - __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order}; - return std::__cxx_atomic_wait(__a, __test_fn); +template <class _AtomicWaitable, class _Up> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void +__atomic_wait(_AtomicWaitable& __a, _Up __val, memory_order __order) { + static_assert(__atomic_waitable<_AtomicWaitable>::value, ""); + __atomic_compare_unequal_to<_Up> __nonatomic_equal = {__val}; + std::__atomic_wait_unless(__a, __nonatomic_equal, __order); } _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/cxx_atomic_impl.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/cxx_atomic_impl.h index 1a0b808a0c..b900cc135f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/cxx_atomic_impl.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/cxx_atomic_impl.h @@ -9,16 +9,13 @@ #ifndef _LIBCPP___ATOMIC_CXX_ATOMIC_IMPL_H #define _LIBCPP___ATOMIC_CXX_ATOMIC_IMPL_H -#include <__atomic/is_always_lock_free.h> #include <__atomic/memory_order.h> #include <__config> #include <__memory/addressof.h> -#include <__type_traits/conditional.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_trivially_copyable.h> #include <__type_traits/remove_const.h> #include <cstddef> -#include <cstring> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -26,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS) +#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) // [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because // the default operator= in an object is not volatile, a byte-by-byte copy @@ -44,10 +41,6 @@ _LIBCPP_HIDE_FROM_ABI void __cxx_atomic_assign_volatile(_Tp volatile& __a_value, *__to++ = *__from++; } -#endif - -#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) - template <typename _Tp> struct __cxx_atomic_base_impl { _LIBCPP_HIDE_FROM_ABI @@ -529,289 +522,7 @@ __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_o #endif // _LIBCPP_HAS_GCC_ATOMIC_IMP, _LIBCPP_HAS_C_ATOMIC_IMP -#ifdef _LIBCPP_ATOMIC_ONLY_USE_BUILTINS - -template <typename _Tp> -struct __cxx_atomic_lock_impl { - _LIBCPP_HIDE_FROM_ABI __cxx_atomic_lock_impl() _NOEXCEPT : __a_value(), __a_lock(0) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT - : __a_value(value), - __a_lock(0) {} - - _Tp __a_value; - mutable __cxx_atomic_base_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_lock; - - _LIBCPP_HIDE_FROM_ABI void __lock() const volatile { - while (1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire)) - /*spin*/; - } - _LIBCPP_HIDE_FROM_ABI void __lock() const { - while (1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire)) - /*spin*/; - } - _LIBCPP_HIDE_FROM_ABI void __unlock() const volatile { - __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release); - } - _LIBCPP_HIDE_FROM_ABI void __unlock() const { - __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release); - } - _LIBCPP_HIDE_FROM_ABI _Tp __read() const volatile { - __lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a_value); - __unlock(); - return __old; - } - _LIBCPP_HIDE_FROM_ABI _Tp __read() const { - __lock(); - _Tp __old = __a_value; - __unlock(); - return __old; - } - _LIBCPP_HIDE_FROM_ABI void __read_inplace(_Tp* __dst) const volatile { - __lock(); - __cxx_atomic_assign_volatile(*__dst, __a_value); - __unlock(); - } - _LIBCPP_HIDE_FROM_ABI void __read_inplace(_Tp* __dst) const { - __lock(); - *__dst = __a_value; - __unlock(); - } -}; - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) { - __cxx_atomic_assign_volatile(__a->__a_value, __val); -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) { - __a->__a_value = __val; -} - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) { - __a->__lock(); - __cxx_atomic_assign_volatile(__a->__a_value, __val); - __a->__unlock(); -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) { - __a->__lock(); - __a->__a_value = __val; - __a->__unlock(); -} - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) { - return __a->__read(); -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) { - return __a->__read(); -} - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI void -__cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __dst, memory_order) { - __a->__read_inplace(__dst); -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __dst, memory_order) { - __a->__read_inplace(__dst); -} - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, __value); - __a->__unlock(); - return __old; -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value = __value; - __a->__unlock(); - return __old; -} - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong( - volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) { - _Tp __temp; - __a->__lock(); - __cxx_atomic_assign_volatile(__temp, __a->__a_value); - bool __ret = (std::memcmp(&__temp, __expected, sizeof(_Tp)) == 0); - if (__ret) - __cxx_atomic_assign_volatile(__a->__a_value, __value); - else - __cxx_atomic_assign_volatile(*__expected, __a->__a_value); - __a->__unlock(); - return __ret; -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong( - __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) { - __a->__lock(); - bool __ret = (std::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0); - if (__ret) - std::memcpy(&__a->__a_value, &__value, sizeof(_Tp)); - else - std::memcpy(__expected, &__a->__a_value, sizeof(_Tp)); - __a->__unlock(); - return __ret; -} - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak( - volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) { - _Tp __temp; - __a->__lock(); - __cxx_atomic_assign_volatile(__temp, __a->__a_value); - bool __ret = (std::memcmp(&__temp, __expected, sizeof(_Tp)) == 0); - if (__ret) - __cxx_atomic_assign_volatile(__a->__a_value, __value); - else - __cxx_atomic_assign_volatile(*__expected, __a->__a_value); - __a->__unlock(); - return __ret; -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak( - __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) { - __a->__lock(); - bool __ret = (std::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0); - if (__ret) - std::memcpy(&__a->__a_value, &__value, sizeof(_Tp)); - else - std::memcpy(__expected, &__a->__a_value, sizeof(_Tp)); - __a->__unlock(); - return __ret; -} - -template <typename _Tp, typename _Td> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old + __delta)); - __a->__unlock(); - return __old; -} -template <typename _Tp, typename _Td> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value += __delta; - __a->__unlock(); - return __old; -} - -template <typename _Tp, typename _Td> -_LIBCPP_HIDE_FROM_ABI _Tp* -__cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order) { - __a->__lock(); - _Tp* __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, __old + __delta); - __a->__unlock(); - return __old; -} -template <typename _Tp, typename _Td> -_LIBCPP_HIDE_FROM_ABI _Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order) { - __a->__lock(); - _Tp* __old = __a->__a_value; - __a->__a_value += __delta; - __a->__unlock(); - return __old; -} - -template <typename _Tp, typename _Td> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old - __delta)); - __a->__unlock(); - return __old; -} -template <typename _Tp, typename _Td> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value -= __delta; - __a->__unlock(); - return __old; -} - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp -__cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old & __pattern)); - __a->__unlock(); - return __old; -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value &= __pattern; - __a->__unlock(); - return __old; -} - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp -__cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old | __pattern)); - __a->__unlock(); - return __old; -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value |= __pattern; - __a->__unlock(); - return __old; -} - -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp -__cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old ^ __pattern)); - __a->__unlock(); - return __old; -} -template <typename _Tp> -_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value ^= __pattern; - __a->__unlock(); - return __old; -} - -template <typename _Tp, - typename _Base = typename conditional<__libcpp_is_always_lock_free<_Tp>::__value, - __cxx_atomic_base_impl<_Tp>, - __cxx_atomic_lock_impl<_Tp> >::type> -#else template <typename _Tp, typename _Base = __cxx_atomic_base_impl<_Tp> > -#endif //_LIBCPP_ATOMIC_ONLY_USE_BUILTINS struct __cxx_atomic_impl : public _Base { static_assert(is_trivially_copyable<_Tp>::value, "std::atomic<T> requires that 'T' be a trivially copyable type"); diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/is_always_lock_free.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/is_always_lock_free.h index fbbd437074..f928e79f70 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/is_always_lock_free.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/is_always_lock_free.h @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> struct __libcpp_is_always_lock_free { // __atomic_always_lock_free is available in all Standard modes - static const bool __value = __atomic_always_lock_free(sizeof(_Tp), 0); + static const bool __value = __atomic_always_lock_free(sizeof(_Tp), nullptr); }; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__availability b/contrib/libs/cxxsupp/libcxx/include/__availability index e9904275e7..78438c55a3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__availability +++ b/contrib/libs/cxxsupp/libcxx/include/__availability @@ -108,11 +108,6 @@ # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP -// This controls the availability of floating-point std::to_chars functions. -// These overloads were added later than the integer overloads. -# define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 1 -# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT - // This controls the availability of the C++20 synchronization library, // which requires shared library support for various operations // (see libcxx/src/atomic.cpp). This includes <barier>, <latch>, @@ -120,6 +115,24 @@ # define _LIBCPP_AVAILABILITY_HAS_SYNC 1 # define _LIBCPP_AVAILABILITY_SYNC +// Enable additional explicit instantiations of iostreams components. This +// reduces the number of weak definitions generated in programs that use +// iostreams by providing a single strong definition in the shared library. +// +// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation, +// or once libc++ doesn't use the attribute anymore. +// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed. +# if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32) +# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 1 +# else +# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0 +# endif + +// This controls the availability of floating-point std::to_chars functions. +// These overloads were added later than the integer overloads. +# define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 1 +# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT + // This controls whether the library claims to provide a default verbose // termination function, and consequently whether the headers will try // to use it when the mechanism isn't overriden at compile-time. @@ -131,24 +144,23 @@ # define _LIBCPP_AVAILABILITY_HAS_PMR 1 # define _LIBCPP_AVAILABILITY_PMR +// These macros controls the availability of __cxa_init_primary_exception +// in the built library, which std::make_exception_ptr might use +// (see libcxx/include/__exception/exception_ptr.h). +# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 1 +# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION + +// This controls the availability of C++23 <print>, which +// has a dependency on the built library (it needs access to +// the underlying buffer types of std::cout, std::cerr, and std::clog. +# define _LIBCPP_AVAILABILITY_HAS_PRINT 1 +# define _LIBCPP_AVAILABILITY_PRINT + // This controls the availability of the C++20 time zone database. // The parser code is built in the library. # define _LIBCPP_AVAILABILITY_HAS_TZDB 1 # define _LIBCPP_AVAILABILITY_TZDB -// Enable additional explicit instantiations of iostreams components. This -// reduces the number of weak definitions generated in programs that use -// iostreams by providing a single strong definition in the shared library. -// -// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation, -// or once libc++ doesn't use the attribute anymore. -// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed. -# if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32) -# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 1 -# else -# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0 -# endif - #elif defined(__APPLE__) # define _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS \ @@ -161,6 +173,10 @@ # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS +// TODO: Update once this is released +# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0 +# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION __attribute__((unavailable)) + // <filesystem> // clang-format off # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \ @@ -258,6 +274,13 @@ # define _LIBCPP_AVAILABILITY_HAS_TZDB 0 # define _LIBCPP_AVAILABILITY_TZDB __attribute__((unavailable)) +// Warning: This availability macro works differently than the other macros. +// The dylib part of print is not needed on Apple platforms. Therefore when +// the macro is not available the code calling the dylib is commented out. +// The macro _LIBCPP_AVAILABILITY_PRINT is not used. +# define _LIBCPP_AVAILABILITY_HAS_PRINT 0 +# define _LIBCPP_AVAILABILITY_PRINT __attribute__((unavailable)) + // clang-format off # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120000) || \ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150000) || \ @@ -290,4 +313,13 @@ # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS #endif +// Define availability attributes that depend on both +// _LIBCPP_HAS_NO_EXCEPTIONS and _LIBCPP_HAS_NO_RTTI. +#if defined(_LIBCPP_HAS_NO_EXCEPTIONS) || defined(_LIBCPP_HAS_NO_RTTI) +# undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION +# undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION +# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0 +# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION +#endif + #endif // _LIBCPP___AVAILABILITY diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit/bit_ceil.h b/contrib/libs/cxxsupp/libcxx/include/__bit/bit_ceil.h index 17fe06aa41..77fa739503 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit/bit_ceil.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bit/bit_ceil.h @@ -28,7 +28,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_ceil(_Tp __t) no if (__t < 2) return 1; const unsigned __n = numeric_limits<_Tp>::digits - std::__countl_zero((_Tp)(__t - 1u)); - _LIBCPP_ASSERT_UNCATEGORIZED(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil"); + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil"); if constexpr (sizeof(_Tp) >= sizeof(unsigned)) return _Tp{1} << __n; diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit_reference b/contrib/libs/cxxsupp/libcxx/include/__bit_reference index 9032b8f018..3a5339b72d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit_reference +++ b/contrib/libs/cxxsupp/libcxx/include/__bit_reference @@ -173,7 +173,7 @@ private: // fill_n -template <bool _FillValue, class _Cp> +template <bool _FillVal, class _Cp> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) { using _It = __bit_iterator<_Cp, false>; @@ -185,7 +185,7 @@ __fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) { __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __dn = std::min(__clz_f, __n); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); - if (_FillValue) + if (_FillVal) *__first.__seg_ |= __m; else *__first.__seg_ &= ~__m; @@ -194,13 +194,13 @@ __fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) { } // do middle whole words __storage_type __nw = __n / __bits_per_word; - std::fill_n(std::__to_address(__first.__seg_), __nw, _FillValue ? static_cast<__storage_type>(-1) : 0); + std::fill_n(std::__to_address(__first.__seg_), __nw, _FillVal ? static_cast<__storage_type>(-1) : 0); __n -= __nw * __bits_per_word; // do last partial word if (__n > 0) { __first.__seg_ += __nw; __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - if (_FillValue) + if (_FillVal) *__first.__seg_ |= __m; else *__first.__seg_ &= ~__m; @@ -1007,7 +1007,7 @@ private: friend class __bit_iterator<_Cp, true>; template <class _Dp> friend struct __bit_array; - template <bool _FillValue, class _Dp> + template <bool _FillVal, class _Dp> _LIBCPP_CONSTEXPR_SINCE_CXX20 friend void __fill_n(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); template <class _Dp, bool _IC> diff --git a/contrib/libs/cxxsupp/libcxx/include/__charconv/from_chars_integral.h b/contrib/libs/cxxsupp/libcxx/include/__charconv/from_chars_integral.h index e969cedb33..c1f033b37b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__charconv/from_chars_integral.h +++ b/contrib/libs/cxxsupp/libcxx/include/__charconv/from_chars_integral.h @@ -11,6 +11,7 @@ #define _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H #include <__algorithm/copy_n.h> +#include <__assert> #include <__charconv/from_chars_result.h> #include <__charconv/traits.h> #include <__config> diff --git a/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_base_10.h b/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_base_10.h index 33c512e20f..c49f4f6797 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_base_10.h +++ b/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_base_10.h @@ -11,6 +11,7 @@ #define _LIBCPP___CHARCONV_TO_CHARS_BASE_10_H #include <__algorithm/copy_n.h> +#include <__assert> #include <__charconv/tables.h> #include <__config> #include <cstdint> @@ -132,14 +133,14 @@ __base_10_u64(char* __buffer, uint64_t __value) noexcept { /// range that can be used. However the range is sufficient for /// \ref __base_10_u128. _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline __uint128_t __pow_10(int __exp) noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED(__exp >= __pow10_128_offset, "Index out of bounds"); + _LIBCPP_ASSERT_INTERNAL(__exp >= __pow10_128_offset, "Index out of bounds"); return __pow10_128[__exp - __pow10_128_offset]; } _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u128(char* __buffer, __uint128_t __value) noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED( - __value > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fail when this isn't true."); + _LIBCPP_ASSERT_INTERNAL( + __value > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fails when this isn't true."); // Unlike the 64 to 32 bit case the 128 bit case the "upper half" can't be // stored in the "lower half". Instead we first need to handle the top most diff --git a/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_integral.h b/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_integral.h index f50cc55a4c..0369f4dfb9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_integral.h +++ b/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_integral.h @@ -11,6 +11,7 @@ #define _LIBCPP___CHARCONV_TO_CHARS_INTEGRAL_H #include <__algorithm/copy_n.h> +#include <__assert> #include <__bit/countl.h> #include <__charconv/tables.h> #include <__charconv/to_chars_base_10.h> @@ -246,7 +247,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value) { template <typename _Tp> _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value, unsigned __base) { - _LIBCPP_ASSERT_UNCATEGORIZED(__value >= 0, "The function requires a non-negative value."); + _LIBCPP_ASSERT_INTERNAL(__value >= 0, "The function requires a non-negative value."); unsigned __base_2 = __base * __base; unsigned __base_3 = __base_2 * __base; diff --git a/contrib/libs/cxxsupp/libcxx/include/__charconv/traits.h b/contrib/libs/cxxsupp/libcxx/include/__charconv/traits.h index d3884b560d..c91c6da324 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__charconv/traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__charconv/traits.h @@ -10,6 +10,7 @@ #ifndef _LIBCPP___CHARCONV_TRAITS #define _LIBCPP___CHARCONV_TRAITS +#include <__assert> #include <__bit/countl.h> #include <__charconv/tables.h> #include <__charconv/to_chars_base_10.h> @@ -101,11 +102,11 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__u /// zero is set to one. This means the first element of the lookup table is /// zero. static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_INTERNAL( __v > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fail when this isn't true."); // There's always a bit set in the upper 64-bits. auto __t = (128 - std::__libcpp_clz(static_cast<uint64_t>(__v >> 64))) * 1233 >> 12; - _LIBCPP_ASSERT_UNCATEGORIZED(__t >= __itoa::__pow10_128_offset, "Index out of bounds"); + _LIBCPP_ASSERT_INTERNAL(__t >= __itoa::__pow10_128_offset, "Index out of bounds"); // __t is adjusted since the lookup table misses the lower entries. return __t - (__v < __itoa::__pow10_128[__t - __itoa::__pow10_128_offset]) + 1; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/duration.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/duration.h index 5693ee6440..1e81420244 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/duration.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/duration.h @@ -412,7 +412,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR template <class _Rep1, class _Period, class _Rep2, - __enable_if_t<is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0> + __enable_if_t<is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period> operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef typename common_type<_Rep1, _Rep2>::type _Cr; @@ -423,7 +423,7 @@ operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { template <class _Rep1, class _Period, class _Rep2, - __enable_if_t<is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0> + __enable_if_t<is_convertible<const _Rep1&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period> operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) { return __d * __s; @@ -435,7 +435,7 @@ template <class _Rep1, class _Period, class _Rep2, __enable_if_t<!__is_duration<_Rep2>::value && - is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, + is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period> operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { @@ -457,7 +457,7 @@ template <class _Rep1, class _Period, class _Rep2, __enable_if_t<!__is_duration<_Rep2>::value && - is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, + is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period> operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/ostream.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/ostream.h index f171944b5c..b687ef8059 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/ostream.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/ostream.h @@ -42,11 +42,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace chrono { template <class _CharT, class _Traits, class _Duration> + requires(!treat_as_floating_point_v<typename _Duration::rep> && _Duration{1} < days{1}) _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& -operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_time<_Duration> __tp) { +operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_time<_Duration>& __tp) { return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp); } +template <class _CharT, class _Traits> +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_days& __dp) { + return __os << year_month_day{__dp}; +} + template <class _CharT, class _Traits, class _Duration> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const file_time<_Duration> __tp) { diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/parser_std_format_spec.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/parser_std_format_spec.h index 296be8794e..785bbae198 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/parser_std_format_spec.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/parser_std_format_spec.h @@ -160,10 +160,9 @@ public: private: _LIBCPP_HIDE_FROM_ABI constexpr _ConstIterator __parse_chrono_specs(_ConstIterator __begin, _ConstIterator __end, __flags __flags) { - _LIBCPP_ASSERT_UNCATEGORIZED( - __begin != __end, - "When called with an empty input the function will cause " - "undefined behavior by evaluating data not in the input"); + _LIBCPP_ASSERT_INTERNAL(__begin != __end, + "When called with an empty input the function will cause " + "undefined behavior by evaluating data not in the input"); if (*__begin != _CharT('%') && *__begin != _CharT('}')) std::__throw_format_error("The format specifier expects a '%' or a '}'"); diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone.h new file mode 100644 index 0000000000..7d97327a6c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone.h @@ -0,0 +1,86 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html + +#ifndef _LIBCPP___CHRONO_TIME_ZONE_H +#define _LIBCPP___CHRONO_TIME_ZONE_H + +#include <version> +// Enable the contents of the header only when libc++ was built with experimental features enabled. +#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) + +# include <__compare/strong_order.h> +# include <__config> +# include <__memory/unique_ptr.h> +# include <string_view> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif + +_LIBCPP_PUSH_MACROS +# include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \ + !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +namespace chrono { + +class _LIBCPP_AVAILABILITY_TZDB time_zone { + _LIBCPP_HIDE_FROM_ABI time_zone() = default; + +public: + class __impl; // public so it can be used by make_unique. + + // The "constructor". + // + // The default constructor is private to avoid the constructor from being + // part of the ABI. Instead use an __ugly_named function as an ABI interface, + // since that gives us the ability to change it in the future. + [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI static time_zone __create(unique_ptr<__impl>&& __p); + + _LIBCPP_EXPORTED_FROM_ABI ~time_zone(); + + _LIBCPP_HIDE_FROM_ABI time_zone(time_zone&&) = default; + _LIBCPP_HIDE_FROM_ABI time_zone& operator=(time_zone&&) = default; + + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI string_view name() const noexcept { return __name(); } + + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const __impl& __implementation() const noexcept { return *__impl_; } + +private: + [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI string_view __name() const noexcept; + unique_ptr<__impl> __impl_; +}; + +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline bool +operator==(const time_zone& __x, const time_zone& __y) noexcept { + return __x.name() == __y.name(); +} + +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline strong_ordering +operator<=>(const time_zone& __x, const time_zone& __y) noexcept { + return __x.name() <=> __y.name(); +} + +} // namespace chrono + +# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) + // && !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) + +#endif // _LIBCPP___CHRONO_TIME_ZONE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone_link.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone_link.h new file mode 100644 index 0000000000..17e915d267 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone_link.h @@ -0,0 +1,79 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html + +#ifndef _LIBCPP___CHRONO_TIME_ZONE_LINK_H +#define _LIBCPP___CHRONO_TIME_ZONE_LINK_H + +#include <version> +// Enable the contents of the header only when libc++ was built with experimental features enabled. +#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) + +# include <__compare/strong_order.h> +# include <__config> +# include <string> +# include <string_view> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif + +_LIBCPP_PUSH_MACROS +# include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \ + !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +namespace chrono { + +class time_zone_link { +public: + struct __constructor_tag; + _LIBCPP_NODISCARD_EXT + _LIBCPP_HIDE_FROM_ABI explicit time_zone_link(__constructor_tag&&, string_view __name, string_view __target) + : __name_{__name}, __target_{__target} {} + + _LIBCPP_HIDE_FROM_ABI time_zone_link(time_zone_link&&) = default; + _LIBCPP_HIDE_FROM_ABI time_zone_link& operator=(time_zone_link&&) = default; + + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI string_view name() const noexcept { return __name_; } + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI string_view target() const noexcept { return __target_; } + +private: + string __name_; + // TODO TZDB instead of the name we can store the pointer to a zone. These + // pointers are immutable. This makes it possible to directly return a + // pointer in the time_zone in the 'locate_zone' function. + string __target_; +}; + +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline bool +operator==(const time_zone_link& __x, const time_zone_link& __y) noexcept { + return __x.name() == __y.name(); +} + +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline strong_ordering +operator<=>(const time_zone_link& __x, const time_zone_link& __y) noexcept { + return __x.name() <=> __y.name(); +} + +} // namespace chrono + +# endif //_LIBCPP_STD_VER >= 20 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) + +#endif // _LIBCPP___CHRONO_TIME_ZONE_LINK_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb.h index bd7b05d478..582172e5df 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb.h @@ -16,12 +16,19 @@ // Enable the contents of the header only when libc++ was built with experimental features enabled. #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) +# include <__chrono/time_zone.h> +# include <__chrono/time_zone_link.h> +# include <__config> # include <string> +# include <vector> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif +_LIBCPP_PUSH_MACROS +# include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD # if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \ @@ -29,8 +36,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace chrono { -struct _LIBCPP_AVAILABILITY_TZDB tzdb { +struct tzdb { string version; + vector<time_zone> zones; + vector<time_zone_link> links; }; } // namespace chrono @@ -40,6 +49,8 @@ struct _LIBCPP_AVAILABILITY_TZDB tzdb { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) #endif // _LIBCPP___CHRONO_TZDB_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb_list.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb_list.h index 0494826c01..112e04ff2e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb_list.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb_list.h @@ -18,8 +18,9 @@ # include <__availability> # include <__chrono/tzdb.h> +# include <__config> +# include <__fwd/string.h> # include <forward_list> -# include <string_view> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -32,9 +33,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace chrono { +// TODO TZDB +// Libc++ recently switched to only export __ugly_names from the dylib. +// Since the library is still experimental the functions in this header +// should be adapted to this new style. The other tzdb headers should be +// evaluated too. + class _LIBCPP_AVAILABILITY_TZDB tzdb_list { public: - _LIBCPP_EXPORTED_FROM_ABI explicit tzdb_list(tzdb&& __tzdb); + class __impl; // public to allow construction in dylib + _LIBCPP_HIDE_FROM_ABI explicit tzdb_list(__impl* __p) : __impl_(__p) { + _LIBCPP_ASSERT_NON_NULL(__impl_ != nullptr, "initialized time_zone without a valid pimpl object"); + } _LIBCPP_EXPORTED_FROM_ABI ~tzdb_list(); tzdb_list(const tzdb_list&) = delete; @@ -46,16 +56,15 @@ public: _LIBCPP_EXPORTED_FROM_ABI const_iterator erase_after(const_iterator __p); - _LIBCPP_EXPORTED_FROM_ABI tzdb& __emplace_front(tzdb&& __tzdb); - _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const_iterator begin() const noexcept; _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const_iterator end() const noexcept; _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const_iterator cbegin() const noexcept; _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const_iterator cend() const noexcept; + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __impl& __implementation() { return *__impl_; } + private: - class __impl; __impl* __impl_; }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__compare/strong_order.h b/contrib/libs/cxxsupp/libcxx/include/__compare/strong_order.h index 5f6ade5aef..3dc819e642 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__compare/strong_order.h +++ b/contrib/libs/cxxsupp/libcxx/include/__compare/strong_order.h @@ -13,11 +13,14 @@ #include <__compare/compare_three_way.h> #include <__compare/ordering.h> #include <__config> +#include <__math/exponential_functions.h> +#include <__math/traits.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> +#include <__type_traits/is_floating_point.h> +#include <__type_traits/is_same.h> #include <__utility/forward.h> #include <__utility/priority_tag.h> -#include <cmath> #include <cstdint> #include <limits> @@ -66,27 +69,27 @@ struct __fn { return strong_ordering::greater; } else if (__t == __u) { if constexpr (numeric_limits<_Dp>::radix == 2) { - return std::signbit(__u) <=> std::signbit(__t); + return __math::signbit(__u) <=> __math::signbit(__t); } else { // This is bullet 3 of the IEEE754 algorithm, relevant // only for decimal floating-point; // see https://stackoverflow.com/questions/69068075/ - if (__t == 0 || std::isinf(__t)) { - return std::signbit(__u) <=> std::signbit(__t); + if (__t == 0 || __math::isinf(__t)) { + return __math::signbit(__u) <=> __math::signbit(__t); } else { int __texp, __uexp; - (void)std::frexp(__t, &__texp); - (void)std::frexp(__u, &__uexp); + (void)__math::frexp(__t, &__texp); + (void)__math::frexp(__u, &__uexp); return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp); } } } else { // They're unordered, so one of them must be a NAN. // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN. - bool __t_is_nan = std::isnan(__t); - bool __u_is_nan = std::isnan(__u); - bool __t_is_negative = std::signbit(__t); - bool __u_is_negative = std::signbit(__u); + bool __t_is_nan = __math::isnan(__t); + bool __u_is_nan = __math::isnan(__u); + bool __t_is_negative = __math::signbit(__t); + bool __u_is_negative = __math::signbit(__u); using _IntType = conditional_t< sizeof(__t) == sizeof(int32_t), int32_t, diff --git a/contrib/libs/cxxsupp/libcxx/include/__compare/weak_order.h b/contrib/libs/cxxsupp/libcxx/include/__compare/weak_order.h index 9f719eb64b..b82a708c29 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__compare/weak_order.h +++ b/contrib/libs/cxxsupp/libcxx/include/__compare/weak_order.h @@ -13,10 +13,12 @@ #include <__compare/ordering.h> #include <__compare/strong_order.h> #include <__config> +#include <__math/traits.h> #include <__type_traits/decay.h> +#include <__type_traits/is_floating_point.h> +#include <__type_traits/is_same.h> #include <__utility/forward.h> #include <__utility/priority_tag.h> -#include <cmath> #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER # pragma GCC system_header @@ -51,10 +53,10 @@ struct __fn { return weak_ordering::greater; } else { // Otherwise, at least one of them is a NaN. - bool __t_is_nan = std::isnan(__t); - bool __u_is_nan = std::isnan(__u); - bool __t_is_negative = std::signbit(__t); - bool __u_is_negative = std::signbit(__u); + bool __t_is_nan = __math::isnan(__t); + bool __u_is_nan = __math::isnan(__u); + bool __t_is_negative = __math::signbit(__t); + bool __u_is_negative = __math::signbit(__u); if (__t_is_nan && __u_is_nan) { return (__u_is_negative <=> __t_is_negative); } else if (__t_is_nan) { diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h index f41e4c9f27..0c44f11780 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h @@ -42,9 +42,13 @@ 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_signed_integer = __libcpp_is_signed_integer<_Tp>::value; +template <class _Tp> +concept __libcpp_integer = __libcpp_unsigned_integer<_Tp> || __libcpp_signed_integer<_Tp>; + #endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__condition_variable/condition_variable.h b/contrib/libs/cxxsupp/libcxx/include/__condition_variable/condition_variable.h index 4d8e590e29..de35aaca10 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__condition_variable/condition_variable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__condition_variable/condition_variable.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___CONDITION_VARIABLE_CONDITION_VARIABLE_H #define _LIBCPP___CONDITION_VARIABLE_CONDITION_VARIABLE_H +#include <__chrono/duration.h> #include <__chrono/steady_clock.h> #include <__chrono/system_clock.h> #include <__chrono/time_point.h> @@ -16,7 +17,7 @@ #include <__mutex/mutex.h> #include <__mutex/unique_lock.h> #include <__system_error/system_error.h> -#include <__threading_support> +#include <__thread/support.h> #include <__type_traits/enable_if.h> #include <__type_traits/is_floating_point.h> #include <__utility/move.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config index 104d5178c7..4e6feace3c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config +++ b/contrib/libs/cxxsupp/libcxx/include/__config @@ -16,6 +16,17 @@ # pragma GCC system_header #endif +#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) +# pragma clang deprecated( \ + _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES, \ + "_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES is deprecated in LLVM 18 and will be removed in LLVM 19") +#endif +#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) +# pragma clang deprecated( \ + _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES, \ + "_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES is deprecated in LLVM 18 and will be removed in LLVM 19") +#endif + #if defined(__apple_build_version__) // Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403) # define _LIBCPP_COMPILER_CLANG_BASED @@ -73,7 +84,7 @@ // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is // defined to XXYYZZ. -# define _LIBCPP_VERSION 180000 +# define _LIBCPP_VERSION 190000 # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) @@ -190,11 +201,12 @@ // The implementation moved to the header, but we still export the symbols from // the dylib for backwards compatibility. # define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 -// Save memory by providing the allocator more freedom to allocate the most -// efficient size class by dropping the alignment requirements for std::string's -// pointer from 16 to 8. This changes the output of std::string::max_size, -// which makes it ABI breaking -# define _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT +// Define std::array/std::string_view iterators to be __wrap_iters instead of raw +// pointers, which prevents people from relying on a non-portable implementation +// detail. This is especially useful because enabling bounded iterators hardening +// requires code not to make these assumptions. +# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY +# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW # elif _LIBCPP_ABI_VERSION == 1 # if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) // Enable compiling copies of now inline methods into the dylib to support @@ -227,6 +239,16 @@ # define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION # endif +// We had some bugs where we use [[no_unique_address]] together with construct_at, +// which causes UB as the call on construct_at could write to overlapping subobjects +// +// https://github.com/llvm/llvm-project/issues/70506 +// https://github.com/llvm/llvm-project/issues/70494 +// +// To fix the bug we had to change the ABI of some classes to remove [[no_unique_address]] under certain conditions. +// The macro below is used for all classes whose ABI have changed as part of fixing these bugs. +# define _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS __attribute__((__abi_tag__("llvm18_nua"))) + // Changes the iterator type of select containers (see below) to a bounded iterator that keeps track of whether it's // within the bounds of the original container and asserts it on every dereference. // @@ -297,9 +319,32 @@ // - `_LIBCPP_ASSERT_NON_OVERLAPPING_RANGES` -- for functions that take several ranges as arguments, checks that the // given ranges do not overlap. // +// - `_LIBCPP_ASSERT_VALID_DEALLOCATION` -- checks that an attempt to deallocate memory is valid (e.g. the given object +// was allocated by the given allocator). Violating this category typically results in a memory leak. +// +// - `_LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL` -- checks that a call to an external API doesn't fail in +// an unexpected manner. This includes triggering documented cases of undefined behavior in an external library (like +// attempting to unlock an unlocked mutex in pthreads). Any API external to the library falls under this category +// (from system calls to compiler intrinsics). We generally don't expect these failures to compromize memory safety or +// otherwise create an immediate security issue. +// // - `_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR` -- checks any operations that exchange nodes between containers to make sure // the containers have compatible allocators. // +// - `_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN` -- checks that the given argument is within the domain of valid arguments +// for the function. Violating this typically produces an incorrect result (e.g. the clamp algorithm returns the +// original value without clamping it due to incorrect functors) or puts an object into an invalid state (e.g. +// a string view where only a subset of elements is possible to access). This category is for assertions violating +// which doesn't cause any immediate issues in the library -- whatever the consequences are, they will happen in the +// user code. +// +// - `_LIBCPP_ASSERT_PEDANTIC` -- checks prerequisites which are imposed by the Standard, but violating which happens to +// be benign in our implementation. +// +// - `_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT` -- checks that the given argument satisfies the semantic requirements imposed +// by the Standard. Typically, there is no simple way to completely prove that a semantic requirement is satisfied; +// thus, this would often be a heuristic check and it might be quite expensive. +// // - `_LIBCPP_ASSERT_INTERNAL` -- checks that internal invariants of the library hold. These assertions don't depend on // user input. // @@ -313,6 +358,12 @@ // clang-format on # ifndef _LIBCPP_HARDENING_MODE + +# ifndef _LIBCPP_HARDENING_MODE_DEFAULT +# error _LIBCPP_HARDENING_MODE_DEFAULT is not defined. This definition should be set at configuration time in the \ +`__config_site` header, please make sure your installation of libc++ is not broken. +# endif + # define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEFAULT # endif @@ -327,67 +378,6 @@ _LIBCPP_HARDENING_MODE_EXTENSIVE, \ _LIBCPP_HARDENING_MODE_DEBUG # endif -// clang-format off -// Fast hardening mode checks. - -# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST - -// Enabled checks. -# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message) -// Disabled checks. -// On most modern platforms, dereferencing a null pointer does not lead to an actual memory access. -# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSUME(expression) -// Overlapping ranges will make algorithms produce incorrect results but don't directly lead to a security -// vulnerability. -# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) - -// Extensive hardening mode checks. - -# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE - -// Enabled checks. -# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) -// Disabled checks. -# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) - -// Debug hardening mode checks. - -# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG - -// All checks enabled. -# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSERT(expression, message) -# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) - -// Disable all checks if hardening is not enabled. - -# else - -// All checks disabled. -# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) - -# endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST -// clang-format on - // } HARDENING # define _LIBCPP_TOSTRING2(x) #x @@ -422,6 +412,11 @@ _LIBCPP_HARDENING_MODE_DEBUG # define __has_constexpr_builtin(x) 0 # endif +// This checks wheter a Clang module is built +# ifndef __building_module +# define __building_module(...) 0 +# endif + // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by // the compiler and '1' otherwise. # ifndef __is_identifier @@ -586,7 +581,7 @@ _LIBCPP_HARDENING_MODE_DEBUG # define _ALIGNAS(x) alignas(x) # define _LIBCPP_NORETURN [[noreturn]] # define _NOEXCEPT noexcept -# define _NOEXCEPT_(x) noexcept(x) +# define _NOEXCEPT_(...) noexcept(__VA_ARGS__) # define _LIBCPP_CONSTEXPR constexpr # else @@ -598,7 +593,7 @@ _LIBCPP_HARDENING_MODE_DEBUG # define _LIBCPP_HAS_NO_NOEXCEPT # define nullptr __nullptr # define _NOEXCEPT throw() -# define _NOEXCEPT_(x) +# define _NOEXCEPT_(...) # define static_assert(...) _Static_assert(__VA_ARGS__) # define decltype(...) __decltype(__VA_ARGS__) # define _LIBCPP_CONSTEXPR @@ -842,11 +837,6 @@ typedef __char32_t char32_t; # define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI # endif -// TODO(LLVM-19): Remove _LIBCPP_INLINE_VISIBILITY and _VSTD, which we're keeping around -// only to ease the renaming for downstreams. -# define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI -# define _VSTD std - // Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect. // clang-format off # define _LIBCPP_BEGIN_NAMESPACE_STD namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \ @@ -983,6 +973,12 @@ typedef __char32_t char32_t; # define _LIBCPP_DEPRECATED_IN_CXX23 # endif +# if _LIBCPP_STD_VER >= 26 +# define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED +# else +# define _LIBCPP_DEPRECATED_IN_CXX26 +# endif + # if !defined(_LIBCPP_HAS_NO_CHAR8_T) # define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED # else @@ -1146,11 +1142,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c # define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION # endif -// Some systems do not provide gets() in their C library, for security reasons. -# if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || defined(__OpenBSD__) -# define _LIBCPP_C_HAS_NO_GETS -# endif - # if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \ defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) # define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE @@ -1169,9 +1160,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c # ifndef _LIBCPP_ATOMIC_FLAG_TYPE # define _LIBCPP_ATOMIC_FLAG_TYPE bool # endif -# ifdef _LIBCPP_FREESTANDING -# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS -# endif # endif # if defined(__FreeBSD__) && defined(__clang__) && __has_attribute(__no_thread_safety_analysis__) @@ -1206,21 +1194,23 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c # define _LIBCPP_CONSTINIT # endif -# if defined(__CUDACC__) && defined(__noinline__) -# pragma push_macro("__noinline__") -# define __noinline__ __noinline__ -# endif - -# if __has_attribute(__noinline__) +# if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__) +// The CUDA SDK contains an unfortunate definition for the __noinline__ macro, +// which breaks the regular __attribute__((__noinline__)) syntax. Therefore, +// when compiling for CUDA we use the non-underscored version of the noinline +// attribute. +// +// This is a temporary workaround and we still expect the CUDA SDK team to solve +// this issue properly in the SDK headers. +// +// See https://github.com/llvm/llvm-project/pull/73838 for more details. +# define _LIBCPP_NOINLINE __attribute__((noinline)) +# elif __has_attribute(__noinline__) # define _LIBCPP_NOINLINE __attribute__((__noinline__)) # else # define _LIBCPP_NOINLINE # endif -# if defined(__CUDACC__) && defined(__noinline__) -# pragma pop_macro("__noinline__") -# endif - // We often repeat things just for handling wide characters in the library. // When wide characters are disabled, it can be useful to have a quick way of // disabling it without having to resort to #if-#endif, which has a larger @@ -1253,8 +1243,8 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c // End of Yandex-specific // clang-format off -# define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") _Pragma("push_macro(\"refresh()\")") _Pragma("push_macro(\"move(int, int)\")") _Pragma("push_macro(\"erase()\")") -# define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") _Pragma("pop_macro(\"refresh()\")") _Pragma("pop_macro(\"move(int, int)\")") _Pragma("pop_macro(\"erase()\")") +# define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") _Pragma("push_macro(\"refresh\")") _Pragma("push_macro(\"move\")") _Pragma("push_macro(\"erase\")") +# define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") _Pragma("pop_macro(\"refresh\")") _Pragma("pop_macro(\"move\")") _Pragma("pop_macro(\"erase\")") // clang-format on # ifndef _LIBCPP_NO_AUTO_LINK @@ -1544,6 +1534,11 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK # endif +// Clang-18 has support for deducing this, but it does not set the FTM. +# if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1800) +# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER +# endif + #endif // __cplusplus #include <__config_epilogue.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__config_site b/contrib/libs/cxxsupp/libcxx/include/__config_site index 38a2b6abe4..9c748b346a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config_site +++ b/contrib/libs/cxxsupp/libcxx/include/__config_site @@ -48,6 +48,8 @@ #define _LIBCPP_NO_ASAN_CONTIGUOUS_CONTAINER_FEATURES +#define _LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE + #ifdef _musl_ # define _LIBCPP_HAS_MUSL_LIBC #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__coroutine/coroutine_handle.h b/contrib/libs/cxxsupp/libcxx/include/__coroutine/coroutine_handle.h index 54bfe5b44f..4557a6643c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__coroutine/coroutine_handle.h +++ b/contrib/libs/cxxsupp/libcxx/include/__coroutine/coroutine_handle.h @@ -55,7 +55,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; } _LIBCPP_HIDE_FROM_ABI bool done() const { - _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "done() can be called only on suspended coroutines"); return __builtin_coro_done(__handle_); } @@ -63,13 +63,13 @@ public: _LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); } _LIBCPP_HIDE_FROM_ABI void resume() const { - _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines"); - _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "resume() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(!done(), "resume() has undefined behavior when the coroutine is done"); __builtin_coro_resume(__handle_); } _LIBCPP_HIDE_FROM_ABI void destroy() const { - _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "destroy() can be called only on suspended coroutines"); __builtin_coro_destroy(__handle_); } @@ -130,7 +130,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; } _LIBCPP_HIDE_FROM_ABI bool done() const { - _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "done() can be called only on suspended coroutines"); return __builtin_coro_done(__handle_); } @@ -138,13 +138,13 @@ public: _LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); } _LIBCPP_HIDE_FROM_ABI void resume() const { - _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines"); - _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "resume() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(!done(), "resume() has undefined behavior when the coroutine is done"); __builtin_coro_resume(__handle_); } _LIBCPP_HIDE_FROM_ABI void destroy() const { - _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "destroy() can be called only on suspended coroutines"); __builtin_coro_destroy(__handle_); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__debug_utils/strict_weak_ordering_check.h b/contrib/libs/cxxsupp/libcxx/include/__debug_utils/strict_weak_ordering_check.h index 99200ad65e..3a9d887284 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__debug_utils/strict_weak_ordering_check.h +++ b/contrib/libs/cxxsupp/libcxx/include/__debug_utils/strict_weak_ordering_check.h @@ -26,12 +26,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _RandomAccessIterator, class _Comp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __check_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) { -#ifdef _LIBCPP_DEBUG_STRICT_WEAK_ORDERING_CHECK +#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG using __diff_t = __iter_diff_t<_RandomAccessIterator>; using _Comp_ref = __comp_ref_type<_Comp>; if (!__libcpp_is_constant_evaluated()) { // Check if the range is actually sorted. - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT( (std::is_sorted<_RandomAccessIterator, _Comp_ref>(__first, __last, _Comp_ref(__comp))), "The range is not sorted after the sort, your comparator is not a valid strict-weak ordering"); // Limit the number of elements we need to check. @@ -46,18 +46,18 @@ __check_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccess // Check that the elements from __p to __q are equal between each other. for (__diff_t __b = __p; __b < __q; ++__b) { for (__diff_t __a = __p; __a <= __b; ++__a) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT( !__comp(*(__first + __a), *(__first + __b)), "Your comparator is not a valid strict-weak ordering"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT( !__comp(*(__first + __b), *(__first + __a)), "Your comparator is not a valid strict-weak ordering"); } } // Check that elements between __p and __q are less than between __q and __size. for (__diff_t __a = __p; __a < __q; ++__a) { for (__diff_t __b = __q; __b < __size; ++__b) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT( __comp(*(__first + __a), *(__first + __b)), "Your comparator is not a valid strict-weak ordering"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT( !__comp(*(__first + __b), *(__first + __a)), "Your comparator is not a valid strict-weak ordering"); } } @@ -69,7 +69,7 @@ __check_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccess (void)__first; (void)__last; (void)__comp; -#endif +#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG } _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__exception/exception_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__exception/exception_ptr.h index 4b8276ad3c..53df28de7f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__exception/exception_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__exception/exception_ptr.h @@ -9,21 +9,54 @@ #ifndef _LIBCPP___EXCEPTION_EXCEPTION_PTR_H #define _LIBCPP___EXCEPTION_EXCEPTION_PTR_H +#include <__availability> #include <__config> #include <__exception/operations.h> #include <__memory/addressof.h> +#include <__memory/construct_at.h> +#include <__type_traits/decay.h> #include <cstddef> #include <cstdlib> +#include <new> +#include <typeinfo> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#ifndef _LIBCPP_ABI_MICROSOFT + +namespace __cxxabiv1 { + +extern "C" { +_LIBCPP_OVERRIDABLE_FUNC_VIS void* __cxa_allocate_exception(size_t) throw(); +_LIBCPP_OVERRIDABLE_FUNC_VIS void __cxa_free_exception(void*) throw(); + +struct __cxa_exception; +_LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception( + void*, + std::type_info*, + void( +# if defined(_WIN32) + __thiscall +# endif + *)(void*)) throw(); +} + +} // namespace __cxxabiv1 + +#endif + namespace std { // purposefully not using versioning namespace class _LIBCPP_EXPORTED_FROM_ABI exception_ptr { void* __ptr_; + static exception_ptr __from_native_exception_pointer(void*) _NOEXCEPT; + + template <class _Ep> + friend _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep) _NOEXCEPT; + public: _LIBCPP_HIDE_FROM_ABI exception_ptr() _NOEXCEPT : __ptr_() {} _LIBCPP_HIDE_FROM_ABI exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {} @@ -57,11 +90,28 @@ public: template <class _Ep> _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && __cplusplus >= 201103L && !defined(__ANDROID__) && !defined(__ARM_NEON__) && !defined(__APPLE__) + using _Ep2 = __decay_t<_Ep>; + + void* __ex = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ep)); + (void)__cxxabiv1::__cxa_init_primary_exception(__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) { + std::__destroy_at(static_cast<_Ep2*>(__p)); + }); + + try { + ::new (__ex) _Ep2(__e); + return exception_ptr::__from_native_exception_pointer(__ex); + } catch (...) { + __cxxabiv1::__cxa_free_exception(__ex); + return current_exception(); + } +# else try { throw __e; } catch (...) { return current_exception(); } +# endif # else ((void)__e); std::abort(); diff --git a/contrib/libs/cxxsupp/libcxx/include/__expected/expected.h b/contrib/libs/cxxsupp/libcxx/include/__expected/expected.h index 507dd72963..bfa3d25bf9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__expected/expected.h +++ b/contrib/libs/cxxsupp/libcxx/include/__expected/expected.h @@ -88,8 +88,372 @@ _LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) { # endif } +// If parameter type `_Tp` of `__conditional_no_unique_address` is neither +// copyable nor movable, a constructor with this tag is provided. For that +// constructor, the user has to provide a function and arguments. The function +// must return an object of type `_Tp`. When the function is invoked by the +// constructor, guaranteed copy elision kicks in and the `_Tp` is constructed +// in place. +struct __conditional_no_unique_address_invoke_tag {}; + +// This class implements an object with `[[no_unique_address]]` conditionally applied to it, +// based on the value of `_NoUnique`. +// +// A member of this class must always have `[[no_unique_address]]` applied to +// it. Otherwise, the `[[no_unique_address]]` in the "`_NoUnique == true`" case +// would not have any effect. In the `false` case, the `__v` is not +// `[[no_unique_address]]`, so nullifies the effects of the "outer" +// `[[no_unique_address]]` regarding data layout. +// +// If we had a language feature, this class would basically be replaced by `[[no_unique_address(condition)]]`. +template <bool _NoUnique, class _Tp> +struct __conditional_no_unique_address; + +template <class _Tp> +struct __conditional_no_unique_address<true, _Tp> { + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(in_place_t, _Args&&... __args) + : __v(std::forward<_Args>(__args)...) {} + + template <class _Func, class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address( + __conditional_no_unique_address_invoke_tag, _Func&& __f, _Args&&... __args) + : __v(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} + + _LIBCPP_NO_UNIQUE_ADDRESS _Tp __v; +}; + +template <class _Tp> +struct __conditional_no_unique_address<false, _Tp> { + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(in_place_t, _Args&&... __args) + : __v(std::forward<_Args>(__args)...) {} + + template <class _Func, class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address( + __conditional_no_unique_address_invoke_tag, _Func&& __f, _Args&&... __args) + : __v(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} + + _Tp __v; +}; + +// This function returns whether the type `_Second` can be stuffed into the tail padding +// of the `_First` type if both of them are given `[[no_unique_address]]`. +template <class _First, class _Second> +inline constexpr bool __fits_in_tail_padding = []() { + struct __x { + _LIBCPP_NO_UNIQUE_ADDRESS _First __first; + _LIBCPP_NO_UNIQUE_ADDRESS _Second __second; + }; + return sizeof(__x) == sizeof(_First); +}(); + +// This class implements the storage used by `std::expected`. We have a few +// goals for this storage: +// 1. Whenever the underlying {_Tp | _Unex} combination has free bytes in its +// tail padding, we should reuse it to store the bool discriminator of the +// expected, so as to save space. +// 2. Whenever the `expected<_Tp, _Unex>` as a whole has free bytes in its tail +// padding, we should allow an object following the expected to be stored in +// its tail padding. +// 3. However, we never want a user object (say `X`) that would follow an +// `expected<_Tp, _Unex>` to be stored in the padding bytes of the +// underlying {_Tp | _Unex} union, if any. That is because we use +// `construct_at` on that union, which would end up overwriting the `X` +// member if it is stored in the tail padding of the union. +// +// To achieve this, `__expected_base`'s logic is implemented in an inner +// `__repr` class. `__expected_base` holds one `__repr` member which is +// conditionally `[[no_unique_address]]`. The `__repr` class holds the +// underlying {_Tp | _Unex} union and a boolean "has value" flag. +// +// Which one of the `__repr_`/`__union_` members is `[[no_unique_address]]` +// depends on whether the "has value" boolean fits into the tail padding of +// the underlying {_Tp | _Unex} union: +// +// - In case the "has value" bool fits into the tail padding of the union, the +// whole `__repr_` member is _not_ `[[no_unique_address]]` as it needs to be +// transparently replaced on `emplace()`/`swap()` etc. +// - In case the "has value" bool does not fit into the tail padding of the +// union, only the union member must be transparently replaced (therefore is +// _not_ `[[no_unique_address]]`) and the "has value" flag must be adjusted +// manually. +// +// This way, the member that is transparently replaced on mutating operations +// is never `[[no_unique_address]]`, satisfying the requirements from +// "[basic.life]" in the standard. +// +// Stripped away of all superfluous elements, the layout of `__expected_base` +// then looks like this: +// +// template <class Tp, class Err> +// class expected_base { +// union union_t { +// [[no_unique_address]] Tp val; +// [[no_unique_address]] Err unex; +// }; +// +// static constexpr bool put_flag_in_tail = fits_in_tail_padding<union_t, bool>; +// static constexpr bool allow_reusing_expected_tail_padding = !put_flag_in_tail; +// +// struct repr { +// private: +// // If "has value" fits into the tail, this should be +// // `[[no_unique_address]]`, otherwise not. +// [[no_unique_address]] conditional_no_unique_address< +// put_flag_in_tail, +// union_t>::type union_; +// [[no_unique_address]] bool has_val_; +// }; +// +// protected: +// // If "has value" fits into the tail, this must _not_ be +// // `[[no_unique_address]]` so that we fill out the +// // complete `expected` object. +// [[no_unique_address]] conditional_no_unique_address< +// allow_reusing_expected_tail_padding, +// repr>::type repr_; +// }; +// template <class _Tp, class _Err> -class expected { +class __expected_base { + // use named union because [[no_unique_address]] cannot be applied to an unnamed union, + // also guaranteed elision into a potentially-overlapping subobject is unsettled (and + // it's not clear that it's implementable, given that the function is allowed to clobber + // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107. + union __union_t { + _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) + requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> && + is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>) + = default; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&) + requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> && + is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>) + = default; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(__union_t&&) = delete; + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(in_place_t, _Args&&... __args) + : __val_(std::forward<_Args>(__args)...) {} + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(unexpect_t, _Args&&... __args) + : __unex_(std::forward<_Args>(__args)...) {} + + template <class _Func, class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t( + std::__expected_construct_in_place_from_invoke_tag, _Func&& __f, _Args&&... __args) + : __val_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} + + template <class _Func, class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t( + std::__expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args) + : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} + + _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() + requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>) + = default; + + // __repr's destructor handles this + _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() {} + + _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_; + _LIBCPP_NO_UNIQUE_ADDRESS _Err __unex_; + }; + + static constexpr bool __put_flag_in_tail = __fits_in_tail_padding<__union_t, bool>; + static constexpr bool __allow_reusing_expected_tail_padding = !__put_flag_in_tail; + + struct __repr { + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr() = delete; + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(in_place_t __tag, _Args&&... __args) + : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(true) {} + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(unexpect_t __tag, _Args&&... __args) + : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {} + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(std::__expected_construct_in_place_from_invoke_tag __tag, + _Args&&... __args) + : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(true) {} + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(std::__expected_construct_unexpected_from_invoke_tag __tag, + _Args&&... __args) + : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {} + + // The return value of `__make_union` must be constructed in place in the + // `__v` member of `__union_`, relying on guaranteed copy elision. To do + // this, the `__conditional_no_unique_address_invoke_tag` constructor is + // called with a lambda that is immediately called inside + // `__conditional_no_unique_address`'s constructor. + template <class _OtherUnion> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(bool __has_val, _OtherUnion&& __other) + requires(__allow_reusing_expected_tail_padding) + : __union_(__conditional_no_unique_address_invoke_tag{}, + [&] { return __make_union(__has_val, std::forward<_OtherUnion>(__other)); }), + __has_val_(__has_val) {} + + _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&) + requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> && + is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>) + = default; + _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&) + requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> && + is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>) + = default; + + _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(const __repr&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(__repr&&) = delete; + + _LIBCPP_HIDE_FROM_ABI constexpr ~__repr() + requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>) + = default; + + _LIBCPP_HIDE_FROM_ABI constexpr ~__repr() + requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>) + { + __destroy_union_member(); + } + + _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union() + requires(__allow_reusing_expected_tail_padding && + (is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>)) + { + // Note: Since the destructor of the union is trivial, this does nothing + // except to end the lifetime of the union. + std::destroy_at(&__union_.__v); + } + + _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union() + requires(__allow_reusing_expected_tail_padding && + (!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>)) + { + __destroy_union_member(); + std::destroy_at(&__union_.__v); + } + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(in_place_t, _Args&&... __args) + requires(__allow_reusing_expected_tail_padding) + { + std::construct_at(&__union_.__v, in_place, std::forward<_Args>(__args)...); + __has_val_ = true; + } + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(unexpect_t, _Args&&... __args) + requires(__allow_reusing_expected_tail_padding) + { + std::construct_at(&__union_.__v, unexpect, std::forward<_Args>(__args)...); + __has_val_ = false; + } + + private: + template <class, class> + friend class __expected_base; + + _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union_member() + requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>) + { + if (__has_val_) { + std::destroy_at(std::addressof(__union_.__v.__val_)); + } else { + std::destroy_at(std::addressof(__union_.__v.__unex_)); + } + } + + template <class _OtherUnion> + _LIBCPP_HIDE_FROM_ABI static constexpr __union_t __make_union(bool __has_val, _OtherUnion&& __other) + requires(__allow_reusing_expected_tail_padding) + { + if (__has_val) + return __union_t(in_place, std::forward<_OtherUnion>(__other).__val_); + else + return __union_t(unexpect, std::forward<_OtherUnion>(__other).__unex_); + } + + _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__put_flag_in_tail, __union_t> __union_; + _LIBCPP_NO_UNIQUE_ADDRESS bool __has_val_; + }; + + template <class _OtherUnion> + _LIBCPP_HIDE_FROM_ABI static constexpr __repr __make_repr(bool __has_val, _OtherUnion&& __other) + requires(__put_flag_in_tail) + { + if (__has_val) + return __repr(in_place, std::forward<_OtherUnion>(__other).__val_); + else + return __repr(unexpect, std::forward<_OtherUnion>(__other).__unex_); + } + +protected: + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_base(_Args&&... __args) + : __repr_(in_place, std::forward<_Args>(__args)...) {} + + // In case we copy/move construct from another `expected` we need to create + // our `expected` so that it either has a value or not, depending on the "has + // value" flag of the other `expected`. To do this without falling back on + // `std::construct_at` we rely on guaranteed copy elision using two helper + // functions `__make_repr` and `__make_union`. There have to be two since + // there are two data layouts with different members being + // `[[no_unique_address]]`. GCC (as of version 13) does not do guaranteed + // copy elision when initializing `[[no_unique_address]]` members. The two + // cases are: + // + // - `__make_repr`: This is used when the "has value" flag lives in the tail + // of the union. In this case, the `__repr` member is _not_ + // `[[no_unique_address]]`. + // - `__make_union`: When the "has value" flag does _not_ fit in the tail of + // the union, the `__repr` member is `[[no_unique_address]]` and the union + // is not. + // + // This constructor "catches" the first case and leaves the second case to + // `__union_t`, its constructors and `__make_union`. + template <class _OtherUnion> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_base(bool __has_val, _OtherUnion&& __other) + requires(__put_flag_in_tail) + : __repr_(__conditional_no_unique_address_invoke_tag{}, + [&] { return __make_repr(__has_val, std::forward<_OtherUnion>(__other)); }) {} + + _LIBCPP_HIDE_FROM_ABI constexpr void __destroy() { + if constexpr (__put_flag_in_tail) + std::destroy_at(&__repr_.__v); + else + __repr_.__v.__destroy_union(); + } + + template <class _Tag, class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr void __construct(_Tag __tag, _Args&&... __args) { + if constexpr (__put_flag_in_tail) + std::construct_at(&__repr_.__v, __tag, std::forward<_Args>(__args)...); + else + __repr_.__v.__construct_union(__tag, std::forward<_Args>(__args)...); + } + + _LIBCPP_HIDE_FROM_ABI constexpr bool __has_val() const { return __repr_.__v.__has_val_; } + _LIBCPP_HIDE_FROM_ABI constexpr __union_t& __union() { return __repr_.__v.__union_.__v; } + _LIBCPP_HIDE_FROM_ABI constexpr const __union_t& __union() const { return __repr_.__v.__union_.__v; } + _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __val() { return __repr_.__v.__union_.__v.__val_; } + _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& __val() const { return __repr_.__v.__union_.__v.__val_; } + _LIBCPP_HIDE_FROM_ABI constexpr _Err& __unex() { return __repr_.__v.__union_.__v.__unex_; } + _LIBCPP_HIDE_FROM_ABI constexpr const _Err& __unex() const { return __repr_.__v.__union_.__v.__unex_; } + +private: + _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__allow_reusing_expected_tail_padding, __repr> __repr_; +}; + +template <class _Tp, class _Err> +class expected : private __expected_base<_Tp, _Err> { static_assert(!is_reference_v<_Tp> && !is_function_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, in_place_t> && !is_same_v<remove_cv_t<_Tp>, unexpect_t> && !__is_std_unexpected<remove_cv_t<_Tp>>::value && __valid_std_unexpected<_Err>::value, @@ -102,6 +466,8 @@ class expected { template <class _Up, class _OtherErr> friend class expected; + using __base = __expected_base<_Tp, _Err>; + public: using value_type = _Tp; using error_type = _Err; @@ -113,7 +479,7 @@ public: // [expected.object.ctor], constructors _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept(is_nothrow_default_constructible_v<_Tp>) // strengthened requires is_default_constructible_v<_Tp> - : __union_(std::in_place), __has_val_(true) {} + : __base(in_place) {} _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete; @@ -126,7 +492,7 @@ public: is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_constructible_v<_Err>) // strengthened requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> && !(is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>)) - : __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) {} + : __base(__other.__has_val(), __other.__union()) {} _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&) requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Tp> && @@ -137,7 +503,7 @@ public: is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_constructible_v<_Err>) requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> && !(is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>)) - : __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) {} + : __base(__other.__has_val(), std::move(__other.__union())) {} private: template <class _Up, class _OtherErr, class _UfQual, class _OtherErrQual> @@ -162,12 +528,12 @@ private: template <class _Func, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr explicit expected( std::__expected_construct_in_place_from_invoke_tag __tag, _Func&& __f, _Args&&... __args) - : __union_(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...), __has_val_(true) {} + : __base(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...) {} template <class _Func, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr explicit expected( std::__expected_construct_unexpected_from_invoke_tag __tag, _Func&& __f, _Args&&... __args) - : __union_(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...), __has_val_(false) {} + : __base(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...) {} public: template <class _Up, class _OtherErr> @@ -177,14 +543,14 @@ public: expected(const expected<_Up, _OtherErr>& __other) noexcept( is_nothrow_constructible_v<_Tp, const _Up&> && is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened - : __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) {} + : __base(__other.__has_val(), __other.__union()) {} template <class _Up, class _OtherErr> requires __can_convert<_Up, _OtherErr, _Up, _OtherErr>::value _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp> || !is_convertible_v<_OtherErr, _Err>) expected(expected<_Up, _OtherErr>&& __other) noexcept( is_nothrow_constructible_v<_Tp, _Up> && is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened - : __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) {} + : __base(__other.__has_val(), std::move(__other.__union())) {} template <class _Up = _Tp> requires(!is_same_v<remove_cvref_t<_Up>, in_place_t> && !is_same_v<expected, remove_cvref_t<_Up>> && @@ -192,80 +558,67 @@ public: (!is_same_v<remove_cv_t<_Tp>, bool> || !__is_std_expected<remove_cvref_t<_Up>>::value)) _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp>) expected(_Up&& __u) noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened - : __union_(std::in_place, std::forward<_Up>(__u)), __has_val_(true) {} + : __base(in_place, std::forward<_Up>(__u)) {} template <class _OtherErr> requires is_constructible_v<_Err, const _OtherErr&> _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected( const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened - : __union_(std::unexpect, __unex.error()), __has_val_(false) {} + : __base(unexpect, __unex.error()) {} template <class _OtherErr> requires is_constructible_v<_Err, _OtherErr> _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>) expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened - : __union_(std::unexpect, std::move(__unex.error())), __has_val_(false) {} + : __base(unexpect, std::move(__unex.error())) {} template <class... _Args> requires is_constructible_v<_Tp, _Args...> _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Tp, _Args...>) // strengthened - : __union_(std::in_place, std::forward<_Args>(__args)...), __has_val_(true) {} + : __base(in_place, std::forward<_Args>(__args)...) {} template <class _Up, class... _Args> requires is_constructible_v< _Tp, initializer_list<_Up>&, _Args... > _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, initializer_list<_Up> __il, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) // strengthened - : __union_(std::in_place, __il, std::forward<_Args>(__args)...), __has_val_(true) {} + : __base(in_place, __il, std::forward<_Args>(__args)...) {} template <class... _Args> requires is_constructible_v<_Err, _Args...> _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Err, _Args...>) // strengthened - : __union_(std::unexpect, std::forward<_Args>(__args)...), __has_val_(false) {} + : __base(unexpect, std::forward<_Args>(__args)...) {} template <class _Up, class... _Args> requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... > _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened - : __union_(std::unexpect, __il, std::forward<_Args>(__args)...), __has_val_(false) {} + : __base(unexpect, __il, std::forward<_Args>(__args)...) {} // [expected.object.dtor], destructor - _LIBCPP_HIDE_FROM_ABI constexpr ~expected() - requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>) - = default; - - _LIBCPP_HIDE_FROM_ABI constexpr ~expected() - requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>) - { - if (__has_val_) { - std::destroy_at(std::addressof(__union_.__val_)); - } else { - std::destroy_at(std::addressof(__union_.__unex_)); - } - } + _LIBCPP_HIDE_FROM_ABI constexpr ~expected() = default; private: - template <class _T1, class _T2, class... _Args> - _LIBCPP_HIDE_FROM_ABI static constexpr void __reinit_expected(_T1& __newval, _T2& __oldval, _Args&&... __args) { + template <class _Tag, class _OtherTag, class _T1, class _T2, class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr void __reinit_expected(_T2& __oldval, _Args&&... __args) { if constexpr (is_nothrow_constructible_v<_T1, _Args...>) { - std::destroy_at(std::addressof(__oldval)); - std::construct_at(std::addressof(__newval), std::forward<_Args>(__args)...); + this->__destroy(); + this->__construct(_Tag{}, std::forward<_Args>(__args)...); } else if constexpr (is_nothrow_move_constructible_v<_T1>) { _T1 __tmp(std::forward<_Args>(__args)...); - std::destroy_at(std::addressof(__oldval)); - std::construct_at(std::addressof(__newval), std::move(__tmp)); + this->__destroy(); + this->__construct(_Tag{}, std::move(__tmp)); } else { static_assert( is_nothrow_move_constructible_v<_T2>, "To provide strong exception guarantee, T2 has to satisfy `is_nothrow_move_constructible_v` so that it can " "be reverted to the previous state in case an exception is thrown during the assignment."); _T2 __tmp(std::move(__oldval)); - std::destroy_at(std::addressof(__oldval)); - auto __trans = - std::__make_exception_guard([&] { std::construct_at(std::addressof(__oldval), std::move(__tmp)); }); - std::construct_at(std::addressof(__newval), std::forward<_Args>(__args)...); + this->__destroy(); + auto __trans = std::__make_exception_guard([&] { this->__construct(_OtherTag{}, std::move(__tmp)); }); + this->__construct(_Tag{}, std::forward<_Args>(__args)...); __trans.__complete(); } } @@ -281,17 +634,15 @@ public: is_copy_constructible_v<_Err> && (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>)) { - if (__has_val_ && __rhs.__has_val_) { - __union_.__val_ = __rhs.__union_.__val_; - } else if (__has_val_) { - __reinit_expected(__union_.__unex_, __union_.__val_, __rhs.__union_.__unex_); - } else if (__rhs.__has_val_) { - __reinit_expected(__union_.__val_, __union_.__unex_, __rhs.__union_.__val_); + if (this->__has_val() && __rhs.__has_val()) { + this->__val() = __rhs.__val(); + } else if (this->__has_val()) { + __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), __rhs.__unex()); + } else if (__rhs.__has_val()) { + __reinit_expected<in_place_t, unexpect_t, _Tp, _Err>(this->__unex(), __rhs.__val()); } else { - __union_.__unex_ = __rhs.__union_.__unex_; + this->__unex() = __rhs.__unex(); } - // note: only reached if no exception+rollback was done inside __reinit_expected - __has_val_ = __rhs.__has_val_; return *this; } @@ -302,17 +653,15 @@ public: is_move_assignable_v<_Err> && (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>)) { - if (__has_val_ && __rhs.__has_val_) { - __union_.__val_ = std::move(__rhs.__union_.__val_); - } else if (__has_val_) { - __reinit_expected(__union_.__unex_, __union_.__val_, std::move(__rhs.__union_.__unex_)); - } else if (__rhs.__has_val_) { - __reinit_expected(__union_.__val_, __union_.__unex_, std::move(__rhs.__union_.__val_)); + if (this->__has_val() && __rhs.__has_val()) { + this->__val() = std::move(__rhs.__val()); + } else if (this->__has_val()) { + __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), std::move(__rhs.__unex())); + } else if (__rhs.__has_val()) { + __reinit_expected<in_place_t, unexpect_t, _Tp, _Err>(this->__unex(), std::move(__rhs.__val())); } else { - __union_.__unex_ = std::move(__rhs.__union_.__unex_); + this->__unex() = std::move(__rhs.__unex()); } - // note: only reached if no exception+rollback was done inside __reinit_expected - __has_val_ = __rhs.__has_val_; return *this; } @@ -323,11 +672,10 @@ public: (is_nothrow_constructible_v<_Tp, _Up> || is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>)) { - if (__has_val_) { - __union_.__val_ = std::forward<_Up>(__v); + if (this->__has_val()) { + this->__val() = std::forward<_Up>(__v); } else { - __reinit_expected(__union_.__val_, __union_.__unex_, std::forward<_Up>(__v)); - __has_val_ = true; + __reinit_expected<in_place_t, unexpect_t, _Tp, _Err>(this->__unex(), std::forward<_Up>(__v)); } return *this; } @@ -346,11 +694,10 @@ public: template <class _OtherErr> requires(__can_assign_from_unexpected<const _OtherErr&>) _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) { - if (__has_val_) { - __reinit_expected(__union_.__unex_, __union_.__val_, __un.error()); - __has_val_ = false; + if (this->__has_val()) { + __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), __un.error()); } else { - __union_.__unex_ = __un.error(); + this->__unex() = __un.error(); } return *this; } @@ -358,11 +705,10 @@ public: template <class _OtherErr> requires(__can_assign_from_unexpected<_OtherErr>) _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) { - if (__has_val_) { - __reinit_expected(__union_.__unex_, __union_.__val_, std::move(__un.error())); - __has_val_ = false; + if (this->__has_val()) { + __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), std::move(__un.error())); } else { - __union_.__unex_ = std::move(__un.error()); + this->__unex() = std::move(__un.error()); } return *this; } @@ -370,27 +716,17 @@ public: template <class... _Args> requires is_nothrow_constructible_v<_Tp, _Args...> _LIBCPP_HIDE_FROM_ABI constexpr _Tp& emplace(_Args&&... __args) noexcept { - if (__has_val_) { - std::destroy_at(std::addressof(__union_.__val_)); - } else { - std::destroy_at(std::addressof(__union_.__unex_)); - } - std::construct_at(std::addressof(__union_.__val_), std::forward<_Args>(__args)...); - __has_val_ = true; - return __union_.__val_; + this->__destroy(); + this->__construct(in_place, std::forward<_Args>(__args)...); + return this->__val(); } template <class _Up, class... _Args> - requires is_nothrow_constructible_v< _Tp, initializer_list<_Up>&, _Args... > + requires is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...> _LIBCPP_HIDE_FROM_ABI constexpr _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) noexcept { - if (__has_val_) { - std::destroy_at(std::addressof(__union_.__val_)); - } else { - std::destroy_at(std::addressof(__union_.__unex_)); - } - std::construct_at(std::addressof(__union_.__val_), __il, std::forward<_Args>(__args)...); - __has_val_ = true; - return __union_.__val_; + this->__destroy(); + this->__construct(in_place, __il, std::forward<_Args>(__args)...); + return this->__val(); } public: @@ -402,48 +738,42 @@ public: is_move_constructible_v<_Err> && (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>)) { - auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) { + auto __swap_val_unex_impl = [](expected& __with_val, expected& __with_err) { if constexpr (is_nothrow_move_constructible_v<_Err>) { - _Err __tmp(std::move(__with_err.__union_.__unex_)); - std::destroy_at(std::addressof(__with_err.__union_.__unex_)); - auto __trans = std::__make_exception_guard([&] { - std::construct_at(std::addressof(__with_err.__union_.__unex_), std::move(__tmp)); - }); - std::construct_at(std::addressof(__with_err.__union_.__val_), std::move(__with_val.__union_.__val_)); + _Err __tmp(std::move(__with_err.__unex())); + __with_err.__destroy(); + auto __trans = std::__make_exception_guard([&] { __with_err.__construct(unexpect, std::move(__tmp)); }); + __with_err.__construct(in_place, std::move(__with_val.__val())); __trans.__complete(); - std::destroy_at(std::addressof(__with_val.__union_.__val_)); - std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__tmp)); + __with_val.__destroy(); + __with_val.__construct(unexpect, std::move(__tmp)); } else { static_assert(is_nothrow_move_constructible_v<_Tp>, "To provide strong exception guarantee, Tp has to satisfy `is_nothrow_move_constructible_v` so " "that it can be reverted to the previous state in case an exception is thrown during swap."); - _Tp __tmp(std::move(__with_val.__union_.__val_)); - std::destroy_at(std::addressof(__with_val.__union_.__val_)); - auto __trans = std::__make_exception_guard([&] { - std::construct_at(std::addressof(__with_val.__union_.__val_), std::move(__tmp)); - }); - std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__with_err.__union_.__unex_)); + _Tp __tmp(std::move(__with_val.__val())); + __with_val.__destroy(); + auto __trans = std::__make_exception_guard([&] { __with_val.__construct(in_place, std::move(__tmp)); }); + __with_val.__construct(unexpect, std::move(__with_err.__unex())); __trans.__complete(); - std::destroy_at(std::addressof(__with_err.__union_.__unex_)); - std::construct_at(std::addressof(__with_err.__union_.__val_), std::move(__tmp)); + __with_err.__destroy(); + __with_err.__construct(in_place, std::move(__tmp)); } - __with_val.__has_val_ = false; - __with_err.__has_val_ = true; }; - if (__has_val_) { - if (__rhs.__has_val_) { + if (this->__has_val()) { + if (__rhs.__has_val()) { using std::swap; - swap(__union_.__val_, __rhs.__union_.__val_); + swap(this->__val(), __rhs.__val()); } else { __swap_val_unex_impl(*this, __rhs); } } else { - if (__rhs.__has_val_) { + if (__rhs.__has_val()) { __swap_val_unex_impl(__rhs, *this); } else { using std::swap; - swap(__union_.__unex_, __rhs.__union_.__unex_); + swap(this->__unex(), __rhs.__unex()); } } } @@ -456,105 +786,115 @@ public: // [expected.object.obs], observers _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator-> requires the expected to contain a value"); - return std::addressof(__union_.__val_); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + this->__has_val(), "expected::operator-> requires the expected to contain a value"); + return std::addressof(this->__val()); } _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator-> requires the expected to contain a value"); - return std::addressof(__union_.__val_); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + this->__has_val(), "expected::operator-> requires the expected to contain a value"); + return std::addressof(this->__val()); } _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value"); - return __union_.__val_; + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + this->__has_val(), "expected::operator* requires the expected to contain a value"); + return this->__val(); } _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value"); - return __union_.__val_; + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + this->__has_val(), "expected::operator* requires the expected to contain a value"); + return this->__val(); } _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value"); - return std::move(__union_.__val_); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + this->__has_val(), "expected::operator* requires the expected to contain a value"); + return std::move(this->__val()); } _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value"); - return std::move(__union_.__val_); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + this->__has_val(), "expected::operator* requires the expected to contain a value"); + return std::move(this->__val()); } - _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __has_val_; } + _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return this->__has_val(); } - _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __has_val_; } + _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); } _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& value() const& { static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible"); - if (!__has_val_) { + if (!this->__has_val()) { std::__throw_bad_expected_access<_Err>(std::as_const(error())); } - return __union_.__val_; + return this->__val(); } _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() & { static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible"); - if (!__has_val_) { + if (!this->__has_val()) { std::__throw_bad_expected_access<_Err>(std::as_const(error())); } - return __union_.__val_; + return this->__val(); } _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& value() const&& { static_assert(is_copy_constructible_v<_Err> && is_constructible_v<_Err, decltype(std::move(error()))>, "error_type has to be both copy constructible and constructible from decltype(std::move(error()))"); - if (!__has_val_) { + if (!this->__has_val()) { std::__throw_bad_expected_access<_Err>(std::move(error())); } - return std::move(__union_.__val_); + return std::move(this->__val()); } _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() && { static_assert(is_copy_constructible_v<_Err> && is_constructible_v<_Err, decltype(std::move(error()))>, "error_type has to be both copy constructible and constructible from decltype(std::move(error()))"); - if (!__has_val_) { + if (!this->__has_val()) { std::__throw_bad_expected_access<_Err>(std::move(error())); } - return std::move(__union_.__val_); + return std::move(this->__val()); } _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error"); - return __union_.__unex_; + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !this->__has_val(), "expected::error requires the expected to contain an error"); + return this->__unex(); } _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error"); - return __union_.__unex_; + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !this->__has_val(), "expected::error requires the expected to contain an error"); + return this->__unex(); } _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error"); - return std::move(__union_.__unex_); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !this->__has_val(), "expected::error requires the expected to contain an error"); + return std::move(this->__unex()); } _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error"); - return std::move(__union_.__unex_); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !this->__has_val(), "expected::error requires the expected to contain an error"); + return std::move(this->__unex()); } template <class _Up> _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& { static_assert(is_copy_constructible_v<_Tp>, "value_type has to be copy constructible"); static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type"); - return __has_val_ ? __union_.__val_ : static_cast<_Tp>(std::forward<_Up>(__v)); + return this->__has_val() ? this->__val() : static_cast<_Tp>(std::forward<_Up>(__v)); } template <class _Up> _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && { static_assert(is_move_constructible_v<_Tp>, "value_type has to be move constructible"); static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type"); - return __has_val_ ? std::move(__union_.__val_) : static_cast<_Tp>(std::forward<_Up>(__v)); + return this->__has_val() ? std::move(this->__val()) : static_cast<_Tp>(std::forward<_Up>(__v)); } template <class _Up = _Err> @@ -584,7 +924,7 @@ public: static_assert(is_same_v<typename _Up::error_type, _Err>, "The result of f(**this) must have the same error_type as this expected"); if (has_value()) { - return std::invoke(std::forward<_Func>(__f), __union_.__val_); + return std::invoke(std::forward<_Func>(__f), this->__val()); } return _Up(unexpect, error()); } @@ -597,7 +937,7 @@ public: static_assert(is_same_v<typename _Up::error_type, _Err>, "The result of f(**this) must have the same error_type as this expected"); if (has_value()) { - return std::invoke(std::forward<_Func>(__f), __union_.__val_); + return std::invoke(std::forward<_Func>(__f), this->__val()); } return _Up(unexpect, error()); } @@ -611,7 +951,7 @@ public: static_assert(is_same_v<typename _Up::error_type, _Err>, "The result of f(std::move(**this)) must have the same error_type as this expected"); if (has_value()) { - return std::invoke(std::forward<_Func>(__f), std::move(__union_.__val_)); + return std::invoke(std::forward<_Func>(__f), std::move(this->__val())); } return _Up(unexpect, std::move(error())); } @@ -625,7 +965,7 @@ public: static_assert(is_same_v<typename _Up::error_type, _Err>, "The result of f(std::move(**this)) must have the same error_type as this expected"); if (has_value()) { - return std::invoke(std::forward<_Func>(__f), std::move(__union_.__val_)); + return std::invoke(std::forward<_Func>(__f), std::move(this->__val())); } return _Up(unexpect, std::move(error())); } @@ -638,7 +978,7 @@ public: static_assert(is_same_v<typename _Gp::value_type, _Tp>, "The result of f(error()) must have the same value_type as this expected"); if (has_value()) { - return _Gp(in_place, __union_.__val_); + return _Gp(in_place, this->__val()); } return std::invoke(std::forward<_Func>(__f), error()); } @@ -651,7 +991,7 @@ public: static_assert(is_same_v<typename _Gp::value_type, _Tp>, "The result of f(error()) must have the same value_type as this expected"); if (has_value()) { - return _Gp(in_place, __union_.__val_); + return _Gp(in_place, this->__val()); } return std::invoke(std::forward<_Func>(__f), error()); } @@ -665,7 +1005,7 @@ public: static_assert(is_same_v<typename _Gp::value_type, _Tp>, "The result of f(std::move(error())) must have the same value_type as this expected"); if (has_value()) { - return _Gp(in_place, std::move(__union_.__val_)); + return _Gp(in_place, std::move(this->__val())); } return std::invoke(std::forward<_Func>(__f), std::move(error())); } @@ -679,7 +1019,7 @@ public: static_assert(is_same_v<typename _Gp::value_type, _Tp>, "The result of f(std::move(error())) must have the same value_type as this expected"); if (has_value()) { - return _Gp(in_place, std::move(__union_.__val_)); + return _Gp(in_place, std::move(this->__val())); } return std::invoke(std::forward<_Func>(__f), std::move(error())); } @@ -693,9 +1033,9 @@ public: } if constexpr (!is_void_v<_Up>) { return expected<_Up, _Err>( - __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_); + __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), this->__val()); } else { - std::invoke(std::forward<_Func>(__f), __union_.__val_); + std::invoke(std::forward<_Func>(__f), this->__val()); return expected<_Up, _Err>(); } } @@ -709,9 +1049,9 @@ public: } if constexpr (!is_void_v<_Up>) { return expected<_Up, _Err>( - __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_); + __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), this->__val()); } else { - std::invoke(std::forward<_Func>(__f), __union_.__val_); + std::invoke(std::forward<_Func>(__f), this->__val()); return expected<_Up, _Err>(); } } @@ -725,9 +1065,9 @@ public: } if constexpr (!is_void_v<_Up>) { return expected<_Up, _Err>( - __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(__union_.__val_)); + __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(this->__val())); } else { - std::invoke(std::forward<_Func>(__f), std::move(__union_.__val_)); + std::invoke(std::forward<_Func>(__f), std::move(this->__val())); return expected<_Up, _Err>(); } } @@ -741,9 +1081,9 @@ public: } if constexpr (!is_void_v<_Up>) { return expected<_Up, _Err>( - __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(__union_.__val_)); + __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(this->__val())); } else { - std::invoke(std::forward<_Func>(__f), std::move(__union_.__val_)); + std::invoke(std::forward<_Func>(__f), std::move(this->__val())); return expected<_Up, _Err>(); } } @@ -755,7 +1095,7 @@ public: static_assert(__valid_std_unexpected<_Gp>::value, "The result of f(error()) must be a valid template argument for unexpected"); if (has_value()) { - return expected<_Tp, _Gp>(in_place, __union_.__val_); + return expected<_Tp, _Gp>(in_place, this->__val()); } return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), error()); } @@ -767,7 +1107,7 @@ public: static_assert(__valid_std_unexpected<_Gp>::value, "The result of f(error()) must be a valid template argument for unexpected"); if (has_value()) { - return expected<_Tp, _Gp>(in_place, __union_.__val_); + return expected<_Tp, _Gp>(in_place, this->__val()); } return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), error()); } @@ -779,7 +1119,7 @@ public: static_assert(__valid_std_unexpected<_Gp>::value, "The result of f(std::move(error())) must be a valid template argument for unexpected"); if (has_value()) { - return expected<_Tp, _Gp>(in_place, std::move(__union_.__val_)); + return expected<_Tp, _Gp>(in_place, std::move(this->__val())); } return expected<_Tp, _Gp>( __expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), std::move(error())); @@ -792,7 +1132,7 @@ public: static_assert(__valid_std_unexpected<_Gp>::value, "The result of f(std::move(error())) must be a valid template argument for unexpected"); if (has_value()) { - return expected<_Tp, _Gp>(in_place, std::move(__union_.__val_)); + return expected<_Tp, _Gp>(in_place, std::move(this->__val())); } return expected<_Tp, _Gp>( __expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), std::move(error())); @@ -802,123 +1142,220 @@ public: template <class _T2, class _E2> requires(!is_void_v<_T2>) _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) { - if (__x.__has_val_ != __y.__has_val_) { + if (__x.__has_val() != __y.__has_val()) { return false; } else { - if (__x.__has_val_) { - return __x.__union_.__val_ == __y.__union_.__val_; + if (__x.__has_val()) { + return __x.__val() == __y.__val(); } else { - return __x.__union_.__unex_ == __y.__union_.__unex_; + return __x.__unex() == __y.__unex(); } } } template <class _T2> _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const _T2& __v) { - return __x.__has_val_ && static_cast<bool>(__x.__union_.__val_ == __v); + return __x.__has_val() && static_cast<bool>(__x.__val() == __v); } template <class _E2> _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>& __e) { - return !__x.__has_val_ && static_cast<bool>(__x.__union_.__unex_ == __e.error()); + return !__x.__has_val() && static_cast<bool>(__x.__unex() == __e.error()); } +}; -private: - template <class _ValueType, class _ErrorType> +template <class _Err> +class __expected_void_base { + struct __empty_t {}; + // use named union because [[no_unique_address]] cannot be applied to an unnamed union, + // also guaranteed elision into a potentially-overlapping subobject is unsettled (and + // it's not clear that it's implementable, given that the function is allowed to clobber + // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107. union __union_t { - template <class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::in_place_t, _Args&&... __args) - : __val_(std::forward<_Args>(__args)...) {} + _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) + requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>) + = default; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&) + requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>) + = default; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(__union_t&&) = delete; + + _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(in_place_t) : __empty_() {} template <class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::unexpect_t, _Args&&... __args) + _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(unexpect_t, _Args&&... __args) : __unex_(std::forward<_Args>(__args)...) {} template <class _Func, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t( - std::__expected_construct_in_place_from_invoke_tag, _Func&& __f, _Args&&... __args) - : __val_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} - - template <class _Func, class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t( - std::__expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args) + __expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args) : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} - template <class _Union> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) { - if (__has_val) - std::construct_at(std::addressof(__val_), std::forward<_Union>(__other).__val_); - else - std::construct_at(std::addressof(__unex_), std::forward<_Union>(__other).__unex_); - } - _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() - requires(is_trivially_destructible_v<_ValueType> && is_trivially_destructible_v<_ErrorType>) + requires(is_trivially_destructible_v<_Err>) = default; - // the expected's destructor handles this - _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() {} + // __repr's destructor handles this + _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() + requires(!is_trivially_destructible_v<_Err>) + {} - _ValueType __val_; - _ErrorType __unex_; + _LIBCPP_NO_UNIQUE_ADDRESS __empty_t __empty_; + _LIBCPP_NO_UNIQUE_ADDRESS _Err __unex_; }; - // use named union because [[no_unique_address]] cannot be applied to an unnamed union, - // also guaranteed elision into a potentially-overlapping subobject is unsettled (and - // it's not clear that it's implementable, given that the function is allowed to clobber - // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107. - template <class _ValueType, class _ErrorType> - requires(is_trivially_move_constructible_v<_ValueType> && is_trivially_move_constructible_v<_ErrorType>) - union __union_t<_ValueType, _ErrorType> { - _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default; - _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = default; + static constexpr bool __put_flag_in_tail = __fits_in_tail_padding<__union_t, bool>; + static constexpr bool __allow_reusing_expected_tail_padding = !__put_flag_in_tail; + + struct __repr { + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr() = delete; template <class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::in_place_t, _Args&&... __args) - : __val_(std::forward<_Args>(__args)...) {} + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(in_place_t __tag) : __union_(in_place, __tag), __has_val_(true) {} template <class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::unexpect_t, _Args&&... __args) - : __unex_(std::forward<_Args>(__args)...) {} + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(unexpect_t __tag, _Args&&... __args) + : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {} - template <class _Func, class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t( - std::__expected_construct_in_place_from_invoke_tag, _Func&& __f, _Args&&... __args) - : __val_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(std::__expected_construct_unexpected_from_invoke_tag __tag, + _Args&&... __args) + : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {} + + template <class _OtherUnion> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(bool __has_val, _OtherUnion&& __other) + requires(__allow_reusing_expected_tail_padding) + : __union_(__conditional_no_unique_address_invoke_tag{}, + [&] { return __make_union(__has_val, std::forward<_OtherUnion>(__other)); }), + __has_val_(__has_val) {} + + _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&) + requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>) + = default; + _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&) + requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>) + = default; - template <class _Func, class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t( - std::__expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args) - : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} + _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(const __repr&) = delete; + _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(__repr&&) = delete; + + _LIBCPP_HIDE_FROM_ABI constexpr ~__repr() + requires(is_trivially_destructible_v<_Err>) + = default; - template <class _Union> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) { + _LIBCPP_HIDE_FROM_ABI constexpr ~__repr() + requires(!is_trivially_destructible_v<_Err>) + { + __destroy_union_member(); + } + + _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union() + requires(__allow_reusing_expected_tail_padding && is_trivially_destructible_v<_Err>) + { + std::destroy_at(&__union_.__v); + } + + _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union() + requires(__allow_reusing_expected_tail_padding && !is_trivially_destructible_v<_Err>) + { + __destroy_union_member(); + std::destroy_at(&__union_.__v); + } + + _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(in_place_t) + requires(__allow_reusing_expected_tail_padding) + { + std::construct_at(&__union_.__v, in_place); + __has_val_ = true; + } + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(unexpect_t, _Args&&... __args) + requires(__allow_reusing_expected_tail_padding) + { + std::construct_at(&__union_.__v, unexpect, std::forward<_Args>(__args)...); + __has_val_ = false; + } + + private: + template <class> + friend class __expected_void_base; + + _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union_member() + requires(!is_trivially_destructible_v<_Err>) + { + if (!__has_val_) + std::destroy_at(std::addressof(__union_.__v.__unex_)); + } + + template <class _OtherUnion> + _LIBCPP_HIDE_FROM_ABI static constexpr __union_t __make_union(bool __has_val, _OtherUnion&& __other) + requires(__allow_reusing_expected_tail_padding) + { if (__has_val) - std::construct_at(std::addressof(__val_), std::forward<_Union>(__other).__val_); + return __union_t(in_place); else - std::construct_at(std::addressof(__unex_), std::forward<_Union>(__other).__unex_); + return __union_t(unexpect, std::forward<_OtherUnion>(__other).__unex_); } - _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() - requires(is_trivially_destructible_v<_ValueType> && is_trivially_destructible_v<_ErrorType>) - = default; + _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__put_flag_in_tail, __union_t> __union_; + _LIBCPP_NO_UNIQUE_ADDRESS bool __has_val_; + }; - // the expected's destructor handles this - _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() - requires(!is_trivially_destructible_v<_ValueType> || !is_trivially_destructible_v<_ErrorType>) - {} + template <class _OtherUnion> + _LIBCPP_HIDE_FROM_ABI static constexpr __repr __make_repr(bool __has_val, _OtherUnion&& __other) + requires(__put_flag_in_tail) + { + if (__has_val) + return __repr(in_place); + else + return __repr(unexpect, std::forward<_OtherUnion>(__other).__unex_); + } - _LIBCPP_NO_UNIQUE_ADDRESS _ValueType __val_; - _LIBCPP_NO_UNIQUE_ADDRESS _ErrorType __unex_; - }; +protected: + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_void_base(_Args&&... __args) + : __repr_(in_place, std::forward<_Args>(__args)...) {} + + template <class _OtherUnion> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_void_base(bool __has_val, _OtherUnion&& __other) + requires(__put_flag_in_tail) + : __repr_(__conditional_no_unique_address_invoke_tag{}, + [&] { return __make_repr(__has_val, std::forward<_OtherUnion>(__other)); }) {} - _LIBCPP_NO_UNIQUE_ADDRESS __union_t<_Tp, _Err> __union_; - bool __has_val_; + _LIBCPP_HIDE_FROM_ABI constexpr void __destroy() { + if constexpr (__put_flag_in_tail) + std::destroy_at(&__repr_.__v); + else + __repr_.__v.__destroy_union(); + } + + template <class _Tag, class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr void __construct(_Tag __tag, _Args&&... __args) { + if constexpr (__put_flag_in_tail) + std::construct_at(&__repr_.__v, __tag, std::forward<_Args>(__args)...); + else + __repr_.__v.__construct_union(__tag, std::forward<_Args>(__args)...); + } + + _LIBCPP_HIDE_FROM_ABI constexpr bool __has_val() const { return __repr_.__v.__has_val_; } + _LIBCPP_HIDE_FROM_ABI constexpr __union_t& __union() { return __repr_.__v.__union_.__v; } + _LIBCPP_HIDE_FROM_ABI constexpr const __union_t& __union() const { return __repr_.__v.__union_.__v; } + _LIBCPP_HIDE_FROM_ABI constexpr _Err& __unex() { return __repr_.__v.__union_.__v.__unex_; } + _LIBCPP_HIDE_FROM_ABI constexpr const _Err& __unex() const { return __repr_.__v.__union_.__v.__unex_; } + +private: + _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__allow_reusing_expected_tail_padding, __repr> __repr_; }; template <class _Tp, class _Err> requires is_void_v<_Tp> -class expected<_Tp, _Err> { +class expected<_Tp, _Err> : private __expected_void_base<_Err> { static_assert(__valid_std_unexpected<_Err>::value, "[expected.void.general] A program that instantiates expected<T, E> with a E that is not a " "valid argument for unexpected<E> is ill-formed"); @@ -935,6 +1372,8 @@ class expected<_Tp, _Err> { _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>, _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>>>; + using __base = __expected_void_base<_Err>; + public: using value_type = _Tp; using error_type = _Err; @@ -944,7 +1383,7 @@ public: using rebind = expected<_Up, error_type>; // [expected.void.ctor], constructors - _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept : __has_val_(true) {} + _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept : __base(in_place) {} _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete; @@ -955,7 +1394,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __rhs) noexcept( is_nothrow_copy_constructible_v<_Err>) // strengthened requires(is_copy_constructible_v<_Err> && !is_trivially_copy_constructible_v<_Err>) - : __union_(__rhs.__has_val_, __rhs.__union_), __has_val_(__rhs.__has_val_) {} + : __base(__rhs.__has_val(), __rhs.__union()) {} _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&) requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>) @@ -963,93 +1402,93 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __rhs) noexcept(is_nothrow_move_constructible_v<_Err>) requires(is_move_constructible_v<_Err> && !is_trivially_move_constructible_v<_Err>) - : __union_(__rhs.__has_val_, std::move(__rhs.__union_)), __has_val_(__rhs.__has_val_) {} + : __base(__rhs.__has_val(), std::move(__rhs.__union())) {} template <class _Up, class _OtherErr> requires __can_convert<_Up, _OtherErr, const _OtherErr&>::value _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(const expected<_Up, _OtherErr>& __rhs) noexcept( is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened - : __union_(__rhs.__has_val_, __rhs.__union_), __has_val_(__rhs.__has_val_) {} + : __base(__rhs.__has_val(), __rhs.__union()) {} template <class _Up, class _OtherErr> requires __can_convert<_Up, _OtherErr, _OtherErr>::value _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>) expected(expected<_Up, _OtherErr>&& __rhs) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened - : __union_(__rhs.__has_val_, std::move(__rhs.__union_)), __has_val_(__rhs.__has_val_) {} + : __base(__rhs.__has_val(), std::move(__rhs.__union())) {} template <class _OtherErr> requires is_constructible_v<_Err, const _OtherErr&> _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected( const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened - : __union_(std::unexpect, __unex.error()), __has_val_(false) {} + : __base(unexpect, __unex.error()) {} template <class _OtherErr> requires is_constructible_v<_Err, _OtherErr> _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>) expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened - : __union_(std::unexpect, std::move(__unex.error())), __has_val_(false) {} + : __base(unexpect, std::move(__unex.error())) {} - _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t) noexcept : __has_val_(true) {} + _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t) noexcept : __base(in_place) {} template <class... _Args> requires is_constructible_v<_Err, _Args...> _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Err, _Args...>) // strengthened - : __union_(std::unexpect, std::forward<_Args>(__args)...), __has_val_(false) {} + : __base(unexpect, std::forward<_Args>(__args)...) {} template <class _Up, class... _Args> requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... > _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened - : __union_(std::unexpect, __il, std::forward<_Args>(__args)...), __has_val_(false) {} + : __base(unexpect, __il, std::forward<_Args>(__args)...) {} private: - template <class _Func> - _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(__expected_construct_in_place_from_invoke_tag, _Func&& __f) - : __has_val_(true) { - std::invoke(std::forward<_Func>(__f)); - } - template <class _Func, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr explicit expected( __expected_construct_unexpected_from_invoke_tag __tag, _Func&& __f, _Args&&... __args) - : __union_(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...), __has_val_(false) {} + : __base(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...) {} public: // [expected.void.dtor], destructor - _LIBCPP_HIDE_FROM_ABI constexpr ~expected() - requires is_trivially_destructible_v<_Err> - = default; + _LIBCPP_HIDE_FROM_ABI constexpr ~expected() = default; - _LIBCPP_HIDE_FROM_ABI constexpr ~expected() - requires(!is_trivially_destructible_v<_Err>) - { - if (!__has_val_) { - std::destroy_at(std::addressof(__union_.__unex_)); - } +private: + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr void __reinit_expected(unexpect_t, _Args&&... __args) { + _LIBCPP_ASSERT_INTERNAL(this->__has_val(), "__reinit_expected(unexpect_t, ...) needs value to be set"); + + this->__destroy(); + auto __trans = std::__make_exception_guard([&] { this->__construct(in_place); }); + this->__construct(unexpect, std::forward<_Args>(__args)...); + __trans.__complete(); } - // [expected.void.assign], assignment + _LIBCPP_HIDE_FROM_ABI constexpr void __reinit_expected(in_place_t) { + _LIBCPP_ASSERT_INTERNAL(!this->__has_val(), "__reinit_expected(in_place_t, ...) needs value to be unset"); + this->__destroy(); + this->__construct(in_place); + } + +public: + // [expected.void.assign], assignment _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete; _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept( is_nothrow_copy_assignable_v<_Err> && is_nothrow_copy_constructible_v<_Err>) // strengthened requires(is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>) { - if (__has_val_) { - if (!__rhs.__has_val_) { - std::construct_at(std::addressof(__union_.__unex_), __rhs.__union_.__unex_); - __has_val_ = false; + if (this->__has_val()) { + if (!__rhs.__has_val()) { + __reinit_expected(unexpect, __rhs.__unex()); } } else { - if (__rhs.__has_val_) { - std::destroy_at(std::addressof(__union_.__unex_)); - __has_val_ = true; + if (__rhs.__has_val()) { + __reinit_expected(in_place); } else { - __union_.__unex_ = __rhs.__union_.__unex_; + this->__unex() = __rhs.__unex(); } } return *this; @@ -1061,17 +1500,15 @@ public: operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Err> && is_nothrow_move_constructible_v<_Err>) requires(is_move_assignable_v<_Err> && is_move_constructible_v<_Err>) { - if (__has_val_) { - if (!__rhs.__has_val_) { - std::construct_at(std::addressof(__union_.__unex_), std::move(__rhs.__union_.__unex_)); - __has_val_ = false; + if (this->__has_val()) { + if (!__rhs.__has_val()) { + __reinit_expected(unexpect, std::move(__rhs.__unex())); } } else { - if (__rhs.__has_val_) { - std::destroy_at(std::addressof(__union_.__unex_)); - __has_val_ = true; + if (__rhs.__has_val()) { + __reinit_expected(in_place); } else { - __union_.__unex_ = std::move(__rhs.__union_.__unex_); + this->__unex() = std::move(__rhs.__unex()); } } return *this; @@ -1080,11 +1517,10 @@ public: template <class _OtherErr> requires(is_constructible_v<_Err, const _OtherErr&> && is_assignable_v<_Err&, const _OtherErr&>) _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) { - if (__has_val_) { - std::construct_at(std::addressof(__union_.__unex_), __un.error()); - __has_val_ = false; + if (this->__has_val()) { + __reinit_expected(unexpect, __un.error()); } else { - __union_.__unex_ = __un.error(); + this->__unex() = __un.error(); } return *this; } @@ -1092,19 +1528,17 @@ public: template <class _OtherErr> requires(is_constructible_v<_Err, _OtherErr> && is_assignable_v<_Err&, _OtherErr>) _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) { - if (__has_val_) { - std::construct_at(std::addressof(__union_.__unex_), std::move(__un.error())); - __has_val_ = false; + if (this->__has_val()) { + __reinit_expected(unexpect, std::move(__un.error())); } else { - __union_.__unex_ = std::move(__un.error()); + this->__unex() = std::move(__un.error()); } return *this; } _LIBCPP_HIDE_FROM_ABI constexpr void emplace() noexcept { - if (!__has_val_) { - std::destroy_at(std::addressof(__union_.__unex_)); - __has_val_ = true; + if (!this->__has_val()) { + __reinit_expected(in_place); } } @@ -1113,23 +1547,23 @@ public: swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>) requires(is_swappable_v<_Err> && is_move_constructible_v<_Err>) { - auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) { - std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__with_err.__union_.__unex_)); - std::destroy_at(std::addressof(__with_err.__union_.__unex_)); - __with_val.__has_val_ = false; - __with_err.__has_val_ = true; + auto __swap_val_unex_impl = [](expected& __with_val, expected& __with_err) { + // May throw, but will re-engage `__with_val` in that case. + __with_val.__reinit_expected(unexpect, std::move(__with_err.__unex())); + // Will not throw. + __with_err.__reinit_expected(in_place); }; - if (__has_val_) { - if (!__rhs.__has_val_) { + if (this->__has_val()) { + if (!__rhs.__has_val()) { __swap_val_unex_impl(*this, __rhs); } } else { - if (__rhs.__has_val_) { + if (__rhs.__has_val()) { __swap_val_unex_impl(__rhs, *this); } else { using std::swap; - swap(__union_.__unex_, __rhs.__union_.__unex_); + swap(this->__unex(), __rhs.__unex()); } } } @@ -1141,44 +1575,51 @@ public: } // [expected.void.obs], observers - _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __has_val_; } + _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return this->__has_val(); } - _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __has_val_; } + _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); } _LIBCPP_HIDE_FROM_ABI constexpr void operator*() const noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + this->__has_val(), "expected::operator* requires the expected to contain a value"); } _LIBCPP_HIDE_FROM_ABI constexpr void value() const& { - if (!__has_val_) { - std::__throw_bad_expected_access<_Err>(__union_.__unex_); + static_assert(is_copy_constructible_v<_Err>); + if (!this->__has_val()) { + std::__throw_bad_expected_access<_Err>(this->__unex()); } } _LIBCPP_HIDE_FROM_ABI constexpr void value() && { - if (!__has_val_) { - std::__throw_bad_expected_access<_Err>(std::move(__union_.__unex_)); + static_assert(is_copy_constructible_v<_Err> && is_move_constructible_v<_Err>); + if (!this->__has_val()) { + std::__throw_bad_expected_access<_Err>(std::move(this->__unex())); } } _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error"); - return __union_.__unex_; + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !this->__has_val(), "expected::error requires the expected to contain an error"); + return this->__unex(); } _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error"); - return __union_.__unex_; + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !this->__has_val(), "expected::error requires the expected to contain an error"); + return this->__unex(); } _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error"); - return std::move(__union_.__unex_); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !this->__has_val(), "expected::error requires the expected to contain an error"); + return std::move(this->__unex()); } _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error"); - return std::move(__union_.__unex_); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !this->__has_val(), "expected::error requires the expected to contain an error"); + return std::move(this->__unex()); } template <class _Up = _Err> @@ -1414,96 +1855,17 @@ public: template <class _T2, class _E2> requires is_void_v<_T2> _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) { - if (__x.__has_val_ != __y.__has_val_) { + if (__x.__has_val() != __y.__has_val()) { return false; } else { - return __x.__has_val_ || static_cast<bool>(__x.__union_.__unex_ == __y.__union_.__unex_); + return __x.__has_val() || static_cast<bool>(__x.__unex() == __y.__unex()); } } template <class _E2> _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>& __y) { - return !__x.__has_val_ && static_cast<bool>(__x.__union_.__unex_ == __y.error()); + return !__x.__has_val() && static_cast<bool>(__x.__unex() == __y.error()); } - -private: - struct __empty_t {}; - - template <class _ErrorType> - union __union_t { - _LIBCPP_HIDE_FROM_ABI constexpr __union_t() : __empty_() {} - - template <class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::unexpect_t, _Args&&... __args) - : __unex_(std::forward<_Args>(__args)...) {} - - template <class _Func, class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t( - __expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args) - : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} - - template <class _Union> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) { - if (__has_val) - std::construct_at(std::addressof(__empty_)); - else - std::construct_at(std::addressof(__unex_), std::forward<_Union>(__other).__unex_); - } - - _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() - requires(is_trivially_destructible_v<_ErrorType>) - = default; - - // the expected's destructor handles this - _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() {} - - __empty_t __empty_; - _ErrorType __unex_; - }; - - // use named union because [[no_unique_address]] cannot be applied to an unnamed union, - // also guaranteed elision into a potentially-overlapping subobject is unsettled (and - // it's not clear that it's implementable, given that the function is allowed to clobber - // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107. - template <class _ErrorType> - requires is_trivially_move_constructible_v<_ErrorType> - union __union_t<_ErrorType> { - _LIBCPP_HIDE_FROM_ABI constexpr __union_t() : __empty_() {} - _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default; - _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = default; - - template <class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::unexpect_t, _Args&&... __args) - : __unex_(std::forward<_Args>(__args)...) {} - - template <class _Func, class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t( - __expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args) - : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {} - - template <class _Union> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) { - if (__has_val) - std::construct_at(std::addressof(__empty_)); - else - std::construct_at(std::addressof(__unex_), std::forward<_Union>(__other).__unex_); - } - - _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() - requires(is_trivially_destructible_v<_ErrorType>) - = default; - - // the expected's destructor handles this - _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() - requires(!is_trivially_destructible_v<_ErrorType>) - {} - - _LIBCPP_NO_UNIQUE_ADDRESS __empty_t __empty_; - _LIBCPP_NO_UNIQUE_ADDRESS _ErrorType __unex_; - }; - - _LIBCPP_NO_UNIQUE_ADDRESS __union_t<_Err> __union_; - bool __has_val_; }; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_iterator.h index 29bd8da6ca..a5aa5ff543 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_iterator.h @@ -29,6 +29,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM) _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM @@ -73,7 +76,8 @@ public: _LIBCPP_HIDE_FROM_ABI ~directory_iterator() = default; _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const { - _LIBCPP_ASSERT_UNCATEGORIZED(__imp_, "The end iterator cannot be dereferenced"); + // Note: this check duplicates a check in `__dereference()`. + _LIBCPP_ASSERT_NON_NULL(__imp_, "The end iterator cannot be dereferenced"); return __dereference(); } @@ -143,4 +147,6 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool #endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM) +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FILESYSTEM_DIRECTORY_ITERATOR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h index 1ff992dd64..9ffc90ada5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h @@ -14,9 +14,8 @@ #include <__algorithm/replace_copy.h> #include <__availability> #include <__config> -#include <__functional/hash.h> #include <__functional/unary_function.h> -#include <__fwd/hash.h> +#include <__fwd/functional.h> #include <__iterator/back_insert_iterator.h> #include <__iterator/iterator_traits.h> #include <__type_traits/decay.h> @@ -36,6 +35,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM @@ -925,4 +927,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FILESYSTEM_PATH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/path_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/path_iterator.h index 1a9aaf0e7d..d2d65cd122 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/path_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/path_iterator.h @@ -61,7 +61,7 @@ public: _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return &__stashed_elem_; } _LIBCPP_HIDE_FROM_ABI iterator& operator++() { - _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular, "attempting to increment a singular iterator"); + _LIBCPP_ASSERT_NON_NULL(__state_ != _Singular, "attempting to increment a singular iterator"); _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _AtEnd, "attempting to increment the end iterator"); return __increment(); } @@ -73,7 +73,7 @@ public: } _LIBCPP_HIDE_FROM_ABI iterator& operator--() { - _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular, "attempting to decrement a singular iterator"); + _LIBCPP_ASSERT_NON_NULL(__state_ != _Singular, "attempting to decrement a singular iterator"); _LIBCPP_ASSERT_UNCATEGORIZED( __entry_.data() != __path_ptr_->native().data(), "attempting to decrement the begin iterator"); return __decrement(); diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/recursive_directory_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/recursive_directory_iterator.h index 7519cc2f29..a8af4f73b1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/recursive_directory_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/recursive_directory_iterator.h @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM) _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM @@ -157,4 +160,6 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool #endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM) +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h index 7ee583d813..8598f0a1c0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h @@ -115,7 +115,7 @@ public: // The output doesn't fit in the internal buffer. // Copy the data in "__capacity_" sized chunks. - _LIBCPP_ASSERT_UNCATEGORIZED(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); + _LIBCPP_ASSERT_INTERNAL(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); const _InCharT* __first = __str.data(); do { size_t __chunk = std::min(__n, __capacity_); @@ -134,7 +134,7 @@ public: class _UnaryOperation, __fmt_char_type _InCharT = typename iterator_traits<_Iterator>::value_type> _LIBCPP_HIDE_FROM_ABI void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) { - _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "not a valid range"); + _LIBCPP_ASSERT_INTERNAL(__first <= __last, "not a valid range"); size_t __n = static_cast<size_t>(__last - __first); __flush_on_overflow(__n); @@ -146,7 +146,7 @@ public: // The output doesn't fit in the internal buffer. // Transform the data in "__capacity_" sized chunks. - _LIBCPP_ASSERT_UNCATEGORIZED(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); + _LIBCPP_ASSERT_INTERNAL(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); do { size_t __chunk = std::min(__n, __capacity_); std::transform(__first, __first + __chunk, std::addressof(__ptr_[__size_]), __operation); @@ -168,7 +168,7 @@ public: // The output doesn't fit in the internal buffer. // Fill the buffer in "__capacity_" sized chunks. - _LIBCPP_ASSERT_UNCATEGORIZED(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); + _LIBCPP_ASSERT_INTERNAL(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); do { size_t __chunk = std::min(__n, __capacity_); std::fill_n(std::addressof(__ptr_[__size_]), __chunk, __value); @@ -596,7 +596,7 @@ public: class _UnaryOperation, __fmt_char_type _InCharT = typename iterator_traits<_Iterator>::value_type> _LIBCPP_HIDE_FROM_ABI void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) { - _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "not a valid range"); + _LIBCPP_ASSERT_INTERNAL(__first <= __last, "not a valid range"); size_t __n = static_cast<size_t>(__last - __first); if (__size_ + __n >= __capacity_) @@ -623,7 +623,7 @@ private: _LIBCPP_HIDE_FROM_ABI void __grow_buffer() { __grow_buffer(__capacity_ * 1.6); } _LIBCPP_HIDE_FROM_ABI void __grow_buffer(size_t __capacity) { - _LIBCPP_ASSERT_UNCATEGORIZED(__capacity > __capacity_, "the buffer must grow"); + _LIBCPP_ASSERT_INTERNAL(__capacity > __capacity_, "the buffer must grow"); auto __result = std::__allocate_at_least(__alloc_, __capacity); auto __guard = std::__make_exception_guard([&] { allocator_traits<_Alloc>::deallocate(__alloc_, __result.ptr, __result.count); diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h index 280c910824..b786ac3b36 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h @@ -30,6 +30,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -83,7 +86,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __use_packed_format_arg_store(size_t __size } _LIBCPP_HIDE_FROM_ABI constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) { - _LIBCPP_ASSERT_UNCATEGORIZED(__id <= __packed_types_max, ""); + _LIBCPP_ASSERT_INTERNAL(__id <= __packed_types_max, ""); if (__id > 0) __types >>= __id * __packed_arg_t_bits; @@ -93,7 +96,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr __arg_t __get_packed_type(uint64_t __types, size } // namespace __format -// This function is not user obervable, so it can directly use the non-standard +// This function is not user observable, so it can directly use the non-standard // types of the "variant". See __arg_t for more details. template <class _Visitor, class _Context> _LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { @@ -144,6 +147,59 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_ __libcpp_unreachable(); } +# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) + +template <class _Rp, class _Visitor, class _Context> +_LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { + switch (__arg.__type_) { + case __format::__arg_t::__none: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__monostate_); + case __format::__arg_t::__boolean: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__boolean_); + case __format::__arg_t::__char_type: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__char_type_); + case __format::__arg_t::__int: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__int_); + case __format::__arg_t::__long_long: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__long_long_); + case __format::__arg_t::__i128: +# ifndef _LIBCPP_HAS_NO_INT128 + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__i128_); +# else + __libcpp_unreachable(); +# endif + case __format::__arg_t::__unsigned: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__unsigned_); + case __format::__arg_t::__unsigned_long_long: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__unsigned_long_long_); + case __format::__arg_t::__u128: +# ifndef _LIBCPP_HAS_NO_INT128 + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__u128_); +# else + __libcpp_unreachable(); +# endif + case __format::__arg_t::__float: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__float_); + case __format::__arg_t::__double: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__double_); + case __format::__arg_t::__long_double: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__long_double_); + case __format::__arg_t::__const_char_type_ptr: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__const_char_type_ptr_); + case __format::__arg_t::__string_view: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__string_view_); + case __format::__arg_t::__ptr: + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__ptr_); + case __format::__arg_t::__handle: + return std::invoke_r<_Rp>( + std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__arg.__value_.__handle_}); + } + + __libcpp_unreachable(); +} + +# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) + /// Contains the values used in basic_format_arg. /// /// This is a separate type so it's possible to store the values and types in @@ -227,6 +283,52 @@ public: _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __type_ != __format::__arg_t::__none; } +# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) + + // This function is user facing, so it must wrap the non-standard types of + // the "variant" in a handle to stay conforming. See __arg_t for more details. + template <class _Visitor> + _LIBCPP_HIDE_FROM_ABI decltype(auto) visit(this basic_format_arg __arg, _Visitor&& __vis) { + switch (__arg.__type_) { +# ifndef _LIBCPP_HAS_NO_INT128 + case __format::__arg_t::__i128: { + typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_}; + return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h}); + } + + case __format::__arg_t::__u128: { + typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_}; + return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h}); + } +# endif + default: + return std::__visit_format_arg(std::forward<_Visitor>(__vis), __arg); + } + } + + // This function is user facing, so it must wrap the non-standard types of + // the "variant" in a handle to stay conforming. See __arg_t for more details. + template <class _Rp, class _Visitor> + _LIBCPP_HIDE_FROM_ABI _Rp visit(this basic_format_arg __arg, _Visitor&& __vis) { + switch (__arg.__type_) { +# ifndef _LIBCPP_HAS_NO_INT128 + case __format::__arg_t::__i128: { + typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_}; + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h}); + } + + case __format::__arg_t::__u128: { + typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_}; + return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h}); + } +# endif + default: + return std::__visit_format_arg<_Rp>(std::forward<_Visitor>(__vis), __arg); + } + } + +# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) + private: using char_type = typename _Context::char_type; @@ -267,7 +369,11 @@ private: // This function is user facing, so it must wrap the non-standard types of // the "variant" in a handle to stay conforming. See __arg_t for more details. template <class _Visitor, class _Context> -_LIBCPP_HIDE_FROM_ABI decltype(auto) visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { +# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) +_LIBCPP_DEPRECATED_IN_CXX26 +# endif + _LIBCPP_HIDE_FROM_ABI decltype(auto) + visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { switch (__arg.__type_) { # ifndef _LIBCPP_HAS_NO_INT128 case __format::__arg_t::__i128: { @@ -279,7 +385,7 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) visit_format_arg(_Visitor&& __vis, basic_fo typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_}; return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h}); } -# endif +# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) default: return std::__visit_format_arg(std::forward<_Visitor>(__vis), __arg); } @@ -289,4 +395,6 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) visit_format_arg(_Visitor&& __vis, basic_fo _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FORMAT_FORMAT_ARG_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h index c481992d2d..066cd369eb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h @@ -228,15 +228,15 @@ _LIBCPP_HIDE_FROM_ABI void __store_basic_format_arg(basic_format_arg<_Context>* ([&] { *__data++ = __format::__create_format_arg<_Context>(__args); }(), ...); } -template <class _Context, size_t N> +template <class _Context, size_t _Np> struct __packed_format_arg_store { - __basic_format_arg_value<_Context> __values_[N]; + __basic_format_arg_value<_Context> __values_[_Np]; uint64_t __types_ = 0; }; -template <class _Context, size_t N> +template <class _Context, size_t _Np> struct __unpacked_format_arg_store { - basic_format_arg<_Context> __args_[N]; + basic_format_arg<_Context> __args_[_Np]; }; } // namespace __format diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h index 5b252b81f6..68dcdb49d3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h @@ -35,6 +35,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -163,20 +166,25 @@ public: # endif __ctx_(std::addressof(__ctx)), __arg_([](void* __c, size_t __id) { - return std::visit_format_arg( - [&](auto __arg) -> basic_format_arg<basic_format_context> { - if constexpr (same_as<decltype(__arg), monostate>) - return {}; - else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Context>::handle>) - // At the moment it's not possible for formatting to use a re-targeted handle. - // TODO FMT add this when support is needed. - std::__throw_format_error("Re-targeting handle not supported"); - else - return basic_format_arg<basic_format_context>{ - __format::__determine_arg_t<basic_format_context, decltype(__arg)>(), - __basic_format_arg_value<basic_format_context>(__arg)}; - }, - static_cast<_Context*>(__c)->arg(__id)); + auto __visitor = [&](auto __arg) -> basic_format_arg<basic_format_context> { + if constexpr (same_as<decltype(__arg), monostate>) + return {}; + else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Context>::handle>) + // At the moment it's not possible for formatting to use a re-targeted handle. + // TODO FMT add this when support is needed. + std::__throw_format_error("Re-targeting handle not supported"); + else + return basic_format_arg<basic_format_context>{ + __format::__determine_arg_t<basic_format_context, decltype(__arg)>(), + __basic_format_arg_value<basic_format_context>(__arg)}; + }; +# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) + return static_cast<_Context*>(__c)->arg(__id).visit(std::move(__visitor)); +# else + _LIBCPP_SUPPRESS_DEPRECATED_PUSH + return std::visit_format_arg(std::move(__visitor), static_cast<_Context*>(__c)->arg(__id)); + _LIBCPP_SUPPRESS_DEPRECATED_POP +# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) }) { } @@ -205,4 +213,6 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_context); _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FORMAT_FORMAT_CONTEXT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_functions.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_functions.h index 015bff70f5..3ee53539f4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_functions.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_functions.h @@ -48,6 +48,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -64,14 +67,14 @@ using wformat_args = basic_format_args<wformat_context>; template <class _Context = format_context, class... _Args> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&... __args) { - return _VSTD::__format_arg_store<_Context, _Args...>(__args...); + return std::__format_arg_store<_Context, _Args...>(__args...); } # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI __format_arg_store<wformat_context, _Args...> make_wformat_args(_Args&... __args) { - return _VSTD::__format_arg_store<wformat_context, _Args...>(__args...); + return std::__format_arg_store<wformat_context, _Args...>(__args...); } # endif @@ -674,4 +677,6 @@ formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FORMAT_FORMAT_FUNCTIONS diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h index 3c8ae95f55..5e3daff7b3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h @@ -22,7 +22,7 @@ #include <__utility/unreachable.h> #ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include <locale> +# include <__locale> #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -62,7 +62,7 @@ public: static_cast<unsigned>(__value), __ctx, __parser_.__get_parsed_std_specifications(__ctx)); default: - _LIBCPP_ASSERT_UNCATEGORIZED(false, "The parse function should have validated the type"); + _LIBCPP_ASSERT_INTERNAL(false, "The parse function should have validated the type"); __libcpp_unreachable(); } } diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h index 33cc2a4ed6..f01d323eff 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h @@ -16,6 +16,7 @@ #include <__algorithm/min.h> #include <__algorithm/rotate.h> #include <__algorithm/transform.h> +#include <__assert> #include <__charconv/chars_format.h> #include <__charconv/to_chars_floating_point.h> #include <__charconv/to_chars_result.h> @@ -57,21 +58,21 @@ namespace __formatter { template <floating_point _Tp> _LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value) { to_chars_result __r = std::to_chars(__first, __last, __value); - _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small"); return __r.ptr; } template <floating_point _Tp> _LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value, chars_format __fmt) { to_chars_result __r = std::to_chars(__first, __last, __value, __fmt); - _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small"); return __r.ptr; } template <floating_point _Tp> _LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value, chars_format __fmt, int __precision) { to_chars_result __r = std::to_chars(__first, __last, __value, __fmt, __precision); - _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small"); return __r.ptr; } @@ -252,10 +253,10 @@ __format_buffer_default(const __float_buffer<_Fp>& __buffer, _Tp __value, char* __result.__radix_point = __result.__last; // clang-format off - _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent == __result.__last || *__result.__exponent == 'e'), - "Post-condition failure."); + _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent == __result.__last || *__result.__exponent == 'e'), + "Post-condition failure."); // clang-format on return __result; @@ -304,10 +305,10 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case( } // clang-format off - _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent != __result.__last && *__result.__exponent == 'p'), - "Post-condition failure."); + _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent != __result.__last && *__result.__exponent == 'p'), + "Post-condition failure."); // clang-format on return __result; @@ -332,7 +333,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case( __formatter::__to_buffer(__integral, __buffer.end(), __value, chars_format::scientific, __precision); char* __first = __integral + 1; - _LIBCPP_ASSERT_UNCATEGORIZED(__first != __result.__last, "No exponent present"); + _LIBCPP_ASSERT_INTERNAL(__first != __result.__last, "No exponent present"); if (*__first == '.') { __result.__radix_point = __first; __result.__exponent = __formatter::__find_exponent(__first + 1, __result.__last); @@ -342,10 +343,10 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case( } // clang-format off - _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent != __result.__last && *__result.__exponent == 'e'), - "Post-condition failure."); + _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent != __result.__last && *__result.__exponent == 'e'), + "Post-condition failure."); // clang-format on return __result; } @@ -374,10 +375,10 @@ __format_buffer_fixed(const __float_buffer<_Fp>& __buffer, _Tp __value, int __pr __result.__exponent = __result.__last; // clang-format off - _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent == __result.__last), - "Post-condition failure."); + _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent == __result.__last), + "Post-condition failure."); // clang-format on return __result; } @@ -410,10 +411,10 @@ __format_buffer_general_lower_case(__float_buffer<_Fp>& __buffer, _Tp __value, i } // clang-format off - _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent == __result.__last || *__result.__exponent == 'e'), - "Post-condition failure."); + _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent == __result.__last || *__result.__exponent == 'e'), + "Post-condition failure."); // clang-format on return __result; @@ -485,7 +486,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer( return __formatter::__format_buffer_general_upper_case(__buffer, __value, __buffer.__precision(), __first); default: - _LIBCPP_ASSERT_UNCATEGORIZED(false, "The parser should have validated the type"); + _LIBCPP_ASSERT_INTERNAL(false, "The parser should have validated the type"); __libcpp_unreachable(); } } @@ -620,9 +621,8 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros( size_t __size, const _CharT* __exponent, size_t __num_trailing_zeros) -> decltype(__out_it) { - _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range"); - _LIBCPP_ASSERT_UNCATEGORIZED( - __num_trailing_zeros > 0, "The overload not writing trailing zeros should have been used"); + _LIBCPP_ASSERT_INTERNAL(__first <= __last, "Not a valid range"); + _LIBCPP_ASSERT_INTERNAL(__num_trailing_zeros > 0, "The overload not writing trailing zeros should have been used"); __padding_size_result __padding = __formatter::__padding_size(__size + __num_trailing_zeros, __specs.__width_, __specs.__alignment_); diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h index ca66e26ede..eca966f888 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h @@ -32,7 +32,7 @@ #include <string_view> #ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include <locale> +# include <__locale> #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -90,10 +90,8 @@ _LIBCPP_HIDE_FROM_ABI inline _Iterator __insert_sign(_Iterator __buf, bool __neg * regardless whether the @c std::numpunct's type is @c char or @c wchar_t. */ _LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptrdiff_t __size, const string& __grouping) { - _LIBCPP_ASSERT_UNCATEGORIZED( - !__grouping.empty() && __size > __grouping[0], - "The slow grouping formatting is used while there will be no " - "separators written"); + _LIBCPP_ASSERT_INTERNAL(!__grouping.empty() && __size > __grouping[0], + "The slow grouping formatting is used while there will be no separators written"); string __r; auto __end = __grouping.end() - 1; auto __ptr = __grouping.begin(); @@ -161,7 +159,7 @@ _LIBCPP_HIDE_FROM_ABI _Iterator __to_buffer(_Iterator __first, _Iterator __last, // TODO FMT Evaluate code overhead due to not calling the internal function // directly. (Should be zero overhead.) to_chars_result __r = std::to_chars(std::to_address(__first), std::to_address(__last), __value, __base); - _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small"); auto __diff = __r.ptr - std::to_address(__first); return __first + __diff; } @@ -248,10 +246,8 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators( auto __r = __grouping.rbegin(); auto __e = __grouping.rend() - 1; - _LIBCPP_ASSERT_UNCATEGORIZED( - __r != __e, - "The slow grouping formatting is used while " - "there will be no separators written."); + _LIBCPP_ASSERT_INTERNAL( + __r != __e, "The slow grouping formatting is used while there will be no separators written."); // The output is divided in small groups of numbers to write: // - A group before the first separator. // - A separator and a group, repeated for the number of separators. @@ -380,7 +376,7 @@ __format_integer(_Tp __value, return __formatter::__format_integer(__value, __ctx, __specs, __negative, __array.begin(), __array.end(), "0X", 16); } default: - _LIBCPP_ASSERT_UNCATEGORIZED(false, "The parse function should have validated the type"); + _LIBCPP_ASSERT_INTERNAL(false, "The parse function should have validated the type"); __libcpp_unreachable(); } } diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h index 89854f67f5..d5038eb158 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h @@ -35,6 +35,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -66,8 +69,8 @@ struct _LIBCPP_EXPORTED_FROM_ABI __padding_size_result { _LIBCPP_HIDE_FROM_ABI constexpr __padding_size_result __padding_size(size_t __size, size_t __width, __format_spec::__alignment __align) { - _LIBCPP_ASSERT_UNCATEGORIZED(__width > __size, "don't call this function when no padding is required"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_INTERNAL(__width > __size, "don't call this function when no padding is required"); + _LIBCPP_ASSERT_INTERNAL( __align != __format_spec::__alignment::__zero_padding, "the caller should have handled the zero-padding"); size_t __fill = __width - __size; @@ -246,7 +249,7 @@ __write(_Iterator __first, output_iterator<const iter_value_t<_Iterator>&> auto __out_it, __format_spec::__parsed_specifications<_ParserCharT> __specs, ptrdiff_t __size) -> decltype(__out_it) { - _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range"); + _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range"); return __formatter::__write(basic_string_view{__first, __last}, std::move(__out_it), __specs, __size); } @@ -259,7 +262,7 @@ __write(_Iterator __first, _Iterator __last, output_iterator<const iter_value_t<_Iterator>&> auto __out_it, __format_spec::__parsed_specifications<_ParserCharT> __specs) -> decltype(__out_it) { - _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range"); + _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range"); return __formatter::__write(__first, __last, std::move(__out_it), __specs, __last - __first); } @@ -273,7 +276,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_transformed( output_iterator<const _CharT&> auto __out_it, __format_spec::__parsed_specifications<_ParserCharT> __specs, _UnaryOperation __op) -> decltype(__out_it) { - _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range"); + _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range"); ptrdiff_t __size = __last - __first; if (__size >= __specs.__width_) @@ -296,7 +299,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_string_no_precision( basic_string_view<_CharT> __str, output_iterator<const _CharT&> auto __out_it, __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) { - _LIBCPP_ASSERT_UNCATEGORIZED(!__specs.__has_precision(), "use __write_string"); + _LIBCPP_ASSERT_INTERNAL(!__specs.__has_precision(), "use __write_string"); // No padding -> copy the string if (!__specs.__has_width()) @@ -325,4 +328,6 @@ _LIBCPP_HIDE_FROM_ABI int __truncate(basic_string_view<_CharT>& __str, int __pre _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FORMAT_FORMATTER_OUTPUT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h index 4ba5617a49..d1ccfb9b5f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h @@ -64,10 +64,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT> : public __formatte template <class _FormatContext> _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _CharT* __str, _FormatContext& __ctx) const { - _LIBCPP_ASSERT_UNCATEGORIZED( - __str, - "The basic_format_arg constructor should have " - "prevented an invalid pointer."); + _LIBCPP_ASSERT_INTERNAL(__str, "The basic_format_arg constructor should have prevented an invalid pointer."); __format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx); # if _LIBCPP_STD_VER >= 23 diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h b/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h index 9a91179fdf..a4b47abff4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h @@ -355,10 +355,10 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator __parse(_ParseContext& __ctx, __fields __fields) { auto __begin = __ctx.begin(); auto __end = __ctx.end(); - if (__begin == __end) + if (__begin == __end || *__begin == _CharT('}') || (__fields.__use_range_fill_ && *__begin == _CharT(':'))) return __begin; - if (__parse_fill_align(__begin, __end, __fields.__use_range_fill_) && __begin == __end) + if (__parse_fill_align(__begin, __end) && __begin == __end) return __begin; if (__fields.__sign_) { @@ -574,12 +574,10 @@ private: return false; } - _LIBCPP_HIDE_FROM_ABI constexpr void __validate_fill_character(_CharT __fill, bool __use_range_fill) { + _LIBCPP_HIDE_FROM_ABI constexpr void __validate_fill_character(_CharT __fill) { // The forbidden fill characters all code points formed from a single code unit, thus the // check can be omitted when more code units are used. - if (__use_range_fill && (__fill == _CharT('{') || __fill == _CharT('}') || __fill == _CharT(':'))) - std::__throw_format_error("The fill option contains an invalid value"); - else if (__fill == _CharT('{') || __fill == _CharT('}')) + if (__fill == _CharT('{')) std::__throw_format_error("The fill option contains an invalid value"); } @@ -590,8 +588,8 @@ private: # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS || (same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2) # endif - _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __begin != __end, "when called with an empty input the function will cause " "undefined behavior by evaluating data not in the input"); @@ -606,7 +604,7 @@ private: // The forbidden fill characters all are code points encoded // in one code unit, thus the check can be omitted when more // code units are used. - __validate_fill_character(*__begin, __use_range_fill); + __validate_fill_character(*__begin); std::copy_n(__begin, __code_units, std::addressof(__fill_.__data[0])); __begin += __code_units + 1; @@ -623,8 +621,8 @@ private: # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <contiguous_iterator _Iterator> requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4) - _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __begin != __end, "when called with an empty input the function will cause " "undefined behavior by evaluating data not in the input"); @@ -632,7 +630,7 @@ private: if (!__unicode::__is_scalar_value(*__begin)) std::__throw_format_error("The fill option contains an invalid value"); - __validate_fill_character(*__begin, __use_range_fill); + __validate_fill_character(*__begin); __fill_.__data[0] = *__begin; __begin += 2; @@ -651,14 +649,14 @@ private: # else // _LIBCPP_HAS_NO_UNICODE // range-fill and tuple-fill are identical template <contiguous_iterator _Iterator> - _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __begin != __end, "when called with an empty input the function will cause " "undefined behavior by evaluating data not in the input"); if (__begin + 1 != __end) { if (__parse_alignment(*(__begin + 1))) { - __validate_fill_character(*__begin, __use_range_fill); + __validate_fill_character(*__begin); __fill_.__data[0] = *__begin; __begin += 2; @@ -733,10 +731,9 @@ private: __format::__parse_number_result __r = __format::__parse_number(__begin, __end); __width_ = __r.__value; - _LIBCPP_ASSERT_UNCATEGORIZED( - __width_ != 0, - "A zero value isn't allowed and should be impossible, " - "due to validations in this function"); + _LIBCPP_ASSERT_INTERNAL(__width_ != 0, + "A zero value isn't allowed and should be impossible, " + "due to validations in this function"); __begin = __r.__last; return true; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/range_formatter.h b/contrib/libs/cxxsupp/libcxx/include/__format/range_formatter.h index d13278009f..6915630743 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/range_formatter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/range_formatter.h @@ -246,9 +246,8 @@ private: __parse_empty_range_underlying_spec(_ParseContext& __ctx, typename _ParseContext::iterator __begin) { __ctx.advance_to(__begin); [[maybe_unused]] typename _ParseContext::iterator __result = __underlying_.parse(__ctx); - _LIBCPP_ASSERT_UNCATEGORIZED( - __result == __begin, - "the underlying's parse function should not advance the input beyond the end of the input"); + _LIBCPP_ASSERT_INTERNAL(__result == __begin, + "the underlying's parse function should not advance the input beyond the end of the input"); return __begin; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h b/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h index 8e1e7bb192..40067ca344 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h @@ -153,7 +153,7 @@ public: // - The parser always needs to consume these code units // - The code is optimized for well-formed UTF-8 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED(__first_ != __last_, "can't move beyond the end of input"); + _LIBCPP_ASSERT_INTERNAL(__first_ != __last_, "can't move beyond the end of input"); // Based on the number of leading 1 bits the number of code units in the // code point can be determined. See @@ -259,7 +259,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED(__first_ != __last_, "can't move beyond the end of input"); + _LIBCPP_ASSERT_INTERNAL(__first_ != __last_, "can't move beyond the end of input"); char32_t __value = static_cast<char32_t>(*__first_++); if constexpr (sizeof(wchar_t) == 2) { @@ -305,8 +305,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break( // *** Break at the start and end of text, unless the text is empty. *** - _LIBCPP_ASSERT_UNCATEGORIZED(__prev != __property::__sot, "should be handled in the constructor"); // GB1 - _LIBCPP_ASSERT_UNCATEGORIZED(__prev != __property::__eot, "should be handled by our caller"); // GB2 + _LIBCPP_ASSERT_INTERNAL(__prev != __property::__sot, "should be handled in the constructor"); // GB1 + _LIBCPP_ASSERT_INTERNAL(__prev != __property::__eot, "should be handled by our caller"); // GB2 // *** Do not break between a CR and LF. Otherwise, break before and after controls. *** if (__prev == __property::__CR && __next == __property::__LF) // GB3 @@ -401,8 +401,8 @@ public: }; _LIBCPP_HIDE_FROM_ABI constexpr __cluster __consume() { - _LIBCPP_ASSERT_UNCATEGORIZED(__next_prop_ != __extended_grapheme_custer_property_boundary::__property::__eot, - "can't move beyond the end of input"); + _LIBCPP_ASSERT_INTERNAL(__next_prop_ != __extended_grapheme_custer_property_boundary::__property::__eot, + "can't move beyond the end of input"); char32_t __code_point = __next_code_point_; if (!__code_point_view_.__at_end()) @@ -459,7 +459,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr _Iterator __position() const noexcept { return __first_; } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED(__first_ != __last_, "can't move beyond the end of input"); + _LIBCPP_ASSERT_INTERNAL(__first_ != __last_, "can't move beyond the end of input"); return {static_cast<char32_t>(*__first_++)}; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/write_escaped.h b/contrib/libs/cxxsupp/libcxx/include/__format/write_escaped.h index 15141eebc0..43a074dd8d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/write_escaped.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/write_escaped.h @@ -30,6 +30,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD namespace __formatter { @@ -71,7 +74,7 @@ __write_escaped_code_unit(basic_string<_CharT>& __str, char32_t __value, const _ char __buffer[8]; to_chars_result __r = std::to_chars(std::begin(__buffer), std::end(__buffer), __value, 16); - _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small"); std::ranges::copy(std::begin(__buffer), __r.ptr, __out_it); __str += _CharT('}'); @@ -218,4 +221,6 @@ __format_escaped_string(basic_string_view<_CharT> __values, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FORMAT_WRITE_ESCAPED_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h b/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h index 92d9bbd173..1fded441a2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h @@ -13,6 +13,7 @@ #include <__config> #include <__functional/invoke.h> #include <__functional/weak_result_type.h> +#include <__fwd/functional.h> #include <__type_traits/decay.h> #include <__type_traits/is_reference_wrapper.h> #include <__type_traits/is_void.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h index 6505bb5871..416c26a0c7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h @@ -45,6 +45,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #ifndef _LIBCPP_CXX03_LANG _LIBCPP_BEGIN_NAMESPACE_STD @@ -1032,4 +1035,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_CXX03_LANG +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FUNCTIONAL_FUNCTION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h b/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h index ff22055d69..a466c83703 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h @@ -12,7 +12,7 @@ #include <__config> #include <__functional/invoke.h> #include <__functional/unary_function.h> -#include <__fwd/hash.h> +#include <__fwd/functional.h> #include <__tuple/sfinae_helpers.h> #include <__type_traits/is_copy_constructible.h> #include <__type_traits/is_default_constructible.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h b/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h index d0e7a7d076..b7be367bd5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h @@ -11,6 +11,7 @@ #define _LIBCPP___FUNCTIONAL_IDENTITY_H #include <__config> +#include <__fwd/functional.h> #include <__type_traits/integral_constant.h> #include <__utility/forward.h> @@ -34,6 +35,10 @@ struct __identity { template <> struct __is_identity<__identity> : true_type {}; +template <> +struct __is_identity<reference_wrapper<__identity> > : true_type {}; +template <> +struct __is_identity<reference_wrapper<const __identity> > : true_type {}; #if _LIBCPP_STD_VER >= 20 @@ -48,6 +53,10 @@ struct identity { template <> struct __is_identity<identity> : true_type {}; +template <> +struct __is_identity<reference_wrapper<identity> > : true_type {}; +template <> +struct __is_identity<reference_wrapper<const identity> > : true_type {}; #endif // _LIBCPP_STD_VER >= 20 diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h index 54de06a887..94b39e3bc7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h @@ -16,6 +16,7 @@ #include <__memory/addressof.h> #include <__type_traits/enable_if.h> #include <__type_traits/remove_cvref.h> +#include <__type_traits/void_t.h> #include <__utility/declval.h> #include <__utility/forward.h> @@ -38,9 +39,9 @@ private: static void __fun(_Tp&&) = delete; public: - template < - class _Up, - class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(std::declval<_Up>())) > > + template <class _Up, + class = __void_t<decltype(__fun(std::declval<_Up>()))>, + __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) { type& __f = static_cast<_Up&&>(__u); diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/array.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/array.h index 9a79effb61..ff3a3eeeef 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/array.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/array.h @@ -21,6 +21,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array; +template <size_t _Ip, class _Tp, size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>&) _NOEXCEPT; + +template <size_t _Ip, class _Tp, size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT; + +#ifndef _LIBCPP_CXX03_LANG +template <size_t _Ip, class _Tp, size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT; + +template <size_t _Ip, class _Tp, size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT; +#endif + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___FWD_ARRAY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/complex.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/complex.h new file mode 100644 index 0000000000..22c78c5cc3 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/complex.h @@ -0,0 +1,42 @@ +//===---------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===---------------------------------------------------------------------===// + +#ifndef _LIBCPP___FWD_COMPLEX_H +#define _LIBCPP___FWD_COMPLEX_H + +#include <__config> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +class _LIBCPP_TEMPLATE_VIS complex; + +#if _LIBCPP_STD_VER >= 26 + +template <size_t _Ip, class _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp& get(complex<_Tp>&) noexcept; + +template <size_t _Ip, class _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp&& get(complex<_Tp>&&) noexcept; + +template <size_t _Ip, class _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr const _Tp& get(const complex<_Tp>&) noexcept; + +template <size_t _Ip, class _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& get(const complex<_Tp>&&) noexcept; + +#endif // _LIBCPP_STD_VER >= 26 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___FWD_COMPLEX_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/hash.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/functional.h index af9eca876a..32c9ef33e4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/hash.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/functional.h @@ -6,8 +6,8 @@ // //===---------------------------------------------------------------------===// -#ifndef _LIBCPP___FWD_HASH_H -#define _LIBCPP___FWD_HASH_H +#ifndef _LIBCPP___FWD_FUNCTIONAL_H +#define _LIBCPP___FWD_FUNCTIONAL_H #include <__config> @@ -20,6 +20,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class> struct _LIBCPP_TEMPLATE_VIS hash; +template <class> +class _LIBCPP_TEMPLATE_VIS reference_wrapper; + _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP___FWD_HASH_H +#endif // _LIBCPP___FWD_FUNCTIONAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/get.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/get.h deleted file mode 100644 index e7261b8269..0000000000 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/get.h +++ /dev/null @@ -1,99 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___FWD_GET_H -#define _LIBCPP___FWD_GET_H - -#include <__concepts/copyable.h> -#include <__config> -#include <__fwd/array.h> -#include <__fwd/pair.h> -#include <__fwd/subrange.h> -#include <__fwd/tuple.h> -#include <__tuple/tuple_element.h> -#include <cstddef> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#ifndef _LIBCPP_CXX03_LANG - -template <size_t _Ip, class... _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(tuple<_Tp...>&) _NOEXCEPT; - -template <size_t _Ip, class... _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(const tuple<_Tp...>&) _NOEXCEPT; - -template <size_t _Ip, class... _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(tuple<_Tp...>&&) _NOEXCEPT; - -template <size_t _Ip, class... _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(const tuple<_Tp...>&&) _NOEXCEPT; - -#endif //_LIBCPP_CXX03_LANG - -template <size_t _Ip, class _T1, class _T2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(pair<_T1, _T2>&) _NOEXCEPT; - -template <size_t _Ip, class _T1, class _T2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(const pair<_T1, _T2>&) _NOEXCEPT; - -#ifndef _LIBCPP_CXX03_LANG -template <size_t _Ip, class _T1, class _T2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(pair<_T1, _T2>&&) _NOEXCEPT; - -template <size_t _Ip, class _T1, class _T2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(const pair<_T1, _T2>&&) _NOEXCEPT; -#endif - -template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>&) _NOEXCEPT; - -template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT; - -#ifndef _LIBCPP_CXX03_LANG -template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT; - -template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT; -#endif - -#if _LIBCPP_STD_VER >= 20 - -namespace ranges { - -template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> - requires((_Index == 0 && copyable<_Iter>) || _Index == 1) -_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange); - -template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> - requires(_Index < 2) -_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange); - -} // namespace ranges - -using ranges::get; - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___FWD_GET_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/pair.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/pair.h index 3844014de3..af32628fe1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/pair.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/pair.h @@ -10,6 +10,8 @@ #define _LIBCPP___FWD_PAIR_H #include <__config> +#include <__fwd/tuple.h> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,6 +22,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class, class> struct _LIBCPP_TEMPLATE_VIS pair; +template <size_t _Ip, class _T1, class _T2> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type& +get(pair<_T1, _T2>&) _NOEXCEPT; + +template <size_t _Ip, class _T1, class _T2> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& +get(const pair<_T1, _T2>&) _NOEXCEPT; + +#ifndef _LIBCPP_CXX03_LANG +template <size_t _Ip, class _T1, class _T2> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& +get(pair<_T1, _T2>&&) _NOEXCEPT; + +template <size_t _Ip, class _T1, class _T2> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& +get(const pair<_T1, _T2>&&) _NOEXCEPT; +#endif + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___FWD_PAIR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/subrange.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/subrange.h index d09b9b1c5b..60a41da23d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/subrange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/subrange.h @@ -9,7 +9,10 @@ #ifndef _LIBCPP___FWD_SUBRANGE_H #define _LIBCPP___FWD_SUBRANGE_H +#include <__concepts/copyable.h> #include <__config> +#include <__iterator/concepts.h> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -17,8 +20,6 @@ #if _LIBCPP_STD_VER >= 20 -# include <__iterator/concepts.h> - _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { @@ -29,8 +30,18 @@ template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent, subrange_ki requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>) class _LIBCPP_TEMPLATE_VIS subrange; +template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> + requires((_Index == 0 && copyable<_Iter>) || _Index == 1) +_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>&); + +template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> + requires(_Index < 2) +_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&&); + } // namespace ranges +using ranges::get; + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/tuple.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/tuple.h index 16b3fabbb9..902770c295 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/tuple.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/tuple.h @@ -10,6 +10,7 @@ #define _LIBCPP___FWD_TUPLE_H #include <__config> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -17,11 +18,33 @@ _LIBCPP_BEGIN_NAMESPACE_STD +template <size_t, class> +struct _LIBCPP_TEMPLATE_VIS tuple_element; + #ifndef _LIBCPP_CXX03_LANG template <class...> class _LIBCPP_TEMPLATE_VIS tuple; +template <class> +struct _LIBCPP_TEMPLATE_VIS tuple_size; + +template <size_t _Ip, class... _Tp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type& +get(tuple<_Tp...>&) _NOEXCEPT; + +template <size_t _Ip, class... _Tp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type& +get(const tuple<_Tp...>&) _NOEXCEPT; + +template <size_t _Ip, class... _Tp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&& +get(tuple<_Tp...>&&) _NOEXCEPT; + +template <size_t _Ip, class... _Tp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& +get(const tuple<_Tp...>&&) _NOEXCEPT; + #endif // _LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__hash_table b/contrib/libs/cxxsupp/libcxx/include/__hash_table index 3cee48ef85..ec7d694c4a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__hash_table +++ b/contrib/libs/cxxsupp/libcxx/include/__hash_table @@ -802,7 +802,7 @@ public: return __emplace_unique_key_args(_NodeTypes::__get_key(__x), std::move(__x)); } - template <class _Pp, class = __enable_if_t<!__is_same_uncvref<_Pp, __container_value_type>::value> > + template <class _Pp, __enable_if_t<!__is_same_uncvref<_Pp, __container_value_type>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(_Pp&& __x) { return __emplace_unique(std::forward<_Pp>(__x)); } @@ -861,7 +861,7 @@ public: template <class _Key> _LIBCPP_HIDE_FROM_ABI size_type bucket(const _Key& __k) const { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( bucket_count() > 0, "unordered container::bucket(key) called when bucket_count() == 0"); return std::__constrain_hash(hash_function()(__k), bucket_count()); } @@ -915,7 +915,10 @@ public: return __bc != 0 ? (float)size() / __bc : 0.f; } _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) _NOEXCEPT { - _LIBCPP_ASSERT_UNCATEGORIZED(__mlf > 0, "unordered container::max_load_factor(lf) called with lf <= 0"); + // While passing a non-positive load factor is undefined behavior, in practice the result will be benign (the + // call will be equivalent to `max_load_factor(load_factor())`, which is also the case for passing a valid value + // less than the current `load_factor`). + _LIBCPP_ASSERT_PEDANTIC(__mlf > 0, "unordered container::max_load_factor(lf) called with lf <= 0"); max_load_factor() = std::max(__mlf, load_factor()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h index e7669e4c5f..5bcefeb512 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h @@ -61,12 +61,13 @@ __advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type _ template < class _InputIter, class _Distance, class _IntegralDistance = decltype(std::__convert_to_integral(std::declval<_Distance>())), - class = __enable_if_t<is_integral<_IntegralDistance>::value> > + __enable_if_t<is_integral<_IntegralDistance>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void advance(_InputIter& __i, _Distance __orig_n) { typedef typename iterator_traits<_InputIter>::difference_type _Difference; _Difference __n = static_cast<_Difference>(std::__convert_to_integral(__orig_n)); - _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value, - "Attempt to advance(it, n) with negative n on a non-bidirectional iterator"); + // Calling `advance` with a negative value on a non-bidirectional iterator is a no-op in the current implementation. + _LIBCPP_ASSERT_PEDANTIC(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value, + "Attempt to advance(it, n) with negative n on a non-bidirectional iterator"); std::__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); } @@ -99,7 +100,8 @@ public: // Preconditions: If `I` does not model `bidirectional_iterator`, `n` is not negative. template <input_or_output_iterator _Ip> _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Ip& __i, iter_difference_t<_Ip> __n) const { - _LIBCPP_ASSERT_UNCATEGORIZED( + // Calling `advance` with a negative value on a non-bidirectional iterator is a no-op in the current implementation. + _LIBCPP_ASSERT_PEDANTIC( __n >= 0 || bidirectional_iterator<_Ip>, "If `n < 0`, then `bidirectional_iterator<I>` must be true."); // If `I` models `random_access_iterator`, equivalent to `i += n`. @@ -149,8 +151,9 @@ public: template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp> _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip& __i, iter_difference_t<_Ip> __n, _Sp ___bound_sentinel) const { - _LIBCPP_ASSERT_UNCATEGORIZED((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>), - "If `n < 0`, then `bidirectional_iterator<I> && same_as<I, S>` must be true."); + // Calling `advance` with a negative value on a non-bidirectional iterator is a no-op in the current implementation. + _LIBCPP_ASSERT_PEDANTIC((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>), + "If `n < 0`, then `bidirectional_iterator<I> && same_as<I, S>` must be true."); // If `S` and `I` model `sized_sentinel_for<S, I>`: if constexpr (sized_sentinel_for<_Sp, _Ip>) { // If |n| >= |bound_sentinel - i|, equivalent to `ranges::advance(i, bound_sentinel)`. diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/bounded_iter.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/bounded_iter.h index 183fd8d417..347dd58e3f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/bounded_iter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/bounded_iter.h @@ -58,7 +58,7 @@ struct ___bounded_iter { _LIBCPP_HIDE_FROM_ABI ___bounded_iter(___bounded_iter const&) = default; _LIBCPP_HIDE_FROM_ABI ___bounded_iter(___bounded_iter&&) = default; - template <class _OtherIterator, class = __enable_if_t< is_convertible<_OtherIterator, _Iterator>::value > > + template <class _OtherIterator, __enable_if_t< is_convertible<_OtherIterator, _Iterator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR ___bounded_iter(___bounded_iter<_OtherIterator> const& __other) _NOEXCEPT : __current_(__other.__current_), __begin_(__other.__begin_), diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h index cc49d62cd0..7b3f4610d5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h @@ -77,7 +77,7 @@ public: requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent> _LIBCPP_HIDE_FROM_ABI constexpr common_iterator(const common_iterator<_I2, _S2>& __other) : __hold_([&]() -> variant<_Iter, _Sent> { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !__other.__hold_.valueless_by_exception(), "Attempted to construct from a valueless common_iterator"); if (__other.__hold_.index() == 0) return variant<_Iter, _Sent>{in_place_index<0>, std::__unchecked_get<0>(__other.__hold_)}; @@ -88,7 +88,7 @@ public: requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent> && assignable_from<_Iter&, const _I2&> && assignable_from<_Sent&, const _S2&> _LIBCPP_HIDE_FROM_ABI common_iterator& operator=(const common_iterator<_I2, _S2>& __other) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !__other.__hold_.valueless_by_exception(), "Attempted to assign from a valueless common_iterator"); auto __idx = __hold_.index(); @@ -110,7 +110,7 @@ public: } _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); return *std::__unchecked_get<_Iter>(__hold_); } @@ -118,7 +118,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const requires __dereferenceable<const _Iter> { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); return *std::__unchecked_get<_Iter>(__hold_); } @@ -129,7 +129,7 @@ public: __i.operator->(); } || is_reference_v<iter_reference_t<_I2>> || constructible_from<iter_value_t<_I2>, iter_reference_t<_I2>>) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); if constexpr (is_pointer_v<_Iter> || requires(const _Iter& __i) { __i.operator->(); }) { return std::__unchecked_get<_Iter>(__hold_); @@ -142,14 +142,14 @@ public: } _LIBCPP_HIDE_FROM_ABI common_iterator& operator++() { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator"); ++std::__unchecked_get<_Iter>(__hold_); return *this; } _LIBCPP_HIDE_FROM_ABI decltype(auto) operator++(int) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator"); if constexpr (forward_iterator<_Iter>) { auto __tmp = *this; @@ -170,9 +170,9 @@ public: requires sentinel_for<_Sent, _I2> _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); auto __x_index = __x.__hold_.index(); @@ -191,9 +191,9 @@ public: requires sentinel_for<_Sent, _I2> && equality_comparable_with<_Iter, _I2> _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); auto __x_index = __x.__hold_.index(); @@ -215,9 +215,9 @@ public: requires sized_sentinel_for<_Sent, _I2> _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2> operator-(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !__x.__hold_.valueless_by_exception(), "Attempted to subtract from a valueless common_iterator"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !__y.__hold_.valueless_by_exception(), "Attempted to subtract a valueless common_iterator"); auto __x_index = __x.__hold_.index(); @@ -239,7 +239,7 @@ public: iter_move(const common_iterator& __i) noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>()))) requires input_iterator<_Iter> { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( std::holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator"); return ranges::iter_move(std::__unchecked_get<_Iter>(__i.__hold_)); } @@ -248,9 +248,9 @@ public: _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) noexcept( noexcept(ranges::iter_swap(std::declval<const _Iter&>(), std::declval<const _I2&>()))) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( std::holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( std::holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator"); return ranges::iter_swap(std::__unchecked_get<_Iter>(__x.__hold_), std::__unchecked_get<_I2>(__y.__hold_)); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h index c72ac677ff..008c52fa87 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h @@ -105,14 +105,14 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; } _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() { - _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator is equal to or past end."); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end."); return *__current_; } _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const requires __dereferenceable<const _Iter> { - _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator is equal to or past end."); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end."); return *__current_; } @@ -229,7 +229,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const requires random_access_iterator<_Iter> { - _LIBCPP_ASSERT_UNCATEGORIZED(__n < __count_, "Subscript argument must be less than size."); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < __count_, "Subscript argument must be less than size."); return __current_[__n]; } @@ -253,7 +253,7 @@ public: iter_move(const counted_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) requires input_iterator<_Iter> { - _LIBCPP_ASSERT_UNCATEGORIZED(__i.__count_ > 0, "Iterator must not be past end of range."); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i.__count_ > 0, "Iterator must not be past end of range."); return ranges::iter_move(__i.__current_); } @@ -261,7 +261,8 @@ public: _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const counted_iterator& __x, const counted_iterator<_I2>& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) { - _LIBCPP_ASSERT_UNCATEGORIZED(__x.__count_ > 0 && __y.__count_ > 0, "Iterators must not be past end of range."); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + __x.__count_ > 0 && __y.__count_ > 0, "Iterators must not be past end of range."); return ranges::iter_swap(__x.__current_, __y.__current_); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/cpp17_iterator_concepts.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/cpp17_iterator_concepts.h index c4f49fe742..d1ad2b4e28 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/cpp17_iterator_concepts.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/cpp17_iterator_concepts.h @@ -29,6 +29,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -182,4 +185,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ITERATOR_CPP17_ITERATOR_CONCEPTS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h index dae8cc75ae..2cd82525ba 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h @@ -121,7 +121,7 @@ private: __void_t<typename _Up::pointer>* = nullptr); public: - static const bool value = decltype(__test<_Tp>(0, 0, 0, 0, 0))::value; + static const bool value = decltype(__test<_Tp>(nullptr, nullptr, nullptr, nullptr, nullptr))::value; }; template <class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_with_data.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_with_data.h index 06c2fa699c..afdc0a4e12 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_with_data.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_with_data.h @@ -24,6 +24,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -97,4 +100,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ITERATOR_ITERATOR_WITH_DATA_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h index d1bd0138bd..eefd5b3748 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h @@ -157,14 +157,14 @@ public: #else _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator() : __current_() {} - template <class _Up, - class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value > > + template <class _Up, __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {} template <class _Up, - class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value && - is_assignable<_Iter&, const _Up&>::value > > + __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value && + is_assignable<_Iter&, const _Up&>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator=(const move_iterator<_Up>& __u) { __current_ = __u.base(); return *this; diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h index 0c2ee29301..5d9095622f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h @@ -27,8 +27,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _InputIter next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) { - _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value, - "Attempt to next(it, n) with negative n on a non-bidirectional iterator"); + // Calling `advance` with a negative value on a non-bidirectional iterator is a no-op in the current implementation. + // Note that this check duplicates the similar check in `std::advance`. + _LIBCPP_ASSERT_PEDANTIC(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value, + "Attempt to next(it, n) with negative n on a non-bidirectional iterator"); std::advance(__x, __n); return __x; diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h index 8c2f613f18..333939c091 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h @@ -27,8 +27,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _InputIter prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) { - _LIBCPP_ASSERT_UNCATEGORIZED(__n <= 0 || __has_bidirectional_iterator_category<_InputIter>::value, - "Attempt to prev(it, n) with a positive n on a non-bidirectional iterator"); + // Calling `advance` with a negative value on a non-bidirectional iterator is a no-op in the current implementation. + // Note that this check duplicates the similar check in `std::advance`. + _LIBCPP_ASSERT_PEDANTIC(__n <= 0 || __has_bidirectional_iterator_category<_InputIter>::value, + "Attempt to prev(it, n) with a positive n on a non-bidirectional iterator"); std::advance(__x, -__n); return __x; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h index b7fe25e1cc..c8f3628ca9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h @@ -96,14 +96,14 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit reverse_iterator(_Iter __x) : __t_(__x), current(__x) {} - template <class _Up, - class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value > > + template <class _Up, __enable_if_t<!is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator(const reverse_iterator<_Up>& __u) : __t_(__u.base()), current(__u.base()) {} template <class _Up, - class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value && - is_assignable<_Iter&, _Up const&>::value > > + __enable_if_t<!is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value && + is_assignable<_Iter&, _Up const&>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator=(const reverse_iterator<_Up>& __u) { __t_ = current = __u.base(); return *this; @@ -113,14 +113,14 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit reverse_iterator(_Iter __x) : current(__x) {} - template <class _Up, - class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value > > + template <class _Up, __enable_if_t<!is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator(const reverse_iterator<_Up>& __u) : current(__u.base()) {} template <class _Up, - class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value && - is_assignable<_Iter&, _Up const&>::value > > + __enable_if_t<!is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value && + is_assignable<_Iter&, _Up const&>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator=(const reverse_iterator<_Up>& __u) { current = __u.base(); return *this; diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h index 3827241e5f..3124826189 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h @@ -97,10 +97,14 @@ private: friend class __wrap_iter; template <class _CharT, class _Traits, class _Alloc> friend class basic_string; + template <class _CharT, class _Traits> + friend class basic_string_view; template <class _Tp, class _Alloc> friend class _LIBCPP_TEMPLATE_VIS vector; template <class _Tp, size_t> friend class _LIBCPP_TEMPLATE_VIS span; + template <class _Tp, size_t _Size> + friend struct array; }; template <class _Iter1> diff --git a/contrib/libs/cxxsupp/libcxx/include/__locale b/contrib/libs/cxxsupp/libcxx/include/__locale index 47ae41b83b..42b31f52b7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__locale +++ b/contrib/libs/cxxsupp/libcxx/include/__locale @@ -12,6 +12,7 @@ #include <__availability> #include <__config> +#include <__locale_dir/locale_base_api.h> #include <__memory/shared_ptr.h> // __shared_count #include <__mutex/once_flag.h> #include <__type_traits/make_unsigned.h> @@ -33,27 +34,6 @@ # include <__std_mbstate_t.h> #endif -#if defined(_LIBCPP_MSVCRT_LIKE) -# include <__support/win32/locale_win32.h> -#elif defined(_AIX) || defined(__MVS__) -# include <__support/ibm/xlocale.h> -#elif defined(__ANDROID__) -# include <__support/android/locale_bionic.h> -#elif defined(_NEWLIB_VERSION) -# include <__support/newlib/xlocale.h> -#elif defined(__OpenBSD__) -# include <__support/openbsd/xlocale.h> -#elif (defined(__APPLE__) || defined(__FreeBSD__)) -# include <xlocale.h> -#elif defined(__Fuchsia__) -# include <__support/fuchsia/xlocale.h> -#elif defined(__wasi__) -// WASI libc uses musl's locales support. -# include <__support/musl/xlocale.h> -#elif defined(_LIBCPP_HAS_MUSL_LIBC) -# include <__support/musl/xlocale.h> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api.h b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api.h new file mode 100644 index 0000000000..1974b9d458 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api.h @@ -0,0 +1,112 @@ +//===-----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_H +#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_H + +#if defined(_LIBCPP_MSVCRT_LIKE) +# include <__locale_dir/locale_base_api/win32.h> +#elif defined(_AIX) || defined(__MVS__) +# include <__locale_dir/locale_base_api/ibm.h> +#elif defined(__ANDROID__) +# include <__locale_dir/locale_base_api/android.h> +#elif defined(__sun__) +#error # include <__locale_dir/locale_base_api/solaris.h> +#elif defined(_NEWLIB_VERSION) +# include <__locale_dir/locale_base_api/newlib.h> +#elif defined(__OpenBSD__) +# include <__locale_dir/locale_base_api/openbsd.h> +#elif defined(__Fuchsia__) +# include <__locale_dir/locale_base_api/fuchsia.h> +#elif defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) +# include <__locale_dir/locale_base_api/musl.h> +#elif defined(__APPLE__) || defined(__FreeBSD__) +# include <xlocale.h> +#endif + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +/* +The platform-specific headers have to provide the following interface: + +// TODO: rename this to __libcpp_locale_t +using locale_t = implementation-defined; + +implementation-defined __libcpp_mb_cur_max_l(locale_t); +wint_t __libcpp_btowc_l(int, locale_t); +int __libcpp_wctob_l(wint_t, locale_t); +size_t __libcpp_wcsnrtombs_l(char* dest, const wchar_t** src, size_t wide_char_count, size_t len, mbstate_t, locale_t); +size_t __libcpp_wcrtomb_l(char* str, wchar_t wide_char, mbstate_t*, locale_t); +size_t __libcpp_mbsnrtowcs_l(wchar_t* dest, const char** src, size_t max_out, size_t len, mbstate_t*, locale_t); +size_t __libcpp_mbrtowc_l(wchar_t* dest, cosnt char* src, size_t count, mbstate_t*, locale_t); +int __libcpp_mbtowc_l(wchar_t* dest, const char* src, size_t count, locale_t); +size_t __libcpp_mbrlen_l(const char* str, size_t count, mbstate_t*, locale_t); +lconv* __libcpp_localeconv_l(locale_t); +size_t __libcpp_mbsrtowcs_l(wchar_t* dest, const char** src, size_t len, mbstate_t*, locale_t); +int __libcpp_snprintf_l(char* dest, size_t buff_size, locale_t, const char* format, ...); +int __libcpp_asprintf_l(char** dest, locale_t, const char* format, ...); +int __libcpp_sscanf_l(const char* dest, locale_t, const char* format, ...); + +// TODO: change these to reserved names +float strtof_l(const char* str, char** str_end, locale_t); +double strtod_l(const char* str, char** str_end, locale_t); +long double strtold_l(const char* str, char** str_end, locale_t); +long long strtoll_l(const char* str, char** str_end, locale_t); +unsigned long long strtoull_l(const char* str, char** str_end, locale_t); + +locale_t newlocale(int category_mask, const char* locale, locale_t base); +void freelocale(locale_t); + +int islower_l(int ch, locale_t); +int isupper_l(int ch, locale_t); +int isdigit_l(int ch, locale_t); +int isxdigit_l(int ch, locale_t); +int strcoll_l(const char* lhs, const char* rhs, locale_t); +size_t strxfrm_l(char* dst, const char* src, size_t n, locale_t); +int wcscoll_l(const char* lhs, const char* rhs, locale_t); +size_t wcsxfrm_l(wchar_t* dst, const wchar_t* src, size_t n, locale_t); +int toupper_l(int ch, locale_t); +int tolower_l(int ch, locale_t); +int iswspace_l(wint_t ch, locale_t); +int iswprint_l(wint_t ch, locale_t); +int iswcntrl_l(wint_t ch, locale_t); +int iswupper_l(wint_t ch, locale_t); +int iswlower_l(wint_t ch, locale_t); +int iswalpha_l(wint_t ch, locale_t); +int iswblank_l(wint_t ch, locale_t); +int iswdigit_l(wint_t ch, locale_t); +int iswpunct_l(wint_t ch, locale_t); +int iswxdigit_l(wint_t ch, locale_t); +wint_t towupper_l(wint_t ch, locale_t); +wint_t towlower_l(wint_t ch, locale_t); +size_t strftime_l(char* str, size_t len, const char* format, const tm*, locale_t); + + +These functions are equivalent to their C counterparts, +except that locale_t is used instead of the current global locale. + +The variadic functions may be implemented as templates with a parameter pack instead of variadic functions. +*/ + +/* +// TODO: These symbols are never actually used, but defined by one or more implementations. They should be removed. +long strtol_l(const char* str, char** str_end, locale_t); +unsigned long strtoul_l(const char* str, char** str_end, locale_t); +long long wcstoll_l(const wchar_t* str, wchar_t** str_end, int base, locale_t); +unsigned long long wcstoull_l(const wchar_t* str, wchar_t** str_end, int base, locale_t); +long double wcstold_l(const wchar_t* str, wchar_t** str_end, int base, locale_t); +int sprintf_l(char* str, const char* format, locale_t, ...); +int vsprintf_l(char* str, const char* format, locale_t, va_list); +int vsnprintf_l(char* str, size_t size, const char* format, locale_t, va_list); +int isblank_l(int ch, locale_t); + +*/ + +#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/android.h index fee2ba5df3..c2dea1e731 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h +++ b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/android.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___SUPPORT_ANDROID_LOCALE_BIONIC_H -#define _LIBCPP___SUPPORT_ANDROID_LOCALE_BIONIC_H +#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_ANDROID_H +#define _LIBCPP___LOCALE_LOCALE_BASE_API_ANDROID_H #if defined(__BIONIC__) @@ -69,4 +69,4 @@ inline _LIBCPP_HIDE_FROM_ABI_C long strtol_l(const char* __nptr, char** __endptr # endif // defined(__ANDROID__) #endif // defined(__BIONIC__) -#endif // _LIBCPP___SUPPORT_ANDROID_LOCALE_BIONIC_H +#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_ANDROID_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/fuchsia.h index 957d5cb47d..f999bead23 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h +++ b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/fuchsia.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___SUPPORT_FUCHSIA_XLOCALE_H -#define _LIBCPP___SUPPORT_FUCHSIA_XLOCALE_H +#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_FUCHSIA_H +#define _LIBCPP___LOCALE_LOCALE_BASE_API_FUCHSIA_H #if defined(__Fuchsia__) @@ -19,4 +19,4 @@ #endif // defined(__Fuchsia__) -#endif // _LIBCPP___SUPPORT_FUCHSIA_XLOCALE_H +#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_FUCHSIA_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/ibm.h index 52538e264c..c5d7f34186 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h +++ b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/ibm.h @@ -7,14 +7,16 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___SUPPORT_IBM_XLOCALE_H -#define _LIBCPP___SUPPORT_IBM_XLOCALE_H +#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_IBM_H +#define _LIBCPP___LOCALE_LOCALE_BASE_API_IBM_H #if defined(__MVS__) # include <__support/ibm/locale_mgmt_zos.h> #endif // defined(__MVS__) +#include <locale.h> #include <stdarg.h> +#include <stdio.h> #include "cstdlib" @@ -98,7 +100,7 @@ inline _LIBCPP_HIDE_FROM_ABI int vasprintf(char** strp, const char* fmt, va_list } va_list ap_copy; - // va_copy may not be provided by the C library in C++ 03 mode. + // va_copy may not be provided by the C library in C++03 mode. #if defined(_LIBCPP_CXX03_LANG) && __has_builtin(__builtin_va_copy) __builtin_va_copy(ap_copy, ap); #else @@ -119,4 +121,4 @@ inline _LIBCPP_HIDE_FROM_ABI int vasprintf(char** strp, const char* fmt, va_list #ifdef __cplusplus } #endif -#endif // _LIBCPP___SUPPORT_IBM_XLOCALE_H +#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_IBM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/musl.h index 9b0a50b04f..e4121ec1a9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h +++ b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/musl.h @@ -14,8 +14,8 @@ // in Musl. //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___SUPPORT_MUSL_XLOCALE_H -#define _LIBCPP___SUPPORT_MUSL_XLOCALE_H +#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_MUSL_H +#define _LIBCPP___LOCALE_LOCALE_BASE_API_MUSL_H #include <cstdlib> #include <cwchar> @@ -50,4 +50,4 @@ inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wcha } #endif -#endif // _LIBCPP___SUPPORT_MUSL_XLOCALE_H +#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_MUSL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/newlib.h index 9c57bf42ab..8d030cb732 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h +++ b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/newlib.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___SUPPORT_NEWLIB_XLOCALE_H -#define _LIBCPP___SUPPORT_NEWLIB_XLOCALE_H +#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_NEWLIB_H +#define _LIBCPP___LOCALE_LOCALE_BASE_API_NEWLIB_H #if defined(_NEWLIB_VERSION) @@ -19,4 +19,4 @@ #endif // _NEWLIB_VERSION -#endif +#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_NEWLIB_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/openbsd/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/openbsd.h index b969ae9d10..623abdb4db 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__support/openbsd/xlocale.h +++ b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/openbsd.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___SUPPORT_OPENBSD_XLOCALE_H -#define _LIBCPP___SUPPORT_OPENBSD_XLOCALE_H +#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_OPENBSD_H +#define _LIBCPP___LOCALE_LOCALE_BASE_API_OPENBSD_H #include <__support/xlocale/__strtonum_fallback.h> #include <clocale> @@ -32,4 +32,4 @@ inline _LIBCPP_HIDE_FROM_ABI_C unsigned long strtoul_l(const char* __nptr, char* } #endif -#endif +#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_OPENBSD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/win32.h index 55e818e63a..5dfacfb9c1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h +++ b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/win32.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___SUPPORT_WIN32_LOCALE_WIN32_H -#define _LIBCPP___SUPPORT_WIN32_LOCALE_WIN32_H +#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_WIN32_H +#define _LIBCPP___LOCALE_LOCALE_BASE_API_WIN32_H #include <__config> #include <cstddef> @@ -236,4 +236,4 @@ _LIBCPP_EXPORTED_FROM_ABI int vasprintf_l(char** __ret, locale_t __loc, const ch 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'); } -#endif // _LIBCPP___SUPPORT_WIN32_LOCALE_WIN32_H +#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_WIN32_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocate_at_least.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocate_at_least.h index 05cbdee828..b2e5dd3ff9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/allocate_at_least.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocate_at_least.h @@ -20,28 +20,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 23 -template <class _Pointer> -struct allocation_result { - _Pointer ptr; - size_t count; -}; -_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result); - -template <class _Alloc> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<typename allocator_traits<_Alloc>::pointer> -allocate_at_least(_Alloc& __alloc, size_t __n) { - if constexpr (requires { __alloc.allocate_at_least(__n); }) { - return __alloc.allocate_at_least(__n); - } else { - return {__alloc.allocate(__n), __n}; - } -} template <class _Alloc> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __allocate_at_least(_Alloc& __alloc, size_t __n) { - return std::allocate_at_least(__alloc, __n); + return std::allocator_traits<_Alloc>::allocate_at_least(__alloc, __n); } + #else + template <class _Pointer> struct __allocation_result { _Pointer ptr; diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h index 747ce30d8f..4e6303914c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h @@ -31,6 +31,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> class allocator; +#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) +# pragma clang deprecated( \ + _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS, \ + "_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS is deprecated in LLVM 18 and will be removed in LLVM 19") +#endif + #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION) // These specializations shouldn't be marked _LIBCPP_DEPRECATED_IN_CXX17. // Specializing allocator<void> is deprecated, but not using it. @@ -101,7 +107,9 @@ public: typedef ptrdiff_t difference_type; typedef _Tp value_type; typedef true_type propagate_on_container_move_assignment; - typedef true_type is_always_equal; +#if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS) + _LIBCPP_DEPRECATED_IN_CXX23 typedef true_type is_always_equal; +#endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default; @@ -179,7 +187,9 @@ public: typedef ptrdiff_t difference_type; typedef const _Tp value_type; typedef true_type propagate_on_container_move_assignment; - typedef true_type is_always_equal; +#if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS) + _LIBCPP_DEPRECATED_IN_CXX23 typedef true_type is_always_equal; +#endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default; diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h index c4482872ea..e79512b2ed 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h @@ -22,6 +22,7 @@ #include <__type_traits/void_t.h> #include <__utility/declval.h> #include <__utility/forward.h> +#include <cstddef> #include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -231,6 +232,17 @@ struct __has_select_on_container_copy_construction< _LIBCPP_SUPPRESS_DEPRECATED_POP +#if _LIBCPP_STD_VER >= 23 + +template <class _Pointer, class _SizeType = size_t> +struct allocation_result { + _Pointer ptr; + _SizeType count; +}; +_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result); + +#endif // _LIBCPP_STD_VER + template <class _Alloc> struct _LIBCPP_TEMPLATE_VIS allocator_traits { using allocator_type = _Alloc; @@ -269,27 +281,39 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits { return __a.allocate(__n); } - template <class _Ap = _Alloc, class = __enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> > + template <class _Ap = _Alloc, __enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value, int> = 0> _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) { _LIBCPP_SUPPRESS_DEPRECATED_PUSH return __a.allocate(__n, __hint); _LIBCPP_SUPPRESS_DEPRECATED_POP } - template <class _Ap = _Alloc, - class = void, - class = __enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> > + template <class _Ap = _Alloc, + class = void, + __enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value, int> = 0> _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer) { return __a.allocate(__n); } +#if _LIBCPP_STD_VER >= 23 + template <class _Ap = _Alloc> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr allocation_result<pointer, size_type> + allocate_at_least(_Ap& __alloc, size_type __n) { + if constexpr (requires { __alloc.allocate_at_least(__n); }) { + return __alloc.allocate_at_least(__n); + } else { + return {__alloc.allocate(__n), __n}; + } + } +#endif + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT { __a.deallocate(__p, __n); } - template <class _Tp, class... _Args, class = __enable_if_t<__has_construct<allocator_type, _Tp*, _Args...>::value> > + template <class _Tp, class... _Args, __enable_if_t<__has_construct<allocator_type, _Tp*, _Args...>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) { _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -298,43 +322,43 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits { } template <class _Tp, class... _Args, - class = void, - class = __enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value> > + class = void, + __enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void construct(allocator_type&, _Tp* __p, _Args&&... __args) { std::__construct_at(__p, std::forward<_Args>(__args)...); } - template <class _Tp, class = __enable_if_t<__has_destroy<allocator_type, _Tp*>::value> > + template <class _Tp, __enable_if_t<__has_destroy<allocator_type, _Tp*>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void destroy(allocator_type& __a, _Tp* __p) { _LIBCPP_SUPPRESS_DEPRECATED_PUSH __a.destroy(__p); _LIBCPP_SUPPRESS_DEPRECATED_POP } - template <class _Tp, class = void, class = __enable_if_t<!__has_destroy<allocator_type, _Tp*>::value> > + template <class _Tp, class = void, __enable_if_t<!__has_destroy<allocator_type, _Tp*>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void destroy(allocator_type&, _Tp* __p) { std::__destroy_at(__p); } - template <class _Ap = _Alloc, class = __enable_if_t<__has_max_size<const _Ap>::value> > + template <class _Ap = _Alloc, __enable_if_t<__has_max_size<const _Ap>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type& __a) _NOEXCEPT { _LIBCPP_SUPPRESS_DEPRECATED_PUSH return __a.max_size(); _LIBCPP_SUPPRESS_DEPRECATED_POP } - template <class _Ap = _Alloc, class = void, class = __enable_if_t<!__has_max_size<const _Ap>::value> > + template <class _Ap = _Alloc, class = void, __enable_if_t<!__has_max_size<const _Ap>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type&) _NOEXCEPT { return numeric_limits<size_type>::max() / sizeof(value_type); } - template <class _Ap = _Alloc, class = __enable_if_t<__has_select_on_container_copy_construction<const _Ap>::value> > + template <class _Ap = _Alloc, __enable_if_t<__has_select_on_container_copy_construction<const _Ap>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type select_on_container_copy_construction(const allocator_type& __a) { return __a.select_on_container_copy_construction(); } - template <class _Ap = _Alloc, - class = void, - class = __enable_if_t<!__has_select_on_container_copy_construction<const _Ap>::value> > + template <class _Ap = _Alloc, + class = void, + __enable_if_t<!__has_select_on_container_copy_construction<const _Ap>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type select_on_container_copy_construction(const allocator_type& __a) { return __a; diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/assume_aligned.h b/contrib/libs/cxxsupp/libcxx/include/__memory/assume_aligned.h index c66fb49ebb..526eb3334f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/assume_aligned.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/assume_aligned.h @@ -27,9 +27,11 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __ass static_assert(_Np != 0 && (_Np & (_Np - 1)) == 0, "std::assume_aligned<N>(p) requires N to be a power of two"); if (__libcpp_is_constant_evaluated()) { + (void)__builtin_assume_aligned(__ptr, _Np); return __ptr; } else { - _LIBCPP_ASSERT_UNCATEGORIZED(reinterpret_cast<uintptr_t>(__ptr) % _Np == 0, "Alignment assumption is violated"); + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( + reinterpret_cast<uintptr_t>(__ptr) % _Np == 0, "Alignment assumption is violated"); return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Np)); } } diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/compressed_pair.h b/contrib/libs/cxxsupp/libcxx/include/__memory/compressed_pair.h index e9faada2f0..373e131a78 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/compressed_pair.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/compressed_pair.h @@ -11,7 +11,6 @@ #define _LIBCPP___MEMORY_COMPRESSED_PAIR_H #include <__config> -#include <__fwd/get.h> #include <__fwd/tuple.h> #include <__tuple/tuple_indices.h> #include <__type_traits/decay.h> @@ -49,7 +48,7 @@ struct __compressed_pair_elem { _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_() {} - template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value> > + template <class _Up, __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) : __value_(std::forward<_Up>(__u)) {} @@ -78,7 +77,7 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_type() {} - template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value> > + template <class _Up, __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) : __value_type(std::forward<_Up>(__u)) {} @@ -108,9 +107,10 @@ public: using _Base1 _LIBCPP_NODEBUG = __compressed_pair_elem<_T1, 0>; using _Base2 _LIBCPP_NODEBUG = __compressed_pair_elem<_T2, 1>; - template <bool _Dummy = true, - class = __enable_if_t< __dependent_type<is_default_constructible<_T1>, _Dummy>::value && - __dependent_type<is_default_constructible<_T2>, _Dummy>::value > > + template <bool _Dummy = true, + __enable_if_t< __dependent_type<is_default_constructible<_T1>, _Dummy>::value && + __dependent_type<is_default_constructible<_T2>, _Dummy>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair() : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {} diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h b/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h index 643b7391d3..1082e37853 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h @@ -201,7 +201,7 @@ struct _IsFancyPointer { }; // enable_if is needed here to avoid instantiating checks for fancy pointers on raw pointers -template <class _Pointer, class = __enable_if_t< _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value > > +template <class _Pointer, __enable_if_t< _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))> __to_address(const _Pointer& __p) _NOEXCEPT { diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h index d836d00820..90090055bb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h @@ -31,6 +31,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -317,4 +320,6 @@ inline constexpr auto uninitialized_move_n = __uninitialized_move_n::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___MEMORY_RANGES_UNINITIALIZED_ALGORITHMS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/raw_storage_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__memory/raw_storage_iterator.h index 33790a397c..774878aa1c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/raw_storage_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/raw_storage_iterator.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR) @@ -79,4 +82,6 @@ public: _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h index 5f626b53c0..e78f2819af 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h @@ -61,6 +61,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD // NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively) @@ -459,15 +462,16 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {} template <class _Yp, - class = __enable_if_t< _And< __raw_pointer_compatible_with<_Yp, _Tp> + __enable_if_t< _And< __raw_pointer_compatible_with<_Yp, _Tp> // In C++03 we get errors when trying to do SFINAE with the // delete operator, so we always pretend that it's deletable. // The same happens on GCC. #if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_COMPILER_GCC) - , - _If<is_array<_Tp>::value, __is_array_deletable<_Yp*>, __is_deletable<_Yp*> > + , + _If<is_array<_Tp>::value, __is_array_deletable<_Yp*>, __is_deletable<_Yp*> > #endif - >::value > > + >::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(_Yp* __p) : __ptr_(__p) { unique_ptr<_Yp> __hold(__p); typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; @@ -477,7 +481,7 @@ public: __enable_weak_this(__p, __p); } - template <class _Yp, class _Dp, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> > + template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { @@ -501,7 +505,7 @@ public: template <class _Yp, class _Dp, class _Alloc, - class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> > + __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { @@ -596,7 +600,7 @@ public: __cntrl_->__add_shared(); } - template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> > + template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr<_Yp>& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { if (__cntrl_) __cntrl_->__add_shared(); @@ -607,13 +611,13 @@ public: __r.__cntrl_ = nullptr; } - template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> > + template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { __r.__ptr_ = nullptr; __r.__cntrl_ = nullptr; } - template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> > + template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(const weak_ptr<_Yp>& __r) : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) { if (__cntrl_ == nullptr) @@ -621,7 +625,7 @@ public: } #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) - template <class _Yp, class = __enable_if_t<is_convertible<_Yp*, element_type*>::value> > + template <class _Yp, __enable_if_t<is_convertible<_Yp*, element_type*>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr(auto_ptr<_Yp>&& __r) : __ptr_(__r.get()) { typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>()); @@ -632,8 +636,9 @@ public: template <class _Yp, class _Dp, - class = __enable_if_t< !is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value && - is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value > > + __enable_if_t<!is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value && + is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) { #if _LIBCPP_STD_VER >= 14 if (__ptr_ == nullptr) @@ -651,9 +656,10 @@ public: template <class _Yp, class _Dp, - class = void, - class = __enable_if_t< is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value && - is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value > > + class = void, + __enable_if_t<is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value && + is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) { #if _LIBCPP_STD_VER >= 14 if (__ptr_ == nullptr) @@ -682,7 +688,7 @@ public: return *this; } - template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> > + template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT { shared_ptr(__r).swap(*this); return *this; @@ -693,7 +699,7 @@ public: return *this; } - template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> > + template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr<_Yp>&& __r) { shared_ptr(std::move(__r)).swap(*this); return *this; @@ -701,19 +707,19 @@ public: #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) template <class _Yp, - class = __enable_if_t< !is_array<_Yp>::value && - is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value > > + __enable_if_t<!is_array<_Yp>::value && is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(auto_ptr<_Yp>&& __r) { shared_ptr(std::move(__r)).swap(*this); return *this; } #endif - template < - class _Yp, - class _Dp, - class = __enable_if_t<_And< __compatible_with<_Yp, _Tp>, - is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*> >::value> > + template <class _Yp, + class _Dp, + __enable_if_t<_And< __compatible_with<_Yp, _Tp>, + is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*> >::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r) { shared_ptr(std::move(__r)).swap(*this); return *this; @@ -726,12 +732,12 @@ public: _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT { shared_ptr().swap(*this); } - template <class _Yp, class = __enable_if_t< __raw_pointer_compatible_with<_Yp, _Tp>::value > > + template <class _Yp, __enable_if_t<__raw_pointer_compatible_with<_Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p) { shared_ptr(__p).swap(*this); } - template <class _Yp, class _Dp, class = __enable_if_t< __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> > + template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d) { shared_ptr(__p, __d).swap(*this); } @@ -739,7 +745,7 @@ public: template <class _Yp, class _Dp, class _Alloc, - class = __enable_if_t< __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> > + __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d, _Alloc __a) { shared_ptr(__p, __d, __a).swap(*this); } @@ -755,7 +761,9 @@ public: _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __cntrl_ ? __cntrl_->use_count() : 0; } - _LIBCPP_HIDE_FROM_ABI bool unique() const _NOEXCEPT { return use_count() == 1; } +#if _LIBCPP_STD_VER < 20 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE) + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI bool unique() const _NOEXCEPT { return use_count() == 1; } +#endif _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return get() != nullptr; } @@ -807,7 +815,7 @@ private: template <class _Yp, class _OrigPtr, - class = __enable_if_t< is_convertible<_OrigPtr*, const enable_shared_from_this<_Yp>*>::value > > + __enable_if_t<is_convertible<_OrigPtr*, const enable_shared_from_this<_Yp>*>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) _NOEXCEPT { typedef __remove_cv_t<_Yp> _RawYp; if (__e && __e->__weak_this_.expired()) { @@ -842,7 +850,7 @@ shared_ptr(unique_ptr<_Tp, _Dp>) -> shared_ptr<_Tp>; // // std::allocate_shared and std::make_shared // -template <class _Tp, class _Alloc, class... _Args, class = __enable_if_t<!is_array<_Tp>::value> > +template <class _Tp, class _Alloc, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) { using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>; using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type; @@ -853,7 +861,7 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&& (*__control_block).__get_elem(), std::addressof(*__control_block)); } -template <class _Tp, class... _Args, class = __enable_if_t<!is_array<_Tp>::value> > +template <class _Tp, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(_Args&&... __args) { return std::allocate_shared<_Tp>(allocator<_Tp>(), std::forward<_Args>(__args)...); } @@ -1059,12 +1067,12 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Array> __allocate_shared_bounded_array(const _ #if _LIBCPP_STD_VER >= 20 // bounded array variants -template <class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>> +template <class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a) { return std::__allocate_shared_bounded_array<_Tp>(__a); } -template <class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>> +template <class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& __u) { return std::__allocate_shared_bounded_array<_Tp>(__a, __u); } @@ -1076,12 +1084,12 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc return std::__allocate_shared_bounded_array<_Tp>(__alloc); } -template <class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>> +template <class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared() { return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>()); } -template <class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>> +template <class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(const remove_extent_t<_Tp>& __u) { return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>(), __u); } @@ -1092,12 +1100,12 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() { } // unbounded array variants -template <class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>> +template <class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n) { return std::__allocate_shared_unbounded_array<_Tp>(__a, __n); } -template <class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>> +template <class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n, const remove_extent_t<_Tp>& __u) { return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __u); } @@ -1109,12 +1117,12 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc return std::__allocate_shared_unbounded_array<_Tp>(__alloc, __n); } -template <class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>> +template <class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n) { return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n); } -template <class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>> +template <class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n, const remove_extent_t<_Tp>& __u) { return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n, __u); } @@ -1196,12 +1204,12 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const shared_ptr<_Tp>& _ template <class _Tp> inline _LIBCPP_HIDE_FROM_ABI bool operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT { - return less<_Tp*>()(__x.get(), nullptr); + return less<typename shared_ptr<_Tp>::element_type*>()(__x.get(), nullptr); } template <class _Tp> inline _LIBCPP_HIDE_FROM_ABI bool operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT { - return less<_Tp*>()(nullptr, __x.get()); + return less<typename shared_ptr<_Tp>::element_type*>()(nullptr, __x.get()); } template <class _Tp> @@ -1692,4 +1700,6 @@ inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit( _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___MEMORY_SHARED_PTR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/temporary_buffer.h b/contrib/libs/cxxsupp/libcxx/include/__memory/temporary_buffer.h index d46bda3821..e3797caff8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/temporary_buffer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/temporary_buffer.h @@ -11,7 +11,6 @@ #define _LIBCPP___MEMORY_TEMPORARY_BUFFER_H #include <__config> -#include <__type_traits/alignment_of.h> #include <__utility/pair.h> #include <cstddef> #include <new> diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h b/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h index e2a6f8dd13..52cce1cf7c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h @@ -29,6 +29,7 @@ #include <__type_traits/is_trivially_copy_constructible.h> #include <__type_traits/is_trivially_move_assignable.h> #include <__type_traits/is_trivially_move_constructible.h> +#include <__type_traits/is_trivially_relocatable.h> #include <__type_traits/is_unbounded_array.h> #include <__type_traits/negation.h> #include <__type_traits/remove_const.h> @@ -42,6 +43,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD struct __always_false { @@ -362,7 +366,7 @@ uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofir // the correct type. template <class _Alloc, class _BidirIter, - class = __enable_if_t< __has_bidirectional_iterator_category<_BidirIter>::value >> + __enable_if_t<__has_bidirectional_iterator_category<_BidirIter>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr void __allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept { using _ValueType = typename iterator_traits<_BidirIter>::value_type; @@ -558,7 +562,6 @@ struct __allocator_has_trivial_copy_construct : _Not<__has_construct<_Alloc, _Ty template <class _Type> struct __allocator_has_trivial_copy_construct<allocator<_Type>, _Type> : true_type {}; -#ifndef __CUDACC__ template <class _Alloc, class _In, class _RawTypeIn = __remove_const_t<_In>, @@ -566,8 +569,9 @@ template <class _Alloc, __enable_if_t< // using _RawTypeIn because of the allocator<T const> extension is_trivially_copy_constructible<_RawTypeIn>::value && is_trivially_copy_assignable<_RawTypeIn>::value && - is_same<__remove_const_t<_In>, __remove_const_t<_Out> >::value && - __allocator_has_trivial_copy_construct<_Alloc, _RawTypeIn>::value>* = nullptr> + is_same<__remove_const_t<_In>, __remove_const_t<_Out> >::value && + __allocator_has_trivial_copy_construct<_Alloc, _RawTypeIn>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Out* __uninitialized_allocator_copy_impl(_Alloc&, _In* __first1, _In* __last1, _Out* __first2) { // TODO: Remove the const_cast once we drop support for std::allocator<T const> @@ -582,7 +586,6 @@ __uninitialized_allocator_copy_impl(_Alloc&, _In* __first1, _In* __last1, _Out* return std::copy(__first1, __last1, const_cast<_RawTypeIn*>(__first2)); } } -#endif // __CUDACC__ template <class _Alloc, class _Iter1, class _Sent1, class _Iter2> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 @@ -593,61 +596,60 @@ __uninitialized_allocator_copy(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, return std::__rewrap_iter(__first2, __result); } -// Move-construct the elements [__first1, __last1) into [__first2, __first2 + N) -// if the move constructor is noexcept, where N is distance(__first1, __last1). -// -// Otherwise try to copy all elements. If an exception is thrown the already copied -// elements are destroyed in reverse order of their construction. -template <class _Alloc, class _Iter1, class _Sent1, class _Iter2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 -__uninitialized_allocator_move_if_noexcept(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) { - static_assert(__is_cpp17_move_insertable<_Alloc>::value, - "The specified type does not meet the requirements of Cpp17MoveInsertable"); - auto __destruct_first = __first2; - auto __guard = - std::__make_exception_guard(_AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2)); - while (__first1 != __last1) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS - allocator_traits<_Alloc>::construct(__alloc, std::__to_address(__first2), std::move_if_noexcept(*__first1)); -#else - allocator_traits<_Alloc>::construct(__alloc, std::__to_address(__first2), std::move(*__first1)); -#endif - ++__first1; - ++__first2; - } - __guard.__complete(); - return __first2; -} - template <class _Alloc, class _Type> struct __allocator_has_trivial_move_construct : _Not<__has_construct<_Alloc, _Type*, _Type&&> > {}; template <class _Type> struct __allocator_has_trivial_move_construct<allocator<_Type>, _Type> : true_type {}; -#if !defined(_LIBCPP_COMPILER_GCC) && !defined(__CUDACC__) -template < - class _Alloc, - class _Iter1, - class _Iter2, - class _Type = typename iterator_traits<_Iter1>::value_type, - class = __enable_if_t<is_trivially_move_constructible<_Type>::value && is_trivially_move_assignable<_Type>::value && - __allocator_has_trivial_move_construct<_Alloc, _Type>::value> > -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 -__uninitialized_allocator_move_if_noexcept(_Alloc&, _Iter1 __first1, _Iter1 __last1, _Iter2 __first2) { - if (__libcpp_is_constant_evaluated()) { - while (__first1 != __last1) { - std::__construct_at(std::__to_address(__first2), std::move(*__first1)); - ++__first1; - ++__first2; +template <class _Alloc, class _Tp> +struct __allocator_has_trivial_destroy : _Not<__has_destroy<_Alloc, _Tp*> > {}; + +template <class _Tp, class _Up> +struct __allocator_has_trivial_destroy<allocator<_Tp>, _Up> : true_type {}; + +// __uninitialized_allocator_relocate relocates the objects in [__first, __last) into __result. +// Relocation means that the objects in [__first, __last) are placed into __result as-if by move-construct and destroy, +// except that the move constructor and destructor may never be called if they are known to be equivalent to a memcpy. +// +// Preconditions: __result doesn't contain any objects and [__first, __last) contains objects +// Postconditions: __result contains the objects from [__first, __last) and +// [__first, __last) doesn't contain any objects +// +// The strong exception guarantee is provided if any of the following are true: +// - is_nothrow_move_constructible<_Tp> +// - is_copy_constructible<_Tp> +// - __libcpp_is_trivially_relocatable<_Tp> +template <class _Alloc, class _Tp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void +__uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _Tp* __result) { + static_assert(__is_cpp17_move_insertable<_Alloc>::value, + "The specified type does not meet the requirements of Cpp17MoveInsertable"); + if (__libcpp_is_constant_evaluated() || !__libcpp_is_trivially_relocatable<_Tp>::value || + !__allocator_has_trivial_move_construct<_Alloc, _Tp>::value || + !__allocator_has_trivial_destroy<_Alloc, _Tp>::value) { + auto __destruct_first = __result; + auto __guard = + std::__make_exception_guard(_AllocatorDestroyRangeReverse<_Alloc, _Tp*>(__alloc, __destruct_first, __result)); + auto __iter = __first; + while (__iter != __last) { +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS + allocator_traits<_Alloc>::construct(__alloc, __result, std::move_if_noexcept(*__iter)); +#else + allocator_traits<_Alloc>::construct(__alloc, __result, std::move(*__iter)); +#endif + ++__iter; + ++__result; } - return __first2; + __guard.__complete(); + std::__allocator_destroy(__alloc, __first, __last); } else { - return std::move(__first1, __last1, __first2); + __builtin_memcpy(const_cast<__remove_const_t<_Tp>*>(__result), __first, sizeof(_Tp) * (__last - __first)); } } -#endif // !defined(_LIBCPP_COMPILER_GCC) && !defined(__CUDACC__) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___MEMORY_UNINITIALIZED_ALGORITHMS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h index ccd7d24fc0..327e02cd2b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h @@ -21,6 +21,7 @@ #include <__memory/compressed_pair.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/common_type.h> +#include <__type_traits/conditional.h> #include <__type_traits/dependent_type.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_array.h> @@ -33,6 +34,7 @@ #include <__type_traits/is_reference.h> #include <__type_traits/is_same.h> #include <__type_traits/is_swappable.h> +#include <__type_traits/is_trivially_relocatable.h> #include <__type_traits/is_void.h> #include <__type_traits/remove_extent.h> #include <__type_traits/type_identity.h> @@ -130,13 +132,20 @@ public: static_assert(!is_rvalue_reference<deleter_type>::value, "the specified deleter type cannot be an rvalue reference"); + // A unique_ptr contains the following members which may be trivially relocatable: + // - pointer : this may be trivially relocatable, so it's checked + // - deleter_type: this may be trivially relocatable, so it's checked + // + // This unique_ptr implementation only contains a pointer to the unique object and a deleter, so there are no + // references to itself. This means that the entire structure is trivially relocatable if its members are. + using __trivially_relocatable = __conditional_t< + __libcpp_is_trivially_relocatable<pointer>::value && __libcpp_is_trivially_relocatable<deleter_type>::value, + unique_ptr, + void>; + private: __compressed_pair<pointer, deleter_type> __ptr_; - struct __nat { - int __for_bool_; - }; - typedef _LIBCPP_NODEBUG __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; template <bool _Dummy> @@ -281,6 +290,17 @@ public: typedef _Dp deleter_type; typedef typename __pointer<_Tp, deleter_type>::type pointer; + // A unique_ptr contains the following members which may be trivially relocatable: + // - pointer : this may be trivially relocatable, so it's checked + // - deleter_type: this may be trivially relocatable, so it's checked + // + // This unique_ptr implementation only contains a pointer to the unique object and a deleter, so there are no + // references to itself. This means that the entire structure is trivially relocatable if its members are. + using __trivially_relocatable = __conditional_t< + __libcpp_is_trivially_relocatable<pointer>::value && __libcpp_is_trivially_relocatable<deleter_type>::value, + unique_ptr, + void>; + private: __compressed_pair<pointer, deleter_type> __ptr_; diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h index 3a27949317..cfd07bc84f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h @@ -68,7 +68,10 @@ public: } _LIBCPP_HIDE_FROM_ABI void deallocate(_ValueType* __p, size_t __n) { - _LIBCPP_ASSERT_UNCATEGORIZED(__n <= __max_size(), "deallocate called for size which exceeds max_size()"); + _LIBCPP_ASSERT_VALID_DEALLOCATION( + __n <= __max_size(), + "deallocate() called for a size which exceeds max_size(), leading to a memory leak " + "(the argument will overflow and result in too few objects being deleted)"); __res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType)); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__mutex/mutex.h b/contrib/libs/cxxsupp/libcxx/include/__mutex/mutex.h index 4423abf62b..ddc85cf5a0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mutex/mutex.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mutex/mutex.h @@ -10,7 +10,7 @@ #define _LIBCPP___MUTEX_MUTEX_H #include <__config> -#include <__threading_support> +#include <__thread/support.h> #include <__type_traits/is_nothrow_default_constructible.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__mutex/once_flag.h b/contrib/libs/cxxsupp/libcxx/include/__mutex/once_flag.h index cdd53d1d0d..9cd3dff573 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mutex/once_flag.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mutex/once_flag.h @@ -29,6 +29,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD struct _LIBCPP_TEMPLATE_VIS once_flag; @@ -175,4 +178,6 @@ inline _LIBCPP_HIDE_FROM_ABI void call_once(once_flag& __flag, const _Callable& _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___MUTEX_ONCE_FLAG_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/gcd_lcm.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/gcd_lcm.h index 3e9c244f25..48df233805 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__numeric/gcd_lcm.h +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/gcd_lcm.h @@ -77,7 +77,7 @@ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up using _Rp = common_type_t<_Tp, _Up>; _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / std::gcd(__m, __n); _Rp __val2 = __ct_abs<_Rp, _Up>()(__n); - _LIBCPP_ASSERT_UNCATEGORIZED((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); return __val1 * __val2; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/midpoint.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/midpoint.h index 5d715c21d8..5ef30d4ec5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__numeric/midpoint.h +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/midpoint.h @@ -67,14 +67,16 @@ template <class _Fp> _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<is_floating_point_v<_Fp>, _Fp> midpoint(_Fp __a, _Fp __b) noexcept { constexpr _Fp __lo = numeric_limits<_Fp>::min() * 2; constexpr _Fp __hi = numeric_limits<_Fp>::max() / 2; - return std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi - ? // typical case: overflow is impossible - (__a + __b) / 2 - : // always correctly rounded - std::__fp_abs(__a) < __lo ? __a + __b / 2 : // not safe to halve a - std::__fp_abs(__b) < __lo ? __a / 2 + __b - : // not safe to halve b - __a / 2 + __b / 2; // otherwise correctly rounded + + // typical case: overflow is impossible + if (std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi) + return (__a + __b) / 2; // always correctly rounded + if (std::__fp_abs(__a) < __lo) + return __a + __b / 2; // not safe to halve a + if (std::__fp_abs(__b) < __lo) + return __a / 2 + __b; // not safe to halve b + + return __a / 2 + __b / 2; // otherwise correctly rounded } #endif // _LIBCPP_STD_VER >= 20 diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/pstl_reduce.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/pstl_reduce.h index b19972a46d..f9f666c2bb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__numeric/pstl_reduce.h +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/pstl_reduce.h @@ -20,6 +20,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -101,4 +104,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___NUMERIC_PSTL_REDUCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/pstl_transform_reduce.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/pstl_transform_reduce.h index 1127726046..2f412d41f7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__numeric/pstl_transform_reduce.h +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/pstl_transform_reduce.h @@ -22,6 +22,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -148,4 +151,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +_LIBCPP_POP_MACROS + #endif // _LIBCPP___NUMERIC_PSTL_TRANSFORM_REDUCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/reduce.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/reduce.h index 1aeefce132..6c205bf581 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__numeric/reduce.h +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/reduce.h @@ -19,6 +19,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 17 @@ -45,4 +48,6 @@ reduce(_InputIterator __first, _InputIterator __last) { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___NUMERIC_REDUCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/saturation_arithmetic.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/saturation_arithmetic.h new file mode 100644 index 0000000000..41596a0c58 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/saturation_arithmetic.h @@ -0,0 +1,116 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H +#define _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H + +#include <__assert> +#include <__concepts/arithmetic.h> +#include <__config> +#include <__utility/cmp.h> +#include <limits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 26 + +template <__libcpp_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept { + if (_Tp __sum; !__builtin_add_overflow(__x, __y, &__sum)) + return __sum; + // Handle overflow + if constexpr (__libcpp_unsigned_integer<_Tp>) { + return std::numeric_limits<_Tp>::max(); + } else { + // Signed addition overflow + if (__x > 0) + // Overflows if (x > 0 && y > 0) + return std::numeric_limits<_Tp>::max(); + else + // Overflows if (x < 0 && y < 0) + return std::numeric_limits<_Tp>::min(); + } +} + +template <__libcpp_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp sub_sat(_Tp __x, _Tp __y) noexcept { + if (_Tp __sub; !__builtin_sub_overflow(__x, __y, &__sub)) + return __sub; + // Handle overflow + if constexpr (__libcpp_unsigned_integer<_Tp>) { + // Overflows if (x < y) + return std::numeric_limits<_Tp>::min(); + } else { + // Signed subtration overflow + if (__x >= 0) + // Overflows if (x >= 0 && y < 0) + return std::numeric_limits<_Tp>::max(); + else + // Overflows if (x < 0 && y > 0) + return std::numeric_limits<_Tp>::min(); + } +} + +template <__libcpp_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp mul_sat(_Tp __x, _Tp __y) noexcept { + if (_Tp __mul; !__builtin_mul_overflow(__x, __y, &__mul)) + return __mul; + // Handle overflow + if constexpr (__libcpp_unsigned_integer<_Tp>) { + return std::numeric_limits<_Tp>::max(); + } else { + // Signed multiplication overflow + if ((__x > 0 && __y > 0) || (__x < 0 && __y < 0)) + return std::numeric_limits<_Tp>::max(); + // Overflows if (x < 0 && y > 0) || (x > 0 && y < 0) + return std::numeric_limits<_Tp>::min(); + } +} + +template <__libcpp_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp div_sat(_Tp __x, _Tp __y) noexcept { + _LIBCPP_ASSERT_UNCATEGORIZED(__y != 0, "Division by 0 is undefined"); + if constexpr (__libcpp_unsigned_integer<_Tp>) { + return __x / __y; + } else { + // Handle signed division overflow + if (__x == std::numeric_limits<_Tp>::min() && __y == _Tp{-1}) + return std::numeric_limits<_Tp>::max(); + return __x / __y; + } +} + +template <__libcpp_integer _Rp, __libcpp_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Rp saturate_cast(_Tp __x) noexcept { + // Saturation is impossible edge case when ((min _Rp) < (min _Tp) && (max _Rp) > (max _Tp)) and it is expected to be + // optimized out by the compiler. + + // Handle overflow + if (std::cmp_less(__x, std::numeric_limits<_Rp>::min())) + return std::numeric_limits<_Rp>::min(); + if (std::cmp_greater(__x, std::numeric_limits<_Rp>::max())) + return std::numeric_limits<_Rp>::max(); + // No overflow + return static_cast<_Rp>(__x); +} + +#endif // _LIBCPP_STD_VER >= 26 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_reduce.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_reduce.h index 6c0a81e5e4..f1150510f0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_reduce.h +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_reduce.h @@ -18,6 +18,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 17 @@ -51,4 +54,6 @@ transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterat _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/linear_congruential_engine.h b/contrib/libs/cxxsupp/libcxx/include/__random/linear_congruential_engine.h index 51f6b248d8..fe9cb909b7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/linear_congruential_engine.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/linear_congruential_engine.h @@ -31,10 +31,10 @@ template <unsigned long long __a, unsigned long long __m, unsigned long long _Mp, bool _MightOverflow = (__a != 0 && __m != 0 && __m - 1 > (_Mp - __c) / __a), - bool _OverflowOK = ((__m | (__m - 1)) > __m), // m = 2^n + bool _OverflowOK = ((__m & (__m - 1)) == 0ull), // m = 2^n bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q struct __lce_alg_picker { - static_assert(__a != 0 || __m != 0 || !_MightOverflow || _OverflowOK || _SchrageOK, + static_assert(!_MightOverflow || _OverflowOK || _SchrageOK, "The current values of a, c, and m cannot generate a number " "within bounds of linear_congruential_engine."); diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/negative_binomial_distribution.h b/contrib/libs/cxxsupp/libcxx/include/__random/negative_binomial_distribution.h index 580c74d464..6d0055d01e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/negative_binomial_distribution.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/negative_binomial_distribution.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___RANDOM_NEGATIVE_BINOMIAL_DISTRIBUTION_H #define _LIBCPP___RANDOM_NEGATIVE_BINOMIAL_DISTRIBUTION_H +#include <__assert> #include <__config> #include <__random/bernoulli_distribution.h> #include <__random/gamma_distribution.h> @@ -113,10 +114,9 @@ _IntType negative_binomial_distribution<_IntType>::operator()(_URNG& __urng, con else ++__f; } - _LIBCPP_ASSERT_UNCATEGORIZED( - __f >= 0, - "std::negative_binomial_distribution should never produce negative values. " - "This is almost certainly a signed integer overflow issue on __f."); + _LIBCPP_ASSERT_INTERNAL(__f >= 0, + "std::negative_binomial_distribution should never produce negative values. " + "This is almost certainly a signed integer overflow issue on __f."); return __f; } return poisson_distribution<result_type>(gamma_distribution<double>(__k, (1 - __p) / __p)(__urng))(__urng); diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h index 17a7de02fb..7e9888768e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h @@ -35,7 +35,7 @@ public: // constructors _LIBCPP_HIDE_FROM_ABI seed_seq() _NOEXCEPT {} #ifndef _LIBCPP_CXX03_LANG - template <class _Tp, __enable_if_t<is_integral<_Tp>::value>* = nullptr> + template <class _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI seed_seq(initializer_list<_Tp> __il) { __init(__il.begin(), __il.end()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/chunk_by_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/chunk_by_view.h index e469986876..b04a23de99 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/chunk_by_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/chunk_by_view.h @@ -54,7 +54,7 @@ namespace ranges { template <forward_range _View, indirect_binary_predicate<iterator_t<_View>, iterator_t<_View>> _Pred> requires view<_View> && is_object_v<_Pred> -class chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> { +class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> { _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_; @@ -65,7 +65,8 @@ class chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> { class __iterator; _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> __find_next(iterator_t<_View> __current) { - _LIBCPP_ASSERT_UNCATEGORIZED( + // Note: this duplicates a check in `optional` but provides a better error message. + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __pred_.__has_value(), "Trying to call __find_next() on a chunk_by_view that does not have a valid predicate."); auto __reversed_pred = [this]<class _Tp, class _Up>(_Tp&& __x, _Up&& __y) -> bool { return !std::invoke(*__pred_, std::forward<_Tp>(__x), std::forward<_Up>(__y)); @@ -77,9 +78,10 @@ class chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> { _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> __find_prev(iterator_t<_View> __current) requires bidirectional_range<_View> { - _LIBCPP_ASSERT_UNCATEGORIZED( - __current != ranges::begin(__base_), "Trying to call __find_prev() on a begin iterator."); - _LIBCPP_ASSERT_UNCATEGORIZED( + // Attempting to decrement a begin iterator is a no-op (`__find_prev` would return the same argument given to it). + _LIBCPP_ASSERT_PEDANTIC(__current != ranges::begin(__base_), "Trying to call __find_prev() on a begin iterator."); + // Note: this duplicates a check in `optional` but provides a better error message. + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __pred_.__has_value(), "Trying to call __find_prev() on a chunk_by_view that does not have a valid predicate."); auto __first = ranges::begin(__base_); @@ -109,7 +111,8 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() { - _LIBCPP_ASSERT_UNCATEGORIZED( + // Note: this duplicates a check in `optional` but provides a better error message. + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __pred_.__has_value(), "Trying to call begin() on a chunk_by_view that does not have a valid predicate."); auto __first = ranges::begin(__base_); @@ -153,12 +156,15 @@ public: _LIBCPP_HIDE_FROM_ABI __iterator() = default; _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { - _LIBCPP_ASSERT_UNCATEGORIZED(__current_ != __next_, "Trying to dereference past-the-end chunk_by_view iterator."); + // If the iterator is at end, this would return an empty range which can be checked by the calling code and doesn't + // necessarily lead to a bad access. + _LIBCPP_ASSERT_PEDANTIC(__current_ != __next_, "Trying to dereference past-the-end chunk_by_view iterator."); return {__current_, __next_}; } _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { - _LIBCPP_ASSERT_UNCATEGORIZED(__current_ != __next_, "Trying to increment past end chunk_by_view iterator."); + // Attempting to increment an end iterator is a no-op (`__find_next` would return the same argument given to it). + _LIBCPP_ASSERT_PEDANTIC(__current_ != __next_, "Trying to increment past end chunk_by_view iterator."); __current_ = __next_; __next_ = __parent_->__find_next(__current_); return *this; diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h index 3376348957..83d76f8fd2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h @@ -29,6 +29,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -82,4 +85,6 @@ inline constexpr auto counted = __counted::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_COUNTED_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h index 2b89c6877a..83bb598b0a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h @@ -90,6 +90,10 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr auto begin() requires(!(__simple_view<_View> && random_access_range<const _View> && sized_range<const _View>)) { + if constexpr (random_access_range<_View> && sized_range<_View>) { + const auto __dist = std::min(ranges::distance(__base_), __count_); + return ranges::begin(__base_) + __dist; + } if constexpr (_UseCache) if (__cached_begin_.__has_value()) return *__cached_begin_; @@ -103,7 +107,8 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const requires random_access_range<const _View> && sized_range<const _View> { - return ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_)); + const auto __dist = std::min(ranges::distance(__base_), __count_); + return ranges::begin(__base_) + __dist; } _LIBCPP_HIDE_FROM_ABI constexpr auto end() diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_while_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_while_view.h index 677b5bc66d..92f48bd0ec 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_while_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_while_view.h @@ -37,6 +37,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -45,7 +48,7 @@ namespace ranges { template <view _View, class _Pred> requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> -class drop_while_view : public view_interface<drop_while_view<_View, _Pred>> { +class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS drop_while_view : public view_interface<drop_while_view<_View, _Pred>> { public: _LIBCPP_HIDE_FROM_ABI drop_while_view() requires default_initializable<_View> && default_initializable<_Pred> @@ -65,7 +68,8 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { - _LIBCPP_ASSERT_UNCATEGORIZED( + // Note: this duplicates a check in `optional` but provides a better error message. + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __pred_.__has_value(), "drop_while_view needs to have a non-empty predicate before calling begin() -- did a previous " "assignment to this drop_while_view fail?"); @@ -127,4 +131,6 @@ inline constexpr auto drop_while = __drop_while::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_DROP_WHILE_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/elements_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/elements_view.h index 325e4c9dca..f159f53dc0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/elements_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/elements_view.h @@ -16,7 +16,7 @@ #include <__concepts/derived_from.h> #include <__concepts/equality_comparable.h> #include <__config> -#include <__fwd/get.h> +#include <__fwd/complex.h> #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> #include <__ranges/access.h> @@ -43,6 +43,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -410,4 +413,6 @@ inline constexpr auto values = elements<1>; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_ELEMENTS_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/filter_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/filter_view.h index 08d50ab011..5b938dd4c1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/filter_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/filter_view.h @@ -44,6 +44,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -51,7 +54,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> requires view<_View> && is_object_v<_Pred> -class filter_view : public view_interface<filter_view<_View, _Pred>> { +class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS filter_view : public view_interface<filter_view<_View, _Pred>> { _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_; @@ -83,7 +86,8 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr _Pred const& pred() const { return *__pred_; } _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() { - _LIBCPP_ASSERT_UNCATEGORIZED( + // Note: this duplicates a check in `optional` but provides a better error message. + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __pred_.__has_value(), "Trying to call begin() on a filter_view that does not have a valid predicate."); if constexpr (_UseCache) { if (!__cached_begin_.__has_value()) { @@ -251,4 +255,6 @@ inline constexpr auto filter = __filter::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_FILTER_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h index c6c9618cfe..c8314dd848 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h @@ -41,6 +41,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -395,4 +398,6 @@ inline constexpr auto iota = __iota::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_IOTA_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h index 2247305913..9c2c779955 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h @@ -41,6 +41,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -415,4 +418,6 @@ struct __segmented_iterator_traits<_JoinViewIterator> { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_JOIN_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/lazy_split_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/lazy_split_view.h index e96398b14b..6aedfdabff 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/lazy_split_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/lazy_split_view.h @@ -47,6 +47,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -433,4 +436,6 @@ inline constexpr auto lazy_split = __lazy_split_view::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_LAZY_SPLIT_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/movable_box.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/movable_box.h index 6615533d37..9b38877494 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/movable_box.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/movable_box.h @@ -134,6 +134,20 @@ concept __doesnt_need_empty_state = // 2. Otherwise, movable-box<T> should store only a T if either T models movable or // is_nothrow_move_constructible_v<T> is true. : movable<_Tp> || is_nothrow_move_constructible_v<_Tp>); + +// When _Tp doesn't have an assignment operator, we must implement __movable_box's assignment operator +// by doing destroy_at followed by construct_at. However, that implementation strategy leads to UB if the nested +// _Tp is potentially overlapping, as it is doing a non-transparent replacement of the sub-object, which means that +// we're not considered "nested" inside the movable-box anymore, and since we're not nested within it, [basic.life]/1.5 +// says that we essentially just reused the storage of the movable-box for a completely unrelated object and ended the +// movable-box's lifetime. +// https://github.com/llvm/llvm-project/issues/70494#issuecomment-1845646490 +// +// Hence, when the _Tp doesn't have an assignment operator, we can't risk making it a potentially-overlapping +// subobject because of the above, and we don't use [[no_unique_address]] in that case. +template <class _Tp> +concept __can_use_no_unique_address = (copy_constructible<_Tp> ? copyable<_Tp> : movable<_Tp>); + # else template <class _Tp> @@ -144,23 +158,45 @@ concept __doesnt_need_empty_state_for_move = movable<_Tp> || is_nothrow_move_con template <class _Tp> concept __doesnt_need_empty_state = __doesnt_need_empty_state_for_copy<_Tp> && __doesnt_need_empty_state_for_move<_Tp>; + +template <class _Tp> +concept __can_use_no_unique_address = copyable<_Tp>; # endif +template <class _Tp> +struct __movable_box_holder { + _Tp __val_; + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box_holder(in_place_t, _Args&&... __args) + : __val_(std::forward<_Args>(__args)...) {} +}; + +template <class _Tp> + requires __can_use_no_unique_address<_Tp> +struct __movable_box_holder<_Tp> { + _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_; + + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box_holder(in_place_t, _Args&&... __args) + : __val_(std::forward<_Args>(__args)...) {} +}; + template <__movable_box_object _Tp> requires __doesnt_need_empty_state<_Tp> class __movable_box<_Tp> { - _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_; + _LIBCPP_NO_UNIQUE_ADDRESS __movable_box_holder<_Tp> __holder_; public: template <class... _Args> requires is_constructible_v<_Tp, _Args...> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box(in_place_t, _Args&&... __args) noexcept( + _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box(in_place_t __inplace, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Tp, _Args...>) - : __val_(std::forward<_Args>(__args)...) {} + : __holder_(__inplace, std::forward<_Args>(__args)...) {} _LIBCPP_HIDE_FROM_ABI constexpr __movable_box() noexcept(is_nothrow_default_constructible_v<_Tp>) requires default_initializable<_Tp> - : __val_() {} + : __holder_(in_place_t{}) {} _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box const&) = default; _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box&&) = default; @@ -176,27 +212,29 @@ public: // Implementation of assignment operators in case we perform optimization (2) _LIBCPP_HIDE_FROM_ABI constexpr __movable_box& operator=(__movable_box const& __other) noexcept { static_assert(is_nothrow_copy_constructible_v<_Tp>); + static_assert(!__can_use_no_unique_address<_Tp>); if (this != std::addressof(__other)) { - std::destroy_at(std::addressof(__val_)); - std::construct_at(std::addressof(__val_), __other.__val_); + std::destroy_at(std::addressof(__holder_.__val_)); + std::construct_at(std::addressof(__holder_.__val_), __other.__holder_.__val_); } return *this; } _LIBCPP_HIDE_FROM_ABI constexpr __movable_box& operator=(__movable_box&& __other) noexcept { static_assert(is_nothrow_move_constructible_v<_Tp>); + static_assert(!__can_use_no_unique_address<_Tp>); if (this != std::addressof(__other)) { - std::destroy_at(std::addressof(__val_)); - std::construct_at(std::addressof(__val_), std::move(__other.__val_)); + std::destroy_at(std::addressof(__holder_.__val_)); + std::construct_at(std::addressof(__holder_.__val_), std::move(__other.__holder_.__val_)); } return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return __val_; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return __val_; } + _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return __holder_.__val_; } + _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return __holder_.__val_; } - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept { return std::addressof(__val_); } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept { return std::addressof(__val_); } + _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept { return std::addressof(__holder_.__val_); } + _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept { return std::addressof(__holder_.__val_); } _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return true; } }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/repeat_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/repeat_view.h index 459a1e2296..620a264549 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/repeat_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/repeat_view.h @@ -10,6 +10,7 @@ #ifndef _LIBCPP___RANGES_REPEAT_VIEW_H #define _LIBCPP___RANGES_REPEAT_VIEW_H +#include <__assert> #include <__concepts/constructible.h> #include <__concepts/same_as.h> #include <__concepts/semiregular.h> @@ -34,6 +35,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 23 @@ -68,7 +72,7 @@ struct __fn; template <move_constructible _Tp, semiregular _Bound = unreachable_sentinel_t> requires(is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>> && (__integer_like_with_usable_difference_type<_Bound> || same_as<_Bound, unreachable_sentinel_t>)) -class repeat_view : public view_interface<repeat_view<_Tp, _Bound>> { +class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS repeat_view : public view_interface<repeat_view<_Tp, _Bound>> { friend struct views::__take::__fn; friend struct views::__drop::__fn; class __iterator; @@ -119,7 +123,7 @@ public: } private: - __movable_box<_Tp> __value_; + _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Tp> __value_; _LIBCPP_NO_UNIQUE_ADDRESS _Bound __bound_ = _Bound(); }; @@ -257,4 +261,6 @@ inline constexpr bool __is_repeat_specialization<repeat_view<_Tp, _Bound>> = tru _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_REPEAT_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h index f784625981..ddbe890841 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h @@ -33,6 +33,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -196,4 +199,6 @@ inline constexpr auto reverse = __reverse::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_REVERSE_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h index b0b2c1d9f3..f91c7c3526 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h @@ -26,6 +26,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -37,8 +40,8 @@ template <move_constructible _Tp> template <copy_constructible _Tp> # endif requires is_object_v<_Tp> -class single_view : public view_interface<single_view<_Tp>> { - __movable_box<_Tp> __value_; +class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS single_view : public view_interface<single_view<_Tp>> { + _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Tp> __value_; public: _LIBCPP_HIDE_FROM_ABI single_view() @@ -101,4 +104,6 @@ inline constexpr auto single = __single_view::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_SINGLE_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/split_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/split_view.h index 7f03be3c34..98f17be04f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/split_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/split_view.h @@ -36,6 +36,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -224,4 +227,6 @@ inline constexpr auto split = __split_view::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_SPLIT_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h index a7a3c1efa7..bb4411cf35 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h @@ -17,7 +17,6 @@ #include <__concepts/derived_from.h> #include <__concepts/different_from.h> #include <__config> -#include <__fwd/get.h> #include <__fwd/subrange.h> #include <__iterator/advance.h> #include <__iterator/concepts.h> @@ -101,8 +100,8 @@ public: requires(_Kind == subrange_kind::sized) : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n) { if constexpr (sized_sentinel_for<_Sent, _Iter>) - _LIBCPP_ASSERT_UNCATEGORIZED((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n), - "std::ranges::subrange was passed an invalid size hint"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n), + "std::ranges::subrange was passed an invalid size hint"); } template <__different_from<subrange> _Range> diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h index 4fd1d8b9ab..83ed5ca0eb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h @@ -276,23 +276,31 @@ struct __fn { } // [range.take.overview]: the `iota_view` case. + // clang-format off template <class _Range, convertible_to<range_difference_t<_Range>> _Np, class _RawRange = remove_cvref_t<_Range>, class _Dist = range_difference_t<_Range>> - requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> && - __is_iota_specialization<_RawRange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto - operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(ranges::iota_view( - *ranges::begin(__rng), *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))))) - -> decltype(ranges::iota_view( - // Note: deliberately not forwarding `__rng` to guard against double moves. - *ranges::begin(__rng), - *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))) { - return ranges::iota_view(*ranges::begin(__rng), - *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))); - } - // clang-format off + requires (!__is_empty_view<_RawRange> && + random_access_range<_RawRange> && + sized_range<_RawRange> && + __is_iota_specialization<_RawRange>) + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Range&& __rng, _Np&& __n) const + noexcept(noexcept(ranges::iota_view( + *ranges::begin(__rng), + *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))) + ))) + -> decltype( ranges::iota_view( + // Note: deliberately not forwarding `__rng` to guard against double moves. + *ranges::begin(__rng), + *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))) + )) + { return ranges::iota_view( + *ranges::begin(__rng), + *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))) + ); } + #if _LIBCPP_STD_VER >= 23 // [range.take.overview]: the `repeat_view` "_RawRange models sized_range" case. template <class _Range, diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_while_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_while_view.h index a6f7f80ca7..77ea9f7bb8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_while_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_while_view.h @@ -35,6 +35,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -43,7 +46,7 @@ namespace ranges { template <view _View, class _Pred> requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> -class take_while_view : public view_interface<take_while_view<_View, _Pred>> { +class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS take_while_view : public view_interface<take_while_view<_View, _Pred>> { template <bool> class __sentinel; @@ -162,4 +165,6 @@ inline constexpr auto take_while = __take_while::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_TAKE_WHILE_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h index 55c6ce587b..dc3aaa59ed 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h @@ -47,6 +47,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 @@ -67,7 +70,7 @@ template <input_range _View, move_constructible _Fn> template <input_range _View, copy_constructible _Fn> # endif requires __transform_view_constraints<_View, _Fn> -class transform_view : public view_interface<transform_view<_View, _Fn>> { +class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS transform_view : public view_interface<transform_view<_View, _Fn>> { template <bool> class __iterator; template <bool> @@ -416,4 +419,6 @@ inline constexpr auto transform = __transform::__fn{}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___RANGES_TRANSFORM_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h index 3216e0bd6f..84dd1c316d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h @@ -109,7 +109,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front() requires forward_range<_D2> { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view."); return *ranges::begin(__derived()); } @@ -118,7 +118,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front() const requires forward_range<const _D2> { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( !empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view."); return *ranges::begin(__derived()); } @@ -127,7 +127,8 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back() requires bidirectional_range<_D2> && common_range<_D2> { - _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view."); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view."); return *ranges::prev(ranges::end(__derived())); } @@ -135,7 +136,8 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back() const requires bidirectional_range<const _D2> && common_range<const _D2> { - _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view."); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + !empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view."); return *ranges::prev(ranges::end(__derived())); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_state.h b/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_state.h index 462aa73952..df07573f87 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_state.h +++ b/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_state.h @@ -10,6 +10,7 @@ #ifndef _LIBCPP___STOP_TOKEN_STOP_STATE_H #define _LIBCPP___STOP_TOKEN_STOP_STATE_H +#include <__assert> #include <__availability> #include <__config> #include <__stop_token/atomic_unique_lock.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h index e3563c57fe..91b413abda 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h @@ -14,6 +14,7 @@ #include <__algorithm/find_end.h> #include <__algorithm/find_first_of.h> #include <__algorithm/min.h> +#include <__assert> #include <__compare/ordering.h> #include <__config> #include <__functional/hash.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h index 774081a8a4..42d24db94e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h +++ b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h @@ -17,9 +17,11 @@ #include <__config> #include <ctype.h> +#include <string.h> #include <time.h> #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# include <wchar.h> # include <wctype.h> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__system_error/error_category.h b/contrib/libs/cxxsupp/libcxx/include/__system_error/error_category.h index 11c920e326..bfe7bc24a5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__system_error/error_category.h +++ b/contrib/libs/cxxsupp/libcxx/include/__system_error/error_category.h @@ -67,8 +67,8 @@ public: string message(int __ev) const override; }; -_LIBCPP_EXPORTED_FROM_ABI const error_category& generic_category() _NOEXCEPT; -_LIBCPP_EXPORTED_FROM_ABI const error_category& system_category() _NOEXCEPT; +__attribute__((__const__)) _LIBCPP_EXPORTED_FROM_ABI const error_category& generic_category() _NOEXCEPT; +__attribute__((__const__)) _LIBCPP_EXPORTED_FROM_ABI const error_category& system_category() _NOEXCEPT; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/formatter.h b/contrib/libs/cxxsupp/libcxx/include/__thread/formatter.h index 0454864ce9..9b54036dca 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/formatter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/formatter.h @@ -43,7 +43,7 @@ public: template <class _FormatContext> _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(__thread_id __id, _FormatContext& __ctx) const { - // In __threading_support __libcpp_thread_id is either a + // In __thread/support/pthread.h, __libcpp_thread_id is either a // unsigned long long or a pthread_t. // // The type of pthread_t is left unspecified in POSIX so it can be any diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/id.h b/contrib/libs/cxxsupp/libcxx/include/__thread/id.h index 83b1d8ecee..6db0ccbfe5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/id.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/id.h @@ -12,9 +12,9 @@ #include <__compare/ordering.h> #include <__config> -#include <__fwd/hash.h> +#include <__fwd/functional.h> #include <__fwd/ostream.h> -#include <__threading_support> +#include <__thread/support.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/jthread.h b/contrib/libs/cxxsupp/libcxx/include/__thread/jthread.h index fc86b13afb..253e3a935d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/jthread.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/jthread.h @@ -15,8 +15,8 @@ #include <__functional/invoke.h> #include <__stop_token/stop_source.h> #include <__stop_token/stop_token.h> +#include <__thread/support.h> #include <__thread/thread.h> -#include <__threading_support> #include <__type_traits/decay.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_same.h> @@ -28,6 +28,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) _LIBCPP_BEGIN_NAMESPACE_STD @@ -127,4 +130,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +_LIBCPP_POP_MACROS + #endif // _LIBCPP___THREAD_JTHREAD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/poll_with_backoff.h b/contrib/libs/cxxsupp/libcxx/include/__thread/poll_with_backoff.h index 0a2eef9a52..d8354e6ca2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/poll_with_backoff.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/poll_with_backoff.h @@ -26,21 +26,21 @@ static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64; // Polls a thread for a condition given by a predicate, and backs off based on a backoff policy // before polling again. // -// - __f is the "test function" that should return true if polling succeeded, and false if it failed. +// - __poll is the "test function" that should return true if polling succeeded, and false if it failed. // -// - __bf is the "backoff policy", which is called with the duration since we started polling. It should +// - __backoff is the "backoff policy", which is called with the duration since we started polling. It should // return false in order to resume polling, and true if polling should stop entirely for some reason. // In general, backoff policies sleep for some time before returning control to the polling loop. // // - __max_elapsed is the maximum duration to try polling for. If the maximum duration is exceeded, // the polling loop will return false to report a timeout. -template <class _Fn, class _BFn> +template <class _Poll, class _Backoff> _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_poll_with_backoff( - _Fn&& __f, _BFn&& __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero()) { + _Poll&& __poll, _Backoff&& __backoff, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero()) { auto const __start = chrono::high_resolution_clock::now(); for (int __count = 0;;) { - if (__f()) - return true; // _Fn completion means success + if (__poll()) + return true; // __poll completion means success if (__count < __libcpp_polling_count) { __count += 1; continue; @@ -48,8 +48,8 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_poll_with_b chrono::nanoseconds const __elapsed = chrono::high_resolution_clock::now() - __start; if (__max_elapsed != chrono::nanoseconds::zero() && __max_elapsed < __elapsed) return false; // timeout failure - if (__bf(__elapsed)) - return false; // _BFn completion means failure + if (__backoff(__elapsed)) + return false; // __backoff completion means failure } } diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/support.h b/contrib/libs/cxxsupp/libcxx/include/__thread/support.h new file mode 100644 index 0000000000..92f1c4415e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/support.h @@ -0,0 +1,123 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___THREAD_SUPPORT_H +#define _LIBCPP___THREAD_SUPPORT_H + +#include <__config> + +#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +# pragma GCC system_header +#endif + +/* + +// +// The library supports multiple implementations of the basic threading functionality. +// The following functionality must be provided by any implementation: +// + +_LIBCPP_BEGIN_NAMESPACE_STD + +using __libcpp_timespec_t = ...; + +// +// Mutex +// +using __libcpp_mutex_t = ...; +#define _LIBCPP_MUTEX_INITIALIZER ... + +using __libcpp_recursive_mutex_t = ...; + +int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t*); +_LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t*); +_LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t*); +_LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t*); +int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t*); + +_LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t*); +_LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t*); +_LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t*); +int __libcpp_mutex_destroy(__libcpp_mutex_t*); + +// +// Condition Variable +// +using __libcpp_condvar_t = ...; +#define _LIBCPP_CONDVAR_INITIALIZER ... + +int __libcpp_condvar_signal(__libcpp_condvar_t*); +int __libcpp_condvar_broadcast(__libcpp_condvar_t*); +_LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_condvar_wait(__libcpp_condvar_t*, __libcpp_mutex_t*); +_LIBCPP_NO_THREAD_SAFETY_ANALYSIS +int __libcpp_condvar_timedwait(__libcpp_condvar_t*, __libcpp_mutex_t*, __libcpp_timespec_t*); +int __libcpp_condvar_destroy(__libcpp_condvar_t*); + +// +// Execute once +// +using __libcpp_exec_once_flag = ...; +#define _LIBCPP_EXEC_ONCE_INITIALIZER ... + +int __libcpp_execute_once(__libcpp_exec_once_flag*, void (*__init_routine)()); + +// +// Thread id +// +using __libcpp_thread_id = ...; + +bool __libcpp_thread_id_equal(__libcpp_thread_id, __libcpp_thread_id); +bool __libcpp_thread_id_less(__libcpp_thread_id, __libcpp_thread_id); + +// +// Thread +// +#define _LIBCPP_NULL_THREAD ... +using __libcpp_thread_t = ...; + +bool __libcpp_thread_isnull(const __libcpp_thread_t*); +int __libcpp_thread_create(__libcpp_thread_t*, void* (*__func)(void*), void* __arg); +__libcpp_thread_id __libcpp_thread_get_current_id(); +__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t*); +int __libcpp_thread_join(__libcpp_thread_t*); +int __libcpp_thread_detach(__libcpp_thread_t*); +void __libcpp_thread_yield(); +void __libcpp_thread_sleep_for(const chrono::nanoseconds&); + +// +// Thread local storage +// +#define _LIBCPP_TLS_DESTRUCTOR_CC ... +using __libcpp_tls_key = ...; + +int __libcpp_tls_create(__libcpp_tls_key*, void (*__at_exit)(void*)); +void* __libcpp_tls_get(__libcpp_tls_key); +int __libcpp_tls_set(__libcpp_tls_key, void*); + +_LIBCPP_END_NAMESPACE_STD + +*/ + +#if !defined(_LIBCPP_HAS_NO_THREADS) + +# if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) +# include <__thread/support/external.h> +# elif defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +# include <__thread/support/pthread.h> +# elif defined(_LIBCPP_HAS_THREAD_API_C11) +# include <__thread/support/c11.h> +# elif defined(_LIBCPP_HAS_THREAD_API_WIN32) +# include <__thread/support/windows.h> +# else +# error "No threading API was selected" +# endif + +#endif // !_LIBCPP_HAS_NO_THREADS + +#endif // _LIBCPP___THREAD_SUPPORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/support/c11.h b/contrib/libs/cxxsupp/libcxx/include/__thread/support/c11.h new file mode 100644 index 0000000000..fe00a2d97f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/support/c11.h @@ -0,0 +1,191 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___THREAD_SUPPORT_C11_H +#define _LIBCPP___THREAD_SUPPORT_C11_H + +#include <__chrono/convert_to_timespec.h> +#include <__chrono/duration.h> +#include <__config> +#include <ctime> +#include <errno.h> +#include <threads.h> + +#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +using __libcpp_timespec_t = ::timespec; + +// +// Mutex +// +typedef mtx_t __libcpp_mutex_t; +// mtx_t is a struct so using {} for initialization is valid. +#define _LIBCPP_MUTEX_INITIALIZER \ + {} + +typedef mtx_t __libcpp_recursive_mutex_t; + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m) { + return mtx_init(__m, mtx_plain | mtx_recursive) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) { + return mtx_lock(__m) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool +__libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) { + return mtx_trylock(__m) == thrd_success; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) { + return mtx_unlock(__m) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m) { + mtx_destroy(__m); + return 0; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t* __m) { + return mtx_lock(__m) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) { + return mtx_trylock(__m) == thrd_success; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) { + return mtx_unlock(__m) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_mutex_destroy(__libcpp_mutex_t* __m) { + mtx_destroy(__m); + return 0; +} + +// +// Condition Variable +// +typedef cnd_t __libcpp_condvar_t; +// cnd_t is a struct so using {} for initialization is valid. +#define _LIBCPP_CONDVAR_INITIALIZER \ + {} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_condvar_signal(__libcpp_condvar_t* __cv) { + return cnd_signal(__cv) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv) { + return cnd_broadcast(__cv) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) { + return cnd_wait(__cv, __m) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, timespec* __ts) { + int __ec = cnd_timedwait(__cv, __m, __ts); + return __ec == thrd_timedout ? ETIMEDOUT : __ec; +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv) { + cnd_destroy(__cv); + return 0; +} + +// +// Execute once +// +typedef ::once_flag __libcpp_exec_once_flag; +#define _LIBCPP_EXEC_ONCE_INITIALIZER ONCE_FLAG_INIT + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_execute_once(__libcpp_exec_once_flag* flag, void (*init_routine)(void)) { + ::call_once(flag, init_routine); + return 0; +} + +// +// Thread id +// +typedef thrd_t __libcpp_thread_id; + +// Returns non-zero if the thread ids are equal, otherwise 0 +inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2) { + return thrd_equal(t1, t2) != 0; +} + +// Returns non-zero if t1 < t2, otherwise 0 +inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2) { + return t1 < t2; +} + +// +// Thread +// +#define _LIBCPP_NULL_THREAD 0U + +typedef thrd_t __libcpp_thread_t; + +inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) { return *__t; } + +inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_isnull(const __libcpp_thread_t* __t) { + return __libcpp_thread_get_id(__t) == 0; +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg) { + int __ec = thrd_create(__t, reinterpret_cast<thrd_start_t>(__func), __arg); + return __ec == thrd_nomem ? ENOMEM : __ec; +} + +inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_current_id() { return thrd_current(); } + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_join(__libcpp_thread_t* __t) { + return thrd_join(*__t, nullptr) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_detach(__libcpp_thread_t* __t) { + return thrd_detach(*__t) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI void __libcpp_thread_yield() { thrd_yield(); } + +inline _LIBCPP_HIDE_FROM_ABI void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) { + __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns); + thrd_sleep(&__ts, nullptr); +} + +// +// Thread local storage +// +#define _LIBCPP_TLS_DESTRUCTOR_CC /* nothing */ + +typedef tss_t __libcpp_tls_key; + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_tls_create(__libcpp_tls_key* __key, void (*__at_exit)(void*)) { + return tss_create(__key, __at_exit) == thrd_success ? 0 : EINVAL; +} + +inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_tls_get(__libcpp_tls_key __key) { return tss_get(__key); } + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { + return tss_set(__key, __p) == thrd_success ? 0 : EINVAL; +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___THREAD_SUPPORT_C11_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/support/external.h b/contrib/libs/cxxsupp/libcxx/include/__thread/support/external.h new file mode 100644 index 0000000000..129dfd85a0 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/support/external.h @@ -0,0 +1,21 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___THREAD_SUPPORT_EXTERNAL_H +#define _LIBCPP___THREAD_SUPPORT_EXTERNAL_H + +#include <__config> + +#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +# pragma GCC system_header +#endif + +#error ##include <__external_threading> + +#endif // _LIBCPP___THREAD_SUPPORT_EXTERNAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/support/pthread.h b/contrib/libs/cxxsupp/libcxx/include/__thread/support/pthread.h new file mode 100644 index 0000000000..e194e5c68a --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/support/pthread.h @@ -0,0 +1,222 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___THREAD_SUPPORT_PTHREAD_H +#define _LIBCPP___THREAD_SUPPORT_PTHREAD_H + +#include <__availability> +#include <__chrono/convert_to_timespec.h> +#include <__chrono/duration.h> +#include <__config> +#include <ctime> +#include <errno.h> +#include <pthread.h> +#include <sched.h> + +#ifdef __MVS__ +# include <__support/ibm/nanosleep.h> +#endif + +// Some platforms require <bits/atomic_wide_counter.h> in order for +// PTHREAD_COND_INITIALIZER to be expanded. Normally that would come +// in via <pthread.h>, but it's a non-modular header on those platforms, +// so libc++'s <math.h> usually absorbs atomic_wide_counter.h into the +// module with <math.h> and makes atomic_wide_counter.h invisible. +// Include <math.h> here to work around that. +// This checks wheter a Clang module is built +#if __building_module(std) +# include <math.h> +#endif + +#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +using __libcpp_timespec_t = ::timespec; + +// +// Mutex +// +typedef pthread_mutex_t __libcpp_mutex_t; +#define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER + +typedef pthread_mutex_t __libcpp_recursive_mutex_t; + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m) { + pthread_mutexattr_t __attr; + int __ec = pthread_mutexattr_init(&__attr); + if (__ec) + return __ec; + __ec = pthread_mutexattr_settype(&__attr, PTHREAD_MUTEX_RECURSIVE); + if (__ec) { + pthread_mutexattr_destroy(&__attr); + return __ec; + } + __ec = pthread_mutex_init(__m, &__attr); + if (__ec) { + pthread_mutexattr_destroy(&__attr); + return __ec; + } + __ec = pthread_mutexattr_destroy(&__attr); + if (__ec) { + pthread_mutex_destroy(__m); + return __ec; + } + return 0; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) { + return pthread_mutex_lock(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool +__libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) { + return pthread_mutex_trylock(__m) == 0; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) { + return pthread_mutex_unlock(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m) { + return pthread_mutex_destroy(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t* __m) { + return pthread_mutex_lock(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) { + return pthread_mutex_trylock(__m) == 0; +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) { + return pthread_mutex_unlock(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_mutex_destroy(__libcpp_mutex_t* __m) { return pthread_mutex_destroy(__m); } + +// +// Condition Variable +// +typedef pthread_cond_t __libcpp_condvar_t; +#define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_condvar_signal(__libcpp_condvar_t* __cv) { return pthread_cond_signal(__cv); } + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv) { + return pthread_cond_broadcast(__cv); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) { + return pthread_cond_wait(__cv, __m); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts) { + return pthread_cond_timedwait(__cv, __m, __ts); +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv) { + return pthread_cond_destroy(__cv); +} + +// +// Execute once +// +typedef pthread_once_t __libcpp_exec_once_flag; +#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_execute_once(__libcpp_exec_once_flag* __flag, void (*__init_routine)()) { + return pthread_once(__flag, __init_routine); +} + +// +// Thread id +// +#if defined(__MVS__) +typedef unsigned long long __libcpp_thread_id; +#else +typedef pthread_t __libcpp_thread_id; +#endif + +// Returns non-zero if the thread ids are equal, otherwise 0 +inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_id_equal(__libcpp_thread_id __t1, __libcpp_thread_id __t2) { + return __t1 == __t2; +} + +// Returns non-zero if t1 < t2, otherwise 0 +inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2) { + return __t1 < __t2; +} + +// +// Thread +// +#define _LIBCPP_NULL_THREAD ((__libcpp_thread_t())) +typedef pthread_t __libcpp_thread_t; + +inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) { +#if defined(__MVS__) + return __t->__; +#else + return *__t; +#endif +} + +inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_isnull(const __libcpp_thread_t* __t) { + return __libcpp_thread_get_id(__t) == 0; +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg) { + return pthread_create(__t, nullptr, __func, __arg); +} + +inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_current_id() { + const __libcpp_thread_t __current_thread = pthread_self(); + return __libcpp_thread_get_id(&__current_thread); +} + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_join(__libcpp_thread_t* __t) { return pthread_join(*__t, nullptr); } + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_detach(__libcpp_thread_t* __t) { return pthread_detach(*__t); } + +inline _LIBCPP_HIDE_FROM_ABI void __libcpp_thread_yield() { sched_yield(); } + +inline _LIBCPP_HIDE_FROM_ABI void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) { + __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns); + while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR) + ; +} + +// +// Thread local storage +// +#define _LIBCPP_TLS_DESTRUCTOR_CC /* nothing */ + +typedef pthread_key_t __libcpp_tls_key; + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_tls_create(__libcpp_tls_key* __key, void (*__at_exit)(void*)) { + return pthread_key_create(__key, __at_exit); +} + +inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_tls_get(__libcpp_tls_key __key) { return pthread_getspecific(__key); } + +inline _LIBCPP_HIDE_FROM_ABI int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { + return pthread_setspecific(__key, __p); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___THREAD_SUPPORT_PTHREAD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/support/windows.h b/contrib/libs/cxxsupp/libcxx/include/__thread/support/windows.h new file mode 100644 index 0000000000..5dc4fa14f4 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/support/windows.h @@ -0,0 +1,133 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___THREAD_SUPPORT_WINDOWS_H +#define _LIBCPP___THREAD_SUPPORT_WINDOWS_H + +#include <__chrono/duration.h> +#include <__config> +#include <ctime> + +#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +using __libcpp_timespec_t = ::timespec; + +// +// Mutex +// +typedef void* __libcpp_mutex_t; +#define _LIBCPP_MUTEX_INITIALIZER 0 + +#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__) +typedef void* __libcpp_recursive_mutex_t[6]; +#elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__) +typedef void* __libcpp_recursive_mutex_t[5]; +#else +# error Unsupported architecture +#endif + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m); + +_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m); + +_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool +__libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m); + +_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m); + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m); + +_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t* __m); + +_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m); + +_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t* __m); + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_mutex_destroy(__libcpp_mutex_t* __m); + +// +// Condition variable +// +typedef void* __libcpp_condvar_t; +#define _LIBCPP_CONDVAR_INITIALIZER 0 + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_condvar_signal(__libcpp_condvar_t* __cv); + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv); + +_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m); + +_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int +__libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts); + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv); + +// +// Execute once +// +typedef void* __libcpp_exec_once_flag; +#define _LIBCPP_EXEC_ONCE_INITIALIZER 0 + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_execute_once(__libcpp_exec_once_flag* __flag, void (*__init_routine)()); + +// +// Thread id +// +typedef long __libcpp_thread_id; + +_LIBCPP_EXPORTED_FROM_ABI bool __libcpp_thread_id_equal(__libcpp_thread_id __t1, __libcpp_thread_id __t2); + +_LIBCPP_EXPORTED_FROM_ABI bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2); + +// +// Thread +// +#define _LIBCPP_NULL_THREAD 0U +typedef void* __libcpp_thread_t; + +_LIBCPP_EXPORTED_FROM_ABI bool __libcpp_thread_isnull(const __libcpp_thread_t* __t); + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg); + +_LIBCPP_EXPORTED_FROM_ABI __libcpp_thread_id __libcpp_thread_get_current_id(); + +_LIBCPP_EXPORTED_FROM_ABI __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t); + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_thread_join(__libcpp_thread_t* __t); + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_thread_detach(__libcpp_thread_t* __t); + +_LIBCPP_EXPORTED_FROM_ABI void __libcpp_thread_yield(); + +_LIBCPP_EXPORTED_FROM_ABI void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns); + +// +// Thread local storage +// +typedef long __libcpp_tls_key; + +#define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall + +_LIBCPP_EXPORTED_FROM_ABI int +__libcpp_tls_create(__libcpp_tls_key* __key, void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*)); + +_LIBCPP_EXPORTED_FROM_ABI void* __libcpp_tls_get(__libcpp_tls_key __key); + +_LIBCPP_EXPORTED_FROM_ABI int __libcpp_tls_set(__libcpp_tls_key __key, void* __p); + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___THREAD_SUPPORT_WINDOWS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/this_thread.h b/contrib/libs/cxxsupp/libcxx/include/__thread/this_thread.h index 6fb42533aa..de7eea282c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/this_thread.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/this_thread.h @@ -16,7 +16,7 @@ #include <__config> #include <__mutex/mutex.h> #include <__mutex/unique_lock.h> -#include <__threading_support> +#include <__thread/support.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/thread.h b/contrib/libs/cxxsupp/libcxx/include/__thread/thread.h index f3300752ac..8db1e28ec7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/thread.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/thread.h @@ -19,7 +19,7 @@ #include <__mutex/mutex.h> #include <__system_error/system_error.h> #include <__thread/id.h> -#include <__threading_support> +#include <__thread/support.h> #include <__utility/forward.h> #include <tuple> @@ -32,6 +32,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> @@ -104,7 +107,7 @@ __thread_specific_ptr<_Tp>::~__thread_specific_ptr() { template <class _Tp> void __thread_specific_ptr<_Tp>::set_pointer(pointer __p) { - _LIBCPP_ASSERT_UNCATEGORIZED(get() == nullptr, "Attempting to overwrite thread local data"); + _LIBCPP_ASSERT_INTERNAL(get() == nullptr, "Attempting to overwrite thread local data"); std::__libcpp_tls_set(__key_, __p); } @@ -154,7 +157,7 @@ public: _LIBCPP_HIDE_FROM_ABI thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {} #ifndef _LIBCPP_CXX03_LANG - template <class _Fp, class... _Args, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value> > + template <class _Fp, class... _Args, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value, int> = 0> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp&& __f, _Args&&... __args); #else // _LIBCPP_CXX03_LANG template <class _Fp> @@ -200,7 +203,7 @@ _LIBCPP_HIDE_FROM_ABI void* __thread_proxy(void* __vp) { return nullptr; } -template <class _Fp, class... _Args, class > +template <class _Fp, class... _Args, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value, int> > thread::thread(_Fp&& __f, _Args&&... __args) { typedef unique_ptr<__thread_struct> _TSPtr; _TSPtr __tsp(new __thread_struct); @@ -251,4 +254,6 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___THREAD_THREAD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/timed_backoff_policy.h b/contrib/libs/cxxsupp/libcxx/include/__thread/timed_backoff_policy.h index 525f52b349..838c918a57 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/timed_backoff_policy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/timed_backoff_policy.h @@ -15,7 +15,7 @@ #ifndef _LIBCPP_HAS_NO_THREADS # include <__chrono/duration.h> -# include <__threading_support> +# include <__thread/support.h> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__threading_support b/contrib/libs/cxxsupp/libcxx/include/__threading_support deleted file mode 100644 index acfe6f7c42..0000000000 --- a/contrib/libs/cxxsupp/libcxx/include/__threading_support +++ /dev/null @@ -1,456 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___THREADING_SUPPORT -#define _LIBCPP___THREADING_SUPPORT - -#include <__availability> -#include <__chrono/convert_to_timespec.h> -#include <__chrono/duration.h> -#include <__config> -#include <__fwd/hash.h> -#include <ctime> -#include <errno.h> - -#ifdef __MVS__ -# include <__support/ibm/nanosleep.h> -#endif - -#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -# pragma GCC system_header -#endif - -#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -#error # #include <__external_threading> -#elif !defined(_LIBCPP_HAS_NO_THREADS) - -# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -// Some platforms require <bits/atomic_wide_counter.h> in order for -// PTHREAD_COND_INITIALIZER to be expanded. Normally that would come -// in via <pthread.h>, but it's a non-modular header on those platforms, -// so libc++'s <math.h> usually absorbs atomic_wide_counter.h into the -// module with <math.h> and makes atomic_wide_counter.h invisible. -// Include <math.h> here to work around that. -# include <math.h> - -# include <pthread.h> -# include <sched.h> -# elif defined(_LIBCPP_HAS_THREAD_API_C11) -# include <threads.h> -# endif - -# if defined(_LIBCPP_HAS_THREAD_API_WIN32) -# define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_EXPORTED_FROM_ABI -# else -# define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_HIDE_FROM_ABI -# endif - -typedef ::timespec __libcpp_timespec_t; -#endif // !defined(_LIBCPP_HAS_NO_THREADS) - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if !defined(_LIBCPP_HAS_NO_THREADS) - -# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -// Mutex -typedef pthread_mutex_t __libcpp_mutex_t; -# define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER - -typedef pthread_mutex_t __libcpp_recursive_mutex_t; - -// Condition Variable -typedef pthread_cond_t __libcpp_condvar_t; -# define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER - -// Execute once -typedef pthread_once_t __libcpp_exec_once_flag; -# define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT - -// Thread id -# if defined(__MVS__) -typedef unsigned long long __libcpp_thread_id; -# else -typedef pthread_t __libcpp_thread_id; -# endif - -// Thread -# define _LIBCPP_NULL_THREAD ((__libcpp_thread_t())) -typedef pthread_t __libcpp_thread_t; - -// Thread Local Storage -typedef pthread_key_t __libcpp_tls_key; - -# define _LIBCPP_TLS_DESTRUCTOR_CC -# elif defined(_LIBCPP_HAS_THREAD_API_C11) -// Mutex -typedef mtx_t __libcpp_mutex_t; -// mtx_t is a struct so using {} for initialization is valid. -# define _LIBCPP_MUTEX_INITIALIZER \ - {} - -typedef mtx_t __libcpp_recursive_mutex_t; - -// Condition Variable -typedef cnd_t __libcpp_condvar_t; -// cnd_t is a struct so using {} for initialization is valid. -# define _LIBCPP_CONDVAR_INITIALIZER \ - {} - -// Execute once -typedef ::once_flag __libcpp_exec_once_flag; -# define _LIBCPP_EXEC_ONCE_INITIALIZER ONCE_FLAG_INIT - -// Thread id -typedef thrd_t __libcpp_thread_id; - -// Thread -# define _LIBCPP_NULL_THREAD 0U - -typedef thrd_t __libcpp_thread_t; - -// Thread Local Storage -typedef tss_t __libcpp_tls_key; - -# define _LIBCPP_TLS_DESTRUCTOR_CC -# elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -// Mutex -typedef void* __libcpp_mutex_t; -# define _LIBCPP_MUTEX_INITIALIZER 0 - -# if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__) -typedef void* __libcpp_recursive_mutex_t[6]; -# elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__) -typedef void* __libcpp_recursive_mutex_t[5]; -# else -# error Unsupported architecture -# endif - -// Condition Variable -typedef void* __libcpp_condvar_t; -# define _LIBCPP_CONDVAR_INITIALIZER 0 - -// Execute Once -typedef void* __libcpp_exec_once_flag; -# define _LIBCPP_EXEC_ONCE_INITIALIZER 0 - -// Thread ID -typedef long __libcpp_thread_id; - -// Thread -# define _LIBCPP_NULL_THREAD 0U - -typedef void* __libcpp_thread_t; - -// Thread Local Storage -typedef long __libcpp_tls_key; - -# define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall -# endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) - -# if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -// Mutex -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m); - -_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int -__libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m); - -_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool -__libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m); - -_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int -__libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m); - -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m); - -_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t* __m); - -_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m); - -_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t* __m); - -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_mutex_destroy(__libcpp_mutex_t* __m); - -// Condition variable -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_condvar_signal(__libcpp_condvar_t* __cv); - -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv); - -_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int -__libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m); - -_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int -__libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts); - -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv); - -// Execute once -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_execute_once(__libcpp_exec_once_flag* __flag, void (*__init_routine)()); - -// Thread id -_LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_thread_id_equal(__libcpp_thread_id __t1, __libcpp_thread_id __t2); - -_LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2); - -// Thread -_LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_thread_isnull(const __libcpp_thread_t* __t); - -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg); - -_LIBCPP_THREAD_ABI_VISIBILITY -__libcpp_thread_id __libcpp_thread_get_current_id(); - -_LIBCPP_THREAD_ABI_VISIBILITY -__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t); - -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_thread_join(__libcpp_thread_t* __t); - -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_thread_detach(__libcpp_thread_t* __t); - -_LIBCPP_THREAD_ABI_VISIBILITY -void __libcpp_thread_yield(); - -_LIBCPP_THREAD_ABI_VISIBILITY -void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns); - -// Thread local storage -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_tls_create(__libcpp_tls_key* __key, void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*)); - -_LIBCPP_THREAD_ABI_VISIBILITY -void* __libcpp_tls_get(__libcpp_tls_key __key); - -_LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_tls_set(__libcpp_tls_key __key, void* __p); - -# endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) - -# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) - -int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m) { - pthread_mutexattr_t __attr; - int __ec = pthread_mutexattr_init(&__attr); - if (__ec) - return __ec; - __ec = pthread_mutexattr_settype(&__attr, PTHREAD_MUTEX_RECURSIVE); - if (__ec) { - pthread_mutexattr_destroy(&__attr); - return __ec; - } - __ec = pthread_mutex_init(__m, &__attr); - if (__ec) { - pthread_mutexattr_destroy(&__attr); - return __ec; - } - __ec = pthread_mutexattr_destroy(&__attr); - if (__ec) { - pthread_mutex_destroy(__m); - return __ec; - } - return 0; -} - -int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_lock(__m); } - -bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_trylock(__m) == 0; } - -int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_unlock(__m); } - -int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_destroy(__m); } - -int __libcpp_mutex_lock(__libcpp_mutex_t* __m) { return pthread_mutex_lock(__m); } - -bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) { return pthread_mutex_trylock(__m) == 0; } - -int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) { return pthread_mutex_unlock(__m); } - -int __libcpp_mutex_destroy(__libcpp_mutex_t* __m) { return pthread_mutex_destroy(__m); } - -// Condition Variable -int __libcpp_condvar_signal(__libcpp_condvar_t* __cv) { return pthread_cond_signal(__cv); } - -int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv) { return pthread_cond_broadcast(__cv); } - -int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) { return pthread_cond_wait(__cv, __m); } - -int __libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts) { - return pthread_cond_timedwait(__cv, __m, __ts); -} - -int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv) { return pthread_cond_destroy(__cv); } - -// Execute once -int __libcpp_execute_once(__libcpp_exec_once_flag* __flag, void (*__init_routine)()) { - return pthread_once(__flag, __init_routine); -} - -// Thread id -// Returns non-zero if the thread ids are equal, otherwise 0 -bool __libcpp_thread_id_equal(__libcpp_thread_id __t1, __libcpp_thread_id __t2) { return __t1 == __t2; } - -// Returns non-zero if t1 < t2, otherwise 0 -bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2) { return __t1 < __t2; } - -// Thread -bool __libcpp_thread_isnull(const __libcpp_thread_t* __t) { return __libcpp_thread_get_id(__t) == 0; } - -int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg) { - return pthread_create(__t, nullptr, __func, __arg); -} - -__libcpp_thread_id __libcpp_thread_get_current_id() { - const __libcpp_thread_t __current_thread = pthread_self(); - return __libcpp_thread_get_id(&__current_thread); -} - -__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) { -# if defined(__MVS__) - return __t->__; -# else - return *__t; -# endif -} - -int __libcpp_thread_join(__libcpp_thread_t* __t) { return pthread_join(*__t, nullptr); } - -int __libcpp_thread_detach(__libcpp_thread_t* __t) { return pthread_detach(*__t); } - -void __libcpp_thread_yield() { sched_yield(); } - -void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) { - __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns); - while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR) - ; -} - -// Thread local storage -int __libcpp_tls_create(__libcpp_tls_key* __key, void (*__at_exit)(void*)) { - return pthread_key_create(__key, __at_exit); -} - -void* __libcpp_tls_get(__libcpp_tls_key __key) { return pthread_getspecific(__key); } - -int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { return pthread_setspecific(__key, __p); } - -# elif defined(_LIBCPP_HAS_THREAD_API_C11) - -int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m) { - return mtx_init(__m, mtx_plain | mtx_recursive) == thrd_success ? 0 : EINVAL; -} - -int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) { - return mtx_lock(__m) == thrd_success ? 0 : EINVAL; -} - -bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) { return mtx_trylock(__m) == thrd_success; } - -int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) { - return mtx_unlock(__m) == thrd_success ? 0 : EINVAL; -} - -int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m) { - mtx_destroy(__m); - return 0; -} - -int __libcpp_mutex_lock(__libcpp_mutex_t* __m) { return mtx_lock(__m) == thrd_success ? 0 : EINVAL; } - -bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) { return mtx_trylock(__m) == thrd_success; } - -int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) { return mtx_unlock(__m) == thrd_success ? 0 : EINVAL; } - -int __libcpp_mutex_destroy(__libcpp_mutex_t* __m) { - mtx_destroy(__m); - return 0; -} - -// Condition Variable -int __libcpp_condvar_signal(__libcpp_condvar_t* __cv) { return cnd_signal(__cv) == thrd_success ? 0 : EINVAL; } - -int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv) { return cnd_broadcast(__cv) == thrd_success ? 0 : EINVAL; } - -int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) { - return cnd_wait(__cv, __m) == thrd_success ? 0 : EINVAL; -} - -int __libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, timespec* __ts) { - int __ec = cnd_timedwait(__cv, __m, __ts); - return __ec == thrd_timedout ? ETIMEDOUT : __ec; -} - -int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv) { - cnd_destroy(__cv); - return 0; -} - -// Execute once -int __libcpp_execute_once(__libcpp_exec_once_flag* flag, void (*init_routine)(void)) { - ::call_once(flag, init_routine); - return 0; -} - -// Thread id -// Returns non-zero if the thread ids are equal, otherwise 0 -bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2) { return thrd_equal(t1, t2) != 0; } - -// Returns non-zero if t1 < t2, otherwise 0 -bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2) { return t1 < t2; } - -// Thread -bool __libcpp_thread_isnull(const __libcpp_thread_t* __t) { return __libcpp_thread_get_id(__t) == 0; } - -int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg) { - int __ec = thrd_create(__t, reinterpret_cast<thrd_start_t>(__func), __arg); - return __ec == thrd_nomem ? ENOMEM : __ec; -} - -__libcpp_thread_id __libcpp_thread_get_current_id() { return thrd_current(); } - -__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) { return *__t; } - -int __libcpp_thread_join(__libcpp_thread_t* __t) { return thrd_join(*__t, nullptr) == thrd_success ? 0 : EINVAL; } - -int __libcpp_thread_detach(__libcpp_thread_t* __t) { return thrd_detach(*__t) == thrd_success ? 0 : EINVAL; } - -void __libcpp_thread_yield() { thrd_yield(); } - -void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) { - __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns); - thrd_sleep(&__ts, nullptr); -} - -// Thread local storage -int __libcpp_tls_create(__libcpp_tls_key* __key, void (*__at_exit)(void*)) { - return tss_create(__key, __at_exit) == thrd_success ? 0 : EINVAL; -} - -void* __libcpp_tls_get(__libcpp_tls_key __key) { return tss_get(__key); } - -int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { return tss_set(__key, __p) == thrd_success ? 0 : EINVAL; } - -# endif - -#endif // !_LIBCPP_HAS_NO_THREADS - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___THREADING_SUPPORT diff --git a/contrib/libs/cxxsupp/libcxx/include/__tree b/contrib/libs/cxxsupp/libcxx/include/__tree index 2dcc3c614d..0d727ad5c9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tree +++ b/contrib/libs/cxxsupp/libcxx/include/__tree @@ -547,10 +547,8 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > { return __t.__get_value(); } - template <class _Up> - _LIBCPP_HIDE_FROM_ABI static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, - __container_value_type const&> - __get_value(_Up& __t) { + template <class _Up, __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(_Up& __t) { return __t; } @@ -1117,12 +1115,12 @@ public: return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), std::move(__v)).first; } - template <class _Vp, class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> > + template <class _Vp, __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(_Vp&& __v) { return __emplace_unique(std::forward<_Vp>(__v)); } - template <class _Vp, class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> > + template <class _Vp, __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI iterator __insert_unique(const_iterator __p, _Vp&& __v) { return __emplace_hint_unique(__p, std::forward<_Vp>(__v)); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/sfinae_helpers.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/sfinae_helpers.h index a96947dcbf..c76e7e0601 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/sfinae_helpers.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/sfinae_helpers.h @@ -18,9 +18,7 @@ #include <__tuple/tuple_types.h> #include <__type_traits/enable_if.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> -#include <__type_traits/is_convertible.h> #include <__type_traits/is_same.h> #include <__type_traits/remove_cvref.h> #include <__type_traits/remove_reference.h> @@ -49,57 +47,27 @@ struct __tuple_sfinae_base { template <class _FromArgs, class _ToArgs> using __constructible = decltype(__do_test<is_constructible>(declval<_ToArgs>(), declval<_FromArgs>())); - template <class _FromArgs, class _ToArgs> - using __convertible = decltype(__do_test<is_convertible>(declval<_FromArgs>(), declval<_ToArgs>())); - template <class _FromArgs, class _ToArgs> - using __assignable = decltype(__do_test<is_assignable>(declval<_ToArgs>(), declval<_FromArgs>())); }; -// __tuple_convertible +// __tuple_constructible template <class _Tp, class _Up, - bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, - bool = __tuple_like_ext<_Up>::value, + bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, + bool = __tuple_like_ext<_Up>::value, class = void> -struct __tuple_convertible : public false_type {}; +struct __tuple_constructible : public false_type {}; template <class _Tp, class _Up> -struct __tuple_convertible< +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::__convertible< typename __make_tuple_types<_Tp>::type, - typename __make_tuple_types<_Up>::type > {}; - -// __tuple_constructible - -template <class _Tp, - class _Up, - bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, - bool = __tuple_like_ext<_Up>::value> -struct __tuple_constructible : public false_type {}; - -template <class _Tp, class _Up> -struct __tuple_constructible<_Tp, _Up, true, true> : public __tuple_sfinae_base::__constructible< typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type > {}; -// __tuple_assignable - -template <class _Tp, - class _Up, - bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, - bool = __tuple_like_ext<_Up>::value> -struct __tuple_assignable : public false_type {}; - -template <class _Tp, class _Up> -struct __tuple_assignable<_Tp, _Up, true, true> - : public __tuple_sfinae_base::__assignable< typename __make_tuple_types<_Tp>::type, - typename __make_tuple_types<_Up&>::type > {}; - template <size_t _Ip, class... _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> > { typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type; diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like.h index dab395be61..967e4a543c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like.h @@ -11,12 +11,12 @@ #include <__config> #include <__fwd/array.h> +#include <__fwd/complex.h> #include <__fwd/pair.h> #include <__fwd/subrange.h> #include <__fwd/tuple.h> #include <__type_traits/integral_constant.h> #include <__type_traits/remove_cvref.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -41,6 +41,13 @@ struct __tuple_like_impl<array<_Tp, _Size> > : true_type {}; template <class _Ip, class _Sp, ranges::subrange_kind _Kp> struct __tuple_like_impl<ranges::subrange<_Ip, _Sp, _Kp> > : true_type {}; +# if _LIBCPP_STD_VER >= 26 + +template <class _Tp> +struct __tuple_like_impl<complex<_Tp>> : true_type {}; + +# endif + template <class _Tp> concept __tuple_like = __tuple_like_impl<remove_cvref_t<_Tp>>::value; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/datasizeof.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/datasizeof.h index 5688e3293a..770c51ef04 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/datasizeof.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/datasizeof.h @@ -28,13 +28,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> struct __libcpp_datasizeof { -#if __has_cpp_attribute(__no_unique_address__) +#if __has_extension(datasizeof) && !defined(__CUDACC__) + static const size_t value = __datasizeof(_Tp); +#else +// NOLINTNEXTLINE(readability-redundant-preprocessor) This is https://llvm.org/PR64825 +# if __has_cpp_attribute(__no_unique_address__) template <class = char> struct _FirstPaddingByte { [[__no_unique_address__]] _Tp __v_; char __first_padding_byte_; }; -#else +# else template <bool = __libcpp_is_final<_Tp>::value || !is_class<_Tp>::value> struct _FirstPaddingByte : _Tp { char __first_padding_byte_; @@ -45,7 +49,7 @@ struct __libcpp_datasizeof { _Tp __v_; char __first_padding_byte_; }; -#endif +# endif // __has_cpp_attribute(__no_unique_address__) // _FirstPaddingByte<> is sometimes non-standard layout. Using `offsetof` is UB in that case, but GCC and Clang allow // the use as an extension. @@ -53,6 +57,7 @@ struct __libcpp_datasizeof { _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-offsetof") static const size_t value = offsetof(_FirstPaddingByte<>, __first_padding_byte_); _LIBCPP_DIAGNOSTIC_POP +#endif // __has_extension(datasizeof) }; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/invoke.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/invoke.h index c0487e25a0..44ef2a83b9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/invoke.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/invoke.h @@ -11,8 +11,6 @@ #define _LIBCPP___TYPE_TRAITS_INVOKE_H #include <__config> -#include <__type_traits/add_lvalue_reference.h> -#include <__type_traits/apply_cv.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> #include <__type_traits/enable_if.h> @@ -25,7 +23,6 @@ #include <__type_traits/is_same.h> #include <__type_traits/is_void.h> #include <__type_traits/nat.h> -#include <__type_traits/remove_cv.h> #include <__utility/declval.h> #include <__utility/forward.h> @@ -35,197 +32,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -struct __any { - __any(...); -}; - -template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr> -struct __member_pointer_traits_imp {}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> { - typedef _Class _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> { - typedef _Class _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> { - typedef _Class const _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> { - typedef _Class const _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> { - typedef _Class volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> { - typedef _Class volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> { - typedef _Class const volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> { - typedef _Class const volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...)&, true, false> { - typedef _Class& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...)&, true, false> { - typedef _Class& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> { - typedef _Class const& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> { - typedef _Class const& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> { - typedef _Class volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> { - typedef _Class volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> { - typedef _Class const volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> { - typedef _Class const volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...)&&, true, false> { - typedef _Class&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...)&&, true, false> { - typedef _Class&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> { - typedef _Class const&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> { - typedef _Class const&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> { - typedef _Class volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> { - typedef _Class volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> { - typedef _Class const volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param...); -}; - -template <class _Rp, class _Class, class... _Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> { - typedef _Class const volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp(_FnType)(_Param..., ...); -}; - -template <class _Rp, class _Class> -struct __member_pointer_traits_imp<_Rp _Class::*, false, true> { - typedef _Class _ClassType; - typedef _Rp _ReturnType; -}; - -template <class _MP> -struct __member_pointer_traits - : public __member_pointer_traits_imp<__remove_cv_t<_MP>, - is_member_function_pointer<_MP>::value, - is_member_object_pointer<_MP>::value> { - // typedef ... _ClassType; - // typedef ... _ReturnType; - // typedef ... _FnType; -}; - template <class _DecayedFp> struct __member_pointer_class_type {}; @@ -285,7 +91,7 @@ using __enable_if_bullet6 = // fall back - none of the bullets template <class... _Args> -__nat __invoke(__any, _Args&&... __args); +__nat __invoke(_Args&&... __args); // bullets 1, 2 and 3 diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_convertible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_convertible.h index eda7a49d72..bfc5a94cba 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_convertible.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_convertible.h @@ -26,6 +26,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 +# if __has_builtin(__is_nothrow_convertible) + +template <class _Tp, class _Up> +struct is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {}; + +template <class _Tp, class _Up> +inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up); + +# else // __has_builtin(__is_nothrow_convertible) + template <typename _Tp> void __test_noexcept(_Tp) noexcept; @@ -43,6 +53,8 @@ struct is_nothrow_convertible template <typename _Fm, typename _To> inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value; +# endif // __has_builtin(__is_nothrow_convertible) + #endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference_wrapper.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference_wrapper.h index b638e7046b..310a910040 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference_wrapper.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference_wrapper.h @@ -10,6 +10,7 @@ #define _LIBCPP___TYPE_TRAITS_IS_REFERENCE_WRAPPER_H #include <__config> +#include <__fwd/functional.h> #include <__type_traits/integral_constant.h> #include <__type_traits/remove_cv.h> @@ -20,9 +21,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> -class _LIBCPP_TEMPLATE_VIS reference_wrapper; - -template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {}; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_relocatable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_relocatable.h new file mode 100644 index 0000000000..dff2ad9e35 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_relocatable.h @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_RELOCATABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_RELOCATABLE_H + +#include <__config> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_trivially_copyable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +// A type is trivially relocatable if a move construct + destroy of the original object is equivalent to +// `memcpy(dst, src, sizeof(T))`. + +#if __has_builtin(__is_trivially_relocatable) && !defined(__CUDACC__) +template <class _Tp, class = void> +struct __libcpp_is_trivially_relocatable : integral_constant<bool, __is_trivially_relocatable(_Tp)> {}; +#else +template <class _Tp, class = void> +struct __libcpp_is_trivially_relocatable : is_trivially_copyable<_Tp> {}; +#endif + +template <class _Tp> +struct __libcpp_is_trivially_relocatable<_Tp, + __enable_if_t<is_same<_Tp, typename _Tp::__trivially_relocatable>::value> > + : true_type {}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_RELOCATABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h index c4bf612794..639a9c4fb6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h @@ -19,22 +19,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__remove_cv) && !defined(_LIBCPP_COMPILER_GCC) template <class _Tp> struct remove_cv { +#if __has_builtin(__remove_cv) using type _LIBCPP_NODEBUG = __remove_cv(_Tp); -}; - -template <class _Tp> -using __remove_cv_t = __remove_cv(_Tp); #else -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS remove_cv { typedef __remove_volatile_t<__remove_const_t<_Tp> > type; +#endif }; +#if defined(_LIBCPP_COMPILER_GCC) || !__has_builtin(__remove_cv) +template <class _Tp> +using __remove_cv_t = typename remove_cv<_Tp>::type; +#else template <class _Tp> -using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >; +using __remove_cv_t = __remove_cv(_Tp); #endif // __has_builtin(__remove_cv) #if _LIBCPP_STD_VER >= 14 diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cvref.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cvref.h index 3ec17b4dde..0334771434 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cvref.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cvref.h @@ -20,21 +20,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC) && !defined(__CUDACC__) +#if defined(_LIBCPP_COMPILER_GCC) template <class _Tp> -using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); -#else +struct __remove_cvref_gcc { + using type = __remove_cvref(_Tp); +}; + +template <class _Tp> +using __remove_cvref_t _LIBCPP_NODEBUG = typename __remove_cvref_gcc<_Tp>::type; +// compatibility with cuda && clang14 +#elif defined(__CUDACC__) || !__has_builtin(__remove_cvref) template <class _Tp> using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >; +#else +template <class _Tp> +using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); #endif // __has_builtin(__remove_cvref) template <class _Tp, class _Up> -struct __is_same_uncvref : _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> > {}; +using __is_same_uncvref = _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> >; #if _LIBCPP_STD_VER >= 20 template <class _Tp> struct remove_cvref { +#if defined(__CUDACC__) || !__has_builtin(__remove_cvref) using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>; +#else + using type _LIBCPP_NODEBUG = __remove_cvref(_Tp); +#endif }; template <class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/unwrap_ref.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/unwrap_ref.h index 5fed08f7dd..6bd74550f3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/unwrap_ref.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/unwrap_ref.h @@ -10,6 +10,7 @@ #define _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H #include <__config> +#include <__fwd/functional.h> #include <__type_traits/decay.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -24,16 +25,10 @@ struct __unwrap_reference { }; template <class _Tp> -class reference_wrapper; - -template <class _Tp> struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _LIBCPP_NODEBUG _Tp& type; }; -template <class _Tp> -struct decay; - #if _LIBCPP_STD_VER >= 20 template <class _Tp> struct unwrap_reference : __unwrap_reference<_Tp> {}; diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h b/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h index 5f88f4b327..b7c1ed614d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h @@ -9,14 +9,10 @@ #ifndef _LIBCPP___UTILITY_CMP_H #define _LIBCPP___UTILITY_CMP_H +#include <__concepts/arithmetic.h> #include <__config> -#include <__type_traits/disjunction.h> -#include <__type_traits/is_integral.h> -#include <__type_traits/is_same.h> #include <__type_traits/is_signed.h> #include <__type_traits/make_unsigned.h> -#include <__utility/forward.h> -#include <__utility/move.h> #include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -29,28 +25,8 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 -template <class _Tp, class... _Up> -struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {}; - -template <class _Tp> -concept __is_safe_integral_cmp = - is_integral_v<_Tp> && - !_IsSameAsAny<_Tp, - bool, - char, - char16_t, - char32_t -# ifndef _LIBCPP_HAS_NO_CHAR8_T - , - char8_t -# endif -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - , - wchar_t -# endif - >::value; - -template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> + +template <__libcpp_integer _Tp, __libcpp_integer _Up> _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept { if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>) return __t == __u; @@ -60,12 +36,12 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept { return __u < 0 ? false : __t == make_unsigned_t<_Up>(__u); } -template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +template <__libcpp_integer _Tp, __libcpp_integer _Up> _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_not_equal(_Tp __t, _Up __u) noexcept { return !std::cmp_equal(__t, __u); } -template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +template <__libcpp_integer _Tp, __libcpp_integer _Up> _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept { if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>) return __t < __u; @@ -75,26 +51,27 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept { return __u < 0 ? false : __t < make_unsigned_t<_Up>(__u); } -template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +template <__libcpp_integer _Tp, __libcpp_integer _Up> _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater(_Tp __t, _Up __u) noexcept { return std::cmp_less(__u, __t); } -template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +template <__libcpp_integer _Tp, __libcpp_integer _Up> _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less_equal(_Tp __t, _Up __u) noexcept { return !std::cmp_greater(__t, __u); } -template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +template <__libcpp_integer _Tp, __libcpp_integer _Up> _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater_equal(_Tp __t, _Up __u) noexcept { return !std::cmp_less(__t, __u); } -template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +template <__libcpp_integer _Tp, __libcpp_integer _Up> _LIBCPP_HIDE_FROM_ABI constexpr bool in_range(_Up __u) noexcept { return std::cmp_less_equal(__u, numeric_limits<_Tp>::max()) && std::cmp_greater_equal(__u, numeric_limits<_Tp>::min()); } + #endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/exception_guard.h b/contrib/libs/cxxsupp/libcxx/include/__utility/exception_guard.h index 389fca6c71..8d90dfd5f1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/exception_guard.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/exception_guard.h @@ -115,7 +115,7 @@ struct __exception_guard_noexceptions { } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG ~__exception_guard_noexceptions() { - _LIBCPP_ASSERT_UNCATEGORIZED(__completed_, "__exception_guard not completed with exceptions disabled"); + _LIBCPP_ASSERT_INTERNAL(__completed_, "__exception_guard not completed with exceptions disabled"); } private: diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h b/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h index e63f3f265b..ccce9433e7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h @@ -31,65 +31,16 @@ struct __integer_sequence { using __to_tuple_indices = __tuple_indices<(_Values + _Sp)...>; }; -#if !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) - -namespace __detail { - -template <typename _Tp, size_t... _Extra> -struct __repeat; -template <typename _Tp, _Tp... _Np, size_t... _Extra> -struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> { - typedef _LIBCPP_NODEBUG __integer_sequence< - _Tp, - _Np..., - sizeof...(_Np) + _Np..., - 2 * sizeof...(_Np) + _Np..., - 3 * sizeof...(_Np) + _Np..., - 4 * sizeof...(_Np) + _Np..., - 5 * sizeof...(_Np) + _Np..., - 6 * sizeof...(_Np) + _Np..., - 7 * sizeof...(_Np) + _Np..., - _Extra...> - type; -}; - -template <size_t _Np> -struct __parity; -template <size_t _Np> -struct __make : __parity<_Np % 8>::template __pmake<_Np> {}; - -// clang-format off -template<> struct __make<0> { typedef __integer_sequence<size_t> type; }; -template<> struct __make<1> { typedef __integer_sequence<size_t, 0> type; }; -template<> struct __make<2> { typedef __integer_sequence<size_t, 0, 1> type; }; -template<> struct __make<3> { typedef __integer_sequence<size_t, 0, 1, 2> type; }; -template<> struct __make<4> { typedef __integer_sequence<size_t, 0, 1, 2, 3> type; }; -template<> struct __make<5> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4> type; }; -template<> struct __make<6> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; }; -template<> struct __make<7> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; }; - -template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; }; -template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; }; -template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<5> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; -// clang-format on - -} // namespace __detail - -#endif - #if __has_builtin(__make_integer_seq) template <size_t _Ep, size_t _Sp> using __make_indices_imp = typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template __to_tuple_indices<_Sp>; -#else +#elif __has_builtin(__integer_pack) template <size_t _Ep, size_t _Sp> -using __make_indices_imp = typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>; - +using __make_indices_imp = + typename __integer_sequence<size_t, __integer_pack(_Ep - _Sp)...>::template __to_tuple_indices<_Sp>; +#else +# error "No known way to get an integer pack from the compiler" #endif #if _LIBCPP_STD_VER >= 14 @@ -104,34 +55,20 @@ struct _LIBCPP_TEMPLATE_VIS integer_sequence { template <size_t... _Ip> using index_sequence = integer_sequence<size_t, _Ip...>; -# if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) +# if __has_builtin(__make_integer_seq) template <class _Tp, _Tp _Ep> -using __make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>; - -# else +using make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>; -template <typename _Tp, _Tp _Np> -using __make_integer_sequence_unchecked _LIBCPP_NODEBUG = - typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>; +# elif __has_builtin(__integer_pack) -template <class _Tp, _Tp _Ep> -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"); - // 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; -}; - -template <class _Tp, _Tp _Ep> -using __make_integer_sequence _LIBCPP_NODEBUG = typename __make_integer_sequence_checked<_Tp, _Ep>::type; +template <class _Tp, _Tp _SequenceSize> +using make_integer_sequence _LIBCPP_NODEBUG = integer_sequence<_Tp, __integer_pack(_SequenceSize)...>; +# else +# error "No known way to get an integer pack from the compiler" # endif -template <class _Tp, _Tp _Np> -using make_integer_sequence = __make_integer_sequence<_Tp, _Np>; - template <size_t _Np> using make_index_sequence = make_integer_sequence<size_t, _Np>; diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/is_pointer_in_range.h b/contrib/libs/cxxsupp/libcxx/include/__utility/is_pointer_in_range.h index e859562e74..68cdfea6f9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/is_pointer_in_range.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/is_pointer_in_range.h @@ -35,7 +35,7 @@ template <class _Tp, class _Up, __enable_if_t<__is_less_than_comparable<const _T _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool __is_pointer_in_range( const _Tp* __begin, const _Tp* __end, const _Up* __ptr) { if (__libcpp_is_constant_evaluated()) { - _LIBCPP_ASSERT_UNCATEGORIZED(__builtin_constant_p(__begin <= __end), "__begin and __end do not form a range"); + _LIBCPP_ASSERT_VALID_INPUT_RANGE(__builtin_constant_p(__begin <= __end), "__begin and __end do not form a range"); // If this is not a constant during constant evaluation we know that __ptr is not part of the allocation where // [__begin, __end) is. diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h b/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h index 2f4908cedd..8af23668a8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h @@ -14,7 +14,6 @@ #include <__concepts/different_from.h> #include <__config> #include <__fwd/array.h> -#include <__fwd/get.h> #include <__fwd/pair.h> #include <__fwd/subrange.h> #include <__fwd/tuple.h> @@ -108,10 +107,11 @@ struct _LIBCPP_TEMPLATE_VIS pair // Extension: This is provided in C++03 because it allows properly handling the // assignment to a pair containing references, which would be a hard // error otherwise. - template <class _U1, - class _U2, - class = __enable_if_t< is_assignable<first_type&, _U1 const&>::value && - is_assignable<second_type&, _U2 const&>::value > > + template < + class _U1, + class _U2, + __enable_if_t<is_assignable<first_type&, _U1 const&>::value && is_assignable<second_type&, _U2 const&>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI pair& operator=(pair<_U1, _U2> const& __p) { first = __p.first; second = __p.second; @@ -187,8 +187,7 @@ struct _LIBCPP_TEMPLATE_VIS pair # endif __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0 > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(_U1&& __u1, _U2&& __u2) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && - is_nothrow_constructible<second_type, _U2>::value)) + _NOEXCEPT_(is_nothrow_constructible<first_type, _U1>::value&& is_nothrow_constructible<second_type, _U2>::value) : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) { } @@ -202,15 +201,12 @@ struct _LIBCPP_TEMPLATE_VIS pair # endif __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0 > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(_U1&& __u1, _U2&& __u2) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && - is_nothrow_constructible<second_type, _U2>::value)) + _NOEXCEPT_(is_nothrow_constructible<first_type, _U1>::value&& is_nothrow_constructible<second_type, _U2>::value) : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) { } # if _LIBCPP_STD_VER >= 23 - template <class _U1, - class _U2, - __enable_if_t< _CheckArgs::template __is_pair_constructible<_U1&, _U2&>() >* = nullptr> + template <class _U1, class _U2, __enable_if_t<_CheckArgs::template __is_pair_constructible<_U1&, _U2&>(), int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_CheckArgs::template __is_implicit<_U1&, _U2&>()) pair(pair<_U1, _U2>& __p) noexcept((is_nothrow_constructible<first_type, _U1&>::value && is_nothrow_constructible<second_type, _U2&>::value)) @@ -221,34 +217,32 @@ struct _LIBCPP_TEMPLATE_VIS pair class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>(), int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(pair<_U1, _U2> const& __p) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && - is_nothrow_constructible<second_type, _U2 const&>::value)) + _NOEXCEPT_(is_nothrow_constructible<first_type, _U1 const&>::value&& + is_nothrow_constructible<second_type, _U2 const&>::value) : first(__p.first), second(__p.second) {} template <class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>(), int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(pair<_U1, _U2> const& __p) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && - is_nothrow_constructible<second_type, _U2 const&>::value)) + _NOEXCEPT_(is_nothrow_constructible<first_type, _U1 const&>::value&& + is_nothrow_constructible<second_type, _U2 const&>::value) : first(__p.first), second(__p.second) {} template <class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(pair<_U1, _U2>&& __p) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && - is_nothrow_constructible<second_type, _U2&&>::value)) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(pair<_U1, _U2>&& __p) _NOEXCEPT_( + is_nothrow_constructible<first_type, _U1&&>::value&& is_nothrow_constructible<second_type, _U2&&>::value) : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {} template <class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(pair<_U1, _U2>&& __p) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && - is_nothrow_constructible<second_type, _U2&&>::value)) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(pair<_U1, _U2>&& __p) _NOEXCEPT_( + is_nothrow_constructible<first_type, _U1&&>::value&& is_nothrow_constructible<second_type, _U2&&>::value) : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {} # if _LIBCPP_STD_VER >= 23 template <class _U1, class _U2, - __enable_if_t< _CheckArgs::template __is_pair_constructible<const _U1&&, const _U2&&>() >* = nullptr> + __enable_if_t<_CheckArgs::template __is_pair_constructible<const _U1&&, const _U2&&>(), int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_CheckArgs::template __is_implicit<const _U1&&, const _U2&&>()) pair(const pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, const _U1&&>::value && is_nothrow_constructible<second_type, const _U2&&>::value) @@ -276,9 +270,8 @@ struct _LIBCPP_TEMPLATE_VIS pair template <class... _Args1, class... _Args2> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 - pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) - _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value && - is_nothrow_constructible<second_type, _Args2...>::value)) + pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) _NOEXCEPT_( + is_nothrow_constructible<first_type, _Args1...>::value&& is_nothrow_constructible<second_type, _Args2...>::value) : pair(__pc, __first_args, __second_args, @@ -304,20 +297,20 @@ struct _LIBCPP_TEMPLATE_VIS pair return *this; } - template <class _U1, - class _U2, - __enable_if_t< is_assignable<first_type&, _U1 const&>::value && - is_assignable<second_type&, _U2 const&>::value >* = nullptr> + template < + class _U1, + class _U2, + __enable_if_t<is_assignable<first_type&, _U1 const&>::value && is_assignable<second_type&, _U2 const&>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2> const& __p) { first = __p.first; second = __p.second; return *this; } - template < - class _U1, - class _U2, - __enable_if_t< is_assignable<first_type&, _U1>::value && is_assignable<second_type&, _U2>::value >* = nullptr> + template <class _U1, + class _U2, + __enable_if_t<is_assignable<first_type&, _U1>::value && is_assignable<second_type&, _U2>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2>&& __p) { first = std::forward<_U1>(__p.first); second = std::forward<_U2>(__p.second); @@ -387,38 +380,36 @@ struct _LIBCPP_TEMPLATE_VIS pair // pair-like types. This was historically provided as an extension. # if _LIBCPP_STD_VER < 23 // from std::tuple - template < - class _U1, - class _U2, - __enable_if_t< is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value >* = nullptr> + template <class _U1, + class _U2, + __enable_if_t<is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2> const& __p) : first(std::get<0>(__p)), second(std::get<1>(__p)) {} - template < - class _U1, - class _U2, - __enable_if_t< is_constructible<_T1, _U1 const&>::value && is_constructible<_T2, _U2 const&>::value && - !(is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value) >* = nullptr> + template < class _U1, + class _U2, + __enable_if_t<is_constructible<_T1, _U1 const&>::value && is_constructible<_T2, _U2 const&>::value && + !(is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value), + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2> const& __p) : first(std::get<0>(__p)), second(std::get<1>(__p)) {} template <class _U1, class _U2, - __enable_if_t< is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value >* = nullptr> + __enable_if_t<is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2>&& __p) : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {} template <class _U1, class _U2, - __enable_if_t< is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value && - !(is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value) >* = nullptr> + __enable_if_t<is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value && + !(is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value) > = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2>&& __p) : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {} - template < - class _U1, - class _U2, - __enable_if_t< is_assignable<_T1&, _U1 const&>::value && is_assignable<_T2&, _U2 const&>::value >* = nullptr> + template <class _U1, + class _U2, + __enable_if_t<is_assignable<_T1&, _U1 const&>::value && is_assignable<_T2&, _U2 const&>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2> const& __p) { first = std::get<0>(__p); second = std::get<1>(__p); @@ -427,7 +418,7 @@ struct _LIBCPP_TEMPLATE_VIS pair template <class _U1, class _U2, - __enable_if_t< is_assignable<_T1&, _U1&&>::value && is_assignable<_T2&, _U2&&>::value >* = nullptr> + __enable_if_t<is_assignable<_T1&, _U1&&>::value && is_assignable<_T2&, _U2&&>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2>&& __p) { first = std::get<0>(std::move(__p)); second = std::get<1>(std::move(__p)); @@ -435,38 +426,37 @@ struct _LIBCPP_TEMPLATE_VIS pair } // from std::array - template < - class _Up, - __enable_if_t< is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value >* = nullptr> + template <class _Up, + __enable_if_t<is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {} - template < - class _Up, - __enable_if_t< is_constructible<_T1, _Up const&>::value && is_constructible<_T2, _Up const&>::value && - !(is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value) >* = nullptr> + template <class _Up, + __enable_if_t<is_constructible<_T1, _Up const&>::value && is_constructible<_T2, _Up const&>::value && + !(is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value), + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {} - template <class _Up, __enable_if_t< is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value >* = nullptr> + template <class _Up, __enable_if_t< is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2>&& __p) : first(std::move(__p)[0]), second(std::move(__p)[1]) {} template <class _Up, - __enable_if_t< is_constructible<_T1, _Up>::value && is_constructible<_T2, _Up>::value && - !(is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value) >* = nullptr> + __enable_if_t<is_constructible<_T1, _Up>::value && is_constructible<_T2, _Up>::value && + !(is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value), + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2>&& __p) : first(std::move(__p)[0]), second(std::move(__p)[1]) {} - template < - class _Up, - __enable_if_t< is_assignable<_T1&, _Up const&>::value && is_assignable<_T2&, _Up const&>::value >* = nullptr> + template <class _Up, + __enable_if_t<is_assignable<_T1&, _Up const&>::value && is_assignable<_T2&, _Up const&>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2> const& __p) { first = std::get<0>(__p); second = std::get<1>(__p); return *this; } - template <class _Up, __enable_if_t< is_assignable<_T1&, _Up>::value && is_assignable<_T2&, _Up>::value >* = nullptr> + template <class _Up, __enable_if_t<is_assignable<_T1&, _Up>::value && is_assignable<_T2&, _Up>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2>&& __p) { first = std::get<0>(std::move(__p)); second = std::get<1>(std::move(__p)); @@ -580,7 +570,7 @@ struct common_type<pair<_T1, _T2>, pair<_U1, _U2>> { template <class _T1, class _T2, __enable_if_t<__is_swappable<_T1>::value && __is_swappable<_T2>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) - _NOEXCEPT_((__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value)) { + _NOEXCEPT_(__is_nothrow_swappable<_T1>::value&& __is_nothrow_swappable<_T2>::value) { __x.swap(__y); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h b/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h index 49334decc8..d833f74c2e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() { - _LIBCPP_ASSERT_UNCATEGORIZED(false, "std::unreachable() was reached"); + _LIBCPP_ASSERT_INTERNAL(false, "std::unreachable() was reached"); __builtin_unreachable(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm index 627e7d2021..0f62de7fa8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/algorithm +++ b/contrib/libs/cxxsupp/libcxx/include/algorithm @@ -42,6 +42,9 @@ namespace ranges { template <class I> struct in_found_result; // since C++20 + template <class I, class T> + struct in_value_result; // since C++23 + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); @@ -214,6 +217,19 @@ namespace ranges { constexpr ranges::minmax_element_result<borrowed_iterator_t<R>> minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + template<forward_iterator I1, sentinel_for<I1> S1, + forward_iterator I2, sentinel_for<I2> S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2, + Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 + + template<forward_range R1, forward_range R2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 + template<class I, class O> using copy_result = in_out_result<I, O>; // since C++20 @@ -226,6 +242,14 @@ namespace ranges { template<class I1, class I2> using copy_backward_result = in_out_result<I1, I2>; // since C++20 + template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> + constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23 + + template<input_range R, class T, class Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> + constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23 + template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> requires indirectly_copyable<I, O> constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20 @@ -873,6 +897,23 @@ namespace ranges { ranges::search_n(R&& r, range_difference_t<R> count, const T& value, Pred pred = {}, Proj proj = {}); // since C++20 + template<input_iterator I, sentinel_for<I> S, class T, + indirectly-binary-left-foldable<T, I> F> + constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23 + + template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F> + constexpr auto fold_left(R&& r, T init, F f); // since C++23 + + template<class I, class T> + using fold_left_with_iter_result = in_value_result<I, T>; // since C++23 + + template<input_iterator I, sentinel_for<I> S, class T, + indirectly-binary-left-foldable<T, I> F> + constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23 + + template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F> + constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23 + template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> @@ -1752,7 +1793,6 @@ template <class BidirectionalIterator, class Compare> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <version> @@ -1778,6 +1818,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/find_first_of.h> #include <__algorithm/find_if.h> #include <__algorithm/find_if_not.h> +#include <__algorithm/fold.h> #include <__algorithm/for_each.h> #include <__algorithm/for_each_n.h> #include <__algorithm/generate.h> @@ -1845,6 +1886,8 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_any_of.h> #include <__algorithm/ranges_binary_search.h> #include <__algorithm/ranges_clamp.h> +#include <__algorithm/ranges_contains.h> +#include <__algorithm/ranges_contains_subrange.h> #include <__algorithm/ranges_copy.h> #include <__algorithm/ranges_copy_backward.h> #include <__algorithm/ranges_copy_if.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/any b/contrib/libs/cxxsupp/libcxx/include/any index b9e0a8d945..ce54803cd9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/any +++ b/contrib/libs/cxxsupp/libcxx/include/any @@ -80,7 +80,6 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__memory/allocator.h> @@ -98,6 +97,7 @@ namespace std { #include <__type_traits/is_nothrow_move_constructible.h> #include <__type_traits/is_reference.h> #include <__type_traits/is_same.h> +#include <__type_traits/is_void.h> #include <__type_traits/remove_cv.h> #include <__type_traits/remove_cvref.h> #include <__type_traits/remove_reference.h> @@ -555,6 +555,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType template <class _ValueType> inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) _NOEXCEPT { + static_assert(!is_void_v<_ValueType>, "_ValueType may not be void."); static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference."); return std::any_cast<_ValueType>(const_cast<any*>(__any)); } @@ -572,6 +573,7 @@ inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void*, /*IsFunction template <class _ValueType> _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT { using __any_imp::_Action; + static_assert(!is_void_v<_ValueType>, "_ValueType may not be void."); static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference."); typedef add_pointer_t<_ValueType> _ReturnType; if (__any && __any->__h_) { diff --git a/contrib/libs/cxxsupp/libcxx/include/array b/contrib/libs/cxxsupp/libcxx/include/array index dcb419f536..7fa5dc1479 100644 --- a/contrib/libs/cxxsupp/libcxx/include/array +++ b/contrib/libs/cxxsupp/libcxx/include/array @@ -116,10 +116,11 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce #include <__algorithm/lexicographical_compare.h> #include <__algorithm/lexicographical_compare_three_way.h> #include <__algorithm/swap_ranges.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__config> #include <__fwd/array.h> #include <__iterator/reverse_iterator.h> +#include <__iterator/wrap_iter.h> #include <__tuple/sfinae_helpers.h> #include <__type_traits/conditional.h> #include <__type_traits/is_array.h> @@ -159,19 +160,27 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array { // types: - using __self = array; - using value_type = _Tp; - using reference = value_type&; - using const_reference = const value_type&; - using iterator = value_type*; - using const_iterator = const value_type*; - using pointer = value_type*; - using const_pointer = const value_type*; + using __self = array; + using value_type = _Tp; + using reference = value_type&; + using const_reference = const value_type&; + using pointer = value_type*; + using const_pointer = const value_type*; +#if defined(_LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY) + using iterator = __wrap_iter<pointer>; + using const_iterator = __wrap_iter<const_pointer>; +#else + using iterator = pointer; + using const_iterator = const_pointer; +#endif using size_type = size_t; using difference_type = ptrdiff_t; using reverse_iterator = std::reverse_iterator<iterator>; @@ -493,6 +502,8 @@ to_array(_Tp (&&__arr)[_Size]) noexcept(is_nothrow_move_constructible_v<_Tp>) { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <algorithm> # include <concepts> diff --git a/contrib/libs/cxxsupp/libcxx/include/atomic b/contrib/libs/cxxsupp/libcxx/include/atomic index 2e8f5b521a..cb142b09bf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/atomic +++ b/contrib/libs/cxxsupp/libcxx/include/atomic @@ -587,7 +587,12 @@ template <class T> */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__config> + +#if _LIBCPP_STD_VER < 23 && defined(_LIBCPP_STDATOMIC_H) +# error <atomic> is incompatible with <stdatomic.h> before C++23. Please compile with -std=c++23. +#endif + #include <__atomic/aliases.h> #include <__atomic/atomic.h> #include <__atomic/atomic_base.h> @@ -602,7 +607,6 @@ template <class T> #include <__atomic/is_always_lock_free.h> #include <__atomic/kill_dependency.h> #include <__atomic/memory_order.h> -#include <__config> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -613,13 +617,10 @@ template <class T> # error <atomic> is not implemented #endif -#ifdef kill_dependency -# error <atomic> is incompatible with <stdatomic.h> before C++23. Please compile with -std=c++23. -#endif - #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <cmath> # include <compare> +# include <cstdlib> # include <cstring> # include <type_traits> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/barrier b/contrib/libs/cxxsupp/libcxx/include/barrier index fcfc96cb04..c5fd84b919 100644 --- a/contrib/libs/cxxsupp/libcxx/include/barrier +++ b/contrib/libs/cxxsupp/libcxx/include/barrier @@ -45,11 +45,16 @@ namespace std */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__config> + +#ifdef _LIBCPP_HAS_NO_THREADS +# error "<barrier> is not supported since libc++ has been configured without support for threads." +#endif + +#include <__assert> #include <__atomic/atomic_base.h> #include <__atomic/memory_order.h> #include <__availability> -#include <__config> #include <__memory/unique_ptr.h> #include <__thread/poll_with_backoff.h> #include <__thread/timed_backoff_policy.h> @@ -63,10 +68,6 @@ namespace std # pragma GCC system_header #endif -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<barrier> is not supported since libc++ has been configured without support for threads." -#endif - _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -128,7 +129,7 @@ public: __completion_(std::move(__completion)), __phase_(0) {} [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __update <= __expected_, "update is greater than the expected count for the current barrier phase"); auto const __old_phase = __phase_.load(memory_order_relaxed); @@ -186,7 +187,7 @@ public: auto const __result = __arrived.fetch_sub(update, memory_order_acq_rel) - update; auto const new_expected = __expected.load(memory_order_relaxed); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( update <= new_expected, "update is greater than the expected count for the current barrier phase"); if (0 == __result) { @@ -231,7 +232,7 @@ public: auto const __inc = __arrived_unit * update; auto const __old = __phase_arrived_expected.fetch_add(__inc, memory_order_acq_rel); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( update <= __old, "update is greater than the expected count for the current barrier phase"); if ((__old ^ (__old + __inc)) & __phase_bit) { @@ -267,10 +268,10 @@ public: _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI explicit barrier( ptrdiff_t __count, _CompletionF __completion = _CompletionF()) : __b_(__count, std::move(__completion)) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __count >= 0, "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with a negative value"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __count <= max(), "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with " "a value greater than max()"); @@ -280,7 +281,7 @@ public: barrier& operator=(barrier const&) = delete; [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1) { - _LIBCPP_ASSERT_UNCATEGORIZED(__update > 0, "barrier:arrive must be called with a value greater than 0"); + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update > 0, "barrier:arrive must be called with a value greater than 0"); return __b_.arrive(__update); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const { diff --git a/contrib/libs/cxxsupp/libcxx/include/bit b/contrib/libs/cxxsupp/libcxx/include/bit index 84e2080377..b8e4bdc2df 100644 --- a/contrib/libs/cxxsupp/libcxx/include/bit +++ b/contrib/libs/cxxsupp/libcxx/include/bit @@ -61,7 +61,6 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__bit/bit_cast.h> #include <__bit/bit_ceil.h> #include <__bit/bit_floor.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/bitset b/contrib/libs/cxxsupp/libcxx/include/bitset index 308c58995d..8818ab6563 100644 --- a/contrib/libs/cxxsupp/libcxx/include/bitset +++ b/contrib/libs/cxxsupp/libcxx/include/bitset @@ -129,7 +129,6 @@ template <size_t N> struct hash<std::bitset<N>>; #include <__algorithm/count.h> #include <__algorithm/fill.h> #include <__algorithm/find.h> -#include <__assert> // all public C++ headers provide the assertion handler #include <__bit_reference> #include <__config> #include <__functional/hash.h> @@ -618,7 +617,7 @@ public: // 23.3.5.1 constructors: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset(unsigned long long __v) _NOEXCEPT : base(__v) {} - template <class _CharT, class = __enable_if_t<_IsCharLikeType<_CharT>::value> > + template <class _CharT, __enable_if_t<_IsCharLikeType<_CharT>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset( const _CharT* __str, #if _LIBCPP_STD_VER >= 26 diff --git a/contrib/libs/cxxsupp/libcxx/include/cassert b/contrib/libs/cxxsupp/libcxx/include/cassert index 761f57dee1..6fec37dc63 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cassert +++ b/contrib/libs/cxxsupp/libcxx/include/cassert @@ -16,7 +16,6 @@ Macros: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> // <assert.h> is not provided by libc++ diff --git a/contrib/libs/cxxsupp/libcxx/include/ccomplex b/contrib/libs/cxxsupp/libcxx/include/ccomplex index cf05c7a910..94d2c8d7d0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ccomplex +++ b/contrib/libs/cxxsupp/libcxx/include/ccomplex @@ -17,7 +17,6 @@ */ -#include <__assert> // all public C++ headers provide the assertion handler #include <complex> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/cctype b/contrib/libs/cxxsupp/libcxx/include/cctype index 32be6f38e5..d7af7e084a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cctype +++ b/contrib/libs/cxxsupp/libcxx/include/cctype @@ -34,7 +34,6 @@ int toupper(int c); } // std */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <ctype.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/cerrno b/contrib/libs/cxxsupp/libcxx/include/cerrno index 937ec23c69..d488fa72a5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cerrno +++ b/contrib/libs/cxxsupp/libcxx/include/cerrno @@ -22,7 +22,6 @@ Macros: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <errno.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/cfenv b/contrib/libs/cxxsupp/libcxx/include/cfenv index 16b3761ee2..f8cacd562f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cfenv +++ b/contrib/libs/cxxsupp/libcxx/include/cfenv @@ -52,7 +52,6 @@ int feupdateenv(const fenv_t* envp); } // std */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <fenv.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/cfloat b/contrib/libs/cxxsupp/libcxx/include/cfloat index 4f991dd49f..5d1b38c557 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cfloat +++ b/contrib/libs/cxxsupp/libcxx/include/cfloat @@ -69,7 +69,6 @@ Macros: LDBL_TRUE_MIN // C11 */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <float.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/charconv b/contrib/libs/cxxsupp/libcxx/include/charconv index 5a2869acba..5bc7b9011b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/charconv +++ b/contrib/libs/cxxsupp/libcxx/include/charconv @@ -69,7 +69,6 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__charconv/chars_format.h> #include <__charconv/from_chars_integral.h> #include <__charconv/from_chars_result.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/chrono b/contrib/libs/cxxsupp/libcxx/include/chrono index e05c8bcd9a..e158436dcb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/chrono +++ b/contrib/libs/cxxsupp/libcxx/include/chrono @@ -58,7 +58,7 @@ public: constexpr explicit duration(const Rep2& r, typename enable_if < - is_convertible<Rep2, rep>::value && + is_convertible<const Rep2&, rep>::value && (treat_as_floating_point<rep>::value || !treat_as_floating_point<rep>::value && !treat_as_floating_point<Rep2>::value) >::type* = 0); @@ -296,6 +296,10 @@ template<class charT, class traits, class Duration> // C++20 basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const sys_time<Duration>& tp); +template<class charT, class traits> // C++20 + basic_ostream<charT, traits>& + operator<<(basic_ostream<charT, traits>& os, const sys_days& dp); + class file_clock // C++20 { public: @@ -682,6 +686,8 @@ constexpr hours make24(const hours& h, bool is_pm) noexcept; // [time.zone.db], time zone database struct tzdb { // C++20 string version; + vector<time_zone> zones; + vector<time_zone_link> links; }; class tzdb_list { // C++20 @@ -712,15 +718,34 @@ tzdb_list& get_tzdb_list(); const tzdb& reload_tzdb(); // C++20 string remote_version(); // C++20 -// 25.10.5, class time_zone // C++20 +// 25.10.5, class time_zone // C++20 enum class choose {earliest, latest}; -class time_zone; -bool operator==(const time_zone& x, const time_zone& y) noexcept; -bool operator!=(const time_zone& x, const time_zone& y) noexcept; -bool operator<(const time_zone& x, const time_zone& y) noexcept; -bool operator>(const time_zone& x, const time_zone& y) noexcept; -bool operator<=(const time_zone& x, const time_zone& y) noexcept; -bool operator>=(const time_zone& x, const time_zone& y) noexcept; +class time_zone { + time_zone(time_zone&&) = default; + time_zone& operator=(time_zone&&) = default; + + // unspecified additional constructors + + string_view name() const noexcept; +}; +bool operator==(const time_zone& x, const time_zone& y) noexcept; // C++20 +strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept; // C++20 + +// [time.zone.link], class time_zone_link +class time_zone_link { // C++20 +public: + time_zone_link(time_zone_link&&) = default; + time_zone_link& operator=(time_zone_link&&) = default; + + // unspecified additional constructors + + string_view name() const noexcept; + string_view target() const noexcept; +}; + +bool operator==(const time_zone_link& x, const time_zone_link& y); // C++20 +strong_ordering operator<=>(const time_zone_link& x, const time_zone_link& y); // C++20 + } // chrono namespace std { @@ -800,7 +825,6 @@ constexpr chrono::year operator ""y(unsigned lo // clang-format on -#include <__assert> // all public C++ headers provide the assertion handler #include <__chrono/calendar.h> #include <__chrono/convert_to_timespec.h> #include <__chrono/convert_to_tm.h> @@ -838,6 +862,8 @@ constexpr chrono::year operator ""y(unsigned lo #if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \ !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include <__chrono/time_zone.h> +# include <__chrono/time_zone_link.h> # include <__chrono/tzdb.h> # include <__chrono/tzdb_list.h> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/cinttypes b/contrib/libs/cxxsupp/libcxx/include/cinttypes index a5b9558abd..52663a4f35 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cinttypes +++ b/contrib/libs/cxxsupp/libcxx/include/cinttypes @@ -234,7 +234,6 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int } // std */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> // standard-mandated includes diff --git a/contrib/libs/cxxsupp/libcxx/include/ciso646 b/contrib/libs/cxxsupp/libcxx/include/ciso646 index e0cd722495..1d859f08fa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ciso646 +++ b/contrib/libs/cxxsupp/libcxx/include/ciso646 @@ -15,7 +15,6 @@ */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/climits b/contrib/libs/cxxsupp/libcxx/include/climits index 2e8993e4d6..bcd8b4a56a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/climits +++ b/contrib/libs/cxxsupp/libcxx/include/climits @@ -37,7 +37,6 @@ Macros: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <limits.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/clocale b/contrib/libs/cxxsupp/libcxx/include/clocale index e2ace355d7..c689a64be2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/clocale +++ b/contrib/libs/cxxsupp/libcxx/include/clocale @@ -34,7 +34,6 @@ lconv* localeconv(); */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <locale.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/cmath b/contrib/libs/cxxsupp/libcxx/include/cmath index 798ddb4963..dd194bbb55 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cmath +++ b/contrib/libs/cxxsupp/libcxx/include/cmath @@ -304,7 +304,6 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__type_traits/enable_if.h> #include <__type_traits/is_arithmetic.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/codecvt b/contrib/libs/cxxsupp/libcxx/include/codecvt index 504dd71f30..b7182ff471 100644 --- a/contrib/libs/cxxsupp/libcxx/include/codecvt +++ b/contrib/libs/cxxsupp/libcxx/include/codecvt @@ -54,7 +54,6 @@ class codecvt_utf8_utf16 */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__locale> #include <version> diff --git a/contrib/libs/cxxsupp/libcxx/include/compare b/contrib/libs/cxxsupp/libcxx/include/compare index 626c7435f5..93953254b7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/compare +++ b/contrib/libs/cxxsupp/libcxx/include/compare @@ -140,7 +140,6 @@ namespace std { } */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__compare/common_comparison_category.h> #include <__compare/compare_partial_order_fallback.h> #include <__compare/compare_strong_order_fallback.h> @@ -162,6 +161,7 @@ namespace std { #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cmath> # include <type_traits> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/complex b/contrib/libs/cxxsupp/libcxx/include/complex index 1b82c25230..95be60c404 100644 --- a/contrib/libs/cxxsupp/libcxx/include/complex +++ b/contrib/libs/cxxsupp/libcxx/include/complex @@ -227,12 +227,40 @@ template<class T> complex<T> sqrt (const complex<T>&); template<class T> complex<T> tan (const complex<T>&); template<class T> complex<T> tanh (const complex<T>&); + // [complex.tuple], tuple interface + template<class T> struct tuple_size; // Since C++26 + template<size_t I, class T> struct tuple_element; // Since C++26 + template<class T> struct tuple_size<complex<T>>; // Since C++26 + template<size_t I, class T> struct tuple_element<I, complex<T>>; // Since C++26 + template<size_t I, class T> + constexpr T& get(complex<T>&) noexcept; // Since C++26 + template<size_t I, class T> + constexpr T&& get(complex<T>&&) noexcept; // Since C++26 + template<size_t I, class T> + constexpr const T& get(const complex<T>&) noexcept; // Since C++26 + template<size_t I, class T> + constexpr const T&& get(const complex<T>&&) noexcept; // Since C++26 + + // [complex.literals], complex literals + inline namespace literals { + inline namespace complex_literals { + constexpr complex<long double> operator""il(long double); // Since C++14 + constexpr complex<long double> operator""il(unsigned long long); // Since C++14 + constexpr complex<double> operator""i(long double); // Since C++14 + constexpr complex<double> operator""i(unsigned long long); // Since C++14 + constexpr complex<float> operator""if(long double); // Since C++14 + constexpr complex<float> operator""if(unsigned long long); // Since C++14 + } + } } // std */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__fwd/complex.h> +#include <__tuple/tuple_element.h> +#include <__tuple/tuple_size.h> +#include <__utility/move.h> #include <cmath> #include <version> @@ -244,6 +272,9 @@ template<class T> complex<T> tanh (const complex<T>&); # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> @@ -331,6 +362,20 @@ public: *this = *this / complex(__c.real(), __c.imag()); return *this; } + +#if _LIBCPP_STD_VER >= 26 + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&&) noexcept; +#endif }; template <> @@ -408,6 +453,20 @@ public: *this = *this / complex(__c.real(), __c.imag()); return *this; } + +#if _LIBCPP_STD_VER >= 26 + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&&) noexcept; +#endif }; template <> @@ -480,6 +539,20 @@ public: *this = *this / complex(__c.real(), __c.imag()); return *this; } + +#if _LIBCPP_STD_VER >= 26 + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&&) noexcept; +#endif }; template <> @@ -553,6 +626,20 @@ public: *this = *this / complex(__c.real(), __c.imag()); return *this; } + +#if _LIBCPP_STD_VER >= 26 + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>&) noexcept; + + template <size_t _Ip, class _Xp> + friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&&) noexcept; +#endif }; inline _LIBCPP_CONSTEXPR complex<float>::complex(const complex<double>& __c) : __re_(__c.real()), __im_(__c.imag()) {} @@ -1353,6 +1440,67 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) { } #endif // !_LIBCPP_HAS_NO_LOCALIZATION +#if _LIBCPP_STD_VER >= 26 + +// [complex.tuple], tuple interface + +template <class _Tp> +struct tuple_size; + +template <class _Tp> +struct tuple_size<complex<_Tp>> : integral_constant<size_t, 2> {}; + +template <size_t _Ip, class _Tp> +struct tuple_element; + +template <size_t _Ip, class _Tp> +struct tuple_element<_Ip, complex<_Tp>> { + static_assert(_Ip < 2, "Index value is out of range."); + using type = _Tp; +}; + +template <size_t _Ip, class _Xp> +_LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>& __z) noexcept { + static_assert(_Ip < 2, "Index value is out of range."); + if constexpr (_Ip == 0) { + return __z.__re_; + } else { + return __z.__im_; + } +} + +template <size_t _Ip, class _Xp> +_LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&& __z) noexcept { + static_assert(_Ip < 2, "Index value is out of range."); + if constexpr (_Ip == 0) { + return std::move(__z.__re_); + } else { + return std::move(__z.__im_); + } +} + +template <size_t _Ip, class _Xp> +_LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>& __z) noexcept { + static_assert(_Ip < 2, "Index value is out of range."); + if constexpr (_Ip == 0) { + return __z.__re_; + } else { + return __z.__im_; + } +} + +template <size_t _Ip, class _Xp> +_LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&& __z) noexcept { + static_assert(_Ip < 2, "Index value is out of range."); + if constexpr (_Ip == 0) { + return std::move(__z.__re_); + } else { + return std::move(__z.__im_); + } +} + +#endif // _LIBCPP_STD_VER >= 26 + #if _LIBCPP_STD_VER >= 14 // Literal suffix for complex number literals [complex.literals] inline namespace literals { @@ -1386,6 +1534,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(unsigned long _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <iosfwd> # include <stdexcept> diff --git a/contrib/libs/cxxsupp/libcxx/include/concepts b/contrib/libs/cxxsupp/libcxx/include/concepts index 196fa2e0ea..e10f5ab5ad 100644 --- a/contrib/libs/cxxsupp/libcxx/include/concepts +++ b/contrib/libs/cxxsupp/libcxx/include/concepts @@ -129,7 +129,6 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__concepts/arithmetic.h> #include <__concepts/assignable.h> #include <__concepts/boolean_testable.h> @@ -155,7 +154,7 @@ namespace std { #include <__config> #include <version> -#if _LIBCPP_STD_VER <= 20 && !defined(_LIPCPP_REMOVE_TRANSITIVE_INCLUDES) +#if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) # include <type_traits> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/condition_variable b/contrib/libs/cxxsupp/libcxx/include/condition_variable index cf7a570b6c..4ded1140d4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/condition_variable +++ b/contrib/libs/cxxsupp/libcxx/include/condition_variable @@ -118,7 +118,6 @@ public: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__chrono/duration.h> #include <__chrono/steady_clock.h> @@ -126,11 +125,11 @@ public: #include <__condition_variable/condition_variable.h> #include <__config> #include <__memory/shared_ptr.h> -#include <__memory/unique_ptr.h> #include <__mutex/lock_guard.h> #include <__mutex/mutex.h> #include <__mutex/tag_types.h> #include <__mutex/unique_lock.h> +#include <__stop_token/stop_callback.h> #include <__stop_token/stop_token.h> #include <__utility/move.h> #include <version> @@ -139,6 +138,9 @@ public: # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #ifndef _LIBCPP_HAS_NO_THREADS _LIBCPP_BEGIN_NAMESPACE_STD @@ -200,19 +202,26 @@ inline void condition_variable_any::notify_all() _NOEXCEPT { __cv_.notify_all(); } -struct __lock_external { - template <class _Lock> - _LIBCPP_HIDE_FROM_ABI void operator()(_Lock* __m) { - __m->lock(); +template <class _Lock> +struct __unlock_guard { + _Lock& __lock_; + + _LIBCPP_HIDE_FROM_ABI __unlock_guard(_Lock& __lock) : __lock_(__lock) { __lock_.unlock(); } + + _LIBCPP_HIDE_FROM_ABI ~__unlock_guard() _NOEXCEPT // turns exception to std::terminate + { + __lock_.lock(); } + + __unlock_guard(const __unlock_guard&) = delete; + __unlock_guard& operator=(const __unlock_guard&) = delete; }; template <class _Lock> void condition_variable_any::wait(_Lock& __lock) { shared_ptr<mutex> __mut = __mut_; unique_lock<mutex> __lk(*__mut); - __lock.unlock(); - unique_ptr<_Lock, __lock_external> __lxx(&__lock); + __unlock_guard<_Lock> __unlock(__lock); lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t()); __cv_.wait(__lk); } // __mut_.unlock(), __lock.lock() @@ -227,8 +236,7 @@ template <class _Lock, class _Clock, class _Duration> cv_status condition_variable_any::wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t) { shared_ptr<mutex> __mut = __mut_; unique_lock<mutex> __lk(*__mut); - __lock.unlock(); - unique_ptr<_Lock, __lock_external> __lxx(&__lock); + __unlock_guard<_Lock> __unlock(__lock); lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t()); return __cv_.wait_until(__lk, __t); } // __mut_.unlock(), __lock.lock() @@ -256,24 +264,75 @@ condition_variable_any::wait_for(_Lock& __lock, const chrono::duration<_Rep, _Pe # if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) template <class _Lock, class _Predicate> -bool condition_variable_any::wait(_Lock& __lock, stop_token __stoken, _Predicate __pred) { - while (!__stoken.stop_requested()) { +bool condition_variable_any::wait(_Lock& __user_lock, stop_token __stoken, _Predicate __pred) { + if (__stoken.stop_requested()) + return __pred(); + + // Per https://eel.is/c++draft/thread.condition.condvarany#general-note-2, + // we do need to take a copy of the shared pointer __mut_ + // This ensures that a thread can call the destructor immediately after calling + // notify_all, without waiting all the wait calls. + // A thread can also safely call the destructor immediately after calling + // request_stop, as the call to request_stop would evaluate the callback, + // which accesses the internal condition variable, immediately on the same thread. + // In this situation, it is OK even without copying a shared ownership the internal + // condition variable. However, this needs the evaluation of stop_callback to + // happen-before the destruction. + // The spec only says "Only the notification to unblock the wait needs to happen + // before destruction". To make this work, we need to copy the shared ownership of + // the internal condition variable inside this function, which is not possible + // with the current ABI. + shared_ptr<mutex> __mut = __mut_; + + stop_callback __cb(__stoken, [this] { notify_all(); }); + + while (true) { if (__pred()) return true; - wait(__lock); - } + + // We need to take the internal lock before checking stop_requested, + // so that the notification cannot come in between the stop_requested + // check and entering the wait. + // Note that the stop_callback takes the same internal lock before notifying + unique_lock<mutex> __internal_lock(*__mut); + if (__stoken.stop_requested()) + break; + + __unlock_guard<_Lock> __unlock(__user_lock); + unique_lock<mutex> __internal_lock2( + std::move(__internal_lock)); // switch unlock order between __internal_lock and __user_lock + __cv_.wait(__internal_lock2); + } // __internal_lock2.unlock(), __user_lock.lock() return __pred(); } template <class _Lock, class _Clock, class _Duration, class _Predicate> bool condition_variable_any::wait_until( - _Lock& __lock, stop_token __stoken, const chrono::time_point<_Clock, _Duration>& __abs_time, _Predicate __pred) { - while (!__stoken.stop_requested()) { + _Lock& __user_lock, + stop_token __stoken, + const chrono::time_point<_Clock, _Duration>& __abs_time, + _Predicate __pred) { + if (__stoken.stop_requested()) + return __pred(); + + shared_ptr<mutex> __mut = __mut_; + stop_callback __cb(__stoken, [this] { notify_all(); }); + + while (true) { if (__pred()) return true; - if (wait_until(__lock, __abs_time) == cv_status::timeout) - return __pred(); - } + + unique_lock<mutex> __internal_lock(*__mut); + if (__stoken.stop_requested()) + break; + + __unlock_guard<_Lock> __unlock(__user_lock); + unique_lock<mutex> __internal_lock2( + std::move(__internal_lock)); // switch unlock order between __internal_lock and __user_lock + + if (__cv_.wait_until(__internal_lock2, __abs_time) == cv_status::timeout) + break; + } // __internal_lock2.unlock(), __user_lock.lock() return __pred(); } @@ -291,6 +350,8 @@ _LIBCPP_END_NAMESPACE_STD #endif // !_LIBCPP_HAS_NO_THREADS +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> diff --git a/contrib/libs/cxxsupp/libcxx/include/coroutine b/contrib/libs/cxxsupp/libcxx/include/coroutine index f264570128..4bd1d4e9c3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/coroutine +++ b/contrib/libs/cxxsupp/libcxx/include/coroutine @@ -38,7 +38,6 @@ struct suspend_always; */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__coroutine/coroutine_handle.h> #include <__coroutine/coroutine_traits.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/csetjmp b/contrib/libs/cxxsupp/libcxx/include/csetjmp index d219c8e6cb..7ba9006871 100644 --- a/contrib/libs/cxxsupp/libcxx/include/csetjmp +++ b/contrib/libs/cxxsupp/libcxx/include/csetjmp @@ -30,10 +30,15 @@ void longjmp(jmp_buf env, int val); */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> -#include <setjmp.h> +// <setjmp.h> is not provided by libc++ +#if __has_include(<setjmp.h>) +# include <setjmp.h> +# ifdef _LIBCPP_SETJMP_H +# error "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>" +# endif +#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/csignal b/contrib/libs/cxxsupp/libcxx/include/csignal index cf45f50753..804a7f95ae 100644 --- a/contrib/libs/cxxsupp/libcxx/include/csignal +++ b/contrib/libs/cxxsupp/libcxx/include/csignal @@ -39,7 +39,6 @@ int raise(int sig); */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> // <signal.h> is not provided by libc++ diff --git a/contrib/libs/cxxsupp/libcxx/include/cstdarg b/contrib/libs/cxxsupp/libcxx/include/cstdarg index 3a4291f458..4642eb7b52 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstdarg +++ b/contrib/libs/cxxsupp/libcxx/include/cstdarg @@ -31,7 +31,6 @@ Types: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> // <stdarg.h> is not provided by libc++ diff --git a/contrib/libs/cxxsupp/libcxx/include/cstdbool b/contrib/libs/cxxsupp/libcxx/include/cstdbool index ce608033a2..ef731c021a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstdbool +++ b/contrib/libs/cxxsupp/libcxx/include/cstdbool @@ -19,7 +19,6 @@ Macros: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/cstddef b/contrib/libs/cxxsupp/libcxx/include/cstddef index 1d7bac24c8..ed16ae44fb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstddef +++ b/contrib/libs/cxxsupp/libcxx/include/cstddef @@ -33,7 +33,6 @@ Types: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__type_traits/enable_if.h> #include <__type_traits/integral_constant.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/cstdint b/contrib/libs/cxxsupp/libcxx/include/cstdint index 829d9398f3..8c47828594 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstdint +++ b/contrib/libs/cxxsupp/libcxx/include/cstdint @@ -140,7 +140,6 @@ Types: } // std */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <stdint.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/cstdio b/contrib/libs/cxxsupp/libcxx/include/cstdio index b1b0ff8d35..7f94371081 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstdio +++ b/contrib/libs/cxxsupp/libcxx/include/cstdio @@ -95,7 +95,6 @@ void perror(const char* s); } // std */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <stdio.h> @@ -159,7 +158,7 @@ using ::tmpfile _LIBCPP_USING_IF_EXISTS; using ::tmpnam _LIBCPP_USING_IF_EXISTS; using ::getchar _LIBCPP_USING_IF_EXISTS; -#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_C_HAS_NO_GETS) +#if _LIBCPP_STD_VER <= 11 using ::gets _LIBCPP_USING_IF_EXISTS; #endif using ::scanf _LIBCPP_USING_IF_EXISTS; diff --git a/contrib/libs/cxxsupp/libcxx/include/cstdlib b/contrib/libs/cxxsupp/libcxx/include/cstdlib index d9ee8630d9..25a829bb05 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstdlib +++ b/contrib/libs/cxxsupp/libcxx/include/cstdlib @@ -81,7 +81,6 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <stdlib.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/cstring b/contrib/libs/cxxsupp/libcxx/include/cstring index a9bdf4ff2d..c2c92b02e7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstring +++ b/contrib/libs/cxxsupp/libcxx/include/cstring @@ -56,7 +56,6 @@ size_t strlen(const char* s); */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__type_traits/is_constant_evaluated.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/ctgmath b/contrib/libs/cxxsupp/libcxx/include/ctgmath index bfcf2f98d4..6237979be4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ctgmath +++ b/contrib/libs/cxxsupp/libcxx/include/ctgmath @@ -18,7 +18,6 @@ */ -#include <__assert> // all public C++ headers provide the assertion handler #include <ccomplex> #include <cmath> diff --git a/contrib/libs/cxxsupp/libcxx/include/ctime b/contrib/libs/cxxsupp/libcxx/include/ctime index e537bbe556..cad942e610 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ctime +++ b/contrib/libs/cxxsupp/libcxx/include/ctime @@ -45,7 +45,6 @@ int timespec_get( struct timespec *ts, int base); // C++17 */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> // <time.h> is not provided by libc++ diff --git a/contrib/libs/cxxsupp/libcxx/include/cuchar b/contrib/libs/cxxsupp/libcxx/include/cuchar index 03b8c7d2a8..f0015be275 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cuchar +++ b/contrib/libs/cxxsupp/libcxx/include/cuchar @@ -36,7 +36,6 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <uchar.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/cwchar b/contrib/libs/cxxsupp/libcxx/include/cwchar index 122af24288..7442438d8f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cwchar +++ b/contrib/libs/cxxsupp/libcxx/include/cwchar @@ -102,7 +102,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__type_traits/apply_cv.h> #include <__type_traits/is_constant_evaluated.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/cwctype b/contrib/libs/cxxsupp/libcxx/include/cwctype index 5a2d2427d8..04abfabef5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cwctype +++ b/contrib/libs/cxxsupp/libcxx/include/cwctype @@ -49,7 +49,6 @@ wctrans_t wctrans(const char* property); */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <cctype> diff --git a/contrib/libs/cxxsupp/libcxx/include/deque b/contrib/libs/cxxsupp/libcxx/include/deque index 314d5bdb9a..eaaa765b85 100644 --- a/contrib/libs/cxxsupp/libcxx/include/deque +++ b/contrib/libs/cxxsupp/libcxx/include/deque @@ -188,7 +188,7 @@ template <class T, class Allocator, class Predicate> #include <__algorithm/remove.h> #include <__algorithm/remove_if.h> #include <__algorithm/unwrap_iter.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__config> #include <__format/enable_insertable.h> @@ -583,7 +583,7 @@ public: #endif _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v); - template <class = __enable_if_t<__is_allocator<_Allocator>::value> > + template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a) : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) { __annotate_new(0); @@ -1000,15 +1000,19 @@ private: } _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT { + (void)__current_size; +#ifndef _LIBCPP_HAS_NO_ASAN if (__current_size == 0) __annotate_from_to(0, __map_.size() * __block_size, __asan_poison, __asan_back_moved); else { __annotate_from_to(0, __start_, __asan_poison, __asan_front_moved); __annotate_from_to(__start_ + __current_size, __map_.size() * __block_size, __asan_poison, __asan_back_moved); } +#endif } _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT { +#ifndef _LIBCPP_HAS_NO_ASAN if (empty()) { for (size_t __i = 0; __i < __map_.size(); ++__i) { __annotate_whole_block(__i, __asan_unposion); @@ -1017,30 +1021,52 @@ private: __annotate_from_to(0, __start_, __asan_unposion, __asan_front_moved); __annotate_from_to(__start_ + size(), __map_.size() * __block_size, __asan_unposion, __asan_back_moved); } +#endif } _LIBCPP_HIDE_FROM_ABI void __annotate_increase_front(size_type __n) const _NOEXCEPT { + (void)__n; +#ifndef _LIBCPP_HAS_NO_ASAN __annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved); +#endif } _LIBCPP_HIDE_FROM_ABI void __annotate_increase_back(size_type __n) const _NOEXCEPT { + (void)__n; +#ifndef _LIBCPP_HAS_NO_ASAN __annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved); +#endif } _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT { + (void)__old_size; + (void)__old_start; +#ifndef _LIBCPP_HAS_NO_ASAN __annotate_from_to(__old_start, __old_start + (__old_size - size()), __asan_poison, __asan_front_moved); +#endif } _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT { + (void)__old_size; + (void)__old_start; +#ifndef _LIBCPP_HAS_NO_ASAN __annotate_from_to(__old_start + size(), __old_start + __old_size, __asan_poison, __asan_back_moved); +#endif } _LIBCPP_HIDE_FROM_ABI void __annotate_poison_block(const void* __beginning, const void* __end) const _NOEXCEPT { + (void)__beginning; + (void)__end; +#ifndef _LIBCPP_HAS_NO_ASAN __annotate_double_ended_contiguous_container(__beginning, __end, __beginning, __end, __end, __end); +#endif } _LIBCPP_HIDE_FROM_ABI void __annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT { + (void)__block_index; + (void)__annotation_type; +#ifndef _LIBCPP_HAS_NO_ASAN __map_const_iterator __block_it = __map_.begin() + __block_index; const void* __block_start = std::__to_address(*__block_it); const void* __block_end = std::__to_address(*__block_it + __block_size); @@ -1051,6 +1077,7 @@ private: __annotate_double_ended_contiguous_container( __block_start, __block_end, __block_start, __block_start, __block_start, __block_end); } +#endif } #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(_LIBCPP_NO_ASAN_CONTIGUOUS_CONTAINER_FEATURES) @@ -1462,6 +1489,7 @@ void deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT { template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < size(), "deque::operator[] index out of bounds"); size_type __p = __start_ + __i; return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); } @@ -1469,6 +1497,8 @@ inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::operat template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT { + // temporary disable this check for infra + // _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < size(), "deque::operator[] index out of bounds"); size_type __p = __start_ + __i; return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); } @@ -1491,22 +1521,26 @@ inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>:: template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::front() _NOEXCEPT { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::front called on an empty deque"); return *(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::front() const _NOEXCEPT { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::front called on an empty deque"); return *(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::back() _NOEXCEPT { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::back called on an empty deque"); size_type __p = size() + __start_ - 1; return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::back() const _NOEXCEPT { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::back called on an empty deque"); size_type __p = size() + __start_ - 1; return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); } @@ -2230,6 +2264,7 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) { template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::pop_front() { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::pop_front called on an empty deque"); size_type __old_sz = size(); size_type __old_start = __start_; allocator_type& __a = __alloc(); @@ -2370,6 +2405,8 @@ void deque<_Tp, _Allocator>::__move_construct_backward_and_check( template <class _Tp, class _Allocator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f) { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + __f != end(), "deque::erase(iterator) called with a non-dereferenceable iterator"); size_type __old_sz = size(); size_type __old_start = __start_; iterator __b = begin(); @@ -2395,6 +2432,8 @@ typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_it template <class _Tp, class _Allocator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) { + // temporary disable this check for maps + // _LIBCPP_ASSERT_VALID_INPUT_RANGE(__f <= __l, "deque::erase(first, last) called with an invalid range"); size_type __old_sz = size(); size_type __old_start = __start_; difference_type __n = __l - __f; diff --git a/contrib/libs/cxxsupp/libcxx/include/exception b/contrib/libs/cxxsupp/libcxx/include/exception index 97fee97769..5eff8e3f8a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/exception +++ b/contrib/libs/cxxsupp/libcxx/include/exception @@ -76,7 +76,6 @@ template <class E> void rethrow_if_nested(const E& e); */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__exception/exception.h> #include <__exception/exception_ptr.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/execution b/contrib/libs/cxxsupp/libcxx/include/execution index 56facc8737..822ffa1fd3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/execution +++ b/contrib/libs/cxxsupp/libcxx/include/execution @@ -32,7 +32,6 @@ namespace std { } */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__type_traits/is_execution_policy.h> #include <__type_traits/is_same.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/expected b/contrib/libs/cxxsupp/libcxx/include/expected index 44d0ce6b00..f455ab7d5d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/expected +++ b/contrib/libs/cxxsupp/libcxx/include/expected @@ -38,7 +38,6 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__expected/bad_expected_access.h> #include <__expected/expected.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__memory b/contrib/libs/cxxsupp/libcxx/include/experimental/__memory deleted file mode 100644 index b9dbf541d7..0000000000 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__memory +++ /dev/null @@ -1,94 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL___MEMORY -#define _LIBCPP_EXPERIMENTAL___MEMORY - -#include <__memory/allocator_arg_t.h> -#include <__memory/uses_allocator.h> -#include <__type_traits/conditional.h> -#include <__type_traits/is_constructible.h> -#include <__type_traits/is_convertible.h> -#include <__type_traits/is_same.h> -#include <experimental/__config> -#include <experimental/utility> // for erased_type - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -template < class _Tp, class _Alloc, bool = uses_allocator<_Tp, _Alloc>::value, bool = __has_allocator_type<_Tp>::value > -struct __lfts_uses_allocator : public false_type {}; - -template <class _Tp, class _Alloc> -struct __lfts_uses_allocator<_Tp, _Alloc, false, false> : public false_type {}; - -template <class _Tp, class _Alloc, bool HasAlloc> -struct __lfts_uses_allocator<_Tp, _Alloc, true, HasAlloc> : public true_type {}; - -template <class _Tp, class _Alloc> -struct __lfts_uses_allocator<_Tp, _Alloc, false, true> - : public integral_constant<bool, - is_convertible<_Alloc, typename _Tp::allocator_type>::value || - is_same<erased_type, typename _Tp::allocator_type>::value > {}; - -template <bool _UsesAlloc, class _Tp, class _Alloc, class... _Args> -struct __lfts_uses_alloc_ctor_imp { - static const int value = 0; -}; - -template <class _Tp, class _Alloc, class... _Args> -struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...> { - static const bool __ic_first = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; - - static const bool __ic_second = - __conditional_t< __ic_first, false_type, is_constructible<_Tp, _Args..., _Alloc> >::value; - - static_assert(__ic_first || __ic_second, "Request for uses allocator construction is ill-formed"); - - static const int value = __ic_first ? 1 : 2; -}; - -template <class _Tp, class _Alloc, class... _Args> -struct __lfts_uses_alloc_ctor - : integral_constant< - int, - __lfts_uses_alloc_ctor_imp< __lfts_uses_allocator<_Tp, _Alloc>::value, _Tp, _Alloc, _Args... >::value > {}; - -template <class _Tp, class _Allocator, class... _Args> -inline _LIBCPP_HIDE_FROM_ABI void -__user_alloc_construct_impl(integral_constant<int, 0>, _Tp* __storage, const _Allocator&, _Args&&... __args) { - new (__storage) _Tp(std::forward<_Args>(__args)...); -} - -// FIXME: This should have a version which takes a non-const alloc. -template <class _Tp, class _Allocator, class... _Args> -inline _LIBCPP_HIDE_FROM_ABI void -__user_alloc_construct_impl(integral_constant<int, 1>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) { - new (__storage) _Tp(allocator_arg_t(), __a, std::forward<_Args>(__args)...); -} - -// FIXME: This should have a version which takes a non-const alloc. -template <class _Tp, class _Allocator, class... _Args> -inline _LIBCPP_HIDE_FROM_ABI void -__user_alloc_construct_impl(integral_constant<int, 2>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) { - new (__storage) _Tp(std::forward<_Args>(__args)..., __a); -} - -template <class _Tp, class _Alloc, class... _Args> -inline _LIBCPP_HIDE_FROM_ABI void __lfts_user_alloc_construct(_Tp* __store, const _Alloc& __a, _Args&&... __args) { - ::std::experimental::fundamentals_v1::__user_alloc_construct_impl( - typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type(), __store, __a, std::forward<_Args>(__args)...); -} - -_LIBCPP_END_NAMESPACE_LFTS - -#endif /* _LIBCPP_EXPERIMENTAL___MEMORY */ diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/abi_tag.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/abi_tag.h deleted file mode 100644 index cec5be65ce..0000000000 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/abi_tag.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H -#define _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H - -#include <cstddef> -#include <experimental/__config> -#include <experimental/__simd/internal_declaration.h> - -#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) - -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL -inline namespace parallelism_v2 { -namespace simd_abi { - -using scalar = __scalar; - -// TODO: make this platform dependent -template <int _Np> -using fixed_size = __vec_ext<_Np>; - -template <class _Tp> -inline constexpr int max_fixed_size = 32; - -// TODO: make this platform dependent -template <class _Tp> -using compatible = __vec_ext<16 / sizeof(_Tp)>; - -// TODO: make this platform dependent -template <class _Tp> -using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>; - -// TODO: make this platform dependent -template <class _Tp, size_t _Np, class... _Abis> -struct deduce { - using type = fixed_size<_Np>; -}; - -// TODO: make this platform dependent -template <class _Tp, size_t _Np, class... _Abis> -using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type; - -} // namespace simd_abi -} // namespace parallelism_v2 -_LIBCPP_END_NAMESPACE_EXPERIMENTAL - -#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) -#endif // _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/aligned_tag.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/aligned_tag.h index d216a21c07..31d2b50aa1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/aligned_tag.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/aligned_tag.h @@ -10,10 +10,11 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H #define _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H -#include <__bit/bit_ceil.h> #include <__memory/assume_aligned.h> +#include <__type_traits/remove_const.h> #include <cstddef> #include <experimental/__config> +#include <experimental/__simd/traits.h> #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) @@ -30,9 +31,12 @@ struct element_aligned_tag { } }; +template <> +inline constexpr bool is_simd_flag_type_v<element_aligned_tag> = true; + struct vector_aligned_tag { template <class _Tp, class _Up = typename _Tp::value_type> - static constexpr size_t __alignment = std::__bit_ceil(sizeof(_Up) * _Tp::size()); + static constexpr size_t __alignment = memory_alignment_v<_Tp, remove_const_t<_Up>>; template <class _Tp, class _Up> static _LIBCPP_HIDE_FROM_ABI constexpr _Up* __apply(_Up* __ptr) { @@ -40,6 +44,9 @@ struct vector_aligned_tag { } }; +template <> +inline constexpr bool is_simd_flag_type_v<vector_aligned_tag> = true; + template <size_t _Np> struct overaligned_tag { template <class _Tp, class _Up = typename _Tp::value_type> @@ -51,6 +58,9 @@ struct overaligned_tag { } }; +template <size_t _Np> +inline constexpr bool is_simd_flag_type_v<overaligned_tag<_Np>> = true; + inline constexpr element_aligned_tag element_aligned{}; inline constexpr vector_aligned_tag vector_aligned{}; diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/declaration.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/declaration.h index 065faeaec3..7b45d035c2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/declaration.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/declaration.h @@ -10,13 +10,63 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H #define _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H +#include <cstddef> #include <experimental/__config> -#include <experimental/__simd/abi_tag.h> #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 { +namespace simd_abi { +template <int> +struct __vec_ext; +struct __scalar; + +using scalar = __scalar; + +// TODO: make this platform dependent +template <int _Np> +using fixed_size = __vec_ext<_Np>; + +template <class _Tp> +inline constexpr int max_fixed_size = 32; + +// TODO: make this platform dependent +template <class _Tp> +using compatible = __vec_ext<16 / sizeof(_Tp)>; + +// TODO: make this platform dependent +template <class _Tp> +using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>; + +// TODO: make this platform dependent +template <class _Tp, size_t _Np, class... _Abis> +struct deduce { + using type = fixed_size<_Np>; +}; + +// TODO: make this platform dependent +template <class _Tp, size_t _Np, class... _Abis> +using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type; + +} // namespace simd_abi + +template <class _Tp, class _Abi> +struct __simd_storage; + +template <class _Tp, class _Abi> +struct __mask_storage; + +template <class _Tp, class _Abi> +struct __simd_operations; + +template <class _Tp, class _Abi> +struct __mask_operations; + +struct element_aligned_tag; +struct vector_aligned_tag; +template <size_t> +struct overaligned_tag; template <class _Tp, class _Abi = simd_abi::compatible<_Tp>> class simd; diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/internal_declaration.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/internal_declaration.h deleted file mode 100644 index 9ad1ad1ae3..0000000000 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/internal_declaration.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H -#define _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H - -#include <experimental/__config> - -#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) - -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL -inline namespace parallelism_v2 { -namespace simd_abi { -template <int> -struct __vec_ext; -struct __scalar; -} // namespace simd_abi - -template <class _Tp, class _Abi> -struct __simd_storage; - -template <class _Tp, class _Abi> -struct __mask_storage; - -template <class _Tp, class _Abi> -struct __simd_operations; - -template <class _Tp, class _Abi> -struct __mask_operations; - -} // namespace parallelism_v2 -_LIBCPP_END_NAMESPACE_EXPERIMENTAL - -#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) -#endif // _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/scalar.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/scalar.h index 53fa1c29f3..aff2cd11cf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/scalar.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/scalar.h @@ -10,9 +10,10 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_SCALAR_H #define _LIBCPP_EXPERIMENTAL___SIMD_SCALAR_H +#include <__assert> #include <cstddef> #include <experimental/__config> -#include <experimental/__simd/internal_declaration.h> +#include <experimental/__simd/declaration.h> #include <experimental/__simd/traits.h> #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) @@ -56,6 +57,11 @@ struct __simd_operations<_Tp, simd_abi::__scalar> { static _LIBCPP_HIDE_FROM_ABI _SimdStorage __generate(_Generator&& __g) noexcept { return {__g(std::integral_constant<size_t, 0>())}; } + + template <class _Up> + static _LIBCPP_HIDE_FROM_ABI void __load(_SimdStorage& __s, const _Up* __mem) noexcept { + __s.__data = static_cast<_Tp>(__mem[0]); + } }; template <class _Tp> @@ -63,6 +69,8 @@ struct __mask_operations<_Tp, simd_abi::__scalar> { using _MaskStorage = __mask_storage<_Tp, simd_abi::__scalar>; static _LIBCPP_HIDE_FROM_ABI _MaskStorage __broadcast(bool __v) noexcept { return {__v}; } + + static _LIBCPP_HIDE_FROM_ABI void __load(_MaskStorage& __s, const bool* __mem) noexcept { __s.__data = __mem[0]; } }; } // namespace parallelism_v2 diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd.h index ffb328eb34..db4ebb8e4a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd.h @@ -15,9 +15,7 @@ #include <__utility/forward.h> #include <cstddef> #include <experimental/__config> -#include <experimental/__simd/abi_tag.h> #include <experimental/__simd/declaration.h> -#include <experimental/__simd/internal_declaration.h> #include <experimental/__simd/reference.h> #include <experimental/__simd/traits.h> #include <experimental/__simd/utility.h> @@ -66,6 +64,12 @@ public: explicit _LIBCPP_HIDE_FROM_ABI simd(_Generator&& __g) noexcept : __s_(_Impl::__generate(std::forward<_Generator>(__g))) {} + // load constructor + template <class _Up, class _Flags, enable_if_t<__is_vectorizable_v<_Up> && is_simd_flag_type_v<_Flags>, int> = 0> + _LIBCPP_HIDE_FROM_ABI simd(const _Up* __mem, _Flags) { + _Impl::__load(__s_, _Flags::template __apply<simd>(__mem)); + } + // scalar access [simd.subscr] _LIBCPP_HIDE_FROM_ABI reference operator[](size_t __i) noexcept { return reference(__s_, __i); } _LIBCPP_HIDE_FROM_ABI value_type operator[](size_t __i) const noexcept { return __s_.__get(__i); } diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd_mask.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd_mask.h index 325b8409e3..754db79926 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd_mask.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd_mask.h @@ -13,9 +13,7 @@ #include <__type_traits/is_same.h> #include <cstddef> #include <experimental/__config> -#include <experimental/__simd/abi_tag.h> #include <experimental/__simd/declaration.h> -#include <experimental/__simd/internal_declaration.h> #include <experimental/__simd/reference.h> #include <experimental/__simd/traits.h> @@ -54,6 +52,12 @@ public: } } + // load constructor + template <class _Flags, enable_if_t<is_simd_flag_type_v<_Flags>, int> = 0> + _LIBCPP_HIDE_FROM_ABI simd_mask(const value_type* __mem, _Flags) { + _Impl::__load(__s_, _Flags::template __apply<simd_mask>(__mem)); + } + // scalar access [simd.mask.subscr] _LIBCPP_HIDE_FROM_ABI reference operator[](size_t __i) noexcept { return reference(__s_, __i); } _LIBCPP_HIDE_FROM_ABI value_type operator[](size_t __i) const noexcept { return __s_.__get(__i); } diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/traits.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/traits.h index 9b4abe9d0c..ec25b4bfa7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/traits.h @@ -10,14 +10,12 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H #define _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H +#include <__bit/bit_ceil.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_same.h> #include <cstddef> #include <experimental/__config> -#include <experimental/__simd/abi_tag.h> -#include <experimental/__simd/aligned_tag.h> #include <experimental/__simd/declaration.h> -#include <experimental/__simd/internal_declaration.h> #include <experimental/__simd/utility.h> #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) @@ -47,15 +45,6 @@ struct is_simd_mask : bool_constant<is_simd_mask_v<_Tp>> {}; template <class _Tp> inline constexpr bool is_simd_flag_type_v = false; -template <> -inline constexpr bool is_simd_flag_type_v<element_aligned_tag> = true; - -template <> -inline constexpr bool is_simd_flag_type_v<vector_aligned_tag> = true; - -template <size_t _Np> -inline constexpr bool is_simd_flag_type_v<overaligned_tag<_Np>> = true; - template <class _Tp> struct is_simd_flag_type : bool_constant<is_simd_flag_type_v<_Tp>> {}; @@ -71,7 +60,7 @@ inline constexpr size_t simd_size_v = simd_size<_Tp, _Abi>::value; template <class _Tp, class _Up = typename _Tp::value_type, bool = (is_simd_v<_Tp> && __is_vectorizable_v<_Up>) || (is_simd_mask_v<_Tp> && is_same_v<_Up, bool>)> -struct memory_alignment : integral_constant<size_t, vector_aligned_tag::__alignment<_Tp, _Up>> {}; +struct memory_alignment : integral_constant<size_t, std::__bit_ceil(sizeof(_Up) * _Tp::size())> {}; template <class _Tp, class _Up> struct memory_alignment<_Tp, _Up, false> {}; diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/vec_ext.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/vec_ext.h index baaeda6a74..c9423df93c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/vec_ext.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/vec_ext.h @@ -10,12 +10,13 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_VEC_EXT_H #define _LIBCPP_EXPERIMENTAL___SIMD_VEC_EXT_H +#include <__assert> #include <__bit/bit_ceil.h> #include <__utility/forward.h> #include <__utility/integer_sequence.h> #include <cstddef> #include <experimental/__config> -#include <experimental/__simd/internal_declaration.h> +#include <experimental/__simd/declaration.h> #include <experimental/__simd/traits.h> #include <experimental/__simd/utility.h> @@ -38,11 +39,11 @@ struct __simd_storage<_Tp, simd_abi::__vec_ext<_Np>> { _Tp __data __attribute__((__vector_size__(std::__bit_ceil((sizeof(_Tp) * _Np))))); _LIBCPP_HIDE_FROM_ABI _Tp __get(size_t __idx) const noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED(__idx >= 0 && __idx < _Np, "Index is out of bounds"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds"); return __data[__idx]; } _LIBCPP_HIDE_FROM_ABI void __set(size_t __idx, _Tp __v) noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED(__idx >= 0 && __idx < _Np, "Index is out of bounds"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds"); __data[__idx] = __v; } }; @@ -73,6 +74,12 @@ struct __simd_operations<_Tp, simd_abi::__vec_ext<_Np>> { static _LIBCPP_HIDE_FROM_ABI _SimdStorage __generate(_Generator&& __g) noexcept { return __generate_init(std::forward<_Generator>(__g), std::make_index_sequence<_Np>()); } + + template <class _Up> + static _LIBCPP_HIDE_FROM_ABI void __load(_SimdStorage& __s, const _Up* __mem) noexcept { + for (size_t __i = 0; __i < _Np; __i++) + __s.__data[__i] = static_cast<_Tp>(__mem[__i]); + } }; template <class _Tp, int _Np> @@ -87,6 +94,11 @@ struct __mask_operations<_Tp, simd_abi::__vec_ext<_Np>> { } return __result; } + + static _LIBCPP_HIDE_FROM_ABI void __load(_MaskStorage& __s, const bool* __mem) noexcept { + for (size_t __i = 0; __i < _Np; __i++) + __s.__data[__i] = experimental::__set_all_bits<_Tp>(__mem[__i]); + } }; } // namespace parallelism_v2 diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/iterator b/contrib/libs/cxxsupp/libcxx/include/experimental/iterator index 5bb1dd1ada..de82da2d3d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/iterator +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/iterator @@ -52,7 +52,6 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__memory/addressof.h> #include <__type_traits/decay.h> #include <__utility/forward.h> @@ -64,6 +63,9 @@ namespace std { # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 14 _LIBCPP_BEGIN_NAMESPACE_LFTS @@ -115,6 +117,8 @@ _LIBCPP_END_NAMESPACE_LFTS #endif // _LIBCPP_STD_VER >= 14 +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <iosfwd> # include <type_traits> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/memory b/contrib/libs/cxxsupp/libcxx/include/experimental/memory index 9de5707275..7e698fe9de 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/memory +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/memory @@ -79,7 +79,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr observer_ptr(nullptr_t) noexcept : __ptr_(nullptr) {} _LIBCPP_HIDE_FROM_ABI constexpr explicit observer_ptr(element_type* __p) noexcept : __ptr_(__p) {} - template <class _W2, class = __enable_if_t<is_convertible<_W2*, _Wp*>::value>> + template <class _W2, __enable_if_t<is_convertible<_W2*, _Wp*>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr observer_ptr(observer_ptr<_W2> __other) noexcept : __ptr_(__other.get()) {} // observers diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/propagate_const b/contrib/libs/cxxsupp/libcxx/include/experimental/propagate_const index 06d7ba43da..43648015fe 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/propagate_const +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/propagate_const @@ -107,9 +107,8 @@ */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__functional/operations.h> -#include <__fwd/hash.h> +#include <__fwd/functional.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> #include <__type_traits/enable_if.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/simd b/contrib/libs/cxxsupp/libcxx/include/experimental/simd index 5685883285..fad6431d13 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/simd +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/simd @@ -71,14 +71,11 @@ inline namespace parallelism_v2 { */ -#include <__assert> // all public C++ headers provide the assertion handler - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif #include <experimental/__config> -#include <experimental/__simd/abi_tag.h> #include <experimental/__simd/aligned_tag.h> #include <experimental/__simd/declaration.h> #include <experimental/__simd/scalar.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/type_traits b/contrib/libs/cxxsupp/libcxx/include/experimental/type_traits index 62f9574ec5..37be434f8e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/type_traits +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/type_traits @@ -68,7 +68,6 @@ inline namespace fundamentals_v1 { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <experimental/__config> #if _LIBCPP_STD_VER >= 14 diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/utility b/contrib/libs/cxxsupp/libcxx/include/experimental/utility index c1bd9364fd..8bd0a055b7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/utility +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/utility @@ -30,7 +30,6 @@ inline namespace fundamentals_v1 { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <experimental/__config> #include <utility> diff --git a/contrib/libs/cxxsupp/libcxx/include/ext/hash_map b/contrib/libs/cxxsupp/libcxx/include/ext/hash_map index 7ac268d5dc..7b5b31c408 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ext/hash_map +++ b/contrib/libs/cxxsupp/libcxx/include/ext/hash_map @@ -201,7 +201,6 @@ template <class Key, class T, class Hash, class Pred, class Alloc> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__hash_table> #include <algorithm> diff --git a/contrib/libs/cxxsupp/libcxx/include/ext/hash_set b/contrib/libs/cxxsupp/libcxx/include/ext/hash_set index 79f0925f6f..1ab259b599 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ext/hash_set +++ b/contrib/libs/cxxsupp/libcxx/include/ext/hash_set @@ -192,7 +192,6 @@ template <class Value, class Hash, class Pred, class Alloc> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__hash_table> #include <algorithm> diff --git a/contrib/libs/cxxsupp/libcxx/include/filesystem b/contrib/libs/cxxsupp/libcxx/include/filesystem index ec68354a9f..eff7dff4a4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/filesystem +++ b/contrib/libs/cxxsupp/libcxx/include/filesystem @@ -533,7 +533,6 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__filesystem/copy_options.h> #include <__filesystem/directory_entry.h> @@ -565,6 +564,7 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <cstdlib> +# include <cstring> # include <iosfwd> # include <new> # include <system_error> diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format index ab9b336d0c..b2fe0053b9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/format +++ b/contrib/libs/cxxsupp/libcxx/include/format @@ -170,7 +170,7 @@ namespace std { template<class Context> class basic_format_arg; template<class Visitor, class Context> - see below visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg); + see below visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg); // Deprecated in C++26 // [format.arg.store], class template format-arg-store template<class Context, class... Args> struct format-arg-store; // exposition only @@ -188,7 +188,6 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__format/buffer.h> #include <__format/concepts.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/forward_list b/contrib/libs/cxxsupp/libcxx/include/forward_list index 22cb0ebc22..a62b171a46 100644 --- a/contrib/libs/cxxsupp/libcxx/include/forward_list +++ b/contrib/libs/cxxsupp/libcxx/include/forward_list @@ -199,7 +199,6 @@ template <class T, class Allocator, class Predicate> #include <__algorithm/lexicographical_compare.h> #include <__algorithm/lexicographical_compare_three_way.h> #include <__algorithm/min.h> -#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__iterator/distance.h> @@ -689,22 +688,16 @@ public: #endif _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v); - template <class = __enable_if_t<__is_allocator<_Alloc>::value> > + template <__enable_if_t<__is_allocator<_Alloc>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v, const allocator_type& __a) : base(__a) { insert_after(cbefore_begin(), __n, __v); } - template <class _InputIterator> - _LIBCPP_HIDE_FROM_ABI - forward_list(_InputIterator __f, - _InputIterator __l, - __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr); - template <class _InputIterator> - _LIBCPP_HIDE_FROM_ABI - forward_list(_InputIterator __f, - _InputIterator __l, - const allocator_type& __a, - __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr); + template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI forward_list(_InputIterator __f, _InputIterator __l); + + template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI forward_list(_InputIterator __f, _InputIterator __l, const allocator_type& __a); #if _LIBCPP_STD_VER >= 23 template <_ContainerCompatibleRange<_Tp> _Range> @@ -938,20 +931,14 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) { } template <class _Tp, class _Alloc> -template <class _InputIterator> -forward_list<_Tp, _Alloc>::forward_list( - _InputIterator __f, _InputIterator __l, __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*) { +template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> > +forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l) { insert_after(cbefore_begin(), __f, __l); } template <class _Tp, class _Alloc> -template <class _InputIterator> -forward_list<_Tp, _Alloc>::forward_list( - _InputIterator __f, - _InputIterator __l, - const allocator_type& __a, - __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*) - : base(__a) { +template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> > +forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, const allocator_type& __a) : base(__a) { insert_after(cbefore_begin(), __f, __l); } diff --git a/contrib/libs/cxxsupp/libcxx/include/fstream b/contrib/libs/cxxsupp/libcxx/include/fstream index 371217b71e..776641b347 100644 --- a/contrib/libs/cxxsupp/libcxx/include/fstream +++ b/contrib/libs/cxxsupp/libcxx/include/fstream @@ -73,6 +73,7 @@ public: typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + using native_handle_type = typename basic_filebuf<charT, traits>::native_handle_type; // Since C++26 basic_ifstream(); explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in); @@ -85,6 +86,7 @@ public: void swap(basic_ifstream& rhs); basic_filebuf<char_type, traits_type>* rdbuf() const; + native_handle_type native_handle() const noexcept; // Since C++26 bool is_open() const; void open(const char* s, ios_base::openmode mode = ios_base::in); void open(const string& s, ios_base::openmode mode = ios_base::in); @@ -110,6 +112,7 @@ public: typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + using native_handle_type = typename basic_filebuf<charT, traits>::native_handle_type; // Since C++26 basic_ofstream(); explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out); @@ -122,6 +125,8 @@ public: void swap(basic_ofstream& rhs); basic_filebuf<char_type, traits_type>* rdbuf() const; + native_handle_type native_handle() const noexcept; // Since C++26 + bool is_open() const; void open(const char* s, ios_base::openmode mode = ios_base::out); void open(const string& s, ios_base::openmode mode = ios_base::out); @@ -148,6 +153,7 @@ public: typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + using native_handle_type = typename basic_filebuf<charT, traits>::native_handle_type; // Since C++26 basic_fstream(); explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); @@ -160,6 +166,7 @@ public: void swap(basic_fstream& rhs); basic_filebuf<char_type, traits_type>* rdbuf() const; + native_handle_type native_handle() const noexcept; // Since C++26 bool is_open() const; void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out); @@ -180,7 +187,7 @@ typedef basic_fstream<wchar_t> wfstream; */ #include <__algorithm/max.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__config> #include <__fwd/fstream.h> @@ -210,6 +217,10 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD +# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_WIN32API) +_LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) noexcept; +# endif + template <class _CharT, class _Traits> class _LIBCPP_TEMPLATE_VIS basic_filebuf : public basic_streambuf<_CharT, _Traits> { public: @@ -219,6 +230,15 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef typename traits_type::state_type state_type; +# if _LIBCPP_STD_VER >= 26 +# if defined(_LIBCPP_WIN32API) + using native_handle_type = void*; // HANDLE +# elif __has_include(<unistd.h>) + using native_handle_type = int; // POSIX file descriptor +# else +# error "Provide a native file handle!" +# endif +# endif // 27.9.1.2 Constructors/destructor: basic_filebuf(); @@ -245,8 +265,23 @@ public: # endif _LIBCPP_HIDE_FROM_ABI basic_filebuf* __open(int __fd, ios_base::openmode __mode); basic_filebuf* close(); +# if _LIBCPP_STD_VER >= 26 + _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { + _LIBCPP_ASSERT_UNCATEGORIZED(this->is_open(), "File must be opened"); +# if defined(_LIBCPP_WIN32API) + return std::__filebuf_windows_native_handle(__file_); +# elif __has_include(<unistd.h>) + return fileno(__file_); +# else +# error "Provide a way to determine the file native handle!" +# endif + } +# endif // _LIBCPP_STD_VER >= 26 _LIBCPP_HIDE_FROM_ABI inline static const char* __make_mdstring(ios_base::openmode __mode) _NOEXCEPT; +# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR + _LIBCPP_HIDE_FROM_ABI inline static const wchar_t* __make_mdwstring(ios_base::openmode __mode) _NOEXCEPT; +# endif protected: // 27.9.1.5 Overridden virtual functions: @@ -280,6 +315,28 @@ private: bool __read_mode(); void __write_mode(); + + _LIBCPP_EXPORTED_FROM_ABI friend FILE* __get_ostream_file(ostream&); + + // There are multiple (__)open function, they use different C-API open + // function. After that call these functions behave the same. This function + // does that part and determines the final return value. + _LIBCPP_HIDE_FROM_ABI basic_filebuf* __do_open(FILE* __file, ios_base::openmode __mode) { + __file_ = __file; + if (!__file_) + return nullptr; + + __om_ = __mode; + if (__mode & ios_base::ate) { + if (fseek(__file_, 0, SEEK_END)) { + fclose(__file_); + __file_ = nullptr; + return nullptr; + } + } + + return this; + } }; template <class _CharT, class _Traits> @@ -514,50 +571,79 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(ios_base::openmode _ __libcpp_unreachable(); } +# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR template <class _CharT, class _Traits> -basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) { - basic_filebuf<_CharT, _Traits>* __rt = nullptr; - if (__file_ == nullptr) { - if (const char* __mdstr = __make_mdstring(__mode)) { - __rt = this; - __file_ = fopen(__s, __mdstr); - if (__file_) { - __om_ = __mode; - if (__mode & ios_base::ate) { - if (fseek(__file_, 0, SEEK_END)) { - fclose(__file_); - __file_ = nullptr; - __rt = nullptr; - } - } - } else - __rt = nullptr; - } +const wchar_t* basic_filebuf<_CharT, _Traits>::__make_mdwstring(ios_base::openmode __mode) _NOEXCEPT { + switch (__mode & ~ios_base::ate) { + case ios_base::out: + case ios_base::out | ios_base::trunc: + return L"w"; + case ios_base::out | ios_base::app: + case ios_base::app: + return L"a"; + case ios_base::in: + return L"r"; + case ios_base::in | ios_base::out: + return L"r+"; + case ios_base::in | ios_base::out | ios_base::trunc: + return L"w+"; + case ios_base::in | ios_base::out | ios_base::app: + case ios_base::in | ios_base::app: + return L"a+"; + case ios_base::out | ios_base::binary: + case ios_base::out | ios_base::trunc | ios_base::binary: + return L"wb"; + case ios_base::out | ios_base::app | ios_base::binary: + case ios_base::app | ios_base::binary: + return L"ab"; + case ios_base::in | ios_base::binary: + return L"rb"; + case ios_base::in | ios_base::out | ios_base::binary: + return L"r+b"; + case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary: + return L"w+b"; + case ios_base::in | ios_base::out | ios_base::app | ios_base::binary: + case ios_base::in | ios_base::app | ios_base::binary: + return L"a+b"; +# if _LIBCPP_STD_VER >= 23 + case ios_base::out | ios_base::noreplace: + case ios_base::out | ios_base::trunc | ios_base::noreplace: + return L"wx"; + case ios_base::in | ios_base::out | ios_base::trunc | ios_base::noreplace: + return L"w+x"; + case ios_base::out | ios_base::binary | ios_base::noreplace: + case ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace: + return L"wbx"; + case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace: + return L"w+bx"; +# endif // _LIBCPP_STD_VER >= 23 + default: + return nullptr; } - return __rt; + __libcpp_unreachable(); +} +# endif + +template <class _CharT, class _Traits> +basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) { + if (__file_) + return nullptr; + const char* __mdstr = __make_mdstring(__mode); + if (!__mdstr) + return nullptr; + + return __do_open(fopen(__s, __mdstr), __mode); } template <class _CharT, class _Traits> inline basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { - basic_filebuf<_CharT, _Traits>* __rt = nullptr; - if (__file_ == nullptr) { - if (const char* __mdstr = __make_mdstring(__mode)) { - __rt = this; - __file_ = fdopen(__fd, __mdstr); - if (__file_) { - __om_ = __mode; - if (__mode & ios_base::ate) { - if (fseek(__file_, 0, SEEK_END)) { - fclose(__file_); - __file_ = nullptr; - __rt = nullptr; - } - } - } else - __rt = nullptr; - } - } - return __rt; + if (__file_) + return nullptr; + const char* __mdstr = __make_mdstring(__mode); + if (!__mdstr) + return nullptr; + + return __do_open(fdopen(__fd, __mdstr), __mode); } # ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR @@ -565,89 +651,13 @@ inline basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::__open(in // and long mode strings. template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) { - basic_filebuf<_CharT, _Traits>* __rt = nullptr; - if (__file_ == nullptr) { - __rt = this; - const wchar_t* __mdstr; - switch (__mode & ~ios_base::ate) { - case ios_base::out: - case ios_base::out | ios_base::trunc: - __mdstr = L"w"; - break; - case ios_base::out | ios_base::app: - case ios_base::app: - __mdstr = L"a"; - break; - case ios_base::in: - __mdstr = L"r"; - break; - case ios_base::in | ios_base::out: - __mdstr = L"r+"; - break; - case ios_base::in | ios_base::out | ios_base::trunc: - __mdstr = L"w+"; - break; - case ios_base::in | ios_base::out | ios_base::app: - case ios_base::in | ios_base::app: - __mdstr = L"a+"; - break; - case ios_base::out | ios_base::binary: - case ios_base::out | ios_base::trunc | ios_base::binary: - __mdstr = L"wb"; - break; - case ios_base::out | ios_base::app | ios_base::binary: - case ios_base::app | ios_base::binary: - __mdstr = L"ab"; - break; - case ios_base::in | ios_base::binary: - __mdstr = L"rb"; - break; - case ios_base::in | ios_base::out | ios_base::binary: - __mdstr = L"r+b"; - break; - case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary: - __mdstr = L"w+b"; - break; - case ios_base::in | ios_base::out | ios_base::app | ios_base::binary: - case ios_base::in | ios_base::app | ios_base::binary: - __mdstr = L"a+b"; - break; -# if _LIBCPP_STD_VER >= 23 - case ios_base::out | ios_base::noreplace: - case ios_base::out | ios_base::trunc | ios_base::noreplace: - __mdstr = L"wx"; - break; - case ios_base::in | ios_base::out | ios_base::trunc | ios_base::noreplace: - __mdstr = L"w+x"; - break; - case ios_base::out | ios_base::binary | ios_base::noreplace: - case ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace: - __mdstr = L"wbx"; - break; - case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace: - __mdstr = L"w+bx"; - break; -# endif // _LIBCPP_STD_VER >= 23 - default: - __rt = nullptr; - break; - } - if (__rt) { - __file_ = _wfopen(__s, __mdstr); - if (__file_) { - __om_ = __mode; - if (__mode & ios_base::ate) { - if (fseek(__file_, 0, SEEK_END)) { - fclose(__file_); - __file_ = nullptr; - __rt = nullptr; - } - } - } else - __rt = nullptr; - } - } - return __rt; + if (__file_) + return nullptr; + const wchar_t* __mdstr = __make_mdwstring(__mode); + if (!__mdstr) + return nullptr; + + return __do_open(_wfopen(__s, __mdstr), __mode); } # endif @@ -1022,6 +1032,9 @@ public: typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; +# if _LIBCPP_STD_VER >= 26 + using native_handle_type = typename basic_filebuf<_CharT, _Traits>::native_handle_type; +# endif _LIBCPP_HIDE_FROM_ABI basic_ifstream(); _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in); @@ -1039,6 +1052,9 @@ public: _LIBCPP_HIDE_FROM_ABI void swap(basic_ifstream& __rhs); _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const; +# if _LIBCPP_STD_VER >= 26 + _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); } +# endif _LIBCPP_HIDE_FROM_ABI bool is_open() const; void open(const char* __s, ios_base::openmode __mode = ios_base::in); # ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR @@ -1169,6 +1185,9 @@ public: typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; +# if _LIBCPP_STD_VER >= 26 + using native_handle_type = typename basic_filebuf<_CharT, _Traits>::native_handle_type; +# endif _LIBCPP_HIDE_FROM_ABI basic_ofstream(); _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out); @@ -1188,6 +1207,9 @@ public: _LIBCPP_HIDE_FROM_ABI void swap(basic_ofstream& __rhs); _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const; +# if _LIBCPP_STD_VER >= 26 + _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); } +# endif _LIBCPP_HIDE_FROM_ABI bool is_open() const; void open(const char* __s, ios_base::openmode __mode = ios_base::out); # ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR @@ -1319,6 +1341,9 @@ public: typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; +# if _LIBCPP_STD_VER >= 26 + using native_handle_type = typename basic_filebuf<_CharT, _Traits>::native_handle_type; +# endif _LIBCPP_HIDE_FROM_ABI basic_fstream(); _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const char* __s, @@ -1343,6 +1368,9 @@ public: _LIBCPP_HIDE_FROM_ABI void swap(basic_fstream& __rhs); _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const; +# if _LIBCPP_STD_VER >= 26 + _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); } +# endif _LIBCPP_HIDE_FROM_ABI bool is_open() const; _LIBCPP_HIDE_FROM_ABI void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); # ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR diff --git a/contrib/libs/cxxsupp/libcxx/include/functional b/contrib/libs/cxxsupp/libcxx/include/functional index fd99e11fb1..a2774a48bd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/functional +++ b/contrib/libs/cxxsupp/libcxx/include/functional @@ -513,7 +513,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited */ #include <__algorithm/search.h> -#include <__assert> // all public C++ headers provide the assertion handler #include <__compare/compare_three_way.h> #include <__config> #include <__functional/binary_function.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/future b/contrib/libs/cxxsupp/libcxx/include/future index 92ba188210..fda1591818 100644 --- a/contrib/libs/cxxsupp/libcxx/include/future +++ b/contrib/libs/cxxsupp/libcxx/include/future @@ -362,11 +362,16 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__config> + +#ifdef _LIBCPP_HAS_NO_THREADS +# error "<future> is not supported since libc++ has been configured without support for threads." +#endif + +#include <__assert> #include <__availability> #include <__chrono/duration.h> #include <__chrono/time_point.h> -#include <__config> #include <__exception/exception_ptr.h> #include <__memory/addressof.h> #include <__memory/allocator.h> @@ -396,9 +401,8 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; # pragma GCC system_header #endif -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<future> is not supported since libc++ has been configured without support for threads." -#endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD @@ -1601,9 +1605,11 @@ private: public: // construction and destruction _LIBCPP_HIDE_FROM_ABI packaged_task() _NOEXCEPT : __p_(nullptr) {} - template <class _Fp, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > + + template <class _Fp, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {} - template <class _Fp, class _Allocator, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > + + template <class _Fp, class _Allocator, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)), __p_(allocator_arg_t(), __a) {} // ~packaged_task() = default; @@ -1691,9 +1697,9 @@ private: public: // construction and destruction _LIBCPP_HIDE_FROM_ABI packaged_task() _NOEXCEPT : __p_(nullptr) {} - template <class _Fp, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > + template <class _Fp, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {} - template <class _Fp, class _Allocator, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > + template <class _Fp, class _Allocator, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)), __p_(allocator_arg_t(), __a) {} // ~packaged_task() = default; @@ -2043,6 +2049,8 @@ inline shared_future<void> future<void>::share() _NOEXCEPT { return shared_futur _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 # include <chrono> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/initializer_list b/contrib/libs/cxxsupp/libcxx/include/initializer_list index 4c2a7925a5..680ca1cd20 100644 --- a/contrib/libs/cxxsupp/libcxx/include/initializer_list +++ b/contrib/libs/cxxsupp/libcxx/include/initializer_list @@ -42,7 +42,6 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <cstddef> diff --git a/contrib/libs/cxxsupp/libcxx/include/iomanip b/contrib/libs/cxxsupp/libcxx/include/iomanip index 1b9563a24e..fb4f15b9a5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iomanip +++ b/contrib/libs/cxxsupp/libcxx/include/iomanip @@ -42,7 +42,6 @@ template <class charT, class traits, class Allocator> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <istream> #include <version> @@ -464,7 +463,7 @@ struct _LIBCPP_HIDDEN __quoted_output_proxy { _LIBCPP_HIDE_FROM_ABI explicit __quoted_output_proxy(const _CharT* __f, const _CharT* __l, _CharT __d, _CharT __e) : __first_(__f), __last_(__l), __delim_(__d), __escape_(__e) {} - template <class _T2, __enable_if_t<_IsSame<_Traits, void>::value || _IsSame<_Traits, _T2>::value>* = nullptr> + template <class _T2, __enable_if_t<_IsSame<_Traits, void>::value || _IsSame<_Traits, _T2>::value, int> = 0> friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _T2>& operator<<(basic_ostream<_CharT, _T2>& __os, const __quoted_output_proxy& __p) { return std::__quoted_output(__os, __p.__first_, __p.__last_, __p.__delim_, __p.__escape_); diff --git a/contrib/libs/cxxsupp/libcxx/include/ios b/contrib/libs/cxxsupp/libcxx/include/ios index d36f5fb2ca..4b1306fc2a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ios +++ b/contrib/libs/cxxsupp/libcxx/include/ios @@ -217,7 +217,6 @@ storage-class-specifier const error_category& iostream_category() noexcept; # error "The iostreams library is not supported since libc++ has been configured without support for localization." #endif -#include <__assert> // all public C++ headers provide the assertion handler #include <__fwd/ios.h> #include <__ios/fpos.h> #include <__locale> @@ -242,6 +241,9 @@ storage-class-specifier const error_category& iostream_category() noexcept; # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD typedef ptrdiff_t streamsize; @@ -820,6 +822,8 @@ _LIBCPP_HIDE_FROM_ABI inline ios_base& defaultfloat(ios_base& __str) { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> diff --git a/contrib/libs/cxxsupp/libcxx/include/iosfwd b/contrib/libs/cxxsupp/libcxx/include/iosfwd index e28998d004..f1c2cbd966 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iosfwd +++ b/contrib/libs/cxxsupp/libcxx/include/iosfwd @@ -106,7 +106,6 @@ using wosyncstream = basic_osyncstream<wchar_t>; // C++20 */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__fwd/fstream.h> #include <__fwd/ios.h> @@ -143,7 +142,7 @@ typedef fpos<mbstate_t> u8streampos; typedef fpos<mbstate_t> u16streampos; typedef fpos<mbstate_t> u32streampos; -#if _LIBCPP_STD_VER >= 20 +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>> class basic_syncbuf; @@ -161,7 +160,7 @@ using osyncstream = basic_osyncstream<char>; using wosyncstream = basic_osyncstream<wchar_t>; # endif -#endif // _LIBCPP_STD_VER >=20 +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) // Include other forward declarations here template <class _Tp, class _Alloc = allocator<_Tp> > diff --git a/contrib/libs/cxxsupp/libcxx/include/iostream b/contrib/libs/cxxsupp/libcxx/include/iostream index 568ce8caed..5df45c6d3f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iostream +++ b/contrib/libs/cxxsupp/libcxx/include/iostream @@ -33,7 +33,6 @@ extern wostream wclog; */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <version> diff --git a/contrib/libs/cxxsupp/libcxx/include/istream b/contrib/libs/cxxsupp/libcxx/include/istream index 1c7fb992df..3f20c35504 100644 --- a/contrib/libs/cxxsupp/libcxx/include/istream +++ b/contrib/libs/cxxsupp/libcxx/include/istream @@ -158,7 +158,6 @@ template <class Stream, class T> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__fwd/istream.h> #include <__iterator/istreambuf_iterator.h> @@ -167,6 +166,7 @@ template <class Stream, class T> #include <__type_traits/is_base_of.h> #include <__utility/declval.h> #include <__utility/forward.h> +#include <bitset> #include <ostream> #include <version> @@ -1009,17 +1009,18 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() { template <class _CharT, class _Traits> int basic_istream<_CharT, _Traits>::sync() { ios_base::iostate __state = ios_base::goodbit; - int __r = 0; sentry __sen(*this, true); + if (this->rdbuf() == nullptr) + return -1; + + int __r = 0; if (__sen) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif // _LIBCPP_HAS_NO_EXCEPTIONS - if (this->rdbuf() == nullptr) - return -1; if (this->rdbuf()->pubsync() == -1) { __state |= ios_base::badbit; - return -1; + __r = -1; } #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { diff --git a/contrib/libs/cxxsupp/libcxx/include/iterator b/contrib/libs/cxxsupp/libcxx/include/iterator index 2f92807423..5779bf8287 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iterator +++ b/contrib/libs/cxxsupp/libcxx/include/iterator @@ -674,7 +674,6 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__iterator/access.h> #include <__iterator/advance.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/latch b/contrib/libs/cxxsupp/libcxx/include/latch index ef52c0562a..3cc7258381 100644 --- a/contrib/libs/cxxsupp/libcxx/include/latch +++ b/contrib/libs/cxxsupp/libcxx/include/latch @@ -40,12 +40,17 @@ namespace std */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__config> + +#ifdef _LIBCPP_HAS_NO_THREADS +# error "<latch> is not supported since libc++ has been configured without support for threads." +#endif + +#include <__assert> #include <__atomic/atomic_base.h> #include <__atomic/atomic_sync.h> #include <__atomic/memory_order.h> #include <__availability> -#include <__config> #include <cstddef> #include <limits> #include <version> @@ -54,10 +59,6 @@ namespace std # pragma GCC system_header #endif -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<latch> is not supported since libc++ has been configured without support for threads." -#endif - _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -72,11 +73,11 @@ public: static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); } inline _LIBCPP_HIDE_FROM_ABI constexpr explicit latch(ptrdiff_t __expected) : __a_(__expected) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __expected >= 0, "latch::latch(ptrdiff_t): latch cannot be " "initialized with a negative value"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __expected <= max(), "latch::latch(ptrdiff_t): latch cannot be " "initialized with a value greater than max()"); @@ -87,26 +88,33 @@ public: latch& operator=(const latch&) = delete; inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void count_down(ptrdiff_t __update = 1) { - _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "latch::count_down called with a negative value"); + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "latch::count_down called with a negative value"); auto const __old = __a_.fetch_sub(__update, memory_order_release); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __update <= __old, "latch::count_down called with a value greater " "than the internal counter"); if (__old == __update) __a_.notify_all(); } - inline _LIBCPP_HIDE_FROM_ABI bool try_wait() const noexcept { return 0 == __a_.load(memory_order_acquire); } + inline _LIBCPP_HIDE_FROM_ABI bool try_wait() const noexcept { + auto __value = __a_.load(memory_order_acquire); + return try_wait_impl(__value); + } inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait() const { - __cxx_atomic_wait(&__a_.__a_, [this]() -> bool { return try_wait(); }); + std::__atomic_wait_unless( + __a_, [this](ptrdiff_t& __value) -> bool { return try_wait_impl(__value); }, memory_order_acquire); } inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait(ptrdiff_t __update = 1) { - _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "latch::arrive_and_wait called with a negative value"); + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "latch::arrive_and_wait called with a negative value"); // other preconditions on __update are checked in count_down() count_down(__update); wait(); } + +private: + _LIBCPP_HIDE_FROM_ABI bool try_wait_impl(ptrdiff_t& __value) const noexcept { return __value == 0; } }; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/libcxx.imp b/contrib/libs/cxxsupp/libcxx/include/libcxx.imp index 3eb2aa8493..cdbb0a63fc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/libcxx.imp +++ b/contrib/libs/cxxsupp/libcxx/include/libcxx.imp @@ -1,53 +1,872 @@ [ - { include: [ "<__hash_table>", "private", "<unordered_map>", "public" ] }, - { include: [ "<__hash_table>", "private", "<unordered_set>", "public" ] }, - { include: [ "<__locale>", "private", "<locale>", "public" ] }, - { include: [ "<__node_handle>", "private", "<map>", "public" ] }, - { include: [ "<__node_handle>", "private", "<set>", "public" ] }, - { include: [ "<__node_handle>", "private", "<unordered_map>", "public" ] }, - { include: [ "<__node_handle>", "private", "<unordered_set>", "public" ] }, - { include: [ "<__split_buffer>", "private", "<deque>", "public" ] }, - { include: [ "<__split_buffer>", "private", "<vector>", "public" ] }, - { include: [ "<__threading_support>", "private", "<atomic>", "public" ] }, - { include: [ "<__threading_support>", "private", "<mutex>", "public" ] }, - { include: [ "<__threading_support>", "private", "<semaphore>", "public" ] }, - { include: [ "<__threading_support>", "private", "<thread>", "public" ] }, - { include: [ "<__tree>", "private", "<map>", "public" ] }, - { include: [ "<__tree>", "private", "<set>", "public" ] }, - { include: [ "@<__algorithm/.*>", "private", "<algorithm>", "public" ] }, - { include: [ "@<__atomic/.*>", "private", "<atomic>", "public" ] }, - { include: [ "@<__bit/.*>", "private", "<bit>", "public" ] }, - { include: [ "@<__charconv/.*>", "private", "<charconv>", "public" ] }, - { include: [ "@<__chrono/.*>", "private", "<chrono>", "public" ] }, - { include: [ "@<__compare/.*>", "private", "<compare>", "public" ] }, - { include: [ "@<__concepts/.*>", "private", "<concepts>", "public" ] }, - { include: [ "@<__condition_variable/.*>", "private", "<condition_variable>", "public" ] }, - { include: [ "@<__coroutine/.*>", "private", "<coroutine>", "public" ] }, - { include: [ "@<__debug_utils/.*>", "private", "<debug_utils>", "public" ] }, - { include: [ "@<__exception/.*>", "private", "<exception>", "public" ] }, - { include: [ "@<__expected/.*>", "private", "<expected>", "public" ] }, - { include: [ "@<__filesystem/.*>", "private", "<filesystem>", "public" ] }, - { include: [ "@<__format/.*>", "private", "<format>", "public" ] }, - { include: [ "@<__functional/.*>", "private", "<functional>", "public" ] }, - { include: [ "@<__fwd/.*>", "private", "<fwd>", "public" ] }, - { include: [ "@<__ios/.*>", "private", "<ios>", "public" ] }, - { include: [ "@<__iterator/.*>", "private", "<iterator>", "public" ] }, - { include: [ "@<__locale_dir/.*>", "private", "<locale>", "public" ] }, - { include: [ "@<__math/.*>", "private", "<math>", "public" ] }, - { include: [ "@<__mdspan/.*>", "private", "<mdspan>", "public" ] }, - { include: [ "@<__memory/.*>", "private", "<memory>", "public" ] }, - { include: [ "@<__memory_resource/.*>", "private", "<memory_resource>", "public" ] }, - { include: [ "@<__mutex/.*>", "private", "<mutex>", "public" ] }, - { include: [ "@<__numeric/.*>", "private", "<numeric>", "public" ] }, - { include: [ "@<__random/.*>", "private", "<random>", "public" ] }, - { include: [ "@<__ranges/.*>", "private", "<ranges>", "public" ] }, - { include: [ "@<__stop_token/.*>", "private", "<stop_token>", "public" ] }, - { include: [ "@<__string/.*>", "private", "<string>", "public" ] }, - { include: [ "@<__support/.*>", "private", "<support>", "public" ] }, - { include: [ "@<__system_error/.*>", "private", "<system_error>", "public" ] }, - { include: [ "@<__thread/.*>", "private", "<thread>", "public" ] }, - { include: [ "@<__tuple/.*>", "private", "<tuple>", "public" ] }, - { include: [ "@<__type_traits/.*>", "private", "<type_traits>", "public" ] }, - { include: [ "@<__utility/.*>", "private", "<utility>", "public" ] }, - { include: [ "@<__variant/.*>", "private", "<variant>", "public" ] }, + { include: [ "<__algorithm/adjacent_find.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/all_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/any_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/binary_search.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/clamp.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/comp.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/comp_ref_type.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/copy_backward.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/copy_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/copy_move_common.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/copy_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/count.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/count_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/equal.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/equal_range.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/fill.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/fill_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/find.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/find_end.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/find_first_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/find_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/find_if_not.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/find_segment_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/fold.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/for_each.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/for_each_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/for_each_segment.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/generate.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/generate_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/half_positive.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/in_found_result.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/in_fun_result.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/in_in_out_result.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/in_in_result.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/in_out_out_result.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/in_out_result.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/includes.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/inplace_merge.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/is_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/is_heap_until.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/is_partitioned.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/is_permutation.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/is_sorted.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/is_sorted_until.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/iter_swap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/iterator_operations.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/lexicographical_compare.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/lexicographical_compare_three_way.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/lower_bound.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/make_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/make_projected.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/max.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/max_element.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/merge.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/min.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/min_element.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/min_max_result.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/minmax.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/minmax_element.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/mismatch.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/move.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/move_backward.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/next_permutation.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/none_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/nth_element.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/partial_sort.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/partial_sort_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/partition.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/partition_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/partition_point.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pop_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/prev_permutation.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_any_all_none_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backend.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backend.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/any_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/backend.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/fill.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/find_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/for_each.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/libdispatch.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/merge.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/serial.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/stable_sort.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/thread.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/transform.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_backends/cpu_backends/transform_reduce.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_count.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_equal.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_fill.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_find.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_for_each.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_frontend_dispatch.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_generate.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_is_partitioned.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_merge.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_move.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_replace.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_rotate_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_sort.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_stable_sort.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/pstl_transform.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/push_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_adjacent_find.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_all_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_any_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_binary_search.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_clamp.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_contains.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_contains_subrange.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_copy_backward.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_copy_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_copy_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_count.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_count_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_ends_with.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_equal.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_equal_range.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_fill.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_fill_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_find.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_find_end.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_find_first_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_find_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_find_if_not.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_for_each.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_for_each_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_generate.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_generate_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_includes.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_inplace_merge.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_is_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_is_heap_until.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_is_partitioned.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_is_permutation.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_is_sorted.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_is_sorted_until.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_iterator_concept.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_lexicographical_compare.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_lower_bound.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_make_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_max.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_max_element.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_merge.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_min.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_min_element.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_minmax.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_minmax_element.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_mismatch.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_move.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_move_backward.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_next_permutation.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_none_of.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_nth_element.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_partial_sort.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_partial_sort_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_partition.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_partition_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_partition_point.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_pop_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_prev_permutation.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_push_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_remove.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_remove_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_remove_copy_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_remove_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_replace.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_replace_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_replace_copy_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_replace_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_reverse.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_reverse_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_rotate.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_rotate_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_sample.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_search.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_search_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_set_difference.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_set_intersection.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_set_symmetric_difference.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_set_union.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_shuffle.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_sort.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_sort_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_stable_partition.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_stable_sort.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_starts_with.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_swap_ranges.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_transform.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_unique.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_unique_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/ranges_upper_bound.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/remove.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/remove_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/remove_copy_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/remove_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/replace.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/replace_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/replace_copy_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/replace_if.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/reverse.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/reverse_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/rotate.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/rotate_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/sample.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/search.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/search_n.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/set_difference.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/set_intersection.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/set_symmetric_difference.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/set_union.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/shift_left.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/shift_right.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/shuffle.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/sift_down.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/sort.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/sort_heap.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/stable_partition.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/stable_sort.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/swap_ranges.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/three_way_comp_ref_type.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/transform.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/uniform_random_bit_generator_adaptor.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/unique.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/unique_copy.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/unwrap_iter.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/unwrap_range.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__algorithm/upper_bound.h>", "private", "<algorithm>", "public" ] }, + { include: [ "<__atomic/aliases.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/atomic.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/atomic_base.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/atomic_flag.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/atomic_init.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/atomic_lock_free.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/atomic_sync.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/check_memory_order.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/contention_t.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/cxx_atomic_impl.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/fence.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/is_always_lock_free.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/kill_dependency.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__atomic/memory_order.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__bit/bit_cast.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/bit_ceil.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/bit_floor.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/bit_log2.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/bit_width.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/blsr.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/byteswap.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/countl.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/countr.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/endian.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/has_single_bit.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/invert_if.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/popcount.h>", "private", "<bit>", "public" ] }, + { include: [ "<__bit/rotate.h>", "private", "<bit>", "public" ] }, + { include: [ "<__charconv/chars_format.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__charconv/from_chars_integral.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__charconv/from_chars_result.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__charconv/tables.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__charconv/to_chars.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__charconv/to_chars_base_10.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__charconv/to_chars_floating_point.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__charconv/to_chars_integral.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__charconv/to_chars_result.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__charconv/traits.h>", "private", "<charconv>", "public" ] }, + { include: [ "<__chrono/calendar.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/concepts.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/convert_to_timespec.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/convert_to_tm.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/day.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/duration.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/file_clock.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/formatter.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/hh_mm_ss.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/high_resolution_clock.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/literals.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/month.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/month_weekday.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/monthday.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/ostream.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/parser_std_format_spec.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/statically_widen.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/steady_clock.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/system_clock.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/time_point.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/time_zone.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/time_zone_link.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/tzdb.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/tzdb_list.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/weekday.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/year.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/year_month.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/year_month_day.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__chrono/year_month_weekday.h>", "private", "<chrono>", "public" ] }, + { include: [ "<__compare/common_comparison_category.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/compare_partial_order_fallback.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/compare_strong_order_fallback.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/compare_three_way.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/compare_three_way_result.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/compare_weak_order_fallback.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/is_eq.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/ordering.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/partial_order.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/strong_order.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/synth_three_way.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/three_way_comparable.h>", "private", "<compare>", "public" ] }, + { include: [ "<__compare/weak_order.h>", "private", "<compare>", "public" ] }, + { include: [ "<__concepts/arithmetic.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/assignable.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/boolean_testable.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/class_or_enum.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/common_reference_with.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/common_with.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/constructible.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/convertible_to.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/copyable.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/derived_from.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/destructible.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/different_from.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/equality_comparable.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/invocable.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/movable.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/predicate.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/regular.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/relation.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/same_as.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/semiregular.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/swappable.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__concepts/totally_ordered.h>", "private", "<concepts>", "public" ] }, + { include: [ "<__condition_variable/condition_variable.h>", "private", "<condition_variable>", "public" ] }, + { include: [ "<__coroutine/coroutine_handle.h>", "private", "<coroutine>", "public" ] }, + { include: [ "<__coroutine/coroutine_traits.h>", "private", "<coroutine>", "public" ] }, + { include: [ "<__coroutine/noop_coroutine_handle.h>", "private", "<coroutine>", "public" ] }, + { include: [ "<__coroutine/trivial_awaitables.h>", "private", "<coroutine>", "public" ] }, + { include: [ "<__exception/exception.h>", "private", "<exception>", "public" ] }, + { include: [ "<__exception/exception_ptr.h>", "private", "<exception>", "public" ] }, + { include: [ "<__exception/nested_exception.h>", "private", "<exception>", "public" ] }, + { include: [ "<__exception/operations.h>", "private", "<exception>", "public" ] }, + { include: [ "<__exception/terminate.h>", "private", "<exception>", "public" ] }, + { include: [ "<__expected/bad_expected_access.h>", "private", "<expected>", "public" ] }, + { include: [ "<__expected/expected.h>", "private", "<expected>", "public" ] }, + { include: [ "<__expected/unexpect.h>", "private", "<expected>", "public" ] }, + { include: [ "<__expected/unexpected.h>", "private", "<expected>", "public" ] }, + { include: [ "<__filesystem/copy_options.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/directory_entry.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/directory_iterator.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/directory_options.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/file_status.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/file_time_type.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/file_type.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/filesystem_error.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/operations.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/path.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/path_iterator.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/perm_options.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/perms.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/recursive_directory_iterator.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/space_info.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__filesystem/u8path.h>", "private", "<filesystem>", "public" ] }, + { include: [ "<__format/buffer.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/concepts.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/container_adaptor.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/enable_insertable.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/escaped_output_table.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/extended_grapheme_cluster_table.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_arg.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_arg_store.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_args.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_context.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_error.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_functions.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_fwd.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_parse_context.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_string.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/format_to_n_result.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter_bool.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter_char.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter_floating_point.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter_integer.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter_integral.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter_output.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter_pointer.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter_string.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/formatter_tuple.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/parser_std_format_spec.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/range_default_formatter.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/range_formatter.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/unicode.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/width_estimation_table.h>", "private", "<format>", "public" ] }, + { include: [ "<__format/write_escaped.h>", "private", "<format>", "public" ] }, + { include: [ "<__functional/binary_function.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/binary_negate.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/bind.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/bind_back.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/bind_front.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/binder1st.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/binder2nd.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/boyer_moore_searcher.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/compose.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/default_searcher.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/function.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/hash.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/identity.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/invoke.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/is_transparent.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/mem_fn.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/mem_fun_ref.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/not_fn.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/operations.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/perfect_forward.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/pointer_to_binary_function.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/pointer_to_unary_function.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/ranges_operations.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/reference_wrapper.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/unary_function.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/unary_negate.h>", "private", "<functional>", "public" ] }, + { include: [ "<__functional/weak_result_type.h>", "private", "<functional>", "public" ] }, + { include: [ "<__fwd/array.h>", "private", "<array>", "public" ] }, + { include: [ "<__fwd/bit_reference.h>", "private", "<bitset>", "public" ] }, + { include: [ "<__fwd/bit_reference.h>", "private", "<vector>", "public" ] }, + { include: [ "<__fwd/complex.h>", "private", "<complex>", "public" ] }, + { include: [ "<__fwd/fstream.h>", "private", "<iosfwd>", "public" ] }, + { include: [ "<__fwd/functional.h>", "private", "<functional>", "public" ] }, + { include: [ "<__fwd/ios.h>", "private", "<iosfwd>", "public" ] }, + { include: [ "<__fwd/istream.h>", "private", "<iosfwd>", "public" ] }, + { include: [ "<__fwd/mdspan.h>", "private", "<mdspan>", "public" ] }, + { include: [ "<__fwd/memory_resource.h>", "private", "<memory_resource>", "public" ] }, + { include: [ "<__fwd/ostream.h>", "private", "<iosfwd>", "public" ] }, + { include: [ "<__fwd/pair.h>", "private", "<utility>", "public" ] }, + { include: [ "<__fwd/span.h>", "private", "<span>", "public" ] }, + { include: [ "<__fwd/sstream.h>", "private", "<iosfwd>", "public" ] }, + { include: [ "<__fwd/streambuf.h>", "private", "<iosfwd>", "public" ] }, + { include: [ "<__fwd/string.h>", "private", "<string>", "public" ] }, + { include: [ "<__fwd/string_view.h>", "private", "<string_view>", "public" ] }, + { include: [ "<__fwd/subrange.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__fwd/tuple.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__ios/fpos.h>", "private", "<ios>", "public" ] }, + { include: [ "<__iterator/access.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/advance.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/back_insert_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/bounded_iter.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/common_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/concepts.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/counted_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/cpp17_iterator_concepts.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/data.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/default_sentinel.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/distance.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/empty.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/erase_if_container.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/front_insert_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/incrementable_traits.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/indirectly_comparable.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/insert_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/istream_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/istreambuf_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/iter_move.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/iter_swap.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/iterator_traits.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/iterator_with_data.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/mergeable.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/move_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/move_sentinel.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/next.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/ostream_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/ostreambuf_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/permutable.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/prev.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/projected.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/ranges_iterator_traits.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/readable_traits.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/reverse_access.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/reverse_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/segmented_iterator.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/size.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/sortable.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/unreachable_sentinel.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__iterator/wrap_iter.h>", "private", "<iterator>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/android.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/bsd_locale_defaults.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/bsd_locale_fallbacks.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/fuchsia.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/ibm.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/locale_guard.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/musl.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/newlib.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/openbsd.h>", "private", "<locale>", "public" ] }, + { include: [ "<__locale_dir/locale_base_api/win32.h>", "private", "<locale>", "public" ] }, + { include: [ "<__math/abs.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/copysign.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/error_functions.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/exponential_functions.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/fdim.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/fma.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/gamma.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/hyperbolic_functions.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/hypot.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/inverse_hyperbolic_functions.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/inverse_trigonometric_functions.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/logarithms.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/min_max.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/modulo.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/remainder.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/roots.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/rounding_functions.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/traits.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__math/trigonometric_functions.h>", "private", "<cmath>", "public" ] }, + { include: [ "<__mdspan/default_accessor.h>", "private", "<mdspan>", "public" ] }, + { include: [ "<__mdspan/extents.h>", "private", "<mdspan>", "public" ] }, + { include: [ "<__mdspan/layout_left.h>", "private", "<mdspan>", "public" ] }, + { include: [ "<__mdspan/layout_right.h>", "private", "<mdspan>", "public" ] }, + { include: [ "<__mdspan/layout_stride.h>", "private", "<mdspan>", "public" ] }, + { include: [ "<__mdspan/mdspan.h>", "private", "<mdspan>", "public" ] }, + { include: [ "<__memory/addressof.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/align.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/aligned_alloc.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/allocate_at_least.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/allocation_guard.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/allocator.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/allocator_arg_t.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/allocator_destructor.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/allocator_traits.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/assume_aligned.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/auto_ptr.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/builtin_new_allocator.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/compressed_pair.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/concepts.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/construct_at.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/destruct_n.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/pointer_traits.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/ranges_construct_at.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/ranges_uninitialized_algorithms.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/raw_storage_iterator.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/shared_ptr.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/swap_allocator.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/temp_value.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/temporary_buffer.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/uninitialized_algorithms.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/unique_ptr.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/uses_allocator.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/uses_allocator_construction.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory/voidify.h>", "private", "<memory>", "public" ] }, + { include: [ "<__memory_resource/memory_resource.h>", "private", "<memory_resource>", "public" ] }, + { include: [ "<__memory_resource/monotonic_buffer_resource.h>", "private", "<memory_resource>", "public" ] }, + { include: [ "<__memory_resource/polymorphic_allocator.h>", "private", "<memory_resource>", "public" ] }, + { include: [ "<__memory_resource/pool_options.h>", "private", "<memory_resource>", "public" ] }, + { include: [ "<__memory_resource/synchronized_pool_resource.h>", "private", "<memory_resource>", "public" ] }, + { include: [ "<__memory_resource/unsynchronized_pool_resource.h>", "private", "<memory_resource>", "public" ] }, + { include: [ "<__mutex/lock_guard.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__mutex/mutex.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__mutex/once_flag.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__mutex/tag_types.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__mutex/unique_lock.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__numeric/accumulate.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/adjacent_difference.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/exclusive_scan.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/gcd_lcm.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/inclusive_scan.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/inner_product.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/iota.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/midpoint.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/partial_sum.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/pstl_reduce.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/pstl_transform_reduce.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/reduce.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/saturation_arithmetic.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/transform_exclusive_scan.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/transform_inclusive_scan.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__numeric/transform_reduce.h>", "private", "<numeric>", "public" ] }, + { include: [ "<__random/bernoulli_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/binomial_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/cauchy_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/chi_squared_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/clamp_to_integral.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/default_random_engine.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/discard_block_engine.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/discrete_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/exponential_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/extreme_value_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/fisher_f_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/gamma_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/generate_canonical.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/geometric_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/independent_bits_engine.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/is_seed_sequence.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/is_valid.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/knuth_b.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/linear_congruential_engine.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/log2.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/lognormal_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/mersenne_twister_engine.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/negative_binomial_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/normal_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/piecewise_constant_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/piecewise_linear_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/poisson_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/random_device.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/ranlux.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/seed_seq.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/shuffle_order_engine.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/student_t_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/subtract_with_carry_engine.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/uniform_int_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/uniform_random_bit_generator.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/uniform_real_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__random/weibull_distribution.h>", "private", "<random>", "public" ] }, + { include: [ "<__ranges/access.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/all.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/as_rvalue_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/chunk_by_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/common_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/concepts.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/container_compatible_range.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/counted.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/dangling.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/data.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/drop_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/drop_while_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/elements_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/empty.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/empty_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/enable_borrowed_range.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/enable_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/filter_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/from_range.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/iota_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/istream_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/join_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/lazy_split_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/movable_box.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/non_propagating_cache.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/owning_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/range_adaptor.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/rbegin.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/ref_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/rend.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/repeat_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/reverse_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/single_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/size.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/split_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/subrange.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/take_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/take_while_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/to.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/transform_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/view_interface.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/views.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__ranges/zip_view.h>", "private", "<ranges>", "public" ] }, + { include: [ "<__stop_token/atomic_unique_lock.h>", "private", "<stop_token>", "public" ] }, + { include: [ "<__stop_token/intrusive_list_view.h>", "private", "<stop_token>", "public" ] }, + { include: [ "<__stop_token/intrusive_shared_ptr.h>", "private", "<stop_token>", "public" ] }, + { include: [ "<__stop_token/stop_callback.h>", "private", "<stop_token>", "public" ] }, + { include: [ "<__stop_token/stop_source.h>", "private", "<stop_token>", "public" ] }, + { include: [ "<__stop_token/stop_state.h>", "private", "<stop_token>", "public" ] }, + { include: [ "<__stop_token/stop_token.h>", "private", "<stop_token>", "public" ] }, + { include: [ "<__string/char_traits.h>", "private", "<string>", "public" ] }, + { include: [ "<__string/constexpr_c_functions.h>", "private", "<string>", "public" ] }, + { include: [ "<__string/extern_template_lists.h>", "private", "<string>", "public" ] }, + { include: [ "<__system_error/errc.h>", "private", "<system_error>", "public" ] }, + { include: [ "<__system_error/error_category.h>", "private", "<system_error>", "public" ] }, + { include: [ "<__system_error/error_code.h>", "private", "<system_error>", "public" ] }, + { include: [ "<__system_error/error_condition.h>", "private", "<system_error>", "public" ] }, + { include: [ "<__system_error/system_error.h>", "private", "<system_error>", "public" ] }, + { include: [ "<__thread/formatter.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/id.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/jthread.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/poll_with_backoff.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/support.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__thread/support.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__thread/support.h>", "private", "<semaphore>", "public" ] }, + { include: [ "<__thread/support.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/support/c11.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__thread/support/c11.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__thread/support/c11.h>", "private", "<semaphore>", "public" ] }, + { include: [ "<__thread/support/c11.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/support/external.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__thread/support/external.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__thread/support/external.h>", "private", "<semaphore>", "public" ] }, + { include: [ "<__thread/support/external.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/support/pthread.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__thread/support/pthread.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__thread/support/pthread.h>", "private", "<semaphore>", "public" ] }, + { include: [ "<__thread/support/pthread.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/support/windows.h>", "private", "<atomic>", "public" ] }, + { include: [ "<__thread/support/windows.h>", "private", "<mutex>", "public" ] }, + { include: [ "<__thread/support/windows.h>", "private", "<semaphore>", "public" ] }, + { include: [ "<__thread/support/windows.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/this_thread.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/thread.h>", "private", "<thread>", "public" ] }, + { include: [ "<__thread/timed_backoff_policy.h>", "private", "<thread>", "public" ] }, + { include: [ "<__tuple/make_tuple_types.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__tuple/pair_like.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__tuple/sfinae_helpers.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__tuple/tuple_element.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__tuple/tuple_indices.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__tuple/tuple_like.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__tuple/tuple_like_ext.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__tuple/tuple_size.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__tuple/tuple_types.h>", "private", "<tuple>", "public" ] }, + { include: [ "<__type_traits/add_const.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/add_cv.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/add_lvalue_reference.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/add_pointer.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/add_rvalue_reference.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/add_volatile.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/aligned_storage.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/aligned_union.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/alignment_of.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/apply_cv.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/can_extract_key.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/common_reference.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/common_type.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/conditional.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/conjunction.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/copy_cv.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/copy_cvref.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/datasizeof.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/decay.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/dependent_type.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/disjunction.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/enable_if.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/extent.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/has_unique_object_representation.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/has_virtual_destructor.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/integral_constant.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/invoke.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_abstract.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_aggregate.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_allocator.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_always_bitcastable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_arithmetic.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_array.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_assignable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_base_of.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_bounded_array.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_callable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_char_like_type.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_class.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_compound.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_const.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_constant_evaluated.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_convertible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_copy_assignable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_copy_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_core_convertible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_default_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_destructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_empty.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_enum.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_equality_comparable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_execution_policy.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_final.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_floating_point.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_function.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_fundamental.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_implicitly_default_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_integral.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_literal_type.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_member_function_pointer.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_member_object_pointer.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_member_pointer.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_move_assignable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_move_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_nothrow_assignable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_nothrow_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_nothrow_convertible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_nothrow_copy_assignable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_nothrow_copy_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_nothrow_default_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_nothrow_destructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_nothrow_move_assignable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_nothrow_move_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_null_pointer.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_object.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_pod.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_pointer.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_polymorphic.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_primary_template.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_reference.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_reference_wrapper.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_referenceable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_same.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_scalar.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_scoped_enum.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_signed.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_signed_integer.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_specialization.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_standard_layout.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_swappable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivial.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_assignable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_copy_assignable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_copy_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_copyable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_default_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_destructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_lexicographically_comparable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_move_assignable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_move_constructible.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_trivially_relocatable.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_unbounded_array.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_union.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_unsigned.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_unsigned_integer.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_valid_expansion.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_void.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/is_volatile.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/lazy.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/make_32_64_or_128_bit.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/make_const_lvalue_ref.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/make_signed.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/make_unsigned.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/maybe_const.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/nat.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/negation.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/noexcept_move_assign_container.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/operation_traits.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/promote.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/rank.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/remove_all_extents.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/remove_const.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/remove_const_ref.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/remove_cv.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/remove_cvref.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/remove_extent.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/remove_pointer.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/remove_reference.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/remove_volatile.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/result_of.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/strip_signature.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/type_identity.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/type_list.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/underlying_type.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/unwrap_ref.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__type_traits/void_t.h>", "private", "<type_traits>", "public" ] }, + { include: [ "<__utility/as_const.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/as_lvalue.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/auto_cast.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/cmp.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/convert_to_integral.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/declval.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/empty.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/exception_guard.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/exchange.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/forward.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/forward_like.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/in_place.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/integer_sequence.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/is_pointer_in_range.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/move.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/no_destroy.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/pair.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/piecewise_construct.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/priority_tag.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/rel_ops.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/small_buffer.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/swap.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/to_underlying.h>", "private", "<utility>", "public" ] }, + { include: [ "<__utility/unreachable.h>", "private", "<utility>", "public" ] }, + { include: [ "<__variant/monostate.h>", "private", "<variant>", "public" ] }, ] diff --git a/contrib/libs/cxxsupp/libcxx/include/limits b/contrib/libs/cxxsupp/libcxx/include/limits index a240580c01..f15b5b1ab1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/limits +++ b/contrib/libs/cxxsupp/libcxx/include/limits @@ -102,7 +102,6 @@ template<> class numeric_limits<cv long double>; */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_signed.h> @@ -436,8 +435,8 @@ protected: }; template <class _Tp> -class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<__remove_cv_t<_Tp> > { - typedef __libcpp_numeric_limits<__remove_cv_t<_Tp> > __base; +class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<_Tp> { + typedef __libcpp_numeric_limits<_Tp> __base; typedef typename __base::type type; public: @@ -530,286 +529,13 @@ template <class _Tp> _LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style; template <class _Tp> -class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp> : private numeric_limits<_Tp> { - typedef numeric_limits<_Tp> __base; - typedef _Tp type; - -public: - static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); } - - static _LIBCPP_CONSTEXPR const int digits = __base::digits; - static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; - static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; - static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; - static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; - static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; - static _LIBCPP_CONSTEXPR const int radix = __base::radix; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); } +class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp> : public numeric_limits<_Tp> {}; - static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; - static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; - static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; - static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; - - static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; - static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; - static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_SUPPRESS_DEPRECATED_POP - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); } - - static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; - static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; - static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; - - static _LIBCPP_CONSTEXPR const bool traps = __base::traps; - static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; - static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; -}; - -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_specialized; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits10; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_digits10; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_signed; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_integer; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_exact; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::radix; template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent10; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent10; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_infinity; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_quiet_NaN; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_signaling_NaN; -template <class _Tp> -_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const _Tp>::has_denorm; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_denorm_loss; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_iec559; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_bounded; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_modulo; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::traps; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::tinyness_before; -template <class _Tp> -_LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style; - -template <class _Tp> -class _LIBCPP_TEMPLATE_VIS numeric_limits<volatile _Tp> : private numeric_limits<_Tp> { - typedef numeric_limits<_Tp> __base; - typedef _Tp type; - -public: - static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); } - - static _LIBCPP_CONSTEXPR const int digits = __base::digits; - static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; - static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; - static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; - static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; - static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; - static _LIBCPP_CONSTEXPR const int radix = __base::radix; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); } - - static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; - static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; - static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; - static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; - - static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; - static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; - static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_SUPPRESS_DEPRECATED_POP - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); } +class _LIBCPP_TEMPLATE_VIS numeric_limits<volatile _Tp> : public numeric_limits<_Tp> {}; - static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; - static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; - static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; - - static _LIBCPP_CONSTEXPR const bool traps = __base::traps; - static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; - static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; -}; - -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_specialized; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits10; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_digits10; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_signed; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_integer; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_exact; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::radix; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent10; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent10; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_infinity; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_quiet_NaN; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_signaling_NaN; -template <class _Tp> -_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<volatile _Tp>::has_denorm; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_denorm_loss; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_iec559; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_bounded; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_modulo; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::traps; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::tinyness_before; -template <class _Tp> -_LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style; - -template <class _Tp> -class _LIBCPP_TEMPLATE_VIS numeric_limits<const volatile _Tp> : private numeric_limits<_Tp> { - typedef numeric_limits<_Tp> __base; - typedef _Tp type; - -public: - static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); } - - static _LIBCPP_CONSTEXPR const int digits = __base::digits; - static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; - static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; - static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; - static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; - static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; - static _LIBCPP_CONSTEXPR const int radix = __base::radix; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); } - - static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; - static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; - static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; - static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; - - static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; - static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; - static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_SUPPRESS_DEPRECATED_POP - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); } - - static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; - static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; - static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; - - static _LIBCPP_CONSTEXPR const bool traps = __base::traps; - static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; - static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; -}; - -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_specialized; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_digits10; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_integer; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_exact; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::radix; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent10; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent; -template <class _Tp> -_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent10; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_infinity; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_quiet_NaN; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_signaling_NaN; -template <class _Tp> -_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_denorm_loss; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_iec559; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_bounded; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_modulo; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::traps; -template <class _Tp> -_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::tinyness_before; template <class _Tp> -_LIBCPP_CONSTEXPR const float_round_style numeric_limits<const volatile _Tp>::round_style; +class _LIBCPP_TEMPLATE_VIS numeric_limits<const volatile _Tp> : public numeric_limits<_Tp> {}; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/list b/contrib/libs/cxxsupp/libcxx/include/list index 7fea487445..8f0689268e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/list +++ b/contrib/libs/cxxsupp/libcxx/include/list @@ -202,7 +202,7 @@ template <class T, class Allocator, class Predicate> #include <__algorithm/lexicographical_compare.h> #include <__algorithm/lexicographical_compare_three_way.h> #include <__algorithm/min.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__config> #include <__format/enable_insertable.h> @@ -706,21 +706,17 @@ public: _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n, const allocator_type& __a); #endif _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x); - template <class = __enable_if_t<__is_allocator<_Alloc>::value> > + template <__enable_if_t<__is_allocator<_Alloc>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a) { for (; __n > 0; --__n) push_back(__x); } - template <class _InpIter> - _LIBCPP_HIDE_FROM_ABI - list(_InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0); - template <class _InpIter> - _LIBCPP_HIDE_FROM_ABI - list(_InpIter __f, - _InpIter __l, - const allocator_type& __a, - __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0); + template <class _InpIter, __enable_if_t<__has_input_iterator_category<_InpIter>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI list(_InpIter __f, _InpIter __l); + + template <class _InpIter, __enable_if_t<__has_input_iterator_category<_InpIter>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI list(_InpIter __f, _InpIter __l, const allocator_type& __a); #if _LIBCPP_STD_VER >= 23 template <_ContainerCompatibleRange<_Tp> _Range> @@ -750,9 +746,8 @@ public: _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); } #endif // _LIBCPP_CXX03_LANG - template <class _InpIter> - _LIBCPP_HIDE_FROM_ABI void - assign(_InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0); + template <class _InpIter, __enable_if_t<__has_input_iterator_category<_InpIter>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI void assign(_InpIter __f, _InpIter __l); #if _LIBCPP_STD_VER >= 23 template <_ContainerCompatibleRange<_Tp> _Range> @@ -854,12 +849,9 @@ public: _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x); _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __x); - template <class _InpIter> - _LIBCPP_HIDE_FROM_ABI iterator - insert(const_iterator __p, - _InpIter __f, - _InpIter __l, - __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0); + + template <class _InpIter, __enable_if_t<__has_input_iterator_category<_InpIter>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InpIter __f, _InpIter __l); #if _LIBCPP_STD_VER >= 23 template <_ContainerCompatibleRange<_Tp> _Range> @@ -1024,19 +1016,15 @@ list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) { } template <class _Tp, class _Alloc> -template <class _InpIter> -list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) { +template <class _InpIter, __enable_if_t<__has_input_iterator_category<_InpIter>::value, int> > +list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l) { for (; __f != __l; ++__f) __emplace_back(*__f); } template <class _Tp, class _Alloc> -template <class _InpIter> -list<_Tp, _Alloc>::list(_InpIter __f, - _InpIter __l, - const allocator_type& __a, - __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) - : base(__a) { +template <class _InpIter, __enable_if_t<__has_input_iterator_category<_InpIter>::value, int> > +list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a) : base(__a) { for (; __f != __l; ++__f) __emplace_back(*__f); } @@ -1121,9 +1109,8 @@ inline list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list& __c) { } template <class _Tp, class _Alloc> -template <class _InpIter> -void list<_Tp, _Alloc>::assign( - _InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) { +template <class _InpIter, __enable_if_t<__has_input_iterator_category<_InpIter>::value, int> > +void list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l) { __assign_with_sentinel(__f, __l); } @@ -1201,9 +1188,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _ } template <class _Tp, class _Alloc> -template <class _InpIter> -typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert( - const_iterator __p, _InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) { +template <class _InpIter, __enable_if_t<__has_input_iterator_category<_InpIter>::value, int> > +typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l) { return __insert_with_sentinel(__p, __f, __l); } diff --git a/contrib/libs/cxxsupp/libcxx/include/locale b/contrib/libs/cxxsupp/libcxx/include/locale index 2806396de9..13b911c5d2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/locale +++ b/contrib/libs/cxxsupp/libcxx/include/locale @@ -193,7 +193,7 @@ template <class charT> class messages_byname; #include <__algorithm/max.h> #include <__algorithm/reverse.h> #include <__algorithm/unwrap_iter.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__config> #include <__iterator/access.h> #include <__iterator/back_insert_iterator.h> @@ -3425,7 +3425,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::~wbuffer_convert() { template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() { _LIBCPP_SUPPRESS_DEPRECATED_POP - if (__cv_ == 0 || __bufptr_ == 0) + if (__cv_ == 0 || __bufptr_ == nullptr) return traits_type::eof(); bool __initial = __read_mode(); char_type __1buf; @@ -3482,7 +3482,7 @@ template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c) { _LIBCPP_SUPPRESS_DEPRECATED_POP - if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr()) { + if (__cv_ != 0 && __bufptr_ && this->eback() < this->gptr()) { if (traits_type::eq_int_type(__c, traits_type::eof())) { this->gbump(-1); return traits_type::not_eof(__c); @@ -3500,7 +3500,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c) { _LIBCPP_SUPPRESS_DEPRECATED_POP - if (__cv_ == 0 || __bufptr_ == 0) + if (__cv_ == 0 || !__bufptr_) return traits_type::eof(); __write_mode(); char_type __1buf; @@ -3592,7 +3592,7 @@ template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __om) { int __width = __cv_->encoding(); - if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync()) + if (__cv_ == 0 || !__bufptr_ || (__width <= 0 && __off != 0) || sync()) return pos_type(off_type(-1)); // __width > 0 || __off == 0, now check __way if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end) @@ -3605,7 +3605,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch) { - if (__cv_ == 0 || __bufptr_ == 0 || sync()) + if (__cv_ == 0 || !__bufptr_ || sync()) return pos_type(off_type(-1)); if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1))) return pos_type(off_type(-1)); @@ -3615,7 +3615,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode template <class _Codecvt, class _Elem, class _Tr> int wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() { _LIBCPP_SUPPRESS_DEPRECATED_POP - if (__cv_ == 0 || __bufptr_ == 0) + if (__cv_ == 0 || !__bufptr_) return 0; if (__cm_ & ios_base::out) { if (this->pptr() != this->pbase()) diff --git a/contrib/libs/cxxsupp/libcxx/include/map b/contrib/libs/cxxsupp/libcxx/include/map index b78ded2a1d..3025557901 100644 --- a/contrib/libs/cxxsupp/libcxx/include/map +++ b/contrib/libs/cxxsupp/libcxx/include/map @@ -574,7 +574,7 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20 #include <__algorithm/equal.h> #include <__algorithm/lexicographical_compare.h> #include <__algorithm/lexicographical_compare_three_way.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__config> #include <__functional/binary_function.h> @@ -617,6 +617,9 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20 # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Key, @@ -800,7 +803,7 @@ public: return *this; } - template <class _ValueTp, class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value> > + template <class _ValueTp, __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI __value_type& operator=(_ValueTp&& __v) { __ref() = std::forward<_ValueTp>(__v); return *this; @@ -1173,12 +1176,12 @@ public: return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...); } - template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> > + template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(_Pp&& __p) { return __tree_.__insert_unique(std::forward<_Pp>(__p)); } - template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> > + template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) { return __tree_.__insert_unique(__pos.__i_, std::forward<_Pp>(__p)); } @@ -1522,12 +1525,13 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) { template <class _Key, class _Tp, class _Compare, class _Allocator> _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) { // TODO investigate this clang-tidy warning. - // NOLINTNEXTLINE(bugprone-use-after-move) + // NOLINTBEGIN(bugprone-use-after-move) return __tree_ .__emplace_unique_key_args( __k, std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple()) .first->__get_value() .second; + // NOLINTEND(bugprone-use-after-move) } #else // _LIBCPP_CXX03_LANG @@ -1855,12 +1859,12 @@ public: return __tree_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...); } - template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value>> + template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __p) { return __tree_.__insert_multi(std::forward<_Pp>(__p)); } - template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value>> + template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) { return __tree_.__insert_multi(__pos.__i_, std::forward<_Pp>(__p)); } @@ -2183,6 +2187,8 @@ using multimap _LIBCPP_AVAILABILITY_PMR = _LIBCPP_END_NAMESPACE_STD #endif +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <cstdlib> diff --git a/contrib/libs/cxxsupp/libcxx/include/memory b/contrib/libs/cxxsupp/libcxx/include/memory index 71e8120646..a8c0264eb9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/memory +++ b/contrib/libs/cxxsupp/libcxx/include/memory @@ -88,6 +88,9 @@ struct allocator_traits static pointer allocate(allocator_type& a, size_type n); // constexpr and [[nodiscard]] in C++20 static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint); // constexpr and [[nodiscard]] in C++20 + [[nodiscard]] static constexpr allocation_result<pointer, size_type> + allocate_at_least(Alloc& a, size_type n); // Since C++23 + static void deallocate(allocator_type& a, pointer p, size_type n) noexcept; // constexpr in C++20 template <class T, class... Args> @@ -100,15 +103,11 @@ struct allocator_traits static allocator_type select_on_container_copy_construction(const allocator_type& a); // constexpr in C++20 }; -template<class Pointer> +template<class Pointer, class SizeType = size_t> struct allocation_result { Pointer ptr; - size_t count; -}; // since C++23 - -template<class Allocator> -[[nodiscard]] constexpr allocation_result<typename allocator_traits<Allocator>::pointer> - allocate_at_least(Allocator& a, size_t n); // since C++23 + SizeType count; +}; // Since C++23 template <> class allocator<void> // removed in C++20 @@ -139,7 +138,7 @@ public: template <class U> struct rebind {typedef allocator<U> other;}; // deprecated in C++17, removed in C++20 typedef true_type propagate_on_container_move_assignment; - typedef true_type is_always_equal; + typedef true_type is_always_equal; // Deprecated in C++23, removed in C++26 constexpr allocator() noexcept; // constexpr in C++20 constexpr allocator(const allocator&) noexcept; // constexpr in C++20 @@ -629,7 +628,7 @@ public: T& operator*() const noexcept; T* operator->() const noexcept; long use_count() const noexcept; - bool unique() const noexcept; + bool unique() const noexcept; // deprected in C++17, removed in C++20 explicit operator bool() const noexcept; template<class U> bool owner_before(shared_ptr<U> const& b) const noexcept; template<class U> bool owner_before(weak_ptr<U> const& b) const noexcept; @@ -918,7 +917,6 @@ template<size_t N, class T> // clang-format on -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__memory/addressof.h> #include <__memory/align.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/module.modulemap.in b/contrib/libs/cxxsupp/libcxx/include/module.modulemap index 5f57a8a2b1..b247f97c18 100644 --- a/contrib/libs/cxxsupp/libcxx/include/module.modulemap.in +++ b/contrib/libs/cxxsupp/libcxx/include/module.modulemap @@ -530,10 +530,8 @@ module std_experimental [system] { export * } module simd { - module abi_tag { private header "experimental/__simd/abi_tag.h" } module aligned_tag { private header "experimental/__simd/aligned_tag.h" } module declaration { private header "experimental/__simd/declaration.h" } - module internal_declaration { private header "experimental/__simd/internal_declaration.h" } module reference { private header "experimental/__simd/reference.h" } module scalar { private header "experimental/__simd/scalar.h" } module simd { private header "experimental/__simd/simd.h" } @@ -557,11 +555,6 @@ module std_experimental [system] { textual header "experimental/__config" export * } - // FIXME these should be private - module __memory { - header "experimental/__memory" - export * - } } // Convenience method to get all of the above modules in a single import statement. @@ -616,10 +609,6 @@ module std_private_std_mbstate_t [system] { header "__std_mbstate_t.h" export * } -module std_private_threading_support [system] { - header "__threading_support" - export * -} module std_private_tree [system] { header "__tree" export * @@ -666,6 +655,7 @@ module std_private_algorithm_find_first_of [system module std_private_algorithm_find_if [system] { header "__algorithm/find_if.h" } module std_private_algorithm_find_if_not [system] { header "__algorithm/find_if_not.h" } module std_private_algorithm_find_segment_if [system] { header "__algorithm/find_segment_if.h" } +module std_private_algorithm_fold [system] { header "__algorithm/fold.h" } module std_private_algorithm_for_each [system] { header "__algorithm/for_each.h" } module std_private_algorithm_for_each_n [system] { header "__algorithm/for_each_n.h" } module std_private_algorithm_for_each_segment [system] { header "__algorithm/for_each_segment.h" } @@ -787,6 +777,8 @@ module std_private_algorithm_ranges_clamp [system header "__algorithm/ranges_clamp.h" export std_private_functional_ranges_operations } +module std_private_algorithm_ranges_contains [system] { header "__algorithm/ranges_contains.h" } +module std_private_algorithm_ranges_contains_subrange [system] { header "__algorithm/ranges_contains_subrange.h" } module std_private_algorithm_ranges_copy [system] { header "__algorithm/ranges_copy.h" export std_private_algorithm_in_out_result @@ -1164,6 +1156,12 @@ module std_private_chrono_steady_clock [system] { header "__chrono/steady_clock.h" export std_private_chrono_time_point } +module std_private_chrono_time_zone [system] { + header "__chrono/time_zone.h" +} +module std_private_chrono_time_zone_link [system] { + header "__chrono/time_zone_link.h" +} module std_private_chrono_system_clock [system] { header "__chrono/system_clock.h" export std_private_chrono_time_point @@ -1197,6 +1195,8 @@ module std_private_compare_synth_three_way [system] { header "__c module std_private_compare_three_way_comparable [system] { header "__compare/three_way_comparable.h" } module std_private_compare_weak_order [system] { header "__compare/weak_order.h" } +module std_private_complex_complex_fwd [system] { header "__fwd/complex.h" } + module std_private_concepts_arithmetic [system] { header "__concepts/arithmetic.h" } module std_private_concepts_assignable [system] { header "__concepts/assignable.h" } module std_private_concepts_boolean_testable [system] { header "__concepts/boolean_testable.h" } @@ -1365,7 +1365,7 @@ module std_private_functional_hash [system] { export std_private_type_traits_underlying_type export std_private_utility_pair } -module std_private_functional_hash_fwd [system] { header "__fwd/hash.h" } +module std_private_functional_fwd [system] { header "__fwd/functional.h" } module std_private_functional_identity [system] { header "__functional/identity.h" } module std_private_functional_invoke [system] { header "__functional/invoke.h" @@ -1463,9 +1463,20 @@ module std_private_iterator_sortable [system] { module std_private_iterator_unreachable_sentinel [system] { header "__iterator/unreachable_sentinel.h" } module std_private_iterator_wrap_iter [system] { header "__iterator/wrap_iter.h" } +module std_private_locale_locale_base_api_android [system] { textual header "__locale_dir/locale_base_api/android.h" } module std_private_locale_locale_base_api_bsd_locale_defaults [system] { textual header "__locale_dir/locale_base_api/bsd_locale_defaults.h" } module std_private_locale_locale_base_api_bsd_locale_fallbacks [system] { textual header "__locale_dir/locale_base_api/bsd_locale_fallbacks.h" } +module std_private_locale_locale_base_api_fuchsia [system] { textual header "__locale_dir/locale_base_api/fuchsia.h" } +module std_private_locale_locale_base_api_ibm [system] { textual header "__locale_dir/locale_base_api/ibm.h" } module std_private_locale_locale_base_api_locale_guard [system] { header "__locale_dir/locale_base_api/locale_guard.h" } +module std_private_locale_locale_base_api_musl [system] { textual header "__locale_dir/locale_base_api/musl.h" } +module std_private_locale_locale_base_api_newlib [system] { textual header "__locale_dir/locale_base_api/newlib.h" } +module std_private_locale_locale_base_api_openbsd [system] { textual header "__locale_dir/locale_base_api/openbsd.h" } +module std_private_locale_locale_base_api_win32 [system] { textual header "__locale_dir/locale_base_api/win32.h" } +module std_private_locale_locale_base_api [system] { + header "__locale_dir/locale_base_api.h" + export * +} module std_private_math_abs [system] { header "__math/abs.h" } module std_private_math_copysign [system] { header "__math/copysign.h" } @@ -1580,6 +1591,7 @@ module std_private_numeric_pstl_transform_reduce [system] { export * } module std_private_numeric_reduce [system] { header "__numeric/reduce.h" } +module std_private_numeric_saturation_arithmetic [system] { header "__numeric/saturation_arithmetic.h" } module std_private_numeric_transform_exclusive_scan [system] { header "__numeric/transform_exclusive_scan.h" } module std_private_numeric_transform_inclusive_scan [system] { header "__numeric/transform_inclusive_scan.h" } module std_private_numeric_transform_reduce [system] { header "__numeric/transform_reduce.h" } @@ -1772,6 +1784,14 @@ module std_private_thread_jthread [system] { export * } module std_private_thread_poll_with_backoff [system] { header "__thread/poll_with_backoff.h" } +module std_private_thread_support [system] { + header "__thread/support.h" + export * +} +module std_private_thread_support_c11 [system] { textual header "__thread/support/c11.h" } +module std_private_thread_support_external [system] { textual header "__thread/support/external.h" } +module std_private_thread_support_pthread [system] { textual header "__thread/support/pthread.h" } +module std_private_thread_support_windows [system] { textual header "__thread/support/windows.h" } module std_private_thread_this_thread [system] { header "__thread/this_thread.h" } module std_private_thread_thread [system] { header "__thread/thread.h" @@ -1779,7 +1799,6 @@ module std_private_thread_thread [system] { } module std_private_thread_timed_backoff_policy [system] { header "__thread/timed_backoff_policy.h" } -module std_private_tuple_get_fwd [system] { header "__fwd/get.h" } module std_private_tuple_make_tuple_types [system] { header "__tuple/make_tuple_types.h" } module std_private_tuple_pair_like [system] { header "__tuple/pair_like.h" @@ -1914,7 +1933,10 @@ module std_private_type_traits_is_nothrow_constructible [system module std_private_type_traits_is_nothrow_convertible [system] { header "__type_traits/is_nothrow_convertible.h" } module std_private_type_traits_is_nothrow_copy_assignable [system] { header "__type_traits/is_nothrow_copy_assignable.h" } module std_private_type_traits_is_nothrow_copy_constructible [system] { header "__type_traits/is_nothrow_copy_constructible.h" } -module std_private_type_traits_is_nothrow_default_constructible [system] { header "__type_traits/is_nothrow_default_constructible.h" } +module std_private_type_traits_is_nothrow_default_constructible [system] { + header "__type_traits/is_nothrow_default_constructible.h" + export std_private_type_traits_integral_constant +} module std_private_type_traits_is_nothrow_destructible [system] { header "__type_traits/is_nothrow_destructible.h" export std_private_type_traits_is_destructible @@ -1970,6 +1992,7 @@ module std_private_type_traits_is_trivially_destructible [system module std_private_type_traits_is_trivially_lexicographically_comparable [system] { header "__type_traits/is_trivially_lexicographically_comparable.h" } module std_private_type_traits_is_trivially_move_assignable [system] { header "__type_traits/is_trivially_move_assignable.h" } module std_private_type_traits_is_trivially_move_constructible [system] { header "__type_traits/is_trivially_move_constructible.h" } +module std_private_type_traits_is_trivially_relocatable [system] { header "__type_traits/is_trivially_relocatable.h" } module std_private_type_traits_is_unbounded_array [system] { header "__type_traits/is_unbounded_array.h" } module std_private_type_traits_is_union [system] { header "__type_traits/is_union.h" } module std_private_type_traits_is_unsigned [system] { header "__type_traits/is_unsigned.h" } diff --git a/contrib/libs/cxxsupp/libcxx/include/mutex b/contrib/libs/cxxsupp/libcxx/include/mutex index a16ef589c6..ea56e30519 100644 --- a/contrib/libs/cxxsupp/libcxx/include/mutex +++ b/contrib/libs/cxxsupp/libcxx/include/mutex @@ -186,7 +186,6 @@ template<class Callable, class ...Args> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__chrono/steady_clock.h> #include <__chrono/time_point.h> #include <__condition_variable/condition_variable.h> @@ -198,7 +197,7 @@ template<class Callable, class ...Args> #include <__mutex/tag_types.h> #include <__mutex/unique_lock.h> #include <__thread/id.h> -#include <__threading_support> +#include <__thread/support.h> #include <__utility/forward.h> #include <cstddef> #include <limits> diff --git a/contrib/libs/cxxsupp/libcxx/include/new b/contrib/libs/cxxsupp/libcxx/include/new index 136adc41c2..988f7a8442 100644 --- a/contrib/libs/cxxsupp/libcxx/include/new +++ b/contrib/libs/cxxsupp/libcxx/include/new @@ -86,13 +86,13 @@ void operator delete[](void* ptr, void*) noexcept; */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__exception/exception.h> #include <__type_traits/is_function.h> #include <__type_traits/is_same.h> #include <__type_traits/remove_cv.h> +#include <__verbose_abort> #include <cstddef> #include <version> @@ -362,7 +362,6 @@ _LIBCPP_END_NAMESPACE_STD #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <cstdlib> -# include <exception> # include <type_traits> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/numbers b/contrib/libs/cxxsupp/libcxx/include/numbers index 0d834c6b86..f48ba4baf3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/numbers +++ b/contrib/libs/cxxsupp/libcxx/include/numbers @@ -58,7 +58,6 @@ namespace std::numbers { } */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__concepts/arithmetic.h> #include <__config> #include <version> diff --git a/contrib/libs/cxxsupp/libcxx/include/numeric b/contrib/libs/cxxsupp/libcxx/include/numeric index d09d0a81fc..8b429fa2f7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/numeric +++ b/contrib/libs/cxxsupp/libcxx/include/numeric @@ -140,11 +140,22 @@ template<class T> template<class T> constexpr T* midpoint(T* a, T* b); // C++20 +// [numeric.sat], saturation arithmetic +template<class T> +constexpr T add_sat(T x, T y) noexcept; // freestanding, Since C++26 +template<class T> +constexpr T sub_sat(T x, T y) noexcept; // freestanding, Since C++26 +template<class T> +constexpr T mul_sat(T x, T y) noexcept; // freestanding, Since C++26 +template<class T> +constexpr T div_sat(T x, T y) noexcept; // freestanding, Since C++26 +template<class T, class U> +constexpr T saturate_cast(U x) noexcept; // freestanding, Since C++26 + } // std */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <version> @@ -160,6 +171,7 @@ template<class T> #include <__numeric/pstl_reduce.h> #include <__numeric/pstl_transform_reduce.h> #include <__numeric/reduce.h> +#include <__numeric/saturation_arithmetic.h> #include <__numeric/transform_exclusive_scan.h> #include <__numeric/transform_inclusive_scan.h> #include <__numeric/transform_reduce.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/optional b/contrib/libs/cxxsupp/libcxx/include/optional index cfc6be6ccd..71ccbea6ec 100644 --- a/contrib/libs/cxxsupp/libcxx/include/optional +++ b/contrib/libs/cxxsupp/libcxx/include/optional @@ -177,7 +177,7 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__compare/compare_three_way_result.h> #include <__compare/three_way_comparable.h> @@ -186,8 +186,8 @@ namespace std { #include <__exception/exception.h> #include <__functional/hash.h> #include <__functional/invoke.h> -#include <__functional/reference_wrapper.h> #include <__functional/unary_function.h> +#include <__fwd/functional.h> #include <__memory/addressof.h> #include <__memory/construct_at.h> #include <__tuple/sfinae_helpers.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/ostream b/contrib/libs/cxxsupp/libcxx/include/ostream index 90ff8ca9bb..51778a2286 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ostream +++ b/contrib/libs/cxxsupp/libcxx/include/ostream @@ -159,11 +159,19 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons template<class traits> basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, const char32_t*) = delete; // since C++20 +// [ostream.formatted.print], print functions +template<class... Args> // since C++23 + void print(ostream& os, format_string<Args...> fmt, Args&&... args); +template<class... Args> // since C++23 + void println(ostream& os, format_string<Args...> fmt, Args&&... args); + +void vprint_unicode(ostream& os, string_view fmt, format_args args); // since C++23 +void vprint_nonunicode(ostream& os, string_view fmt, format_args args); // since C++23 } // std */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__availability> #include <__config> #include <__exception/operations.h> #include <__fwd/ostream.h> @@ -176,16 +184,23 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons #include <__type_traits/void_t.h> #include <__utility/declval.h> #include <bitset> +#include <cstdio> +#include <format> #include <ios> #include <locale> #include <new> +#include <print> #include <streambuf> +#include <string_view> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _CharT, class _Traits> @@ -1005,8 +1020,155 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>; #endif +#if _LIBCPP_STD_VER >= 23 + +template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). +_LIBCPP_HIDE_FROM_ABI inline void +__vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) { + // [ostream.formatted.print]/3 + // Effects: Behaves as a formatted output function + // ([ostream.formatted.reqmts]) of os, except that: + // - failure to generate output is reported as specified below, and + // - any exception thrown by the call to vformat is propagated without regard + // to the value of os.exceptions() and without turning on ios_base::badbit + // in the error state of os. + // After constructing a sentry object, the function initializes an automatic + // variable via + // string out = vformat(os.getloc(), fmt, args); + + ostream::sentry __s(__os); + if (__s) { + string __o = std::vformat(__os.getloc(), __fmt, __args); + if (__write_nl) + __o += '\n'; + + const char* __str = __o.data(); + size_t __len = __o.size(); + +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS + try { +# endif // _LIBCPP_HAS_NO_EXCEPTIONS + typedef ostreambuf_iterator<char> _Ip; + if (std::__pad_and_output( + _Ip(__os), + __str, + (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str, + __str + __len, + __os, + __os.fill()) + .failed()) + __os.setstate(ios_base::badbit | ios_base::failbit); + +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS + } catch (...) { + __os.__set_badbit_and_consider_rethrow(); + } +# endif // _LIBCPP_HAS_NO_EXCEPTIONS + } +} + +template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). +_LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args) { + std::__vprint_nonunicode(__os, __fmt, __args, false); +} + +// Returns the FILE* associated with the __os. +// Returns a nullptr when no FILE* is associated with __os. +// This function is in the dylib since the type of the buffer associated +// with std::cout, std::cerr, and std::clog is only known in the dylib. +// +// This function implements part of the implementation-defined behavior +// of [ostream.formatted.print]/3 +// If the function is vprint_unicode and os is a stream that refers to +// a terminal capable of displaying Unicode which is determined in an +// implementation-defined manner, writes out to the terminal using the +// native Unicode API; +// Whether the returned FILE* is "a terminal capable of displaying Unicode" +// is determined in the same way as the print(FILE*, ...) overloads. +_LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os); + +# ifndef _LIBCPP_HAS_NO_UNICODE +template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). +_LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) { +# if _LIBCPP_AVAILABILITY_HAS_PRINT == 0 + return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl); +# else + FILE* __file = std::__get_ostream_file(__os); + if (!__file || !__print::__is_terminal(__file)) + return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl); + + // [ostream.formatted.print]/3 + // If the function is vprint_unicode and os is a stream that refers to a + // terminal capable of displaying Unicode which is determined in an + // implementation-defined manner, writes out to the terminal using the + // native Unicode API; if out contains invalid code units, the behavior is + // undefined and implementations are encouraged to diagnose it. If the + // native Unicode API is used, the function flushes os before writing out. + // + // This is the path for the native API, start with flushing. + __os.flush(); + +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS + try { +# endif // _LIBCPP_HAS_NO_EXCEPTIONS + ostream::sentry __s(__os); + if (__s) { +# ifndef _LIBCPP_WIN32API + __print::__vprint_unicode_posix(__file, __fmt, __args, __write_nl, true); +# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) + __print::__vprint_unicode_windows(__file, __fmt, __args, __write_nl, true); +# else +# error "Windows builds with wchar_t disabled are not supported." +# endif + } + +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS + } catch (...) { + __os.__set_badbit_and_consider_rethrow(); + } +# endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_AVAILABILITY_HAS_PRINT +} + +template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). +_LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(ostream& __os, string_view __fmt, format_args __args) { + std::__vprint_unicode(__os, __fmt, __args, false); +} +# endif // _LIBCPP_HAS_NO_UNICODE + +template <class... _Args> +_LIBCPP_HIDE_FROM_ABI void print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { +# ifndef _LIBCPP_HAS_NO_UNICODE + if constexpr (__print::__use_unicode_execution_charset) + std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), false); + else + std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false); +# else // _LIBCPP_HAS_NO_UNICODE + std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false); +# endif // _LIBCPP_HAS_NO_UNICODE +} + +template <class... _Args> +_LIBCPP_HIDE_FROM_ABI void println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { +# ifndef _LIBCPP_HAS_NO_UNICODE + // Note the wording in the Standard is inefficient. The output of + // std::format is a std::string which is then copied. This solution + // just appends a newline at the end of the output. + if constexpr (__print::__use_unicode_execution_charset) + std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), true); + else + std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true); +# else // _LIBCPP_HAS_NO_UNICODE + std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true); +# endif // _LIBCPP_HAS_NO_UNICODE +} + +#endif // _LIBCPP_STD_VER >= 23 + _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> diff --git a/contrib/libs/cxxsupp/libcxx/include/print b/contrib/libs/cxxsupp/libcxx/include/print index d119c8bda7..a9f10433a7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/print +++ b/contrib/libs/cxxsupp/libcxx/include/print @@ -31,35 +31,26 @@ namespace std { } */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> +#include <__availability> #include <__concepts/same_as.h> #include <__config> -#include <__format/buffer.h> -#include <__format/format_arg_store.h> -#include <__format/format_args.h> -#include <__format/format_context.h> -#include <__format/format_error.h> -#include <__format/format_functions.h> -#include <__format/unicode.h> #include <__system_error/system_error.h> #include <__utility/forward.h> #include <cerrno> #include <cstdio> +#include <format> #include <string> #include <string_view> #include <version> -#if __has_include(<unistd.h>) -# include <unistd.h> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD -#ifdef _WIN32 +#ifdef _LIBCPP_WIN32API _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream); # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -74,8 +65,9 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream); // Note the function is only implemented on the Windows platform. _LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view); # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS - -#endif // _WIN32 +#elif __has_include(<unistd.h>) +_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream); +#endif // _LIBCPP_WIN32API #if _LIBCPP_STD_VER >= 23 @@ -122,6 +114,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __encode(_OutIt&, char32_t) = delete; template <class _OutIt> requires __utf16_code_unit<iter_value_t<_OutIt>> _LIBCPP_HIDE_FROM_ABI constexpr void __encode(_OutIt& __out_it, char32_t __value) { + // [print.fun]/7 : "if `out` contains invalid code units, the behavior is undefined and implementations are encouraged + // to diagnose it". _LIBCPP_ASSERT_UNCATEGORIZED(__is_scalar_value(__value), "an invalid unicode scalar value results in invalid UTF-16"); if (__value < 0x10000) { @@ -137,6 +131,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __encode(_OutIt& __out_it, char32_t __value template <class _OutIt> requires __utf32_code_unit<iter_value_t<_OutIt>> _LIBCPP_HIDE_FROM_ABI constexpr void __encode(_OutIt& __out_it, char32_t __value) { + // [print.fun]/7 : "if `out` contains invalid code units, the behavior is undefined and implementations are encouraged + // to diagnose it". _LIBCPP_ASSERT_UNCATEGORIZED(__is_scalar_value(__value), "an invalid unicode scalar value results in invalid UTF-32"); *__out_it++ = __value; } @@ -188,20 +184,26 @@ namespace __print { // # ifdef _LIBCPP_HAS_NO_UNICODE -inline constexpr bool __use_unicode = false; +inline constexpr bool __use_unicode_execution_charset = false; # elif defined(_MSVC_EXECUTION_CHARACTER_SET) // This is the same test MSVC STL uses in their implementation of <print> // See: https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers -inline constexpr bool __use_unicode = _MSVC_EXECUTION_CHARACTER_SET == 65001; +inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTER_SET == 65001; # else -inline constexpr bool __use_unicode = true; +inline constexpr bool __use_unicode_execution_charset = true; # endif -_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal(FILE* __stream) { -# ifdef _WIN32 +_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream) { + // The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change + // the behavior in the test. This is not part of the public API. +# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL + return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream); +# elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0 + return false; +# elif defined(_LIBCPP_WIN32API) return std::__is_windows_terminal(__stream); # elif __has_include(<unistd.h>) - return isatty(fileno(__stream)); + return std::__is_posix_terminal(__stream); # else # error "Provide a way to determine whether a FILE* is a terminal" # endif @@ -210,7 +212,7 @@ _LIBCPP_HIDE_FROM_ABI inline bool __is_terminal(FILE* __stream) { template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). _LIBCPP_HIDE_FROM_ABI inline void __vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl) { - _LIBCPP_ASSERT_UNCATEGORIZED(__stream, "__stream is a valid pointer to an output C stream"); + _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream"); string __str = std::vformat(__fmt, __args); if (__write_nl) __str.push_back('\n'); @@ -271,7 +273,7 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, // the behavior in the test. This is not part of the public API. # ifdef _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION(__stream, __view); -# elif defined(_WIN32) +# elif defined(_LIBCPP_WIN32API) std::__write_to_windows_console(__stream, __view); # else std::__throw_runtime_error("No defintion of _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION and " @@ -286,7 +288,7 @@ __vprint_unicode([[maybe_unused]] FILE* __stream, [[maybe_unused]] string_view __fmt, [[maybe_unused]] format_args __args, [[maybe_unused]] bool __write_nl) { - _LIBCPP_ASSERT_UNCATEGORIZED(__stream, "__stream is a valid pointer to an output C stream"); + _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream"); // [print.fun] // 7 - Effects: If stream refers to a terminal capable of displaying @@ -309,7 +311,7 @@ __vprint_unicode([[maybe_unused]] FILE* __stream, // so there the call can be forwarded to the non_unicode API. On // Windows there is a different API. This API requires transcoding. -# ifndef _WIN32 +# ifndef _LIBCPP_WIN32API __print::__vprint_unicode_posix(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream)); # elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) __print::__vprint_unicode_windows(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream)); @@ -325,7 +327,7 @@ __vprint_unicode([[maybe_unused]] FILE* __stream, template <class... _Args> _LIBCPP_HIDE_FROM_ABI void print(FILE* __stream, format_string<_Args...> __fmt, _Args&&... __args) { # ifndef _LIBCPP_HAS_NO_UNICODE - if constexpr (__print::__use_unicode) + if constexpr (__print::__use_unicode_execution_charset) __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), false); else __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false); @@ -345,7 +347,7 @@ _LIBCPP_HIDE_FROM_ABI void println(FILE* __stream, format_string<_Args...> __fmt // Note the wording in the Standard is inefficient. The output of // std::format is a std::string which is then copied. This solution // just appends a newline at the end of the output. - if constexpr (__print::__use_unicode) + if constexpr (__print::__use_unicode_execution_charset) __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), true); else __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true); diff --git a/contrib/libs/cxxsupp/libcxx/include/queue b/contrib/libs/cxxsupp/libcxx/include/queue index 692e38bb35..521a465713 100644 --- a/contrib/libs/cxxsupp/libcxx/include/queue +++ b/contrib/libs/cxxsupp/libcxx/include/queue @@ -258,7 +258,6 @@ template <class T, class Container, class Compare> #include <__algorithm/pop_heap.h> #include <__algorithm/push_heap.h> #include <__algorithm/ranges_copy.h> -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/operations.h> #include <__iterator/back_insert_iterator.h> @@ -283,6 +282,9 @@ template <class T, class Container, class Compare> # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp, class _Container = deque<_Tp> > @@ -313,7 +315,7 @@ public: _LIBCPP_HIDE_FROM_ABI queue(const queue& __q) : c(__q.c) {} #if _LIBCPP_STD_VER >= 23 - template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>> + template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI queue(_InputIterator __first, _InputIterator __last) : c(__first, __last) {} template <_ContainerCompatibleRange<_Tp> _Range> @@ -321,14 +323,14 @@ public: template <class _InputIterator, class _Alloc, - class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>, - class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>> + __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0, + __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI queue(_InputIterator __first, _InputIterator __second, const _Alloc& __alloc) : c(__first, __second, __alloc) {} template <_ContainerCompatibleRange<_Tp> _Range, class _Alloc, - class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>> + __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI queue(from_range_t, _Range&& __range, const _Alloc& __alloc) : c(from_range, std::forward<_Range>(__range), __alloc) {} @@ -353,28 +355,22 @@ public: #ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI explicit queue(container_type&& __c) : c(std::move(__c)) {} #endif // _LIBCPP_CXX03_LANG - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI explicit queue(const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(__a) {} - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI - queue(const queue& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(__q.c, __a) {} - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI - queue(const container_type& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(__c, __a) {} + + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI explicit queue(const _Alloc& __a) : c(__a) {} + + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI queue(const queue& __q, const _Alloc& __a) : c(__q.c, __a) {} + + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI queue(const container_type& __c, const _Alloc& __a) : c(__c, __a) {} + #ifndef _LIBCPP_CXX03_LANG - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI - queue(container_type&& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(std::move(__c), __a) {} - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI - queue(queue&& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(std::move(__q.c), __a) {} + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI queue(container_type&& __c, const _Alloc& __a) : c(std::move(__c), __a) {} + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI queue(queue&& __q, const _Alloc& __a) : c(std::move(__q.c), __a) {} #endif // _LIBCPP_CXX03_LANG _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); } @@ -444,7 +440,7 @@ queue(_Container, _Alloc) -> queue<typename _Container::value_type, _Container>; #endif #if _LIBCPP_STD_VER >= 23 -template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>> +template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> queue(_InputIterator, _InputIterator) -> queue<__iter_value_type<_InputIterator>>; template <ranges::input_range _Range> @@ -452,14 +448,16 @@ queue(from_range_t, _Range&&) -> queue<ranges::range_value_t<_Range>>; template <class _InputIterator, class _Alloc, - class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>, - class = __enable_if_t<__is_allocator<_Alloc>::value>> -queue(_InputIterator, _InputIterator, _Alloc) - -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>; - -template <ranges::input_range _Range, class _Alloc, class = __enable_if_t<__is_allocator<_Alloc>::value>> -queue(from_range_t, _Range&&, _Alloc) - -> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>; + __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0, + __enable_if_t<__is_allocator<_Alloc>::value, int> = 0> +queue(_InputIterator, + _InputIterator, + _Alloc) -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>; + +template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator<_Alloc>::value, int> = 0> +queue(from_range_t, + _Range&&, + _Alloc) -> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>; #endif template <class _Tp, class _Container> @@ -559,13 +557,15 @@ public: #ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c); #endif - template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> > + template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp = value_compare()); - template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> > + + template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c); + #ifndef _LIBCPP_CXX03_LANG - template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> > + template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c); #endif // _LIBCPP_CXX03_LANG @@ -578,68 +578,56 @@ public: } #endif - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI - priority_queue(const value_compare& __comp, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI - priority_queue(const value_compare& __comp, - const container_type& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI priority_queue( - const priority_queue& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); -#ifndef _LIBCPP_CXX03_LANG - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI - priority_queue(const value_compare& __comp, - container_type&& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - template <class _Alloc> - _LIBCPP_HIDE_FROM_ABI priority_queue( - priority_queue&& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); -#endif // _LIBCPP_CXX03_LANG + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const _Alloc& __a); - template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> > - _LIBCPP_HIDE_FROM_ABI - priority_queue(_InputIter __f, - _InputIter __l, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const _Alloc& __a); - template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> > - _LIBCPP_HIDE_FROM_ABI priority_queue( - _InputIter __f, - _InputIter __l, - const value_compare& __comp, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const container_type& __c, const _Alloc& __a); - template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> > - _LIBCPP_HIDE_FROM_ABI priority_queue( - _InputIter __f, - _InputIter __l, - const value_compare& __comp, - const container_type& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q, const _Alloc& __a); #ifndef _LIBCPP_CXX03_LANG - template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> > + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c, const _Alloc& __a); + + template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q, const _Alloc& __a); +#endif // _LIBCPP_CXX03_LANG + + template < + class _InputIter, + class _Alloc, + __enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value, + int> = 0> + _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a); + + template < + class _InputIter, + class _Alloc, + __enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value, + int> = 0> + _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const _Alloc& __a); + + template < + class _InputIter, + class _Alloc, + __enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI priority_queue( - _InputIter __f, - _InputIter __l, - const value_compare& __comp, - container_type&& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); + _InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c, const _Alloc& __a); + +#ifndef _LIBCPP_CXX03_LANG + template < + class _InputIter, + class _Alloc, + __enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value, + int> = 0> + _LIBCPP_HIDE_FROM_ABI + priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c, const _Alloc& __a); #endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER >= 23 @@ -789,7 +777,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_com #endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class> +template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> > inline priority_queue<_Tp, _Container, _Compare>::priority_queue( _InputIter __f, _InputIter __l, const value_compare& __comp) : c(__f, __l), comp(__comp) { @@ -797,7 +785,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue( } template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class> +template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> > inline priority_queue<_Tp, _Container, _Compare>::priority_queue( _InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c) : c(__c), comp(__comp) { @@ -808,7 +796,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue( #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class> +template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> > inline priority_queue<_Tp, _Container, _Compare>::priority_queue( _InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c) : c(std::move(__c)), comp(__comp) { @@ -819,84 +807,72 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue( #endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(__a) {} +template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> > +inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a) : c(__a) {} template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - const value_compare& __comp, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) +template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> > +inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, const _Alloc& __a) : c(__a), comp(__comp) {} template <class _Tp, class _Container, class _Compare> -template <class _Alloc> +template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> > inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - const value_compare& __comp, - const container_type& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) + const value_compare& __comp, const container_type& __c, const _Alloc& __a) : c(__c, __a), comp(__comp) { std::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - const priority_queue& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) +template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> > +inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q, const _Alloc& __a) : c(__q.c, __a), comp(__q.comp) {} #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> -template <class _Alloc> +template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> > inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - const value_compare& __comp, - container_type&& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) + const value_compare& __comp, container_type&& __c, const _Alloc& __a) : c(std::move(__c), __a), comp(__comp) { std::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - priority_queue&& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) +template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> > +inline priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, const _Alloc& __a) : c(std::move(__q.c), __a), comp(std::move(__q.comp)) {} #endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class _Alloc, class> -inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - _InputIter __f, _InputIter __l, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) +template < + class _InputIter, + class _Alloc, + __enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> > +inline priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a) : c(__f, __l, __a), comp() { std::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class _Alloc, class> +template < + class _InputIter, + class _Alloc, + __enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> > inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - _InputIter __f, - _InputIter __l, - const value_compare& __comp, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) + _InputIter __f, _InputIter __l, const value_compare& __comp, const _Alloc& __a) : c(__f, __l, __a), comp(__comp) { std::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class _Alloc, class> +template < + class _InputIter, + class _Alloc, + __enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> > inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - _InputIter __f, - _InputIter __l, - const value_compare& __comp, - const container_type& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) + _InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c, const _Alloc& __a) : c(__c, __a), comp(__comp) { c.insert(c.end(), __f, __l); std::make_heap(c.begin(), c.end(), comp); @@ -904,14 +880,12 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue( #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class _Alloc, class> +template < + class _InputIter, + class _Alloc, + __enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> > inline priority_queue<_Tp, _Container, _Compare>::priority_queue( - _InputIter __f, - _InputIter __l, - const value_compare& __comp, - container_type&& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) + _InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c, const _Alloc& __a) : c(std::move(__c), __a), comp(__comp) { c.insert(c.end(), __f, __l); std::make_heap(c.begin(), c.end(), comp); @@ -971,6 +945,8 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Comp _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <cstdlib> diff --git a/contrib/libs/cxxsupp/libcxx/include/random b/contrib/libs/cxxsupp/libcxx/include/random index 02d71ad6dd..9edd6c4608 100644 --- a/contrib/libs/cxxsupp/libcxx/include/random +++ b/contrib/libs/cxxsupp/libcxx/include/random @@ -1677,7 +1677,6 @@ class piecewise_linear_distribution } // std */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__random/bernoulli_distribution.h> #include <__random/binomial_distribution.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/ranges b/contrib/libs/cxxsupp/libcxx/include/ranges index 660d533b2a..167d2137ea 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ranges +++ b/contrib/libs/cxxsupp/libcxx/include/ranges @@ -375,7 +375,6 @@ namespace std { } */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__ranges/access.h> #include <__ranges/all.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/ratio b/contrib/libs/cxxsupp/libcxx/include/ratio index 3b11a2aa5b..b989c272aa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ratio +++ b/contrib/libs/cxxsupp/libcxx/include/ratio @@ -81,7 +81,6 @@ using quetta = ratio <1'000'000'000'000'000'000'000'000'000'000, 1>; // Since C+ } */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__type_traits/integral_constant.h> #include <climits> @@ -289,6 +288,9 @@ private: static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value; static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value; + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); + public: typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value, __ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value >::type type; @@ -312,6 +314,9 @@ private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); + public: typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value, __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::type type; @@ -335,6 +340,9 @@ private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); + public: typedef typename ratio_multiply< ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>, @@ -361,6 +369,9 @@ private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); + public: typedef typename ratio_multiply< ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>, @@ -384,10 +395,16 @@ struct _LIBCPP_TEMPLATE_VIS ratio_subtract : public __ratio_subtract<_R1, _R2>:: // ratio_equal template <class _R1, class _R2> -struct _LIBCPP_TEMPLATE_VIS ratio_equal : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_equal : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template <class _R1, class _R2> -struct _LIBCPP_TEMPLATE_VIS ratio_not_equal : _BoolConstant<!ratio_equal<_R1, _R2>::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_not_equal : _BoolConstant<!ratio_equal<_R1, _R2>::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; // ratio_less @@ -441,16 +458,28 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL> { }; template <class _R1, class _R2> -struct _LIBCPP_TEMPLATE_VIS ratio_less : _BoolConstant<__ratio_less<_R1, _R2>::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_less : _BoolConstant<__ratio_less<_R1, _R2>::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template <class _R1, class _R2> -struct _LIBCPP_TEMPLATE_VIS ratio_less_equal : _BoolConstant<!ratio_less<_R2, _R1>::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_less_equal : _BoolConstant<!ratio_less<_R2, _R1>::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template <class _R1, class _R2> -struct _LIBCPP_TEMPLATE_VIS ratio_greater : _BoolConstant<ratio_less<_R2, _R1>::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_greater : _BoolConstant<ratio_less<_R2, _R1>::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template <class _R1, class _R2> -struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal : _BoolConstant<!ratio_less<_R1, _R2>::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal : _BoolConstant<!ratio_less<_R1, _R2>::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template <class _R1, class _R2> struct __ratio_gcd { diff --git a/contrib/libs/cxxsupp/libcxx/include/regex b/contrib/libs/cxxsupp/libcxx/include/regex index 061194cb2e..dc3db93744 100644 --- a/contrib/libs/cxxsupp/libcxx/include/regex +++ b/contrib/libs/cxxsupp/libcxx/include/regex @@ -791,7 +791,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; #include <__algorithm/find.h> #include <__algorithm/search.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__config> #include <__iterator/back_insert_iterator.h> @@ -4587,28 +4587,36 @@ public: // element access: _LIBCPP_HIDE_FROM_ABI difference_type length(size_type __sub = 0) const { - _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::length() called when not ready"); + // If the match results are not ready, this will return `0`. + _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::length() called when not ready"); return (*this)[__sub].length(); } _LIBCPP_HIDE_FROM_ABI difference_type position(size_type __sub = 0) const { - _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::position() called when not ready"); + // If the match results are not ready, this will return the result of subtracting two default-constructed iterators + // (which is typically a well-defined operation). + _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::position() called when not ready"); return std::distance(__position_start_, (*this)[__sub].first); } _LIBCPP_HIDE_FROM_ABI string_type str(size_type __sub = 0) const { - _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::str() called when not ready"); + // If the match results are not ready, this will return an empty string. + _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::str() called when not ready"); return (*this)[__sub].str(); } _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const { - _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::operator[]() called when not ready"); + // If the match results are not ready, this call will be equivalent to calling this function with `__n >= size()`, + // returning an empty subrange. + _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::operator[]() called when not ready"); return __n < __matches_.size() ? __matches_[__n] : __unmatched_; } _LIBCPP_HIDE_FROM_ABI const_reference prefix() const { - _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::prefix() called when not ready"); + // If the match results are not ready, this will return a default-constructed empty `__suffix_`. + _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::prefix() called when not ready"); return __prefix_; } _LIBCPP_HIDE_FROM_ABI const_reference suffix() const { - _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::suffix() called when not ready"); + // If the match results are not ready, this will return a default-constructed empty `__suffix_`. + _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::suffix() called when not ready"); return __suffix_; } @@ -4722,7 +4730,8 @@ _OutputIter match_results<_BidirectionalIterator, _Allocator>::format( const char_type* __fmt_first, const char_type* __fmt_last, regex_constants::match_flag_type __flags) const { - _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::format() called when not ready"); + // Note: this duplicates a check in `vector::operator[]` but provides a better error message. + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(ready(), "match_results::format() called when not ready"); if (__flags & regex_constants::format_sed) { for (; __fmt_first != __fmt_last; ++__fmt_first) { if (*__fmt_first == '&') @@ -5115,6 +5124,14 @@ bool basic_regex<_CharT, _Traits>::__search( } __m.__matches_.assign(__m.size(), __m.__unmatched_); } + __m.__matches_.assign(__m.size(), __m.__unmatched_); + if (__match_at_start(__first, __last, __m, __flags, false)) { + __m.__prefix_.second = __m[0].first; + __m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second; + __m.__suffix_.first = __m[0].second; + __m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second; + return true; + } } __m.__matches_.clear(); return false; diff --git a/contrib/libs/cxxsupp/libcxx/include/scoped_allocator b/contrib/libs/cxxsupp/libcxx/include/scoped_allocator index 6078906e92..c53261025b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/scoped_allocator +++ b/contrib/libs/cxxsupp/libcxx/include/scoped_allocator @@ -109,7 +109,6 @@ template <class OuterA1, class OuterA2, class... InnerAllocs> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__memory/allocator_traits.h> #include <__memory/uses_allocator_construction.h> @@ -334,12 +333,12 @@ struct __outermost<_Alloc, true> { template <class _OuterAlloc, class... _InnerAllocs> class _LIBCPP_TEMPLATE_VIS scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...> : public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> { - typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base; + typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> _Base; typedef allocator_traits<_OuterAlloc> _OuterTraits; public: typedef _OuterAlloc outer_allocator_type; - typedef typename base::inner_allocator_type inner_allocator_type; + typedef typename _Base::inner_allocator_type inner_allocator_type; typedef typename _OuterTraits::size_type size_type; typedef typename _OuterTraits::difference_type difference_type; typedef typename _OuterTraits::pointer pointer; @@ -365,29 +364,29 @@ public: template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor(_OuterA2&& __outer_alloc, const _InnerAllocs&... __inner_allocs) _NOEXCEPT - : base(std::forward<_OuterA2>(__outer_alloc), __inner_allocs...) {} + : _Base(std::forward<_OuterA2>(__outer_alloc), __inner_allocs...) {} // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default; template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor(const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT - : base(__other) {} + : _Base(__other) {} template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor(scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT - : base(std::move(__other)) {} + : _Base(std::move(__other)) {} // scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default; // scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default; // ~scoped_allocator_adaptor() = default; - _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT { return base::inner_allocator(); } + _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT { return _Base::inner_allocator(); } _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT { - return base::inner_allocator(); + return _Base::inner_allocator(); } - _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT { return base::outer_allocator(); } + _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT { return _Base::outer_allocator(); } _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT { - return base::outer_allocator(); + return _Base::outer_allocator(); } _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n) { @@ -472,13 +471,12 @@ public: } _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT { - return base::select_on_container_copy_construction(); + return _Base::select_on_container_copy_construction(); } private: - template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor(_OuterA2&& __o, const inner_allocator_type& __i) _NOEXCEPT - : base(std::forward<_OuterA2>(__o), __i) {} + _LIBCPP_HIDE_FROM_ABI explicit scoped_allocator_adaptor( + outer_allocator_type&& __o, inner_allocator_type&& __i) _NOEXCEPT : _Base(std::move(__o), std::move(__i)) {} template <class _Tp, class... _Args> _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 0>, _Tp* __p, _Args&&... __args) { diff --git a/contrib/libs/cxxsupp/libcxx/include/semaphore b/contrib/libs/cxxsupp/libcxx/include/semaphore index de45b8b5db..1375ec3f7c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/semaphore +++ b/contrib/libs/cxxsupp/libcxx/include/semaphore @@ -45,16 +45,21 @@ using binary_semaphore = counting_semaphore<1>; */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__config> + +#ifdef _LIBCPP_HAS_NO_THREADS +# error "<semaphore> is not supported since libc++ has been configured without support for threads." +#endif + +#include <__assert> #include <__atomic/atomic_base.h> #include <__atomic/atomic_sync.h> #include <__atomic/memory_order.h> #include <__availability> #include <__chrono/time_point.h> -#include <__config> #include <__thread/poll_with_backoff.h> +#include <__thread/support.h> #include <__thread/timed_backoff_policy.h> -#include <__threading_support> #include <cstddef> #include <limits> #include <version> @@ -63,10 +68,6 @@ using binary_semaphore = counting_semaphore<1>; # pragma GCC system_header #endif -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<semaphore> is not supported since libc++ has been configured without support for threads." -#endif - _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -91,37 +92,35 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count) {} _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) { auto __old = __a_.fetch_add(__update, memory_order_release); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __update <= _LIBCPP_SEMAPHORE_MAX - __old, "update is greater than the expected value"); - - if (__old > 0) { - // Nothing to do - } else if (__update > 1) + if (__old == 0) { __a_.notify_all(); - else - __a_.notify_one(); + } } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() { - auto const __test_fn = [this]() -> bool { - auto __old = __a_.load(memory_order_relaxed); - return (__old != 0) && __a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed); - }; - __cxx_atomic_wait(&__a_.__a_, __test_fn); + std::__atomic_wait_unless( + __a_, [this](ptrdiff_t& __old) { return __try_acquire_impl(__old); }, memory_order_relaxed); } template <class _Rep, class _Period> _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) { if (__rel_time == chrono::duration<_Rep, _Period>::zero()) return try_acquire(); - auto const __test_fn = [this]() { return try_acquire(); }; - return std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time); + auto const __poll_fn = [this]() { return try_acquire(); }; + return std::__libcpp_thread_poll_with_backoff(__poll_fn, __libcpp_timed_backoff_policy(), __rel_time); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire() { - auto __old = __a_.load(memory_order_acquire); + auto __old = __a_.load(memory_order_relaxed); + return __try_acquire_impl(__old); + } + +private: + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __try_acquire_impl(ptrdiff_t& __old) { while (true) { if (__old == 0) return false; - if (__a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed)) + if (__a_.compare_exchange_weak(__old, __old - 1, memory_order_acquire, memory_order_relaxed)) return true; } } @@ -137,11 +136,11 @@ public: static constexpr ptrdiff_t max() noexcept { return __least_max_value; } _LIBCPP_HIDE_FROM_ABI constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __count >= 0, "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be " "initialized with a negative value"); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __count <= max(), "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be " "initialized with a value greater than max()"); @@ -152,7 +151,7 @@ public: counting_semaphore& operator=(const counting_semaphore&) = delete; _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) { - _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "counting_semaphore:release called with a negative value"); + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "counting_semaphore:release called with a negative value"); __semaphore_.release(__update); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() { __semaphore_.acquire(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/set b/contrib/libs/cxxsupp/libcxx/include/set index 758df59af1..90a22c61d0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/set +++ b/contrib/libs/cxxsupp/libcxx/include/set @@ -515,7 +515,7 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 #include <__algorithm/equal.h> #include <__algorithm/lexicographical_compare.h> #include <__algorithm/lexicographical_compare_three_way.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__config> #include <__functional/is_transparent.h> @@ -552,6 +552,9 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Key, class _Compare, class _Allocator> @@ -770,13 +773,13 @@ public: #if _LIBCPP_STD_VER >= 17 _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) { - _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to set::insert()"); + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), + "node_type with incompatible allocator passed to set::insert()"); return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh)); } _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) { - _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to set::insert()"); + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), + "node_type with incompatible allocator passed to set::insert()"); return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh)); } _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) { @@ -787,25 +790,25 @@ public: } template <class _Compare2> _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } template <class _Compare2> _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } template <class _Compare2> _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } template <class _Compare2> _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } @@ -1229,13 +1232,13 @@ public: #if _LIBCPP_STD_VER >= 17 _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) { - _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to multiset::insert()"); + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), + "node_type with incompatible allocator passed to multiset::insert()"); return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh)); } _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) { - _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to multiset::insert()"); + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), + "node_type with incompatible allocator passed to multiset::insert()"); return __tree_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh)); } _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) { @@ -1246,25 +1249,25 @@ public: } template <class _Compare2> _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } template <class _Compare2> _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } template <class _Compare2> _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } template <class _Compare2> _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) { - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } @@ -1490,6 +1493,8 @@ using multiset _LIBCPP_AVAILABILITY_PMR = std::multiset<_KeyT, _CompareT, polymo _LIBCPP_END_NAMESPACE_STD #endif +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <cstdlib> diff --git a/contrib/libs/cxxsupp/libcxx/include/shared_mutex b/contrib/libs/cxxsupp/libcxx/include/shared_mutex index 1528d108d7..38b559e893 100644 --- a/contrib/libs/cxxsupp/libcxx/include/shared_mutex +++ b/contrib/libs/cxxsupp/libcxx/include/shared_mutex @@ -122,13 +122,17 @@ template <class Mutex> */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__config> + +#ifdef _LIBCPP_HAS_NO_THREADS +# error "<shared_mutex> is not supported since libc++ has been configured without support for threads." +#endif + #include <__availability> #include <__chrono/duration.h> #include <__chrono/steady_clock.h> #include <__chrono/time_point.h> #include <__condition_variable/condition_variable.h> -#include <__config> #include <__memory/addressof.h> #include <__mutex/mutex.h> #include <__mutex/tag_types.h> @@ -147,10 +151,6 @@ _LIBCPP_PUSH_MACROS # pragma GCC system_header # endif -# ifdef _LIBCPP_HAS_NO_THREADS -# error "<shared_mutex> is not supported since libc++ has been configured without support for threads." -# endif - _LIBCPP_BEGIN_NAMESPACE_STD struct _LIBCPP_EXPORTED_FROM_ABI __shared_mutex_base { diff --git a/contrib/libs/cxxsupp/libcxx/include/span b/contrib/libs/cxxsupp/libcxx/include/span index 7dd53110ac..9efaac517f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/span +++ b/contrib/libs/cxxsupp/libcxx/include/span @@ -68,6 +68,7 @@ public: constexpr span(const array<value_type, N>& arr) noexcept; template<class R> constexpr explicit(Extent != dynamic_extent) span(R&& r); + constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il); // Since C++26 constexpr span(const span& other) noexcept = default; template <class OtherElementType, size_t OtherExtent> constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) noexcept; @@ -92,6 +93,7 @@ public: // [span.elem], span element access constexpr reference operator[](size_type idx) const; + constexpr reference at(size_type idx) const; // since C++26 constexpr reference front() const; constexpr reference back() const; constexpr pointer data() const noexcept; @@ -126,7 +128,7 @@ template<class R> */ -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__config> #include <__fwd/span.h> #include <__iterator/bounded_iter.h> @@ -146,6 +148,7 @@ template<class R> #include <__utility/forward.h> #include <array> // for array #include <cstddef> // for byte +#include <stdexcept> #include <version> // standard-mandated includes @@ -226,6 +229,15 @@ public: requires(_Sz == 0) _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {} +# if _LIBCPP_STD_VER >= 26 + _LIBCPP_HIDE_FROM_ABI constexpr explicit span(std::initializer_list<value_type> __il) + requires is_const_v<element_type> + : __data_{__il.begin()} { + _LIBCPP_ASSERT_VALID_INPUT_RANGE( + _Extent == __il.size(), "Size mismatch in span's constructor _Extent != __il.size()."); + } +# endif + constexpr span(const span&) noexcept = default; constexpr span& operator=(const span&) noexcept = default; @@ -321,6 +333,14 @@ public: return __data_[__idx]; } +# if _LIBCPP_STD_VER >= 26 + _LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __index) const { + if (__index >= size()) + std::__throw_out_of_range("span"); + return __data_[__index]; + } +# endif + _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::front() on empty span"); return __data_[0]; @@ -387,6 +407,12 @@ public: // [span.cons], span constructors, copy, assignment, and destructor _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {} +# if _LIBCPP_STD_VER >= 26 + _LIBCPP_HIDE_FROM_ABI constexpr span(std::initializer_list<value_type> __il) + requires is_const_v<element_type> + : __data_{__il.begin()}, __size_{__il.size()} {} +# endif + constexpr span(const span&) noexcept = default; constexpr span& operator=(const span&) noexcept = default; @@ -469,6 +495,14 @@ public: return __data_[__idx]; } +# if _LIBCPP_STD_VER >= 26 + _LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __index) const { + if (__index >= size()) + std::__throw_out_of_range("span"); + return __data_[__index]; + } +# endif + _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::front() on empty span"); return __data_[0]; diff --git a/contrib/libs/cxxsupp/libcxx/include/sstream b/contrib/libs/cxxsupp/libcxx/include/sstream index bd5cea9a5e..5873deb831 100644 --- a/contrib/libs/cxxsupp/libcxx/include/sstream +++ b/contrib/libs/cxxsupp/libcxx/include/sstream @@ -48,10 +48,19 @@ public: template <class SAlloc> explicit basic_stringbuf(const basic_string<char_type, traits_type, SAlloc>& s, ios_base::openmode which = ios_base::in | ios_base::out); // C++20 + template<class T> + explicit basic_stringbuf(const T& t, + ios_base::openmode which = ios_base::in | ios_base::out); // Since C++26 + template<class T> + basic_stringbuf(const T& t, const Allocator& a); // Since C++26 + template<class T> + basic_stringbuf(const T& t, ios_base::openmode which, const Allocator& a); // Since C++26 + basic_stringbuf(const basic_stringbuf&) = delete; basic_stringbuf(basic_stringbuf&& rhs); basic_stringbuf(basic_stringbuf&& rhs, const allocator_type& a); // C++20 // [stringbuf.assign] Assign and swap: + basic_stringbuf& operator=(const basic_stringbuf&) = delete; basic_stringbuf& operator=(basic_stringbuf&& rhs); void swap(basic_stringbuf& rhs) noexcept(see below); // conditionally noexcept since C++20 @@ -67,6 +76,8 @@ public: template <class SAlloc> void str(const basic_string<char_type, traits_type, SAlloc>& s); // C++20 void str(basic_string<char_type, traits_type, allocator_type>&& s); // C++20 + template<class T> + void str(const T& t); // Since C++26 protected: // [stringbuf.virtuals] Overridden virtual functions: @@ -119,9 +130,17 @@ public: template <class SAlloc> explicit basic_istringstream(const basic_string<char_type, traits_type, SAlloc>& s, ios_base::openmode which = ios_base::in); // C++20 + template<class T> + explicit basic_istringstream(const T& t, ios_base::openmode which = ios_base::in); // Since C++26 + template<class T> + basic_istringstream(const T& t, const Allocator& a); // Since C++26 + template<class T> + basic_istringstream(const T& t, ios_base::openmode which, const Allocator& a); // Since C++26 + basic_istringstream(const basic_istringstream&) = delete; basic_istringstream(basic_istringstream&& rhs); // [istringstream.assign] Assign and swap: + basic_istringstream& operator=(const basic_istringstream&) = delete; basic_istringstream& operator=(basic_istringstream&& rhs); void swap(basic_istringstream& rhs); @@ -137,6 +156,8 @@ public: template <class SAlloc> void str(const basic_string<char_type, traits_type, SAlloc>& s); // C++20 void str(basic_string<char_type, traits_type, allocator_type>&& s); // C++20 + template<class T> + void str(const T& t); // Since C++26 }; template <class charT, class traits, class Allocator> @@ -178,9 +199,17 @@ public: template <class SAlloc> explicit basic_ostringstream(const basic_string<char_type, traits_type, SAlloc>& s, ios_base::openmode which = ios_base::out); // C++20 + template<class T> + explicit basic_ostringstream(const T& t, ios_base::openmode which = ios_base::out); // Since C++26 + template<class T> + basic_ostringstream(const T& t, const Allocator& a); // Since C++26 + template<class T> + basic_ostringstream(const T& t, ios_base::openmode which, const Allocator& a); // Since C++26 + basic_ostringstream(const basic_ostringstream&) = delete; basic_ostringstream(basic_ostringstream&& rhs); // [ostringstream.assign] Assign and swap: + basic_ostringstream& operator=(const basic_ostringstream&) = delete; basic_ostringstream& operator=(basic_ostringstream&& rhs); void swap(basic_ostringstream& rhs); @@ -196,6 +225,8 @@ public: template <class SAlloc> void str(const basic_string<char_type, traits_type, SAlloc>& s); // C++20 void str(basic_string<char_type, traits_type, allocator_type>&& s); // C++20 + template<class T> + void str(const T& t); // Since C++26 }; template <class charT, class traits, class Allocator> @@ -237,9 +268,18 @@ public: template <class SAlloc> explicit basic_stringstream(const basic_string<char_type, traits_type, SAlloc>& s, ios_base::openmode which = ios_base::out | ios_base::in); // C++20 + template<class T> + explicit basic_stringstream(const T& t, + ios_base::openmode which = ios_base::out | ios_base::in); // Since C++26 + template<class T> + basic_stringstream(const T& t, const Allocator& a); // Since C++26 + template<class T> + basic_stringstream(const T& t, ios_base::openmode which, const Allocator& a); // Since C++26 + basic_stringstream(const basic_stringstream&) = delete; basic_stringstream(basic_stringstream&& rhs); // [stringstream.assign] Assign and swap: + basic_stringstream& operator=(const basic_stringstream&) = delete; basic_stringstream& operator=(basic_stringstream&& rhs); void swap(basic_stringstream& rhs); @@ -255,6 +295,8 @@ public: template <class SAlloc> void str(const basic_string<char_type, traits_type, SAlloc>& s); // C++20 void str(basic_string<char_type, traits_type, allocator_type>&& s); // C++20 + template<class T> + void str(const T& t); // Since C++26 }; template <class charT, class traits, class Allocator> @@ -270,14 +312,15 @@ typedef basic_stringstream<wchar_t> wstringstream; // clang-format on -#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__fwd/sstream.h> +#include <__type_traits/is_convertible.h> #include <__utility/swap.h> #include <istream> #include <ostream> #include <string> +#include <string_view> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -364,6 +407,31 @@ public: } #endif // _LIBCPP_STD_VER >= 20 +#if _LIBCPP_STD_VER >= 26 + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const _Tp& __t, + ios_base::openmode __which = ios_base::in | ios_base::out) + : basic_stringbuf(__t, __which, _Allocator()) {} + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI basic_stringbuf(const _Tp& __t, const _Allocator& __a) + : basic_stringbuf(__t, ios_base::in | ios_base::out, __a) {} + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI basic_stringbuf(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a) + : __hm_(nullptr), __mode_(__which) { + basic_string_view<_CharT, _Traits> __sv = __t; + __str_ = string_type(__sv, __a); + __init_buf_ptrs(); + } + +#endif // _LIBCPP_STD_VER >= 26 + + basic_stringbuf(const basic_stringbuf&) = delete; basic_stringbuf(basic_stringbuf&& __rhs) : __mode_(__rhs.__mode_) { __move_init(std::move(__rhs)); } #if _LIBCPP_STD_VER >= 20 @@ -374,6 +442,7 @@ public: #endif // [stringbuf.assign] Assign and swap: + basic_stringbuf& operator=(const basic_stringbuf&) = delete; basic_stringbuf& operator=(basic_stringbuf&& __rhs); void swap(basic_stringbuf& __rhs) #if _LIBCPP_STD_VER >= 20 @@ -398,9 +467,9 @@ public: typename string_type::size_type __pos = __view.empty() ? 0 : __view.data() - __str_.data(); // In C++23, this is just string_type(std::move(__str_), __pos, __view.size(), __str_.get_allocator()); // But we need something that works in C++20 also. - string_type __result(__str_.get_allocator()); - __result.__move_assign(std::move(__str_), __pos, __view.size()); - __str_.clear(); + string_type __result(std::move(__str_), __str_.get_allocator()); + __result.resize(__pos + __view.size()); + __result.erase(0, __pos); __init_buf_ptrs(); return __result; } @@ -435,6 +504,18 @@ public: } #endif // _LIBCPP_STD_VER >= 20 +#if _LIBCPP_STD_VER >= 26 + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) { + basic_string_view<_CharT, _Traits> __sv = __t; + __str_ = __sv; + __init_buf_ptrs(); + } + +#endif // _LIBCPP_STD_VER >= 26 + protected: // [stringbuf.virtuals] Overridden virtual functions: int_type underflow() override; @@ -822,12 +903,33 @@ public: : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in) {} #endif // _LIBCPP_STD_VER >= 20 +#if _LIBCPP_STD_VER >= 26 + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const _Tp& __t, ios_base::openmode __which = ios_base::in) + : basic_istringstream(__t, __which, _Allocator()) {} + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI basic_istringstream(const _Tp& __t, const _Allocator& __a) + : basic_istringstream(__t, ios_base::in, __a) {} + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI basic_istringstream(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a) + : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__t, __which | ios_base::in, __a) {} + +#endif // _LIBCPP_STD_VER >= 26 + + basic_istringstream(const basic_istringstream&) = delete; _LIBCPP_HIDE_FROM_ABI basic_istringstream(basic_istringstream&& __rhs) : basic_istream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) { basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); } // [istringstream.assign] Assign and swap: + basic_istringstream& operator=(const basic_istringstream&) = delete; basic_istringstream& operator=(basic_istringstream&& __rhs) { basic_istream<char_type, traits_type>::operator=(std::move(__rhs)); __sb_ = std::move(__rhs.__sb_); @@ -871,6 +973,14 @@ public: _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); } #endif // _LIBCPP_STD_VER >= 20 + +#if _LIBCPP_STD_VER >= 26 + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) { + rdbuf()->str(__t); + } +#endif // _LIBCPP_STD_VER >= 26 }; template <class _CharT, class _Traits, class _Allocator> @@ -929,12 +1039,33 @@ public: : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out) {} #endif // _LIBCPP_STD_VER >= 20 +#if _LIBCPP_STD_VER >= 26 + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const _Tp& __t, ios_base::openmode __which = ios_base::out) + : basic_ostringstream(__t, __which | ios_base::out, _Allocator()) {} + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI basic_ostringstream(const _Tp& __t, const _Allocator& __a) + : basic_ostringstream(__t, ios_base::out, __a) {} + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI basic_ostringstream(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a) + : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__t, __which | ios_base::out, __a) {} + +#endif // _LIBCPP_STD_VER >= 26 + + basic_ostringstream(const basic_ostringstream&) = delete; _LIBCPP_HIDE_FROM_ABI basic_ostringstream(basic_ostringstream&& __rhs) : basic_ostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) { basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); } // [ostringstream.assign] Assign and swap: + basic_ostringstream& operator=(const basic_ostringstream&) = delete; basic_ostringstream& operator=(basic_ostringstream&& __rhs) { basic_ostream<char_type, traits_type>::operator=(std::move(__rhs)); __sb_ = std::move(__rhs.__sb_); @@ -979,6 +1110,14 @@ public: _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); } #endif // _LIBCPP_STD_VER >= 20 + +#if _LIBCPP_STD_VER >= 26 + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) { + rdbuf()->str(__t); + } +#endif // _LIBCPP_STD_VER >= 26 }; template <class _CharT, class _Traits, class _Allocator> @@ -1040,12 +1179,34 @@ public: : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch) {} #endif // _LIBCPP_STD_VER >= 20 +#if _LIBCPP_STD_VER >= 26 + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const _Tp& __t, + ios_base::openmode __which = ios_base::out | ios_base::in) + : basic_stringstream(__t, __which, _Allocator()) {} + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI basic_stringstream(const _Tp& __t, const _Allocator& __a) + : basic_stringstream(__t, ios_base::out | ios_base::in, __a) {} + + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI basic_stringstream(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a) + : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__t, __which, __a) {} + +#endif // _LIBCPP_STD_VER >= 26 + + basic_stringstream(const basic_stringstream&) = delete; _LIBCPP_HIDE_FROM_ABI basic_stringstream(basic_stringstream&& __rhs) : basic_iostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) { basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); } // [stringstream.assign] Assign and swap: + basic_stringstream& operator=(const basic_stringstream&) = delete; basic_stringstream& operator=(basic_stringstream&& __rhs) { basic_iostream<char_type, traits_type>::operator=(std::move(__rhs)); __sb_ = std::move(__rhs.__sb_); @@ -1089,6 +1250,14 @@ public: _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); } #endif // _LIBCPP_STD_VER >= 20 + +#if _LIBCPP_STD_VER >= 26 + template <class _Tp> + requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> + _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) { + rdbuf()->str(__t); + } +#endif // _LIBCPP_STD_VER >= 26 }; template <class _CharT, class _Traits, class _Allocator> @@ -1108,7 +1277,7 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#if _LIBCPP_STD_VER <= 20 && !defined(_LIPCPP_REMOVE_TRANSITIVE_INCLUDES) +#if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) # include <type_traits> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/stack b/contrib/libs/cxxsupp/libcxx/include/stack index 546380b0aa..4003792600 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stack +++ b/contrib/libs/cxxsupp/libcxx/include/stack @@ -114,7 +114,6 @@ template <class T, class Container> */ #include <__algorithm/ranges_copy.h> -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__iterator/back_insert_iterator.h> #include <__iterator/iterator_traits.h> @@ -138,6 +137,9 @@ template <class T, class Container> # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp, class _Container = deque<_Tp> > @@ -210,7 +212,7 @@ public: #endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER >= 23 - template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>> + template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI stack(_InputIterator __first, _InputIterator __last) : c(__first, __last) {} template <_ContainerCompatibleRange<_Tp> _Range> @@ -218,14 +220,14 @@ public: template <class _InputIterator, class _Alloc, - class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>, - class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>> + __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0, + __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI stack(_InputIterator __first, _InputIterator __last, const _Alloc& __alloc) : c(__first, __last, __alloc) {} template <_ContainerCompatibleRange<_Tp> _Range, class _Alloc, - class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>> + __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI stack(from_range_t, _Range&& __range, const _Alloc& __alloc) : c(from_range, std::forward<_Range>(__range), __alloc) {} @@ -294,7 +296,7 @@ stack(_Container, _Alloc) -> stack<typename _Container::value_type, _Container>; #endif #if _LIBCPP_STD_VER >= 23 -template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>> +template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> stack(_InputIterator, _InputIterator) -> stack<__iter_value_type<_InputIterator>>; template <ranges::input_range _Range> @@ -302,12 +304,12 @@ stack(from_range_t, _Range&&) -> stack<ranges::range_value_t<_Range>>; template <class _InputIterator, class _Alloc, - class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>, - class = __enable_if_t<__is_allocator<_Alloc>::value>> + __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0, + __enable_if_t<__is_allocator<_Alloc>::value, int> = 0> stack(_InputIterator, _InputIterator, _Alloc) -> stack<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>; -template <ranges::input_range _Range, class _Alloc, class = __enable_if_t<__is_allocator<_Alloc>::value>> +template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator<_Alloc>::value, int> = 0> stack(from_range_t, _Range&&, _Alloc) -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>; @@ -366,6 +368,8 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc> : pub _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <functional> diff --git a/contrib/libs/cxxsupp/libcxx/include/stdexcept b/contrib/libs/cxxsupp/libcxx/include/stdexcept index 3016c130a9..4e4cd22a6a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stdexcept +++ b/contrib/libs/cxxsupp/libcxx/include/stdexcept @@ -41,7 +41,6 @@ public: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__exception/exception.h> #include <__fwd/string.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/stop_token b/contrib/libs/cxxsupp/libcxx/include/stop_token index b223ceb27f..fee195f9d6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stop_token +++ b/contrib/libs/cxxsupp/libcxx/include/stop_token @@ -31,8 +31,12 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> + +#ifdef _LIBCPP_HAS_NO_THREADS +# error "<stop_token> is not supported since libc++ has been configured without support for threads." +#endif + #include <__stop_token/stop_callback.h> #include <__stop_token/stop_source.h> #include <__stop_token/stop_token.h> @@ -42,10 +46,6 @@ namespace std { # pragma GCC system_header #endif -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<stop_token> is not supported since libc++ has been configured without support for threads." -#endif - #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <iosfwd> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/streambuf b/contrib/libs/cxxsupp/libcxx/include/streambuf index 577ad340d0..aec537866c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/streambuf +++ b/contrib/libs/cxxsupp/libcxx/include/streambuf @@ -107,9 +107,9 @@ protected: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__fwd/streambuf.h> +#include <__type_traits/is_same.h> #include <climits> #include <ios> #include <iosfwd> diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index bc76545a98..c7f7bcb328 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -573,7 +573,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); #include <__algorithm/min.h> #include <__algorithm/remove.h> #include <__algorithm/remove_if.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__config> #include <__format/enable_insertable.h> #include <__functional/hash.h> @@ -600,6 +600,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); #include <__ranges/size.h> #include <__string/char_traits.h> #include <__string/extern_template_lists.h> +#include <__type_traits/conditional.h> #include <__type_traits/is_allocator.h> #include <__type_traits/is_array.h> #include <__type_traits/is_convertible.h> @@ -608,6 +609,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); #include <__type_traits/is_same.h> #include <__type_traits/is_standard_layout.h> #include <__type_traits/is_trivial.h> +#include <__type_traits/is_trivially_relocatable.h> #include <__type_traits/noexcept_move_assign_container.h> #include <__type_traits/remove_cvref.h> #include <__type_traits/void_t.h> @@ -725,6 +727,20 @@ public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; + // A basic_string contains the following members which may be trivially relocatable: + // - pointer: is currently assumed to be trivially relocatable, but is still checked in case that changes + // - size_type: is always trivially relocatable, since it has to be an integral type + // - value_type: is always trivially relocatable, since it has to be trivial + // - unsigned char: is a fundamental type, so it's trivially relocatable + // - allocator_type: may or may not be trivially relocatable, so it's checked + // + // This string implementation doesn't contain any references into itself. It only contains a bit that says whether + // it is in small or large string mode, so the entire structure is trivially relocatable if its members are. + using __trivially_relocatable = __conditional_t< + __libcpp_is_trivially_relocatable<allocator_type>::value && __libcpp_is_trivially_relocatable<pointer>::value, + basic_string, + void>; + static_assert((!is_array<value_type>::value), "Character type of basic_string must not be an array"); static_assert((is_standard_layout<value_type>::value), "Character type of basic_string must be standard-layout"); static_assert((is_trivial<value_type>::value), "Character type of basic_string must be trivial"); @@ -928,7 +944,11 @@ public: // Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS // does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first. // __str's memory needs to be unpoisoned only in the case where it's a short string. - : __r_(((__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)), std::move(__str.__r_))) { + : __r_([](basic_string& __s) -> decltype(__s.__r_)&& { + if (!__s.__is_long()) + __s.__annotate_delete(); + return std::move(__s.__r_); + }(__str)) { __str.__r_.first() = __rep(); __str.__annotate_new(0); if (!__is_long()) @@ -1132,7 +1152,7 @@ public: #ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(basic_string&& __str) - _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { + _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) { __move_assign(__str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); return *this; } @@ -1147,7 +1167,7 @@ public: #if _LIBCPP_STD_VER >= 20 basic_string& operator=(nullptr_t) = delete; #endif - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& operator=(value_type __c); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c); #ifndef _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT { @@ -1408,7 +1428,7 @@ public: } #ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(basic_string&& __str) - _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { + _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) { *this = std::move(__str); return *this; } @@ -1919,8 +1939,7 @@ private: #if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN) const void* __begin = data(); const void* __end = data() + capacity() + 1; - if (!__libcpp_is_constant_evaluated() && __begin != nullptr && - is_same<allocator_type, __default_allocator_type>::value) + if (__asan_annotate_container_with_allocator<allocator_type>::value && !__libcpp_is_constant_evaluated()) __sanitizer_annotate_contiguous_container(__begin, __end, __old_mid, __new_mid); #endif } @@ -1931,43 +1950,47 @@ private: } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_new(size_type __current_size) const _NOEXCEPT { + (void)__current_size; +#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN) if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long())) __annotate_contiguous_container(data() + capacity() + 1, data() + __current_size + 1); +#endif } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_delete() const _NOEXCEPT { +#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN) if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long())) __annotate_contiguous_container(data() + size() + 1, data() + capacity() + 1); +#endif } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_increase(size_type __n) const _NOEXCEPT { + (void)__n; +#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN) if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long())) __annotate_contiguous_container(data() + size() + 1, data() + size() + 1 + __n); +#endif } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_shrink(size_type __old_size) const _NOEXCEPT { + (void)__old_size; +#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN) if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long())) __annotate_contiguous_container(data() + __old_size + 1, data() + size() + 1); +#endif } template <size_type __a> static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __align_it(size_type __s) _NOEXCEPT { return (__s + (__a - 1)) & ~(__a - 1); } - enum { - __alignment = -#ifdef _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT - 8 -#else - 16 -#endif - }; + enum { __alignment = 8 }; static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __s) _NOEXCEPT { if (__s < __min_cap) { return static_cast<size_type>(__min_cap) - 1; } - size_type __guess = - __align_it < sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1 > (__s + 1) - 1; + const size_type __boundary = sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1; + size_type __guess = __align_it<__boundary>(__s + 1) - 1; if (__guess == __min_cap) ++__guess; return __guess; @@ -2403,7 +2426,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__ __old_sz = __n_copy + __n_add + __sec_cp_sz; __set_long_size(__old_sz); traits_type::assign(__p[__old_sz], value_type()); - __annotate_new(__old_cap + __delta_cap); + __annotate_new(__old_sz); } // __grow_by is deprecated because it does not set the size. It may not update the size when the size is changed, and it diff --git a/contrib/libs/cxxsupp/libcxx/include/string_view b/contrib/libs/cxxsupp/libcxx/include/string_view index 4f59a524fb..2ddb931f2b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string_view +++ b/contrib/libs/cxxsupp/libcxx/include/string_view @@ -206,7 +206,7 @@ namespace std { // clang-format on #include <__algorithm/min.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__config> #include <__functional/hash.h> #include <__functional/unary_function.h> @@ -215,6 +215,7 @@ namespace std { #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> #include <__iterator/reverse_iterator.h> +#include <__iterator/wrap_iter.h> #include <__memory/pointer_traits.h> #include <__ranges/concepts.h> #include <__ranges/data.h> @@ -278,10 +279,12 @@ public: using const_pointer = const _CharT*; using reference = _CharT&; using const_reference = const _CharT&; -#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS +#if defined(_LIBCPP_ABI_BOUNDED_ITERATORS) using const_iterator = __bounded_iter<const_pointer>; +#elif defined(_LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW) + using const_iterator = __wrap_iter<const_pointer>; #else - using const_iterator = const_pointer; // See [string.view.iterators] + using const_iterator = const_pointer; #endif using iterator = const_iterator; using const_reverse_iterator = std::reverse_iterator<const_iterator>; @@ -309,8 +312,11 @@ public: : __data_(__s), __size_(__len) { #if _LIBCPP_STD_VER >= 14 - _LIBCPP_ASSERT_UNCATEGORIZED(__len <= static_cast<size_type>(numeric_limits<difference_type>::max()), - "string_view::string_view(_CharT *, size_t): length does not fit in difference_type"); + // This will result in creating an invalid `string_view` object -- some calculations involving `size` would + // overflow, making it effectively truncated. + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( + __len <= static_cast<size_type>(numeric_limits<difference_type>::max()), + "string_view::string_view(_CharT *, size_t): length does not fit in difference_type"); _LIBCPP_ASSERT_NON_NULL( __len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr"); #endif @@ -352,7 +358,7 @@ public: #ifdef _LIBCPP_ABI_BOUNDED_ITERATORS return std::__make_bounded_iter(data(), data(), data() + size()); #else - return __data_; + return const_iterator(__data_); #endif } @@ -360,7 +366,7 @@ public: #ifdef _LIBCPP_ABI_BOUNDED_ITERATORS return std::__make_bounded_iter(data() + size(), data(), data() + size()); #else - return __data_ + __size_; + return const_iterator(__data_ + __size_); #endif } diff --git a/contrib/libs/cxxsupp/libcxx/include/strstream b/contrib/libs/cxxsupp/libcxx/include/strstream index 7843184e4d..e9f533644f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/strstream +++ b/contrib/libs/cxxsupp/libcxx/include/strstream @@ -129,7 +129,6 @@ private: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <istream> #include <ostream> @@ -139,6 +138,9 @@ private: # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf { @@ -340,4 +342,6 @@ private: _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_STRSTREAM diff --git a/contrib/libs/cxxsupp/libcxx/include/system_error b/contrib/libs/cxxsupp/libcxx/include/system_error index a60c98492a..eeab347788 100644 --- a/contrib/libs/cxxsupp/libcxx/include/system_error +++ b/contrib/libs/cxxsupp/libcxx/include/system_error @@ -144,7 +144,6 @@ template <> struct hash<std::error_condition>; */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__system_error/errc.h> #include <__system_error/error_category.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/thread b/contrib/libs/cxxsupp/libcxx/include/thread index 1cf22bf6aa..ed70bde760 100644 --- a/contrib/libs/cxxsupp/libcxx/include/thread +++ b/contrib/libs/cxxsupp/libcxx/include/thread @@ -86,14 +86,18 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); */ -#include <__assert> // all public C++ headers provide the assertion handler -#include <__availability> #include <__config> + +#ifdef _LIBCPP_HAS_NO_THREADS +# error "<thread> is not supported since libc++ has been configured without support for threads." +#endif + +#include <__availability> #include <__thread/formatter.h> #include <__thread/jthread.h> +#include <__thread/support.h> #include <__thread/this_thread.h> #include <__thread/thread.h> -#include <__threading_support> #include <version> // standard-mandated includes @@ -105,10 +109,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); # pragma GCC system_header #endif -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<thread> is not supported since libc++ has been configured without support for threads." -#endif - #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) # include <cstddef> # include <ctime> diff --git a/contrib/libs/cxxsupp/libcxx/include/tuple b/contrib/libs/cxxsupp/libcxx/include/tuple index 3126b88327..f2369fab50 100644 --- a/contrib/libs/cxxsupp/libcxx/include/tuple +++ b/contrib/libs/cxxsupp/libcxx/include/tuple @@ -141,7 +141,7 @@ template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // cons // [tuple.apply], calling a function with a tuple of arguments: template <class F, class Tuple> - constexpr decltype(auto) apply(F&& f, Tuple&& t); // C++17 + constexpr decltype(auto) apply(F&& f, Tuple&& t) noexcept(see below); // C++17 noexcept since C++23 template <class T, class Tuple> constexpr T make_from_tuple(Tuple&& t); // C++17 @@ -205,13 +205,11 @@ template <class... Types> // clang-format on -#include <__assert> // all public C++ headers provide the assertion handler #include <__compare/common_comparison_category.h> #include <__compare/synth_three_way.h> #include <__config> #include <__functional/invoke.h> #include <__fwd/array.h> -#include <__fwd/get.h> #include <__fwd/tuple.h> #include <__memory/allocator_arg_t.h> #include <__memory/uses_allocator.h> @@ -338,10 +336,10 @@ public: } template <class _Tp, - class = __enable_if_t< - _And< _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) - _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) + __enable_if_t<_And<_IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value, + int> = 0> + _LIBCPP_HIDE_FROM_ABI + _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_(is_nothrow_constructible<_Hp, _Tp>::value) : __value_(std::forward<_Tp>(__t)) { static_assert(__can_bind_reference<_Tp&&>(), "Attempted construction of reference element binds to a temporary whose lifetime has ended"); @@ -406,10 +404,10 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) : _Hp(__a) {} template <class _Tp, - class = __enable_if_t< - _And< _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) - _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) + __enable_if_t< _And< _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value, + int> = 0> + _LIBCPP_HIDE_FROM_ABI + _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_(is_nothrow_constructible<_Hp, _Tp>::value) : _Hp(std::forward<_Tp>(__t)) {} template <class _Tp, class _Alloc> @@ -468,8 +466,8 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. template <size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl( __tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u) - _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value && - __all<is_nothrow_default_constructible<_Tl>::value...>::value)) + _NOEXCEPT_(__all<is_nothrow_constructible<_Tf, _Up>::value...>::value&& + __all<is_nothrow_default_constructible<_Tl>::value...>::value) : __tuple_leaf<_Uf, _Tf>(std::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {} template <class _Alloc, size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up> @@ -484,7 +482,7 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. : __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, std::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {} - template <class _Tuple, class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value> > + template <class _Tuple, __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(_Tuple&& __t) _NOEXCEPT_( (__all<is_nothrow_constructible< _Tp, @@ -493,7 +491,7 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. std::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>( std::get<_Indx>(__t)))... {} - template <class _Alloc, class _Tuple, class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value> > + template <class _Alloc, class _Tuple, __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __tuple_leaf<_Indx, _Tp>( __uses_alloc_ctor<_Tp, @@ -624,7 +622,7 @@ public: >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) - tuple(_Up&&... __u) _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value)) + tuple(_Up&&... __u) _NOEXCEPT_(_And<is_nothrow_constructible<_Tp, _Up>...>::value) : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), @@ -691,7 +689,7 @@ public: template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit( _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) tuple(const tuple<_Up...>& __t) - _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, const _Up&>...>::value)) + _NOEXCEPT_(_And<is_nothrow_constructible<_Tp, const _Up&>...>::value) : __base_(__t) {} template <class... _Up, @@ -718,7 +716,7 @@ public: // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants) template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) - tuple(tuple<_Up...>&& __t) _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value)) + tuple(tuple<_Up...>&& __t) _NOEXCEPT_(_And<is_nothrow_constructible<_Tp, _Up>...>::value) : __base_(std::move(__t)) {} template <class _Alloc, @@ -775,7 +773,7 @@ public: __enable_if_t< _And< _EnableCtorFromPair<const pair<_Up1, _Up2>&> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit( _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value) tuple(const pair<_Up1, _Up2>& __p) - _NOEXCEPT_((_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value)) + _NOEXCEPT_(_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value) : __base_(__p) {} template <class _Alloc, @@ -813,7 +811,7 @@ public: __enable_if_t< _And< _EnableCtorFromPair<pair<_Up1, _Up2>&&> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit( _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value) tuple(pair<_Up1, _Up2>&& __p) - _NOEXCEPT_((_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value)) + _NOEXCEPT_(_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value) : __base_(std::move(__p)) {} template <class _Alloc, @@ -848,7 +846,7 @@ public: // [tuple.assign] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple) - _NOEXCEPT_((_And<is_nothrow_copy_assignable<_Tp>...>::value)) { + _NOEXCEPT_(_And<is_nothrow_copy_assignable<_Tp>...>::value) { std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; } @@ -872,7 +870,7 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple) - _NOEXCEPT_((_And<is_nothrow_move_assignable<_Tp>...>::value)) { + _NOEXCEPT_(_And<is_nothrow_move_assignable<_Tp>...>::value) { std::__memberwise_forward_assign( *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; @@ -883,7 +881,7 @@ public: __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up const&>... >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...> const& __tuple) - _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value)) { + _NOEXCEPT_(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) { std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; } @@ -892,7 +890,7 @@ public: __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up>... >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...>&& __tuple) - _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value)) { + _NOEXCEPT_(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) { std::__memberwise_forward_assign( *this, std::move(__tuple), __tuple_types<_Up...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; @@ -957,7 +955,7 @@ public: class _Up2, __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2> const& __pair) - _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value)) { + _NOEXCEPT_(_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value) { std::get<0>(*this) = __pair.first; std::get<1>(*this) = __pair.second; return *this; @@ -965,7 +963,7 @@ public: template <class _Up1, class _Up2, __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2>&& __pair) - _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value)) { + _NOEXCEPT_(_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value) { std::get<0>(*this) = std::forward<_Up1>(__pair.first); std::get<1>(*this) = std::forward<_Up2>(__pair.second); return *this; @@ -975,9 +973,9 @@ public: template < class _Up, size_t _Np, - class = __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up const&>... >::value > > + __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up const&>... >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np> const& __array) - _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value)) { + _NOEXCEPT_(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) { std::__memberwise_copy_assign(*this, __array, typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; } @@ -986,9 +984,9 @@ public: template <class _Up, size_t _Np, class = void, - class = __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up>... >::value > > + __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up>... >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np>&& __array) - _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value)) { + _NOEXCEPT_(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) { std::__memberwise_forward_assign( *this, std::move(__array), @@ -1424,25 +1422,27 @@ inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value; # define _LIBCPP_NOEXCEPT_RETURN(...) \ noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; } +// The _LIBCPP_NOEXCEPT_RETURN macro breaks formatting. +// clang-format off template <class _Fn, class _Tuple, size_t... _Id> inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __apply_tuple_impl(_Fn&& __f, _Tuple&& __t, __tuple_indices<_Id...>) _LIBCPP_NOEXCEPT_RETURN(std::__invoke(std::forward<_Fn>(__f), std::get<_Id>(std::forward<_Tuple>(__t))...)) - template <class _Fn, class _Tuple> - inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN( - std::__apply_tuple_impl(std::forward<_Fn>(__f), - std::forward<_Tuple>(__t), - typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{})) +template <class _Fn, class _Tuple> +inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&& __t) + _LIBCPP_NOEXCEPT_RETURN(std::__apply_tuple_impl( + std::forward<_Fn>(__f), + std::forward<_Tuple>(__t), + typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{})) - template <class _Tp, class _Tuple, size_t... _Idx> - inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp - __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>) - _LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...)) +template <class _Tp, class _Tuple, size_t... _Idx> +inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>) + _LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...)) - template <class _Tp, class _Tuple> - inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp - make_from_tuple(_Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN(std::__make_from_tuple_impl<_Tp>( +template <class _Tp, class _Tuple> +inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp make_from_tuple(_Tuple&& __t) + _LIBCPP_NOEXCEPT_RETURN(std::__make_from_tuple_impl<_Tp>( std::forward<_Tuple>(__t), typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{})) # undef _LIBCPP_NOEXCEPT_RETURN @@ -1451,9 +1451,11 @@ __apply_tuple_impl(_Fn&& __f, _Tuple&& __t, __tuple_indices<_Id...>) #endif // !defined(_LIBCPP_CXX03_LANG) - _LIBCPP_END_NAMESPACE_STD +_LIBCPP_END_NAMESPACE_STD - _LIBCPP_POP_MACROS +_LIBCPP_POP_MACROS + +// clang-format on #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <exception> diff --git a/contrib/libs/cxxsupp/libcxx/include/type_traits b/contrib/libs/cxxsupp/libcxx/include/type_traits index 466aeb6e0d..54c8abec34 100644 --- a/contrib/libs/cxxsupp/libcxx/include/type_traits +++ b/contrib/libs/cxxsupp/libcxx/include/type_traits @@ -416,9 +416,9 @@ namespace std } */ -#include <__assert> // all public C++ headers provide the assertion handler + #include <__config> -#include <__fwd/hash.h> // This is https://llvm.org/PR56938 +#include <__fwd/functional.h> // This is https://llvm.org/PR56938 #include <__type_traits/add_const.h> #include <__type_traits/add_cv.h> #include <__type_traits/add_lvalue_reference.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/typeindex b/contrib/libs/cxxsupp/libcxx/include/typeindex index e6ea12afd5..6398aa40d6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/typeindex +++ b/contrib/libs/cxxsupp/libcxx/include/typeindex @@ -45,7 +45,6 @@ struct hash<type_index> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/unary_function.h> #include <typeinfo> diff --git a/contrib/libs/cxxsupp/libcxx/include/typeinfo b/contrib/libs/cxxsupp/libcxx/include/typeinfo index aa18b3b731..d39d8ab1ee 100644 --- a/contrib/libs/cxxsupp/libcxx/include/typeinfo +++ b/contrib/libs/cxxsupp/libcxx/include/typeinfo @@ -56,7 +56,6 @@ public: */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__exception/exception.h> @@ -394,7 +393,6 @@ _LIBCPP_END_NAMESPACE_STD #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <cstdlib> -# include <exception> # include <type_traits> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map index 4be25fc1cd..ca3d1a80bd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_map +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map @@ -584,7 +584,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc> */ #include <__algorithm/is_permutation.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__config> #include <__functional/is_transparent.h> @@ -625,6 +625,9 @@ template <class Key, class T, class Hash, class Pred, class Alloc> # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Key, @@ -874,7 +877,7 @@ public: return *this; } - template <class _ValueTp, class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value> > + template <class _ValueTp, __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI __hash_value_type& operator=(_ValueTp&& __v) { __ref() = std::forward<_ValueTp>(__v); return *this; @@ -1242,12 +1245,12 @@ public: return __table_.__insert_unique(std::move(__x)).first; } - template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> > + template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(_Pp&& __x) { return __table_.__insert_unique(std::forward<_Pp>(__x)); } - template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> > + template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, _Pp&& __x) { return insert(std::forward<_Pp>(__x)).first; } @@ -2049,12 +2052,12 @@ public: return __table_.__insert_multi(__p.__i_, std::move(__x)); } - template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> > + template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __x) { return __table_.__insert_multi(std::forward<_Pp>(__x)); } - template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> > + template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _Pp&& __x) { return __table_.__insert_multi(__p.__i_, std::forward<_Pp>(__x)); } @@ -2544,6 +2547,8 @@ using unordered_multimap _LIBCPP_AVAILABILITY_PMR = _LIBCPP_END_NAMESPACE_STD #endif +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <algorithm> # include <bit> diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_set b/contrib/libs/cxxsupp/libcxx/include/unordered_set index 6414885f4c..64a02de3cf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_set +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_set @@ -532,7 +532,7 @@ template <class Value, class Hash, class Pred, class Alloc> // clang-format on #include <__algorithm/is_permutation.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__config> #include <__functional/is_transparent.h> @@ -570,6 +570,9 @@ template <class Value, class Hash, class Pred, class Alloc> # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Value, class _Hash, class _Pred, class _Alloc> @@ -1810,6 +1813,8 @@ using unordered_multiset _LIBCPP_AVAILABILITY_PMR = _LIBCPP_END_NAMESPACE_STD #endif +_LIBCPP_POP_MACROS + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <cstdlib> diff --git a/contrib/libs/cxxsupp/libcxx/include/utility b/contrib/libs/cxxsupp/libcxx/include/utility index 1deef3db20..90713da621 100644 --- a/contrib/libs/cxxsupp/libcxx/include/utility +++ b/contrib/libs/cxxsupp/libcxx/include/utility @@ -246,7 +246,6 @@ template <class T> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__utility/as_const.h> #include <__utility/as_lvalue.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/valarray b/contrib/libs/cxxsupp/libcxx/include/valarray index fb61868495..3d45925a25 100644 --- a/contrib/libs/cxxsupp/libcxx/include/valarray +++ b/contrib/libs/cxxsupp/libcxx/include/valarray @@ -350,7 +350,7 @@ template <class T> unspecified2 end(const valarray<T>& v); #include <__algorithm/min.h> #include <__algorithm/min_element.h> #include <__algorithm/unwrap_iter.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__config> #include <__functional/operations.h> #include <__memory/addressof.h> @@ -734,6 +734,50 @@ template <class _Tp> struct __is_val_expr<valarray<_Tp> > : true_type {}; template <class _Tp> +struct __is_val_expr<slice_array<_Tp> > : true_type {}; + +template <class _Tp> +struct __is_val_expr<gslice_array<_Tp> > : true_type {}; + +template <class _Tp> +struct __is_val_expr<mask_array<_Tp> > : true_type {}; + +template <class _Tp> +struct __is_val_expr<indirect_array<_Tp> > : true_type {}; + +// The functions using a __val_expr access the elements by their index. +// valarray and the libc++ lazy proxies have an operator[]. The +// Standard proxy array's don't have this operator, instead they have a +// implementation specific accessor +// __get(size_t) +// +// The functions use the non-member function +// __get(__val_expr, size_t) +// +// If the __val_expr is a specialization of __val_expr_use_member_functions it +// uses the __val_expr's member function +// __get(size_t) +// else it uses the __val_expr's member function +// operator[](size_t) +template <class _ValExpr> +struct __val_expr_use_member_functions; + +template <class> +struct __val_expr_use_member_functions : false_type {}; + +template <class _Tp> +struct __val_expr_use_member_functions<slice_array<_Tp> > : true_type {}; + +template <class _Tp> +struct __val_expr_use_member_functions<gslice_array<_Tp> > : true_type {}; + +template <class _Tp> +struct __val_expr_use_member_functions<mask_array<_Tp> > : true_type {}; + +template <class _Tp> +struct __val_expr_use_member_functions<indirect_array<_Tp> > : true_type {}; + +template <class _Tp> class _LIBCPP_TEMPLATE_VIS valarray { public: typedef _Tp value_type; @@ -903,6 +947,18 @@ template <class _Tp, size_t _Size> valarray(const _Tp (&)[_Size], size_t) -> valarray<_Tp>; #endif +template <class _Expr, + __enable_if_t<__is_val_expr<_Expr>::value && __val_expr_use_member_functions<_Expr>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI typename _Expr::value_type __get(const _Expr& __v, size_t __i) { + return __v.__get(__i); +} + +template <class _Expr, + __enable_if_t<__is_val_expr<_Expr>::value && !__val_expr_use_member_functions<_Expr>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI typename _Expr::value_type __get(const _Expr& __v, size_t __i) { + return __v[__i]; +} + extern template _LIBCPP_EXPORTED_FROM_ABI void valarray<size_t>::resize(size_t, size_t); template <class _Op, class _Tp> @@ -1025,6 +1081,12 @@ public: _LIBCPP_HIDE_FROM_ABI void operator=(const valarray<value_type>& __va) const; + // Behaves like __val_expr::operator[], which returns by value. + _LIBCPP_HIDE_FROM_ABI value_type __get(size_t __i) const { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "slice_array.__get() index out of bounds"); + return __vp_[__i * __stride_]; + } + private: _LIBCPP_HIDE_FROM_ABI slice_array(const slice& __sl, const valarray<value_type>& __v) : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())), __size_(__sl.size()), __stride_(__sl.stride()) {} @@ -1246,6 +1308,12 @@ public: gslice_array(const gslice_array&) = default; + // Behaves like __val_expr::operator[], which returns by value. + _LIBCPP_HIDE_FROM_ABI value_type __get(size_t __i) const { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __1d_.size(), "gslice_array.__get() index out of bounds"); + return __vp_[__1d_[__i]]; + } + private: gslice_array(const gslice& __gs, const valarray<value_type>& __v) : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(__gs.__1d_) {} @@ -1425,6 +1493,12 @@ public: _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const; + // Behaves like __val_expr::operator[], which returns by value. + _LIBCPP_HIDE_FROM_ABI value_type __get(size_t __i) const { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __1d_.size(), "mask_array.__get() index out of bounds"); + return __vp_[__1d_[__i]]; + } + private: _LIBCPP_HIDE_FROM_ABI mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v) : __vp_(const_cast<value_type*>(__v.__begin_)), @@ -1624,6 +1698,12 @@ public: _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const; + // Behaves like __val_expr::operator[], which returns by value. + _LIBCPP_HIDE_FROM_ABI value_type __get(size_t __i) const { + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __1d_.size(), "indirect_array.__get() index out of bounds"); + return __vp_[__1d_[__i]]; + } + private: _LIBCPP_HIDE_FROM_ABI indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v) : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(__ia) {} @@ -2355,7 +2435,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator*=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t *= __v[__i]; + *__t *= std::__get(__v, __i); return *this; } @@ -2364,7 +2444,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator/=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t /= __v[__i]; + *__t /= std::__get(__v, __i); return *this; } @@ -2373,7 +2453,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator%=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t %= __v[__i]; + *__t %= std::__get(__v, __i); return *this; } @@ -2382,7 +2462,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator+=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t += __v[__i]; + *__t += std::__get(__v, __i); return *this; } @@ -2391,7 +2471,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator-=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t -= __v[__i]; + *__t -= std::__get(__v, __i); return *this; } @@ -2400,7 +2480,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator^=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t ^= __v[__i]; + *__t ^= std::__get(__v, __i); return *this; } @@ -2409,7 +2489,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator|=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t |= __v[__i]; + *__t |= std::__get(__v, __i); return *this; } @@ -2418,7 +2498,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator&=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t &= __v[__i]; + *__t &= std::__get(__v, __i); return *this; } @@ -2427,7 +2507,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator<<=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t <<= __v[__i]; + *__t <<= std::__get(__v, __i); return *this; } @@ -2436,7 +2516,7 @@ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator>>=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t >>= __v[__i]; + *__t >>= std::__get(__v, __i); return *this; } diff --git a/contrib/libs/cxxsupp/libcxx/include/variant b/contrib/libs/cxxsupp/libcxx/include/variant index 6179b2a1a0..5ce99250a8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/variant +++ b/contrib/libs/cxxsupp/libcxx/include/variant @@ -69,6 +69,12 @@ namespace std { // 20.7.2.6, swap void swap(variant&) noexcept(see below); + + // [variant.visit], visitation + template<class Self, class Visitor> + constexpr decltype(auto) visit(this Self&&, Visitor&&); // Since C++26 + template<class R, class Self, class Visitor> + constexpr R visit(this Self&&, Visitor&&); // Since C++26 }; // 20.7.3, variant helper classes @@ -204,7 +210,6 @@ namespace std { */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__compare/common_comparison_category.h> #include <__compare/compare_three_way_result.h> @@ -235,6 +240,7 @@ namespace std { #include <__type_traits/void_t.h> #include <__utility/declval.h> #include <__utility/forward.h> +#include <__utility/forward_like.h> #include <__utility/in_place.h> #include <__utility/move.h> #include <__utility/swap.h> @@ -801,14 +807,15 @@ protected: _LIBCPP_HIDE_FROM_ABI static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) { __lhs.__destroy(); if (!__rhs.valueless_by_exception()) { + auto __rhs_index = __rhs.index(); __visitation::__base::__visit_alt_at( - __rhs.index(), + __rhs_index, [](auto& __lhs_alt, auto&& __rhs_alt) { __construct_alt(__lhs_alt, std::forward<decltype(__rhs_alt)>(__rhs_alt).__value); }, __lhs, std::forward<_Rhs>(__rhs)); - __lhs.__index = __rhs.index(); + __lhs.__index = __rhs_index; } } }; @@ -1130,6 +1137,19 @@ using __best_match_t = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, } // namespace __variant_detail +template <class _Visitor, class... _Vs, typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...>> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto) +visit(_Visitor&& __visitor, _Vs&&... __vs); + +# if _LIBCPP_STD_VER >= 20 +template <class _Rp, + class _Visitor, + class... _Vs, + typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...>> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp +visit(_Visitor&& __visitor, _Vs&&... __vs); +# endif + template <class... _Types> class _LIBCPP_TEMPLATE_VIS _LIBCPP_DECLSPEC_EMPTY_BASES variant : private __sfinae_ctor_base< __all<is_copy_constructible_v<_Types>...>::value, @@ -1273,6 +1293,27 @@ public: __impl_.__swap(__that.__impl_); } +# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) + // Helper class to implement [variant.visit]/10 + // Constraints: The call to visit does not use an explicit template-argument-list + // that begins with a type template-argument. + struct __variant_visit_barrier_tag { + _LIBCPP_HIDE_FROM_ABI explicit __variant_visit_barrier_tag() = default; + }; + + template <__variant_visit_barrier_tag = __variant_visit_barrier_tag{}, class _Self, class _Visitor> + _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) visit(this _Self&& __self, _Visitor&& __visitor) { + using _VariantT = _OverrideRef<_Self&&, _CopyConst<remove_reference_t<_Self>, variant>>; + return std::visit(std::forward<_Visitor>(__visitor), (_VariantT)__self); + } + + template <class _Rp, class _Self, class _Visitor> + _LIBCPP_HIDE_FROM_ABI constexpr _Rp visit(this _Self&& __self, _Visitor&& __visitor) { + using _VariantT = _OverrideRef<_Self&&, _CopyConst<remove_reference_t<_Self>, variant>>; + return std::visit<_Rp>(std::forward<_Visitor>(__visitor), (_VariantT)__self); + } +# endif + private: __variant_detail::__impl<_Types...> __impl_; @@ -1511,7 +1552,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr vo } } -template < class _Visitor, class... _Vs, typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> > +template < class _Visitor, class... _Vs, typename> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) { using __variant_detail::__visitation::__variant; @@ -1520,10 +1561,7 @@ visit(_Visitor&& __visitor, _Vs&&... __vs) { } # if _LIBCPP_STD_VER >= 20 -template < class _Rp, - class _Visitor, - class... _Vs, - typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> > +template < class _Rp, class _Visitor, class... _Vs, typename> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp visit(_Visitor&& __visitor, _Vs&&... __vs) { using __variant_detail::__visitation::__variant; diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector index 9e512b30a5..cc80875596 100644 --- a/contrib/libs/cxxsupp/libcxx/include/vector +++ b/contrib/libs/cxxsupp/libcxx/include/vector @@ -315,7 +315,7 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ #include <__algorithm/remove_if.h> #include <__algorithm/rotate.h> #include <__algorithm/unwrap_iter.h> -#include <__assert> // all public C++ headers provide the assertion handler +#include <__assert> #include <__availability> #include <__bit_reference> #include <__concepts/same_as.h> @@ -352,6 +352,7 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ #include <__type_traits/type_identity.h> #include <__utility/exception_guard.h> #include <__utility/forward.h> +#include <__utility/is_pointer_in_range.h> #include <__utility/move.h> #include <__utility/pair.h> #include <__utility/swap.h> @@ -434,7 +435,7 @@ public: #endif _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x); - template <class = __enable_if_t<__is_allocator<_Allocator>::value> > + template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x, const allocator_type& __a) : __end_cap_(nullptr, __a) { @@ -533,7 +534,7 @@ public: _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(vector&& __x, const __type_identity_t<allocator_type>& __a); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(vector&& __x) - _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); + _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value); template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value && @@ -843,13 +844,13 @@ private: // For more details, see the "Using libc++" documentation page or // the documentation for __sanitizer_annotate_contiguous_container. - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_contiguous_container( - const void* __beg, const void* __end, const void* __old_mid, const void* __new_mid) const { - (void)__beg; - (void)__end; + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void + __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const { (void)__old_mid; (void)__new_mid; #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(_LIBCPP_NO_ASAN_CONTIGUOUS_CONTAINER_FEATURES) + const void* __beg = data(); + const void* __end = data() + capacity(); if (!__libcpp_is_constant_evaluated() && __beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value) __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid); @@ -857,19 +858,30 @@ private: } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT { - __annotate_contiguous_container(data(), data() + capacity(), data() + capacity(), data() + __current_size); + (void)__current_size; +#ifndef _LIBCPP_HAS_NO_ASAN + __annotate_contiguous_container(data() + capacity(), data() + __current_size); +#endif } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT { - __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + capacity()); +#ifndef _LIBCPP_HAS_NO_ASAN + __annotate_contiguous_container(data() + size(), data() + capacity()); +#endif } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_increase(size_type __n) const _NOEXCEPT { - __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + size() + __n); + (void)__n; +#ifndef _LIBCPP_HAS_NO_ASAN + __annotate_contiguous_container(data() + size(), data() + size() + __n); +#endif } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_shrink(size_type __old_size) const _NOEXCEPT { - __annotate_contiguous_container(data(), data() + capacity(), data() + __old_size, data() + size()); + (void)__old_size; +#ifndef _LIBCPP_HAS_NO_ASAN + __annotate_contiguous_container(data() + __old_size, data() + size()); +#endif } struct _ConstructTransaction { @@ -983,14 +995,18 @@ template <ranges::input_range _Range, vector(from_range_t, _Range&&, _Alloc = _Alloc()) -> vector<ranges::range_value_t<_Range>, _Alloc>; #endif +// __swap_out_circular_buffer relocates the objects in [__begin_, __end_) into the front of __v and swaps the buffers of +// *this and __v. It is assumed that __v provides space for exactly (__end_ - __begin_) objects in the front. This +// function has a strong exception guarantee. template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v) { __annotate_delete(); - using _RevIter = std::reverse_iterator<pointer>; - __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept( - __alloc(), _RevIter(__end_), _RevIter(__begin_), _RevIter(__v.__begin_)) - .base(); + auto __new_begin = __v.__begin_ - (__end_ - __begin_); + std::__uninitialized_allocator_relocate( + __alloc(), std::__to_address(__begin_), std::__to_address(__end_), std::__to_address(__new_begin)); + __v.__begin_ = __new_begin; + __end_ = __begin_; // All the objects have been destroyed by relocating them. std::swap(this->__begin_, __v.__begin_); std::swap(this->__end_, __v.__end_); std::swap(this->__end_cap(), __v.__end_cap()); @@ -998,22 +1014,35 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a __annotate_new(size()); } +// __swap_out_circular_buffer relocates the objects in [__begin_, __p) into the front of __v, the objects in +// [__p, __end_) into the back of __v and swaps the buffers of *this and __v. It is assumed that __v provides space for +// exactly (__p - __begin_) objects in the front and space for at least (__end_ - __p) objects in the back. This +// function has a strong exception guarantee if __begin_ == __p || __end_ == __p. template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p) { __annotate_delete(); - pointer __r = __v.__begin_; - using _RevIter = std::reverse_iterator<pointer>; - __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept( - __alloc(), _RevIter(__p), _RevIter(__begin_), _RevIter(__v.__begin_)) - .base(); - __v.__end_ = std::__uninitialized_allocator_move_if_noexcept(__alloc(), __p, __end_, __v.__end_); + pointer __ret = __v.__begin_; + + // Relocate [__p, __end_) first to avoid having a hole in [__begin_, __end_) + // in case something in [__begin_, __p) throws. + std::__uninitialized_allocator_relocate( + __alloc(), std::__to_address(__p), std::__to_address(__end_), std::__to_address(__v.__end_)); + __v.__end_ += (__end_ - __p); + __end_ = __p; // The objects in [__p, __end_) have been destroyed by relocating them. + auto __new_begin = __v.__begin_ - (__p - __begin_); + + std::__uninitialized_allocator_relocate( + __alloc(), std::__to_address(__begin_), std::__to_address(__p), std::__to_address(__new_begin)); + __v.__begin_ = __new_begin; + __end_ = __begin_; // All the objects have been destroyed by relocating them. + std::swap(this->__begin_, __v.__begin_); std::swap(this->__end_, __v.__end_); std::swap(this->__end_cap(), __v.__end_cap()); __v.__first_ = __v.__begin_; __annotate_new(size()); - return __r; + return __ret; } template <class _Tp, class _Allocator> @@ -1277,7 +1306,7 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocat template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>& vector<_Tp, _Allocator>::operator=(vector&& __x) - _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { + _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) { __move_assign(__x, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); return *this; } @@ -1364,7 +1393,7 @@ vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel // We need to save the make_iter function and replace all constructor calls with it // Made to support pointer iterators template <class _Tp, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::iterator +_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT { #if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 return iterator(__p); @@ -1374,7 +1403,7 @@ vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT { } template <class _Tp, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::const_iterator +_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT { #if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 return const_iterator(__p); @@ -1599,14 +1628,13 @@ template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) { pointer __p = this->__begin_ + (__position - begin()); - // We can't compare unrelated pointers inside constant expressions - if (!__libcpp_is_constant_evaluated() && this->__end_ < this->__end_cap()) { + if (this->__end_ < this->__end_cap()) { if (__p == this->__end_) { __construct_one_at_end(__x); } else { __move_range(__p, this->__end_, __p + 1); const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); - if (__p <= __xr && __xr < this->__end_) + if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end_), std::addressof(__x))) ++__xr; *__p = *__xr; } @@ -2008,7 +2036,7 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(vector&& __v, const __type_identity_t<allocator_type>& __a); _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(vector&& __v) - _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); + _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value); template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0> void _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_InputIterator __first, _InputIterator __last); @@ -2557,7 +2585,7 @@ vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator template <class _Allocator> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>& vector<bool, _Allocator>::operator=(vector&& __v) - _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { + _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) { __move_assign(__v, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>()); return *this; } @@ -2917,7 +2945,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<vector<bool, _Allocator> > // 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 + _LIBCPP_HIDE_FROM_ABI size_t operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT { size_t __h = 0; size_t __idx = 0; @@ -3054,6 +3082,7 @@ _LIBCPP_POP_MACROS # include <atomic> # include <concepts> # include <cstdlib> +# include <locale> # include <type_traits> # include <typeinfo> # include <utility> diff --git a/contrib/libs/cxxsupp/libcxx/include/version b/contrib/libs/cxxsupp/libcxx/include/version index 7aa002e257..3bd296e34a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/version +++ b/contrib/libs/cxxsupp/libcxx/include/version @@ -16,7 +16,7 @@ Macro name Value Headers __cpp_lib_adaptor_iterator_pair_constructor 202106L <queue> <stack> __cpp_lib_addressof_constexpr 201603L <memory> -__cpp_lib_allocate_at_least 202106L <memory> +__cpp_lib_allocate_at_least 202302L <memory> __cpp_lib_allocator_traits_is_always_equal 201411L <deque> <forward_list> <list> <map> <memory> <scoped_allocator> <set> <string> <unordered_map> @@ -170,6 +170,7 @@ __cpp_lib_ranges_as_const 202207L <ranges> __cpp_lib_ranges_as_rvalue 202207L <ranges> __cpp_lib_ranges_chunk 202202L <ranges> __cpp_lib_ranges_chunk_by 202202L <ranges> +__cpp_lib_ranges_contains 202207L <algorithm> __cpp_lib_ranges_iota 202202L <numeric> __cpp_lib_ranges_join_with 202202L <ranges> __cpp_lib_ranges_repeat 202207L <ranges> @@ -201,6 +202,7 @@ __cpp_lib_smart_ptr_for_overwrite 202002L <memory> __cpp_lib_smart_ptr_owner_equality 202306L <memory> __cpp_lib_source_location 201907L <source_location> __cpp_lib_span 202002L <span> +__cpp_lib_span_at 202311L <span> __cpp_lib_span_initializer_list 202311L <span> __cpp_lib_spanstream 202106L <spanstream> __cpp_lib_ssize 201902L <iterator> @@ -243,7 +245,6 @@ __cpp_lib_within_lifetime 202306L <type_traits> */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> @@ -265,7 +266,9 @@ __cpp_lib_within_lifetime 202306L <type_traits> # define __cpp_lib_make_reverse_iterator 201402L # define __cpp_lib_make_unique 201304L # define __cpp_lib_null_iterators 201304L -# define __cpp_lib_quoted_string_io 201304L +# if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# define __cpp_lib_quoted_string_io 201304L +# endif # define __cpp_lib_result_of_sfinae 201210L # define __cpp_lib_robust_nonmodifying_seq_ops 201304L # if !defined(_LIBCPP_HAS_NO_THREADS) @@ -293,7 +296,7 @@ __cpp_lib_within_lifetime 202306L <type_traits> # define __cpp_lib_clamp 201603L # define __cpp_lib_enable_shared_from_this 201603L // # define __cpp_lib_execution 201603L -# if _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY +# if !defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY # define __cpp_lib_filesystem 201703L # endif # define __cpp_lib_gcd_lcm 201606L @@ -322,7 +325,9 @@ __cpp_lib_within_lifetime 202306L <type_traits> // # define __cpp_lib_parallel_algorithm 201603L # define __cpp_lib_raw_memory_algorithms 201606L # define __cpp_lib_sample 201603L -# define __cpp_lib_scoped_lock 201703L +# if !defined(_LIBCPP_HAS_NO_THREADS) +# define __cpp_lib_scoped_lock 201703L +# endif # if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_shared_mutex 201505L # endif @@ -432,7 +437,7 @@ __cpp_lib_within_lifetime 202306L <type_traits> #if _LIBCPP_STD_VER >= 23 # define __cpp_lib_adaptor_iterator_pair_constructor 202106L -# define __cpp_lib_allocate_at_least 202106L +# define __cpp_lib_allocate_at_least 202302L // # define __cpp_lib_associative_heterogeneous_erasure 202110L // # define __cpp_lib_bind_back 202202L # define __cpp_lib_byteswap 202110L @@ -454,16 +459,17 @@ __cpp_lib_within_lifetime 202306L <type_traits> # undef __cpp_lib_optional # define __cpp_lib_optional 202110L // # define __cpp_lib_out_ptr 202106L -// # define __cpp_lib_print 202207L +# define __cpp_lib_print 202207L // # define __cpp_lib_ranges_as_const 202207L # define __cpp_lib_ranges_as_rvalue 202207L // # define __cpp_lib_ranges_chunk 202202L # define __cpp_lib_ranges_chunk_by 202202L +# define __cpp_lib_ranges_contains 202207L // # define __cpp_lib_ranges_iota 202202L // # define __cpp_lib_ranges_join_with 202202L # define __cpp_lib_ranges_repeat 202207L // # define __cpp_lib_ranges_slide 202202L -// # define __cpp_lib_ranges_starts_ends_with 202106L +# define __cpp_lib_ranges_starts_ends_with 202106L # define __cpp_lib_ranges_to_container 202202L // # define __cpp_lib_ranges_zip 202110L // # define __cpp_lib_reference_from_temporary 202202L @@ -495,7 +501,9 @@ __cpp_lib_within_lifetime 202306L <type_traits> // # define __cpp_lib_freestanding_optional 202311L // # define __cpp_lib_freestanding_string_view 202311L // # define __cpp_lib_freestanding_variant 202311L -// # define __cpp_lib_fstream_native_handle 202306L +# if !defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# define __cpp_lib_fstream_native_handle 202306L +# endif // # define __cpp_lib_function_ref 202306L // # define __cpp_lib_hazard_pointer 202306L // # define __cpp_lib_linalg 202311L @@ -503,10 +511,11 @@ __cpp_lib_within_lifetime 202306L <type_traits> // # define __cpp_lib_out_ptr 202311L # define __cpp_lib_ratio 202306L // # define __cpp_lib_rcu 202306L -// # define __cpp_lib_saturation_arithmetic 202311L +# define __cpp_lib_saturation_arithmetic 202311L // # define __cpp_lib_smart_ptr_owner_equality 202306L -// # define __cpp_lib_span_initializer_list 202311L -// # define __cpp_lib_sstream_from_string_view 202306L +# define __cpp_lib_span_at 202311L +# define __cpp_lib_span_initializer_list 202311L +# define __cpp_lib_sstream_from_string_view 202306L // # define __cpp_lib_submdspan 202306L // # define __cpp_lib_text_encoding 202306L # undef __cpp_lib_to_chars diff --git a/contrib/libs/cxxsupp/libcxx/patches/00-future-2023-12-19-fix-order-windows.patch b/contrib/libs/cxxsupp/libcxx/patches/00-future-2023-12-19-fix-order-windows.patch deleted file mode 100644 index d1d3525b79..0000000000 --- a/contrib/libs/cxxsupp/libcxx/patches/00-future-2023-12-19-fix-order-windows.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/src/support/win32/thread_win32.cpp b/src/support/win32/thread_win32.cpp -index a651a3c..8736a53 100644 ---- a/src/support/win32/thread_win32.cpp -+++ b/src/support/win32/thread_win32.cpp -@@ -11,9 +11,9 @@ - - #define NOMINMAX - #define WIN32_LEAN_AND_MEAN --#include <fibersapi.h> --#include <process.h> - #include <windows.h> -+#include <process.h> -+#include <fibersapi.h> - - _LIBCPP_BEGIN_NAMESPACE_STD - diff --git a/contrib/libs/cxxsupp/libcxx/patches/00-future-2023-12-20-fix-clangd-DEVTOOLSSUPPORT-42012.patch b/contrib/libs/cxxsupp/libcxx/patches/00-future-2023-12-20-fix-clangd-DEVTOOLSSUPPORT-42012.patch deleted file mode 100644 index 220569e6dd..0000000000 --- a/contrib/libs/cxxsupp/libcxx/patches/00-future-2023-12-20-fix-clangd-DEVTOOLSSUPPORT-42012.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/include/__numeric/midpoint.h b/include/__numeric/midpoint.h -index 986cb6e..5d715c2 100644 ---- a/include/__numeric/midpoint.h -+++ b/include/__numeric/midpoint.h -@@ -48,12 +48,8 @@ midpoint(_Tp __a, _Tp __b) noexcept _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK - return __a + __half_diff; - } - --template <class _TPtr> --_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t< -- is_pointer_v<_TPtr> && is_object_v<remove_pointer_t<_TPtr>> && !is_void_v<remove_pointer_t<_TPtr>> && -- (sizeof(remove_pointer_t<_TPtr>) > 0), -- _TPtr> --midpoint(_TPtr __a, _TPtr __b) noexcept { -+template <class _Tp, enable_if_t<is_object_v<_Tp> && !is_void_v<_Tp> && (sizeof(_Tp) > 0), int> = 0> -+_LIBCPP_HIDE_FROM_ABI constexpr _Tp* midpoint(_Tp* __a, _Tp* __b) noexcept { - return __a + std::midpoint(ptrdiff_t(0), __b - __a); - } - diff --git a/contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch b/contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch index e8a62bc984..941ad6471d 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch @@ -1,8 +1,8 @@ diff --git a/include/__config b/include/__config -index adff13e..51463fc 100644 +index 3a438e8..6a7bda1 100644 --- a/include/__config +++ b/include/__config -@@ -127,7 +127,12 @@ +@@ -138,7 +138,12 @@ // Previously libc++ used "unsigned int" exclusively. # define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION // Unstable attempt to provide a more optimized std::function @@ -17,10 +17,10 @@ index adff13e..51463fc 100644 # define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO // Re-worked external template instantiations for std::string with a focus on diff --git a/include/typeinfo b/include/typeinfo -index 39a9067..ed89a4f 100644 +index dafc7b8..d4e5e4e 100644 --- a/include/typeinfo +++ b/include/typeinfo -@@ -98,7 +98,13 @@ public: +@@ -97,7 +97,13 @@ public: size_t hash_code() const _NOEXCEPT; @@ -36,7 +36,7 @@ index 39a9067..ed89a4f 100644 // from different translation units, so it is sufficient to compare their addresses. if (__libcpp_is_constant_evaluated()) { diff --git a/src/filesystem/operations.cpp b/src/filesystem/operations.cpp -index 6bee340..1b9f260 100644 +index 62bb248..fa31f05 100644 --- a/src/filesystem/operations.cpp +++ b/src/filesystem/operations.cpp @@ -37,7 +37,7 @@ @@ -49,26 +49,24 @@ index 6bee340..1b9f260 100644 # define _LIBCPP_FILESYSTEM_USE_SENDFILE #elif defined(__APPLE__) || __has_include(<copyfile.h>) diff --git a/src/new.cpp b/src/new.cpp -index 033bba5..e9a4adc 100644 +index b0c7316..7f1cc67 100644 --- a/src/new.cpp +++ b/src/new.cpp -@@ -41,6 +41,16 @@ _LIBCPP_WEAK void* operator new(std::size_t size) _THROW_BAD_ALLOC { - # ifndef _LIBCPP_HAS_NO_EXCEPTIONS - if (p == nullptr) - throw std::bad_alloc(); -+# else -+# ifdef __EMSCRIPTEN__ -+ if (p == nullptr) -+ // 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(); -+# endif - # endif - return p; - } +@@ -18,7 +18,13 @@ + // The code below is copied as-is into libc++abi's libcxxabi/src/stdlib_new_delete.cpp + // file. The version in this file is the canonical one. + +-inline void __throw_bad_alloc_shim() { std::__throw_bad_alloc(); } ++inline void __throw_bad_alloc_shim() { ++# ifdef __EMSCRIPTEN__ ++ abort(); ++#else ++ std::__throw_bad_alloc(); ++#endif ++} + + # define _LIBCPP_ASSERT_SHIM(expr, str) _LIBCPP_ASSERT(expr, str) + diff --git a/src/support/runtime/exception_fallback.ipp b/src/support/runtime/exception_fallback.ipp index 18ff4b8..d54a9a5 100644 --- a/src/support/runtime/exception_fallback.ipp diff --git a/contrib/libs/cxxsupp/libcxx/patches/05-compiler-msvc.patch b/contrib/libs/cxxsupp/libcxx/patches/05-compiler-msvc.patch index a40b79228d..ac64152687 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/05-compiler-msvc.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/05-compiler-msvc.patch @@ -1,8 +1,8 @@ diff --git a/include/__functional/bind.h b/include/__functional/bind.h -index 19e7d82..92d9bbd 100644 +index 8a0e3b7..1fded44 100644 --- a/include/__functional/bind.h +++ b/include/__functional/bind.h -@@ -230,6 +230,10 @@ public: +@@ -231,6 +231,10 @@ public: } }; @@ -13,7 +13,7 @@ index 19e7d82..92d9bbd 100644 template <class _Fp, class... _BoundArgs> struct is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {}; -@@ -237,7 +241,11 @@ template <class _Rp, class _Fp, class... _BoundArgs> +@@ -238,7 +242,11 @@ template <class _Rp, class _Fp, class... _BoundArgs> class __bind_r : public __bind<_Fp, _BoundArgs...> { typedef __bind<_Fp, _BoundArgs...> base; typedef typename base::_Fd _Fd; diff --git a/contrib/libs/cxxsupp/libcxx/patches/09-clang-cl-abi.patch b/contrib/libs/cxxsupp/libcxx/patches/09-clang-cl-abi.patch index dd57def15a..c5e9c5b42c 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/09-clang-cl-abi.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/09-clang-cl-abi.patch @@ -1,5 +1,5 @@ diff --git a/include/locale b/include/locale -index 70d22ff..2806396 100644 +index e3c63e3..13b911c 100644 --- a/include/locale +++ b/include/locale @@ -2168,7 +2168,11 @@ public: diff --git a/contrib/libs/cxxsupp/libcxx/patches/10-using_if_exists-in-clang11-and-msvcrt.patch b/contrib/libs/cxxsupp/libcxx/patches/10-using_if_exists-in-clang11-and-msvcrt.patch index 85d988acab..2b9affd402 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/10-using_if_exists-in-clang11-and-msvcrt.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/10-using_if_exists-in-clang11-and-msvcrt.patch @@ -1,8 +1,8 @@ diff --git a/include/cstdlib b/include/cstdlib -index 9bf0ea3..d9ee863 100644 +index c817fd8..25a829b 100644 --- a/include/cstdlib +++ b/include/cstdlib -@@ -142,11 +142,11 @@ using ::wctomb _LIBCPP_USING_IF_EXISTS; +@@ -141,11 +141,11 @@ using ::wctomb _LIBCPP_USING_IF_EXISTS; using ::mbstowcs _LIBCPP_USING_IF_EXISTS; using ::wcstombs _LIBCPP_USING_IF_EXISTS; #endif @@ -17,10 +17,10 @@ index 9bf0ea3..d9ee863 100644 #endif diff --git a/include/ctime b/include/ctime -index b61e19d..e537bbe 100644 +index f47b49a..cad942e 100644 --- a/include/ctime +++ b/include/ctime -@@ -66,7 +66,7 @@ using ::clock_t _LIBCPP_USING_IF_EXISTS; +@@ -65,7 +65,7 @@ using ::clock_t _LIBCPP_USING_IF_EXISTS; using ::size_t _LIBCPP_USING_IF_EXISTS; using ::time_t _LIBCPP_USING_IF_EXISTS; using ::tm _LIBCPP_USING_IF_EXISTS; @@ -29,7 +29,7 @@ index b61e19d..e537bbe 100644 using ::timespec _LIBCPP_USING_IF_EXISTS; #endif using ::clock _LIBCPP_USING_IF_EXISTS; -@@ -78,7 +78,7 @@ using ::ctime _LIBCPP_USING_IF_EXISTS; +@@ -77,7 +77,7 @@ using ::ctime _LIBCPP_USING_IF_EXISTS; using ::gmtime _LIBCPP_USING_IF_EXISTS; using ::localtime _LIBCPP_USING_IF_EXISTS; using ::strftime _LIBCPP_USING_IF_EXISTS; diff --git a/contrib/libs/cxxsupp/libcxx/patches/14-has-no-threads.patch b/contrib/libs/cxxsupp/libcxx/patches/14-has-no-threads.patch index 1122c6cb3a..4688ea395a 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/14-has-no-threads.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/14-has-no-threads.patch @@ -1,5 +1,5 @@ diff --git a/include/__memory/shared_ptr.h b/include/__memory/shared_ptr.h -index a868093..5f626b5 100644 +index d90e144..e78f281 100644 --- a/include/__memory/shared_ptr.h +++ b/include/__memory/shared_ptr.h @@ -54,7 +54,7 @@ @@ -11,7 +11,7 @@ index a868093..5f626b5 100644 #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -@@ -135,7 +135,12 @@ class _LIBCPP_EXPORTED_FROM_ABI __shared_count { +@@ -138,7 +138,12 @@ class _LIBCPP_EXPORTED_FROM_ABI __shared_count { __shared_count& operator=(const __shared_count&); protected: @@ -25,7 +25,7 @@ index a868093..5f626b5 100644 virtual ~__shared_count(); private: -@@ -148,20 +153,41 @@ public: +@@ -151,20 +156,41 @@ public: void __add_shared() noexcept; bool __release_shared() noexcept; #else @@ -70,7 +70,7 @@ index a868093..5f626b5 100644 public: _LIBCPP_HIDE_FROM_ABI explicit __shared_weak_count(long __refs = 0) _NOEXCEPT -@@ -178,7 +204,13 @@ public: +@@ -181,7 +207,13 @@ public: void __release_shared() noexcept; #else _LIBCPP_HIDE_FROM_ABI void __add_shared() _NOEXCEPT { __shared_count::__add_shared(); } diff --git a/contrib/libs/cxxsupp/libcxx/patches/15-unique-ptr.patch b/contrib/libs/cxxsupp/libcxx/patches/15-unique-ptr.patch index c1a842d7e7..07fb95833c 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/15-unique-ptr.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/15-unique-ptr.patch @@ -1,8 +1,8 @@ diff --git a/include/__memory/unique_ptr.h b/include/__memory/unique_ptr.h -index 7bf5e3c..ccd7d24 100644 +index a505dab..327e02c 100644 --- a/include/__memory/unique_ptr.h +++ b/include/__memory/unique_ptr.h -@@ -39,6 +39,7 @@ +@@ -41,6 +41,7 @@ #include <__utility/forward.h> #include <__utility/move.h> #include <cstddef> @@ -10,7 +10,7 @@ index 7bf5e3c..ccd7d24 100644 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header -@@ -120,7 +121,7 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> { +@@ -122,7 +123,7 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> { # define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI #endif diff --git a/contrib/libs/cxxsupp/libcxx/patches/22__config.patch b/contrib/libs/cxxsupp/libcxx/patches/22__config.patch index 222dcfa0e9..89321804cc 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/22__config.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/22__config.patch @@ -1,8 +1,8 @@ diff --git a/include/__config b/include/__config -index 51463fc..c4027b8 100644 +index 6a7bda1..5eeb235 100644 --- a/include/__config +++ b/include/__config -@@ -28,13 +28,35 @@ +@@ -39,13 +39,35 @@ # define _LIBCPP_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__) #endif @@ -39,7 +39,7 @@ index 51463fc..c4027b8 100644 # endif # elif defined(_LIBCPP_APPLE_CLANG_VER) # if _LIBCPP_APPLE_CLANG_VER < 1500 -@@ -83,7 +105,7 @@ +@@ -94,7 +116,7 @@ # define _LIBCPP_OBJECT_FORMAT_ELF 1 # elif defined(__MACH__) # define _LIBCPP_OBJECT_FORMAT_MACHO 1 @@ -48,7 +48,7 @@ index 51463fc..c4027b8 100644 # define _LIBCPP_OBJECT_FORMAT_COFF 1 # elif defined(__wasm__) # define _LIBCPP_OBJECT_FORMAT_WASM 1 -@@ -797,7 +819,7 @@ typedef __char32_t char32_t; +@@ -792,7 +814,7 @@ typedef __char32_t char32_t; // TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing // the length of symbols with an ABI tag. In practice, we should remove the escape hatch and // use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70. @@ -57,7 +57,7 @@ index 51463fc..c4027b8 100644 # define _LIBCPP_HIDE_FROM_ABI \ _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \ __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE)))) -@@ -1049,7 +1071,8 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c +@@ -1045,7 +1067,8 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c defined(__APPLE__) || \ defined(__MVS__) || \ defined(_AIX) || \ @@ -67,7 +67,7 @@ index 51463fc..c4027b8 100644 // clang-format on # define _LIBCPP_HAS_THREAD_API_PTHREAD # elif defined(__Fuchsia__) -@@ -1214,6 +1237,10 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c +@@ -1213,6 +1236,10 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c # define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS # endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES @@ -76,9 +76,9 @@ index 51463fc..c4027b8 100644 +// End of Yandex-specific + // clang-format off - # define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") _Pragma("push_macro(\"refresh()\")") _Pragma("push_macro(\"move(int, int)\")") _Pragma("push_macro(\"erase()\")") - # define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") _Pragma("pop_macro(\"refresh()\")") _Pragma("pop_macro(\"move(int, int)\")") _Pragma("pop_macro(\"erase()\")") -@@ -1416,6 +1443,11 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c + # define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") _Pragma("push_macro(\"refresh\")") _Pragma("push_macro(\"move\")") _Pragma("push_macro(\"erase\")") + # define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") _Pragma("pop_macro(\"refresh\")") _Pragma("pop_macro(\"move\")") _Pragma("pop_macro(\"erase\")") +@@ -1415,6 +1442,11 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c # define _LIBCPP_NO_DESTROY # endif @@ -90,7 +90,7 @@ index 51463fc..c4027b8 100644 # if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) # define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning"))) # else -@@ -1437,6 +1469,12 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c +@@ -1436,6 +1468,12 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c # define _LIBCPP_LIFETIMEBOUND # endif diff --git a/contrib/libs/cxxsupp/libcxx/patches/23__locale.patch b/contrib/libs/cxxsupp/libcxx/patches/23__locale.patch index b0ba17f7da..5769dc3015 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/23__locale.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/23__locale.patch @@ -1,8 +1,8 @@ diff --git a/include/__locale b/include/__locale -index 3ba7ac1..47ae41b 100644 +index 2186db8..42b31f5 100644 --- a/include/__locale +++ b/include/__locale -@@ -16,6 +16,7 @@ +@@ -17,6 +17,7 @@ #include <__mutex/once_flag.h> #include <__type_traits/make_unsigned.h> #include <__utility/no_destroy.h> @@ -10,7 +10,7 @@ index 3ba7ac1..47ae41b 100644 #include <cctype> #include <clocale> #include <cstdint> -@@ -146,8 +147,7 @@ private: +@@ -126,8 +127,7 @@ private: }; class _LIBCPP_EXPORTED_FROM_ABI locale::id { diff --git a/contrib/libs/cxxsupp/libcxx/patches/25__tuple.patch b/contrib/libs/cxxsupp/libcxx/patches/25__tuple.patch index 9f54e661bd..db8b2b2227 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/25__tuple.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/25__tuple.patch @@ -1,42 +1,35 @@ diff --git a/include/__tuple/sfinae_helpers.h b/include/__tuple/sfinae_helpers.h -index b57f2a4..a96947d 100644 +index 90e9b1e..c76e7e0 100644 --- a/include/__tuple/sfinae_helpers.h +++ b/include/__tuple/sfinae_helpers.h -@@ -48,23 +48,29 @@ struct __tuple_sfinae_base { +@@ -46,7 +46,7 @@ struct __tuple_sfinae_base { 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 - + // __tuple_constructible +@@ -54,11 +54,17 @@ struct __tuple_sfinae_base { template <class _Tp, class _Up, -- bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, + bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, - bool = __tuple_like_ext<_Up>::value> -+ bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, -+ bool = __tuple_like_ext<_Up>::value, ++ bool = __tuple_like_ext<_Up>::value, + class = void> - struct __tuple_convertible : public false_type {}; + struct __tuple_constructible : public false_type {}; template <class _Tp, class _Up> --struct __tuple_convertible<_Tp, _Up, true, true> -+struct __tuple_convertible< +-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::__convertible< typename __make_tuple_types<_Tp>::type, - typename __make_tuple_types<_Up>::type > {}; + : public __tuple_sfinae_base::__constructible< typename __make_tuple_types<_Tp>::type, + typename __make_tuple_types<_Up>::type > {}; diff --git a/include/__tuple/tuple_element.h b/include/__tuple/tuple_element.h index 2b9ac66..e811a21 100644 diff --git a/contrib/libs/cxxsupp/libcxx/patches/28-cudacc.patch b/contrib/libs/cxxsupp/libcxx/patches/28-cudacc.patch index db0a5b5c34..012b29cf5d 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/28-cudacc.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/28-cudacc.patch @@ -1,31 +1,5 @@ -diff --git a/include/__config b/include/__config -index c4027b8..e9c86c8 100644 ---- a/include/__config -+++ b/include/__config -@@ -1204,12 +1204,21 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c - # define _LIBCPP_CONSTINIT - # endif - -+# if defined(__CUDACC__) && defined(__noinline__) -+# pragma push_macro("__noinline__") -+# define __noinline__ __noinline__ -+# endif -+ - # if __has_attribute(__noinline__) - # define _LIBCPP_NOINLINE __attribute__((__noinline__)) - # else - # define _LIBCPP_NOINLINE - # endif - -+# if defined(__CUDACC__) && defined(__noinline__) -+# pragma pop_macro("__noinline__") -+# endif -+ - // We often repeat things just for handling wide characters in the library. - // When wide characters are disabled, it can be useful to have a quick way of - // disabling it without having to resort to #if-#endif, which has a larger diff --git a/include/__iterator/reverse_iterator.h b/include/__iterator/reverse_iterator.h -index 79b48bc..b7fe25e 100644 +index 5900b1c..c8f3628 100644 --- a/include/__iterator/reverse_iterator.h +++ b/include/__iterator/reverse_iterator.h @@ -132,7 +132,7 @@ public: @@ -75,10 +49,10 @@ index da585af..b271b8f 100644 return __builtin_isnan(__x); } diff --git a/include/complex b/include/complex -index 02b9db8..5f62c04 100644 +index e996485..d553dad 100644 --- a/include/complex +++ b/include/complex -@@ -1370,6 +1370,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(unsigned long +@@ -1518,6 +1518,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(unsigned long return {0.0, static_cast<double>(__im)}; } @@ -86,7 +60,7 @@ index 02b9db8..5f62c04 100644 _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double __im) { return {0.0f, static_cast<float>(__im)}; } -@@ -1377,6 +1378,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double _ +@@ -1525,6 +1526,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double _ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(unsigned long long __im) { return {0.0f, static_cast<float>(__im)}; } @@ -95,10 +69,10 @@ index 02b9db8..5f62c04 100644 } // namespace literals #endif diff --git a/include/tuple b/include/tuple -index 8c954fc..3126b88 100644 +index 0101d64..f2369fa 100644 --- a/include/tuple +++ b/include/tuple -@@ -307,7 +307,7 @@ class __tuple_leaf { +@@ -305,7 +305,7 @@ class __tuple_leaf { template <class _Tp> static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() { @@ -107,7 +81,7 @@ index 8c954fc..3126b88 100644 return !__reference_binds_to_temporary(_Hp, _Tp); # else return true; -@@ -613,8 +613,16 @@ public: +@@ -611,8 +611,16 @@ public: is_constructible<_Tp, _Up>... > {}; template <class... _Up, @@ -124,5 +98,5 @@ index 8c954fc..3126b88 100644 + >::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) - tuple(_Up&&... __u) _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value)) + tuple(_Up&&... __u) _NOEXCEPT_(_And<is_nothrow_constructible<_Tp, _Up>...>::value) : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), diff --git a/contrib/libs/cxxsupp/libcxx/patches/35-set-map.patch b/contrib/libs/cxxsupp/libcxx/patches/35-set-map.patch index 9d21414e99..102f470314 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/35-set-map.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/35-set-map.patch @@ -1,8 +1,8 @@ diff --git a/include/map b/include/map -index 85fcebf..b78ded2 100644 +index 5b6ec9d..3025557 100644 --- a/include/map +++ b/include/map -@@ -1312,6 +1312,7 @@ public: +@@ -1315,6 +1315,7 @@ public: _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f.__i_, __l.__i_); } @@ -10,7 +10,7 @@ index 85fcebf..b78ded2 100644 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); } #if _LIBCPP_STD_VER >= 17 -@@ -1946,6 +1947,7 @@ public: +@@ -1950,6 +1951,7 @@ public: } #endif @@ -19,10 +19,10 @@ index 85fcebf..b78ded2 100644 _LIBCPP_HIDE_FROM_ABI void swap(multimap& __m) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) { diff --git a/include/set b/include/set -index 08677a9..758df59 100644 +index e2e87e4..90a22c6 100644 --- a/include/set +++ b/include/set -@@ -765,6 +765,7 @@ public: +@@ -768,6 +768,7 @@ public: _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); } _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); } _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); } @@ -30,7 +30,7 @@ index 08677a9..758df59 100644 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); } #if _LIBCPP_STD_VER >= 17 -@@ -1223,6 +1224,7 @@ public: +@@ -1226,6 +1227,7 @@ public: _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); } _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); } _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); } diff --git a/contrib/libs/cxxsupp/libcxx/patches/37-mutex.patch b/contrib/libs/cxxsupp/libcxx/patches/37-mutex.patch index 8dfac89c3c..f410b7b89c 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/37-mutex.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/37-mutex.patch @@ -1,5 +1,5 @@ diff --git a/include/__mutex/once_flag.h b/include/__mutex/once_flag.h -index 5a6f8e0..cdd53d1 100644 +index 9d7baec..9cd3dff 100644 --- a/include/__mutex/once_flag.h +++ b/include/__mutex/once_flag.h @@ -21,6 +21,10 @@ @@ -13,7 +13,7 @@ index 5a6f8e0..cdd53d1 100644 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -@@ -60,7 +64,11 @@ struct _LIBCPP_TEMPLATE_VIS once_flag { +@@ -63,7 +67,11 @@ struct _LIBCPP_TEMPLATE_VIS once_flag { static const _State_type _Complete = ~_State_type(0); private: @@ -25,7 +25,7 @@ index 5a6f8e0..cdd53d1 100644 #ifndef _LIBCPP_CXX03_LANG template <class _Callable, class... _Args> -@@ -115,13 +123,21 @@ void _LIBCPP_HIDE_FROM_ABI __call_once_proxy(void* __vp) { +@@ -118,13 +126,21 @@ void _LIBCPP_HIDE_FROM_ABI __call_once_proxy(void* __vp) { (*__p)(); } @@ -47,7 +47,7 @@ index 5a6f8e0..cdd53d1 100644 typedef tuple<_Callable&&, _Args&&...> _Gp; _Gp __f(std::forward<_Callable>(__func), std::forward<_Args>(__args)...); __call_once_param<_Gp> __p(__f); -@@ -133,7 +149,11 @@ inline _LIBCPP_HIDE_FROM_ABI void call_once(once_flag& __flag, _Callable&& __fun +@@ -136,7 +152,11 @@ inline _LIBCPP_HIDE_FROM_ABI void call_once(once_flag& __flag, _Callable&& __fun template <class _Callable> inline _LIBCPP_HIDE_FROM_ABI void call_once(once_flag& __flag, _Callable& __func) { @@ -59,7 +59,7 @@ index 5a6f8e0..cdd53d1 100644 __call_once_param<_Callable> __p(__func); std::__call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>); } -@@ -141,7 +161,11 @@ inline _LIBCPP_HIDE_FROM_ABI void call_once(once_flag& __flag, _Callable& __func +@@ -144,7 +164,11 @@ inline _LIBCPP_HIDE_FROM_ABI void call_once(once_flag& __flag, _Callable& __func template <class _Callable> inline _LIBCPP_HIDE_FROM_ABI void call_once(once_flag& __flag, const _Callable& __func) { diff --git a/contrib/libs/cxxsupp/libcxx/patches/38-complex.patch b/contrib/libs/cxxsupp/libcxx/patches/38-complex.patch index c7b8fe73fa..a9ca4cd77c 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/38-complex.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/38-complex.patch @@ -1,8 +1,8 @@ diff --git a/include/complex b/include/complex -index 5f62c04..1b82c25 100644 +index d553dad..95be60c 100644 --- a/include/complex +++ b/include/complex -@@ -1254,7 +1254,8 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) { +@@ -1341,7 +1341,8 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) { } if (std::__constexpr_isinf(__x.imag())) return complex<_Tp>(__pi / _Tp(2), -__x.imag()); diff --git a/contrib/libs/cxxsupp/libcxx/patches/39-optional.patch b/contrib/libs/cxxsupp/libcxx/patches/39-optional.patch index 4931baf11c..0b5b5ed41d 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/39-optional.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/39-optional.patch @@ -1,5 +1,5 @@ diff --git a/include/optional b/include/optional -index 73da0a8..cfc6be6 100644 +index 99bfd0d..71ccbea 100644 --- a/include/optional +++ b/include/optional @@ -294,7 +294,7 @@ struct __optional_destruct_base<_Tp, false> { diff --git a/contrib/libs/cxxsupp/libcxx/patches/40-deque.patch b/contrib/libs/cxxsupp/libcxx/patches/40-deque.patch index 36fbbf10f7..7c10cf4bbc 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/40-deque.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/40-deque.patch @@ -1,5 +1,5 @@ diff --git a/include/deque b/include/deque -index d0520b6..6389627 100644 +index 85ea9c6..2c6773a 100644 --- a/include/deque +++ b/include/deque @@ -249,7 +249,9 @@ class _LIBCPP_TEMPLATE_VIS deque; @@ -22,7 +22,7 @@ index d0520b6..6389627 100644 _LIBCPP_HIDE_FROM_ABI bool __invariants() const { if (!__map_.__invariants()) -@@ -2457,7 +2459,7 @@ inline void deque<_Tp, _Allocator>::swap(deque& __c) +@@ -2494,7 +2496,7 @@ inline void deque<_Tp, _Allocator>::swap(deque& __c) } template <class _Tp, class _Allocator> diff --git a/contrib/libs/cxxsupp/libcxx/patches/41-exception.patch b/contrib/libs/cxxsupp/libcxx/patches/41-exception.patch index 47a8f084df..172c087738 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/41-exception.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/41-exception.patch @@ -1,8 +1,8 @@ diff --git a/include/__exception/exception_ptr.h b/include/__exception/exception_ptr.h -index 970d819..4b8276a 100644 +index 53e2f71..b340ac0 100644 --- a/include/__exception/exception_ptr.h +++ b/include/__exception/exception_ptr.h -@@ -21,8 +21,6 @@ +@@ -49,8 +49,6 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception( namespace std { // purposefully not using versioning namespace @@ -11,7 +11,7 @@ index 970d819..4b8276a 100644 class _LIBCPP_EXPORTED_FROM_ABI exception_ptr { void* __ptr_; -@@ -44,10 +42,18 @@ public: +@@ -77,10 +75,18 @@ public: return !(__x == __y); } @@ -30,7 +30,7 @@ index 970d819..4b8276a 100644 template <class _Ep> _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS -@@ -64,34 +70,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { +@@ -114,34 +120,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { #else // _LIBCPP_ABI_MICROSOFT @@ -66,7 +66,7 @@ index 970d819..4b8276a 100644 // This is a built-in template function which automagically extracts the required // information. -@@ -99,7 +78,7 @@ template <class _E> +@@ -149,7 +128,7 @@ template <class _E> void* __GetExceptionInfo(_E); template <class _Ep> diff --git a/contrib/libs/cxxsupp/libcxx/patches/43-string.patch b/contrib/libs/cxxsupp/libcxx/patches/43-string.patch index bf22baeb6e..2035bfab64 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/43-string.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/43-string.patch @@ -1,5 +1,5 @@ diff --git a/include/string b/include/string -index fdffca5..cb7bac6 100644 +index ca5b3fa..653aa6f 100644 --- a/include/string +++ b/include/string @@ -83,6 +83,7 @@ template <> struct char_traits<char32_t>; @@ -10,7 +10,7 @@ index fdffca5..cb7bac6 100644 public: // types: typedef traits traits_type; -@@ -961,9 +962,10 @@ public: +@@ -981,9 +982,10 @@ public: __init(__s, traits_type::length(__s)); } @@ -22,7 +22,7 @@ index fdffca5..cb7bac6 100644 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n) : __r_(__default_init_tag(), __default_init_tag()) { -@@ -971,6 +973,8 @@ public: +@@ -991,6 +993,8 @@ public: __init(__s, __n); } @@ -31,7 +31,7 @@ index fdffca5..cb7bac6 100644 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) : __r_(__default_init_tag(), __a) { -@@ -1135,7 +1139,7 @@ public: +@@ -1155,7 +1159,7 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const value_type* __s) { return assign(__s); } @@ -39,8 +39,8 @@ index fdffca5..cb7bac6 100644 +#if _LIBCPP_STD_VER >= 20 basic_string& operator=(nullptr_t) = delete; #endif - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& operator=(value_type __c); -@@ -1192,6 +1196,10 @@ public: + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c); +@@ -1212,6 +1216,10 @@ public: return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1; } @@ -51,7 +51,7 @@ index fdffca5..cb7bac6 100644 _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n, value_type __c); _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n) { resize(__n, value_type()); } -@@ -1739,7 +1747,7 @@ public: +@@ -1759,7 +1767,7 @@ public: } #endif diff --git a/contrib/libs/cxxsupp/libcxx/patches/45-type-traits.patch b/contrib/libs/cxxsupp/libcxx/patches/45-type-traits.patch index aac908808e..8ae807e907 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/45-type-traits.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/45-type-traits.patch @@ -129,16 +129,50 @@ index 9561b7b..5013724 100644 _LIBCPP_END_NAMESPACE_STD +diff --git a/include/__type_traits/remove_cv.h b/include/__type_traits/remove_cv.h +index 8e1c043..639a9c4 100644 +--- a/include/__type_traits/remove_cv.h ++++ b/include/__type_traits/remove_cv.h +@@ -21,10 +21,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD + + template <class _Tp> + struct remove_cv { ++#if __has_builtin(__remove_cv) + using type _LIBCPP_NODEBUG = __remove_cv(_Tp); ++#else ++ typedef __remove_volatile_t<__remove_const_t<_Tp> > type; ++#endif + }; + +-#if defined(_LIBCPP_COMPILER_GCC) ++#if defined(_LIBCPP_COMPILER_GCC) || !__has_builtin(__remove_cv) + template <class _Tp> + using __remove_cv_t = typename remove_cv<_Tp>::type; + #else diff --git a/include/__type_traits/remove_cvref.h b/include/__type_traits/remove_cvref.h -index e8e8745..3ec17b4 100644 +index 55f894d..0334771 100644 --- a/include/__type_traits/remove_cvref.h +++ b/include/__type_traits/remove_cvref.h -@@ -20,7 +20,7 @@ - - _LIBCPP_BEGIN_NAMESPACE_STD +@@ -28,6 +28,10 @@ struct __remove_cvref_gcc { --#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC) -+#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC) && !defined(__CUDACC__) template <class _Tp> - using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); + using __remove_cvref_t _LIBCPP_NODEBUG = typename __remove_cvref_gcc<_Tp>::type; ++// compatibility with cuda && clang14 ++#elif defined(__CUDACC__) || !__has_builtin(__remove_cvref) ++template <class _Tp> ++using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >; #else + template <class _Tp> + using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); +@@ -39,7 +43,11 @@ using __is_same_uncvref = _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> > + #if _LIBCPP_STD_VER >= 20 + template <class _Tp> + struct remove_cvref { ++#if defined(__CUDACC__) || !__has_builtin(__remove_cvref) ++ using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>; ++#else + using type _LIBCPP_NODEBUG = __remove_cvref(_Tp); ++#endif + }; + + template <class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/patches/46-typeinfo-variant-valarray.patch b/contrib/libs/cxxsupp/libcxx/patches/46-typeinfo-variant-valarray.patch index d0e3de8ff0..9c9ba9afa3 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/46-typeinfo-variant-valarray.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/46-typeinfo-variant-valarray.patch @@ -1,8 +1,8 @@ diff --git a/include/typeinfo b/include/typeinfo -index ed89a4f..aa18b3b 100644 +index d4e5e4e..d39d8ab 100644 --- a/include/typeinfo +++ b/include/typeinfo -@@ -322,24 +322,40 @@ public: +@@ -321,24 +321,40 @@ public: class _LIBCPP_EXPORTED_FROM_ABI bad_cast : public exception { public: diff --git a/contrib/libs/cxxsupp/libcxx/patches/47-vector.patch b/contrib/libs/cxxsupp/libcxx/patches/47-vector.patch index 2f620a3fc8..8e589ccc0f 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/47-vector.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/47-vector.patch @@ -1,5 +1,5 @@ diff --git a/include/vector b/include/vector -index 3abc917..15e00d9 100644 +index 89cbdf0..4a875b6 100644 --- a/include/vector +++ b/include/vector @@ -347,6 +347,7 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ @@ -10,7 +10,7 @@ index 3abc917..15e00d9 100644 #include <__type_traits/noexcept_move_assign_container.h> #include <__type_traits/type_identity.h> #include <__utility/exception_guard.h> -@@ -704,12 +705,22 @@ public: +@@ -705,12 +706,22 @@ public: _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __position); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last); @@ -34,7 +34,7 @@ index 3abc917..15e00d9 100644 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz, const_reference __x); -@@ -792,7 +803,7 @@ private: +@@ -793,7 +804,7 @@ private: template <class _InputIterator, class _Sentinel> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n); @@ -43,7 +43,7 @@ index 3abc917..15e00d9 100644 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator __make_iter(pointer __p) _NOEXCEPT { -@@ -1071,6 +1082,19 @@ vector<_Tp, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __ +@@ -1100,6 +1111,19 @@ vector<_Tp, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __ __tx.__pos_ = std::__uninitialized_allocator_copy(__alloc(), __first, __last, __tx.__pos_); } @@ -63,7 +63,7 @@ index 3abc917..15e00d9 100644 // Default constructs __n objects starting at __end_ // throws if construction throws // Postcondition: size() == size() + __n -@@ -1750,6 +1774,25 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __s +@@ -1778,6 +1802,25 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __s this->__destruct_at_end(this->__begin_ + __sz); } @@ -89,7 +89,7 @@ index 3abc917..15e00d9 100644 template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x) #if _LIBCPP_STD_VER >= 14 -@@ -1785,6 +1828,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<_Tp, _Allocator>::__invariants() const +@@ -1813,6 +1856,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<_Tp, _Allocator>::__invariants() const return true; } @@ -97,7 +97,7 @@ index 3abc917..15e00d9 100644 // vector<bool> template <class _Allocator> -@@ -2090,7 +2134,9 @@ public: +@@ -2118,7 +2162,9 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __position); _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __first, const_iterator __last); @@ -108,7 +108,7 @@ index 3abc917..15e00d9 100644 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(vector&) #if _LIBCPP_STD_VER >= 14 -@@ -2844,6 +2890,30 @@ struct _LIBCPP_TEMPLATE_VIS hash<vector<bool, _Allocator> > +@@ -2872,6 +2918,30 @@ struct _LIBCPP_TEMPLATE_VIS hash<vector<bool, _Allocator> > return __vec.__hash_code(); } }; @@ -116,7 +116,7 @@ index 3abc917..15e00d9 100644 +// 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 ++ _LIBCPP_HIDE_FROM_ABI + size_t operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT { + size_t __h = 0; + size_t __idx = 0; diff --git a/contrib/libs/cxxsupp/libcxx/patches/49-string-view.patch b/contrib/libs/cxxsupp/libcxx/patches/49-string-view.patch index 878fe4f45e..c122effe72 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/49-string-view.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/49-string-view.patch @@ -1,8 +1,8 @@ diff --git a/include/string_view b/include/string_view -index 909224f..4f59a52 100644 +index e0dd5c5..2ddb931 100644 --- a/include/string_view +++ b/include/string_view -@@ -303,6 +303,8 @@ public: +@@ -306,6 +306,8 @@ public: _LIBCPP_HIDE_FROM_ABI basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default; @@ -11,7 +11,7 @@ index 909224f..4f59a52 100644 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT : __data_(__s), __size_(__len) { -@@ -337,7 +339,7 @@ public: +@@ -343,7 +345,7 @@ public: _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view(const _CharT* __s) : __data_(__s), __size_(std::__char_traits_length_checked<_Traits>(__s)) {} @@ -20,7 +20,7 @@ index 909224f..4f59a52 100644 basic_string_view(nullptr_t) = delete; #endif -@@ -659,7 +661,7 @@ public: +@@ -665,7 +667,7 @@ public: } #endif diff --git a/contrib/libs/cxxsupp/libcxx/patches/56-iostream.patch b/contrib/libs/cxxsupp/libcxx/patches/56-iostream.patch index f8918072cf..30b9a04852 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/56-iostream.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/56-iostream.patch @@ -1,8 +1,8 @@ diff --git a/include/ostream b/include/ostream -index 28e0aef..90ff8ca 100644 +index 42819ce..51778a2 100644 --- a/include/ostream +++ b/include/ostream -@@ -949,7 +949,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) { +@@ -964,7 +964,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) { std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); } @@ -12,155 +12,131 @@ index 28e0aef..90ff8ca 100644 # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class _Traits> diff --git a/src/iostream.cpp b/src/iostream.cpp -index bb49e26..93edf3a 100644 +index c5ad77a..029de4a 100644 --- a/src/iostream.cpp +++ b/src/iostream.cpp -@@ -21,88 +21,128 @@ +@@ -21,80 +21,120 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) -+_ALIGNAS_TYPE(istream) char _cin[sizeof(istream)]; ++alignas(istream) char _cin[sizeof(istream)]; +_LIBCPP_EXPORTED_FROM_ABI istream& cin = *reinterpret_cast<istream*>(_cin); +#else - _ALIGNAS_TYPE(istream) - _LIBCPP_EXPORTED_FROM_ABI char cin[sizeof(istream)] --#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) -+# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + alignas(istream) _LIBCPP_EXPORTED_FROM_ABI 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 + #endif ; +#endif - _ALIGNAS_TYPE(__stdinbuf<char>) static char __cin[sizeof(__stdinbuf<char>)]; + alignas(__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)]; ++alignas(wistream) char _wcin[sizeof(wistream)]; +_LIBCPP_EXPORTED_FROM_ABI wistream& wcin = *reinterpret_cast<wistream*>(_wcin); +# else - _ALIGNAS_TYPE(wistream) - _LIBCPP_EXPORTED_FROM_ABI char wcin[sizeof(wistream)] --# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) -+# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + alignas(wistream) _LIBCPP_EXPORTED_FROM_ABI 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 + # endif ; -+# endif - _ALIGNAS_TYPE(__stdinbuf<wchar_t>) static char __wcin[sizeof(__stdinbuf<wchar_t>)]; ++#endif + alignas(__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)]; ++alignas(ostream) char _cout[sizeof(ostream)]; +_LIBCPP_EXPORTED_FROM_ABI ostream& cout = *reinterpret_cast<ostream*>(_cout); +#else - _ALIGNAS_TYPE(ostream) - _LIBCPP_EXPORTED_FROM_ABI char cout[sizeof(ostream)] --#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) -+# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI 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 + #endif ; +#endif - _ALIGNAS_TYPE(__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)]; + alignas(__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)]; ++alignas(wostream) char _wcout[sizeof(wostream)]; +_LIBCPP_EXPORTED_FROM_ABI wostream& wcout = *reinterpret_cast<wostream*>(_wcout); +# else - _ALIGNAS_TYPE(wostream) - _LIBCPP_EXPORTED_FROM_ABI char wcout[sizeof(wostream)] --# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) -+# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI 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 + # endif ; -+# endif - _ALIGNAS_TYPE(__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)]; ++#endif + alignas(__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)]; ++alignas(ostream) char _cerr[sizeof(ostream)]; +_LIBCPP_EXPORTED_FROM_ABI ostream& cerr = *reinterpret_cast<ostream*>(_cerr); +#else - _ALIGNAS_TYPE(ostream) - _LIBCPP_EXPORTED_FROM_ABI char cerr[sizeof(ostream)] --#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) -+# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI 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 + #endif ; +#endif - _ALIGNAS_TYPE(__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)]; + alignas(__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)]; ++alignas(wostream) char _wcerr[sizeof(wostream)]; +_LIBCPP_EXPORTED_FROM_ABI wostream& wcerr = *reinterpret_cast<wostream*>(_wcerr); +# else - _ALIGNAS_TYPE(wostream) - _LIBCPP_EXPORTED_FROM_ABI char wcerr[sizeof(wostream)] --# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) -+# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI 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 + # endif ; +# endif - _ALIGNAS_TYPE(__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)]; + alignas(__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)]; ++alignas(ostream) char _clog[sizeof(ostream)]; +_LIBCPP_EXPORTED_FROM_ABI ostream& clog = *reinterpret_cast<ostream*>(_clog); +#else - _ALIGNAS_TYPE(ostream) - _LIBCPP_EXPORTED_FROM_ABI char clog[sizeof(ostream)] --#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) -+# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI 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 + #endif ; +#endif #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) -+_ALIGNAS_TYPE(wostream) char _wclog[sizeof(wostream)]; ++alignas(wostream) char _wclog[sizeof(wostream)]; +_LIBCPP_EXPORTED_FROM_ABI wostream& wclog = *reinterpret_cast<wostream*>(_wclog); +# else - _ALIGNAS_TYPE(wostream) - _LIBCPP_EXPORTED_FROM_ABI char wclog[sizeof(wostream)] --# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) -+# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) + alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI 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 ; -+# 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 -@@ -136,19 +176,19 @@ public: +@@ -128,19 +168,19 @@ public: DoIOSInit::DoIOSInit() { force_locale_initialization(); @@ -188,7 +164,7 @@ index bb49e26..93edf3a 100644 wcin_ptr->tie(wcout_ptr); std::unitbuf(*wcerr_ptr); -@@ -157,15 +197,15 @@ DoIOSInit::DoIOSInit() { +@@ -149,15 +189,15 @@ DoIOSInit::DoIOSInit() { } DoIOSInit::~DoIOSInit() { diff --git a/contrib/libs/cxxsupp/libcxx/patches/57-locale.patch b/contrib/libs/cxxsupp/libcxx/patches/57-locale.patch index 0f604ccffe..4b3a2e4827 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/57-locale.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/57-locale.patch @@ -1,8 +1,8 @@ diff --git a/src/locale.cpp b/src/locale.cpp -index 73b24db..433394d 100644 +index 7fdd5be..1b937dc 100644 --- a/src/locale.cpp +++ b/src/locale.cpp -@@ -40,8 +40,8 @@ +@@ -38,8 +38,8 @@ # include <langinfo.h> #endif @@ -12,7 +12,7 @@ index 73b24db..433394d 100644 // On Linux, wint_t and wchar_t have different signed-ness, and this causes // lots of noise in the build log, but no bugs that I know of. -@@ -595,8 +595,17 @@ void locale::facet::__on_zero_shared() noexcept { delete this; } +@@ -593,8 +593,17 @@ void locale::facet::__on_zero_shared() noexcept { delete this; } constinit int32_t locale::id::__next_id = 0; long locale::id::__get() { @@ -32,7 +32,7 @@ index 73b24db..433394d 100644 } // template <> class collate_byname<char> -@@ -897,6 +906,11 @@ extern "C" const int** __ctype_tolower_loc(); +@@ -895,6 +904,11 @@ extern "C" const int** __ctype_tolower_loc(); extern "C" const int** __ctype_toupper_loc(); #endif @@ -44,7 +44,7 @@ index 73b24db..433394d 100644 #ifdef _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE const ctype<char>::mask* ctype<char>::classic_table() noexcept { // clang-format off -@@ -992,6 +1006,8 @@ const ctype<char>::mask* ctype<char>::classic_table() noexcept { +@@ -990,6 +1004,8 @@ const ctype<char>::mask* 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; @@ -53,7 +53,7 @@ index 73b24db..433394d 100644 # elif defined(_AIX) return (const unsigned int*)__lc_ctype_ptr->obj->mask; # elif defined(__MVS__) -@@ -3646,15 +3662,25 @@ __codecvt_utf16<char32_t, true>::result __codecvt_utf16<char32_t, true>::do_out( +@@ -3644,15 +3660,25 @@ __codecvt_utf16<char32_t, true>::result __codecvt_utf16<char32_t, true>::do_out( extern_type* to, extern_type* to_end, extern_type*& to_nxt) const { @@ -85,7 +85,7 @@ index 73b24db..433394d 100644 return r; } -@@ -3714,7 +3740,7 @@ __codecvt_utf8_utf16<wchar_t>::result __codecvt_utf8_utf16<wchar_t>::do_out( +@@ -3712,7 +3738,7 @@ __codecvt_utf8_utf16<wchar_t>::result __codecvt_utf8_utf16<wchar_t>::do_out( extern_type* to, extern_type* to_end, extern_type*& to_nxt) const { @@ -94,7 +94,7 @@ index 73b24db..433394d 100644 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; -@@ -3743,7 +3769,7 @@ __codecvt_utf8_utf16<wchar_t>::result __codecvt_utf8_utf16<wchar_t>::do_in( +@@ -3741,7 +3767,7 @@ __codecvt_utf8_utf16<wchar_t>::result __codecvt_utf8_utf16<wchar_t>::do_in( 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; @@ -103,7 +103,7 @@ index 73b24db..433394d 100644 uint16_t* _to = reinterpret_cast<uint16_t*>(to); uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); uint16_t* _to_nxt = _to; -@@ -3882,12 +3908,18 @@ __codecvt_utf8_utf16<char32_t>::result __codecvt_utf8_utf16<char32_t>::do_in( +@@ -3880,12 +3906,18 @@ __codecvt_utf8_utf16<char32_t>::result __codecvt_utf8_utf16<char32_t>::do_in( 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; @@ -128,7 +128,7 @@ index 73b24db..433394d 100644 return r; } -@@ -5125,7 +5157,7 @@ static void __init_pat( +@@ -5123,7 +5155,7 @@ static void __init_pat( // 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. @@ -137,7 +137,7 @@ index 73b24db..433394d 100644 } return; default: -@@ -5147,7 +5179,7 @@ static void __init_pat( +@@ -5145,7 +5177,7 @@ static void __init_pat( // 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. @@ -146,7 +146,7 @@ index 73b24db..433394d 100644 } return; case 2: // Space between sign and currency or value. -@@ -5176,7 +5208,7 @@ static void __init_pat( +@@ -5174,7 +5206,7 @@ static void __init_pat( // 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. @@ -155,7 +155,7 @@ index 73b24db..433394d 100644 } pat.field[1] = none; pat.field[2] = symbol; -@@ -5218,7 +5250,7 @@ static void __init_pat( +@@ -5216,7 +5248,7 @@ static void __init_pat( // 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. @@ -164,7 +164,7 @@ index 73b24db..433394d 100644 } return; default: -@@ -5240,7 +5272,7 @@ static void __init_pat( +@@ -5238,7 +5270,7 @@ static void __init_pat( // 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. @@ -173,7 +173,7 @@ index 73b24db..433394d 100644 } return; case 2: // Space between sign and currency or value. -@@ -5279,7 +5311,7 @@ static void __init_pat( +@@ -5277,7 +5309,7 @@ static void __init_pat( // 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. diff --git a/contrib/libs/cxxsupp/libcxx/patches/59-mutex.patch b/contrib/libs/cxxsupp/libcxx/patches/59-mutex.patch index d76bbac044..595b336789 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/59-mutex.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/59-mutex.patch @@ -1,5 +1,5 @@ diff --git a/src/call_once.cpp b/src/call_once.cpp -index b596518..7f5aef1 100644 +index 5744347..2b981b6 100644 --- a/src/call_once.cpp +++ b/src/call_once.cpp @@ -28,7 +28,12 @@ static constinit __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER; @@ -46,7 +46,7 @@ index b596518..7f5aef1 100644 __libcpp_condvar_broadcast(&cv); guard.__complete(); diff --git a/src/mutex.cpp b/src/mutex.cpp -index ce85475..13c6324 100644 +index 2f8504d..26b26b6 100644 --- a/src/mutex.cpp +++ b/src/mutex.cpp @@ -12,7 +12,9 @@ diff --git a/contrib/libs/cxxsupp/libcxx/patches/60-chrono.patch b/contrib/libs/cxxsupp/libcxx/patches/60-chrono.patch index fe9cdfe82c..f9336f7e1d 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/60-chrono.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/60-chrono.patch @@ -1,8 +1,8 @@ diff --git a/include/chrono b/include/chrono -index b3ed9ac..e05c8bc 100644 +index b3b260c..e158436 100644 --- a/include/chrono +++ b/include/chrono -@@ -829,7 +829,7 @@ constexpr chrono::year operator ""y(unsigned lo +@@ -853,7 +853,7 @@ constexpr chrono::year operator ""y(unsigned lo // [time.syn] #include <compare> diff --git a/contrib/libs/cxxsupp/libcxx/patches/61-remove-includes.sh b/contrib/libs/cxxsupp/libcxx/patches/61-remove-includes.sh index 321e73f118..3c9bbc3d6e 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/61-remove-includes.sh +++ b/contrib/libs/cxxsupp/libcxx/patches/61-remove-includes.sh @@ -1,5 +1,6 @@ sed -i 's/#\( *\)include <__pstl_algorithm>/#error #\1include <__pstl_algorithm>/' include/algorithm sed -i 's/#\( *\)include <__pstl_execution>/#error #\1include <__pstl_execution>/' include/execution -sed -i 's/#\( *\)include <__external_threading>/#error #\1#include <__external_threading>/' include/__threading_support +sed -i 's/#\( *\)include <__external_threading>/#error #\1#include <__external_threading>/' include/__thread/support/external.h sed -i 's/#\( *\)include <__pstl_memory>/#error #\1include <__pstl_memory>/' include/memory sed -i 's/#\( *\)include <__pstl_numeric>/#error #\1include <__pstl_numeric>/' include/numeric +sed -i 's|#\( *\)include <__locale_dir/locale_base_api/solaris.h>|#error #\1include <__locale_dir/locale_base_api/solaris.h>|' include/__locale_dir/locale_base_api.h diff --git a/contrib/libs/cxxsupp/libcxx/patches/65-string-iterator-pointer.patch b/contrib/libs/cxxsupp/libcxx/patches/65-string-iterator-pointer.patch index b5f596b3e0..8afcfd1880 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/65-string-iterator-pointer.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/65-string-iterator-pointer.patch @@ -1,8 +1,8 @@ diff --git a/include/string b/include/string -index cb7bac6..bc76545 100644 +index 653aa6f..c7f7bcb 100644 --- a/include/string +++ b/include/string -@@ -737,9 +737,14 @@ public: +@@ -753,9 +753,14 @@ public: "[allocator.requirements] states that rebinding an allocator to the same type should result in the " "original allocator"); @@ -17,15 +17,15 @@ index cb7bac6..bc76545 100644 typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; -@@ -1144,6 +1149,7 @@ public: +@@ -1164,6 +1169,7 @@ public: #endif - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& operator=(value_type __c); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c); +#ifndef _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT { return __make_iterator(__get_pointer()); } -@@ -1156,6 +1162,20 @@ public: +@@ -1176,6 +1182,20 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT { return __make_const_iterator(__get_pointer() + size()); } diff --git a/contrib/libs/cxxsupp/libcxx/patches/66-vector-iterator-pointer.patch b/contrib/libs/cxxsupp/libcxx/patches/66-vector-iterator-pointer.patch index 7a40ae2772..93b767c6be 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/66-vector-iterator-pointer.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/66-vector-iterator-pointer.patch @@ -1,8 +1,8 @@ diff --git a/include/vector b/include/vector -index 15e00d9..fb92f68 100644 +index 4a875b6..3aeb250 100644 --- a/include/vector +++ b/include/vector -@@ -400,9 +400,14 @@ public: +@@ -401,9 +401,14 @@ public: typedef typename __alloc_traits::difference_type difference_type; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; @@ -17,7 +17,7 @@ index 15e00d9..fb92f68 100644 typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; -@@ -806,12 +811,8 @@ private: +@@ -807,12 +812,8 @@ private: void __append_uninitialized(size_type __n); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x); @@ -32,14 +32,14 @@ index 15e00d9..fb92f68 100644 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer -@@ -1360,6 +1361,28 @@ vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel +@@ -1389,6 +1390,28 @@ vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel } } +// We need to save the make_iter function and replace all constructor calls with it +// Made to support pointer iterators +template <class _Tp, class _Allocator> -+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::iterator ++_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator +vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT { +#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 + return iterator(__p); @@ -49,7 +49,7 @@ index 15e00d9..fb92f68 100644 +} + +template <class _Tp, class _Allocator> -+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::const_iterator ++_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::const_iterator +vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT { +#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 + return const_iterator(__p); diff --git a/contrib/libs/cxxsupp/libcxx/patches/67-uninitialized-algorithms.patch b/contrib/libs/cxxsupp/libcxx/patches/67-uninitialized-algorithms.patch deleted file mode 100644 index 8e5030e631..0000000000 --- a/contrib/libs/cxxsupp/libcxx/patches/67-uninitialized-algorithms.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/include/__memory/uninitialized_algorithms.h b/include/__memory/uninitialized_algorithms.h -index 2a4ecf6..e2a6f8d 100644 ---- a/include/__memory/uninitialized_algorithms.h -+++ b/include/__memory/uninitialized_algorithms.h -@@ -558,6 +558,7 @@ struct __allocator_has_trivial_copy_construct : _Not<__has_construct<_Alloc, _Ty - template <class _Type> - struct __allocator_has_trivial_copy_construct<allocator<_Type>, _Type> : true_type {}; - -+#ifndef __CUDACC__ - template <class _Alloc, - class _In, - class _RawTypeIn = __remove_const_t<_In>, -@@ -581,6 +582,7 @@ __uninitialized_allocator_copy_impl(_Alloc&, _In* __first1, _In* __last1, _Out* - return std::copy(__first1, __last1, const_cast<_RawTypeIn*>(__first2)); - } - } -+#endif // __CUDACC__ - - template <class _Alloc, class _Iter1, class _Sent1, class _Iter2> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 -@@ -623,7 +625,7 @@ struct __allocator_has_trivial_move_construct : _Not<__has_construct<_Alloc, _Ty - template <class _Type> - struct __allocator_has_trivial_move_construct<allocator<_Type>, _Type> : true_type {}; - --#ifndef _LIBCPP_COMPILER_GCC -+#if !defined(_LIBCPP_COMPILER_GCC) && !defined(__CUDACC__) - template < - class _Alloc, - class _Iter1, -@@ -644,7 +646,7 @@ __uninitialized_allocator_move_if_noexcept(_Alloc&, _Iter1 __first1, _Iter1 __la - return std::move(__first1, __last1, __first2); - } - } --#endif // _LIBCPP_COMPILER_GCC -+#endif // !defined(_LIBCPP_COMPILER_GCC) && !defined(__CUDACC__) - - _LIBCPP_END_NAMESPACE_STD - diff --git a/contrib/libs/cxxsupp/libcxx/patches/68-asan-contiguous-container.patch b/contrib/libs/cxxsupp/libcxx/patches/68-asan-contiguous-container.patch index 711f3c0dc9..7895c16330 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/68-asan-contiguous-container.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/68-asan-contiguous-container.patch @@ -1,8 +1,8 @@ diff --git a/include/__config b/include/__config -index e9c86c8..de02565 100644 +index 5eeb235..255b858 100644 --- a/include/__config +++ b/include/__config -@@ -1039,10 +1039,12 @@ typedef __char32_t char32_t; +@@ -1035,10 +1035,12 @@ typedef __char32_t char32_t; # ifndef _LIBCPP_HAS_NO_ASAN extern "C" _LIBCPP_EXPORTED_FROM_ABI void __sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*); @@ -16,7 +16,7 @@ index e9c86c8..de02565 100644 // Try to find out if RTTI is disabled. diff --git a/include/deque b/include/deque -index 6389627..314d5bd 100644 +index 2c6773a..26bacb7 100644 --- a/include/deque +++ b/include/deque @@ -888,7 +888,7 @@ private: @@ -28,9 +28,9 @@ index 6389627..314d5bd 100644 if (__beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value) __sanitizer_annotate_double_ended_contiguous_container( __beg, __end, __old_con_beg, __old_con_end, __new_con_beg, __new_con_end); -@@ -1052,7 +1052,7 @@ private: - __block_start, __block_end, __block_start, __block_start, __block_start, __block_end); +@@ -1079,7 +1079,7 @@ private: } + #endif } -#if !defined(_LIBCPP_HAS_NO_ASAN) +#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(_LIBCPP_NO_ASAN_CONTIGUOUS_CONTAINER_FEATURES) @@ -38,15 +38,15 @@ index 6389627..314d5bd 100644 public: _LIBCPP_HIDE_FROM_ABI bool __verify_asan_annotations() const _NOEXCEPT { diff --git a/include/vector b/include/vector -index fb92f68..9e512b3 100644 +index 3aeb250..cc80875 100644 --- a/include/vector +++ b/include/vector -@@ -849,7 +849,7 @@ private: - (void)__end; +@@ -848,7 +848,7 @@ private: + __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const { (void)__old_mid; (void)__new_mid; -#ifndef _LIBCPP_HAS_NO_ASAN +#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(_LIBCPP_NO_ASAN_CONTIGUOUS_CONTAINER_FEATURES) + const void* __beg = data(); + const void* __end = data() + capacity(); if (!__libcpp_is_constant_evaluated() && __beg != nullptr && - __asan_annotate_container_with_allocator<_Allocator>::value) - __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid); diff --git a/contrib/libs/cxxsupp/libcxx/patches/70-auto-type-traits.sh b/contrib/libs/cxxsupp/libcxx/patches/70-auto-type-traits.sh index 4e0b2806a1..e35c5b7b79 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/70-auto-type-traits.sh +++ b/contrib/libs/cxxsupp/libcxx/patches/70-auto-type-traits.sh @@ -3,6 +3,11 @@ replace_has_builtin_in() sed 's/#if __has_builtin('${1}')/#if __has_builtin('${1}') \&\& !defined(__CUDACC__)/g' -i include/__type_traits/${2} } +replace_has_extension_in() +{ + sed 's/#if __has_extension('${1}')/#if __has_extension('${1}') \&\& !defined(__CUDACC__)/g' -i include/__type_traits/${2} +} + replace_has_builtin_in __array_extent extent.h replace_has_builtin_in __is_compound is_compound.h replace_has_builtin_in __is_const is_const.h @@ -21,3 +26,6 @@ replace_has_builtin_in __is_trivially_destructible is_trivially_destructible.h replace_has_builtin_in __is_unsigned is_unsigned.h replace_has_builtin_in __is_void is_void.h replace_has_builtin_in __is_volatile is_volatile.h +replace_has_builtin_in __is_trivially_relocatable is_trivially_relocatable.h + +replace_has_extension_in datasizeof datasizeof.h diff --git a/contrib/libs/cxxsupp/libcxx/patches/71-char-traits-deprecated.patch b/contrib/libs/cxxsupp/libcxx/patches/71-char-traits-deprecated.patch new file mode 100644 index 0000000000..1cb832634f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/patches/71-char-traits-deprecated.patch @@ -0,0 +1,111 @@ +diff --git a/include/__string/char_traits.h b/include/__string/char_traits.h +index 5880d3a..91b413a 100644 +--- a/include/__string/char_traits.h ++++ b/include/__string/char_traits.h +@@ -73,6 +73,106 @@ exposition-only to document what members a char_traits specialization should pro + }; + */ + ++// ++// Temporary extension to provide a base template for std::char_traits. ++// TODO(LLVM-19): Remove this class. ++// ++#if !defined(_LIBCPP_CHAR_TRAITS_REMOVE_BASE_SPECIALIZATION) ++template <class _CharT> ++struct _LIBCPP_DEPRECATED_( ++ "char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided " ++ "for a temporary period. It will be removed in LLVM 19, so please migrate off of it.") char_traits { ++ using char_type = _CharT; ++ using int_type = int; ++ using off_type = streamoff; ++ using pos_type = streampos; ++ using state_type = mbstate_t; ++ ++ static inline void _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI ++ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT { ++ __c1 = __c2; ++ } ++ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT { ++ return __c1 == __c2; ++ } ++ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT { ++ return __c1 < __c2; ++ } ++ ++ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int ++ compare(const char_type* __s1, const char_type* __s2, size_t __n) { ++ for (; __n; --__n, ++__s1, ++__s2) { ++ if (lt(*__s1, *__s2)) ++ return -1; ++ if (lt(*__s2, *__s1)) ++ return 1; ++ } ++ return 0; ++ } ++ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) { ++ size_t __len = 0; ++ for (; !eq(*__s, char_type(0)); ++__s) ++ ++__len; ++ return __len; ++ } ++ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type* ++ find(const char_type* __s, size_t __n, const char_type& __a) { ++ for (; __n; --__n) { ++ if (eq(*__s, __a)) ++ return __s; ++ ++__s; ++ } ++ return nullptr; ++ } ++ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* ++ move(char_type* __s1, const char_type* __s2, size_t __n) { ++ if (__n == 0) ++ return __s1; ++ char_type* __r = __s1; ++ if (__s1 < __s2) { ++ for (; __n; --__n, ++__s1, ++__s2) ++ assign(*__s1, *__s2); ++ } else if (__s2 < __s1) { ++ __s1 += __n; ++ __s2 += __n; ++ for (; __n; --__n) ++ assign(*--__s1, *--__s2); ++ } ++ return __r; ++ } ++ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* ++ copy(char_type* __s1, const char_type* __s2, size_t __n) { ++ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), ++ "char_traits::copy: source and destination ranges overlap"); ++ char_type* __r = __s1; ++ for (; __n; --__n, ++__s1, ++__s2) ++ assign(*__s1, *__s2); ++ return __r; ++ } ++ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* ++ assign(char_type* __s, size_t __n, char_type __a) { ++ char_type* __r = __s; ++ for (; __n; --__n, ++__s) ++ assign(*__s, __a); ++ return __r; ++ } ++ ++ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT { ++ return eq_int_type(__c, eof()) ? ~eof() : __c; ++ } ++ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT { ++ return char_type(__c); ++ } ++ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT { ++ return int_type(__c); ++ } ++ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT { ++ return __c1 == __c2; ++ } ++ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(EOF); } ++}; ++#endif // !defined(_LIBCPP_CHAR_TRAITS_REMOVE_BASE_SPECIALIZATION) ++ + // char_traits<char> + + template <> diff --git a/contrib/libs/cxxsupp/libcxx/patches/72-abi-has-no-init_primary_exception.patch b/contrib/libs/cxxsupp/libcxx/patches/72-abi-has-no-init_primary_exception.patch new file mode 100644 index 0000000000..e48292db7a --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/patches/72-abi-has-no-init_primary_exception.patch @@ -0,0 +1,13 @@ +diff --git a/include/__exception/exception_ptr.h b/include/__exception/exception_ptr.h +index b340ac0..53df28d 100644 +--- a/include/__exception/exception_ptr.h ++++ b/include/__exception/exception_ptr.h +@@ -90,7 +90,7 @@ public: + template <class _Ep> + _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { + # ifndef _LIBCPP_HAS_NO_EXCEPTIONS +-# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && __cplusplus >= 201103L ++# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && __cplusplus >= 201103L && !defined(__ANDROID__) && !defined(__ARM_NEON__) && !defined(__APPLE__) + using _Ep2 = __decay_t<_Ep>; + + void* __ex = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ep)); diff --git a/contrib/libs/cxxsupp/libcxx/patches/73-deque-disable-harderning.patch b/contrib/libs/cxxsupp/libcxx/patches/73-deque-disable-harderning.patch new file mode 100644 index 0000000000..6c2e365b77 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/patches/73-deque-disable-harderning.patch @@ -0,0 +1,24 @@ +diff --git a/include/deque b/include/deque +index 26bacb7..eaaa765 100644 +--- a/include/deque ++++ b/include/deque +@@ -1497,7 +1497,8 @@ inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::operat + template <class _Tp, class _Allocator> + inline typename deque<_Tp, _Allocator>::const_reference + deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT { +- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < size(), "deque::operator[] index out of bounds"); ++ // temporary disable this check for infra ++ // _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < size(), "deque::operator[] index out of bounds"); + size_type __p = __start_ + __i; + return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); + } +@@ -2431,7 +2432,8 @@ typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_it + + template <class _Tp, class _Allocator> + typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) { +- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__f <= __l, "deque::erase(first, last) called with an invalid range"); ++ // temporary disable this check for maps ++ // _LIBCPP_ASSERT_VALID_INPUT_RANGE(__f <= __l, "deque::erase(first, last) called with an invalid range"); + size_type __old_sz = size(); + size_type __old_start = __start_; + difference_type __n = __l - __f; diff --git a/contrib/libs/cxxsupp/libcxx/patches/xxx-config-epilogue.patch b/contrib/libs/cxxsupp/libcxx/patches/xxx-config-epilogue.patch index 675eb2bc94..1eb8694739 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/xxx-config-epilogue.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/xxx-config-epilogue.patch @@ -1,8 +1,8 @@ diff --git a/include/__config b/include/__config -index de02565..104d517 100644 +index 255b858..4e6feac 100644 --- a/include/__config +++ b/include/__config -@@ -1546,4 +1546,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c +@@ -1541,4 +1541,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c #endif // __cplusplus diff --git a/contrib/libs/cxxsupp/libcxx/patches/yyy-enable-std-expected.patch b/contrib/libs/cxxsupp/libcxx/patches/yyy-enable-std-expected.patch index 4e59003ce7..4e0b9689a3 100644 --- a/contrib/libs/cxxsupp/libcxx/patches/yyy-enable-std-expected.patch +++ b/contrib/libs/cxxsupp/libcxx/patches/yyy-enable-std-expected.patch @@ -12,7 +12,7 @@ index 27f01d9..174f97f 100644 _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/include/__expected/expected.h b/include/__expected/expected.h -index 97f92bd..507dd72 100644 +index 443d925..bfa3d25 100644 --- a/include/__expected/expected.h +++ b/include/__expected/expected.h @@ -62,7 +62,7 @@ diff --git a/contrib/libs/cxxsupp/libcxx/src/atomic.cpp b/contrib/libs/cxxsupp/libcxx/src/atomic.cpp index 2f0389ae69..2b67685c8a 100644 --- a/contrib/libs/cxxsupp/libcxx/src/atomic.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/atomic.cpp @@ -178,6 +178,7 @@ _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) { __libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, false); } +// This function is never used, but still exported for ABI compatibility. _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) { return __libcpp_contention_monitor_for_wait(&__libcpp_contention_state(__location)->__contention_state, __location); diff --git a/contrib/libs/cxxsupp/libcxx/src/call_once.cpp b/contrib/libs/cxxsupp/libcxx/src/call_once.cpp index 7f5aef1db5..2b981b69ab 100644 --- a/contrib/libs/cxxsupp/libcxx/src/call_once.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/call_once.cpp @@ -10,7 +10,7 @@ #include <__utility/exception_guard.h> #ifndef _LIBCPP_HAS_NO_THREADS -# include <__threading_support> +# include <__thread/support.h> #endif #include "include/atomic_support.h" diff --git a/contrib/libs/cxxsupp/libcxx/src/condition_variable_destructor.cpp b/contrib/libs/cxxsupp/libcxx/src/condition_variable_destructor.cpp index 8b62d41840..59811ed7ff 100644 --- a/contrib/libs/cxxsupp/libcxx/src/condition_variable_destructor.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/condition_variable_destructor.cpp @@ -12,7 +12,7 @@ // definition is only provided for ABI compatibility. #include <__config> -#include <__threading_support> +#include <__thread/support.h> #if _LIBCPP_ABI_VERSION == 1 || !defined(_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION) # define NEEDS_CONDVAR_DESTRUCTOR diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/error.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/error.h index b86f4ed410..572cc73292 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/error.h +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/error.h @@ -99,7 +99,7 @@ inline errc __win_err_to_errc(int err) { #endif // _LIBCPP_WIN32API inline error_code capture_errno() { - _LIBCPP_ASSERT_UNCATEGORIZED(errno != 0, "Expected errno to be non-zero"); + _LIBCPP_ASSERT_INTERNAL(errno != 0, "Expected errno to be non-zero"); return error_code(errno, generic_category()); } diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/format_string.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/format_string.h index 215d42421b..a44def86f5 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/format_string.h +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/format_string.h @@ -47,7 +47,7 @@ inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 0) string vformat_string(const ch size_t size_with_null = static_cast<size_t>(ret) + 1; result.__resize_default_init(size_with_null - 1); ret = ::vsnprintf(&result[0], size_with_null, msg, ap); - _LIBCPP_ASSERT_UNCATEGORIZED(static_cast<size_t>(ret) == (size_with_null - 1), "TODO"); + _LIBCPP_ASSERT_INTERNAL(static_cast<size_t>(ret) == (size_with_null - 1), "TODO"); } return result; } diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp b/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp index 1b9f260580..fa31f05b2d 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp @@ -460,8 +460,21 @@ path __current_path(error_code* ec) { typedef decltype(&::free) Deleter; Deleter deleter = &::free; #else + errno = 0; // Note: POSIX mandates that modifying `errno` is thread-safe. auto size = ::pathconf(".", _PC_PATH_MAX); - _LIBCPP_ASSERT_UNCATEGORIZED(size >= 0, "pathconf returned a 0 as max size"); + if (size == -1) { + if (errno != 0) { + return err.report(capture_errno(), "call to pathconf failed"); + + // `pathconf` returns `-1` without an error to indicate no limit. + } else { +# if defined(__MVS__) && !defined(PATH_MAX) + size = _XOPEN_PATH_MAX + 1; +# else + size = PATH_MAX + 1; +# endif + } + } auto buff = unique_ptr<path::value_type[]>(new path::value_type[size + 1]); path::value_type* ptr = buff.get(); @@ -608,10 +621,9 @@ void __permissions(const path& p, perms prms, perm_options opts, error_code* ec) const bool resolve_symlinks = !has_opt(perm_options::nofollow); const bool add_perms = has_opt(perm_options::add); const bool remove_perms = has_opt(perm_options::remove); - _LIBCPP_ASSERT_UNCATEGORIZED( + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( (add_perms + remove_perms + has_opt(perm_options::replace)) == 1, - "One and only one of the perm_options constants replace, add, or remove " - "is present in opts"); + "One and only one of the perm_options constants 'replace', 'add', or 'remove' must be present in opts"); bool set_sym_perms = false; prms &= perms::mask; @@ -621,7 +633,9 @@ void __permissions(const path& p, perms prms, perm_options opts, error_code* ec) set_sym_perms = is_symlink(st); if (m_ec) return err.report(m_ec); - _LIBCPP_ASSERT_UNCATEGORIZED(st.permissions() != perms::unknown, "Permissions unexpectedly unknown"); + // TODO(hardening): double-check this assertion -- it might be a valid (if rare) case when the permissions are + // unknown. + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(st.permissions() != perms::unknown, "Permissions unexpectedly unknown"); if (add_perms) prms |= st.permissions(); else if (remove_perms) @@ -668,7 +682,7 @@ path __read_symlink(const path& p, error_code* ec) { detail::SSizeT ret; if ((ret = detail::readlink(p.c_str(), buff.get(), size)) == -1) return err.report(capture_errno()); - _LIBCPP_ASSERT_UNCATEGORIZED(ret > 0, "TODO"); + // Note that `ret` returning `0` would work, resulting in a valid empty string being returned. if (static_cast<size_t>(ret) >= size) return err.report(errc::value_too_large); buff[ret] = 0; @@ -801,8 +815,9 @@ uintmax_t remove_all_impl(int parent_directory, const path& p, error_code& ec) { // If opening `p` failed because it wasn't a directory, remove it as // a normal file instead. Note that `openat()` can return either ENOTDIR - // or ELOOP depending on the exact reason of the failure. - if (ec == errc::not_a_directory || ec == errc::too_many_symbolic_link_levels) { + // or ELOOP depending on the exact reason of the failure. On FreeBSD it + // may return EMLINK instead of ELOOP, contradicting POSIX. + if (ec == errc::not_a_directory || ec == errc::too_many_symbolic_link_levels || ec == errc::too_many_links) { ec.clear(); if (::unlinkat(parent_directory, p.c_str(), /* flags = */ 0) == -1) { ec = detail::capture_errno(); diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/posix_compat.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/posix_compat.h index ec2de49960..760cdb65da 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/posix_compat.h +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/posix_compat.h @@ -318,8 +318,8 @@ inline int statvfs(const wchar_t* p, StatVFS* buf) { inline wchar_t* getcwd([[maybe_unused]] wchar_t* in_buf, [[maybe_unused]] size_t in_size) { // Only expected to be used with us allocating the buffer. - _LIBCPP_ASSERT_UNCATEGORIZED(in_buf == nullptr, "Windows getcwd() assumes in_buf==nullptr"); - _LIBCPP_ASSERT_UNCATEGORIZED(in_size == 0, "Windows getcwd() assumes in_size==0"); + _LIBCPP_ASSERT_INTERNAL(in_buf == nullptr, "Windows getcwd() assumes in_buf==nullptr"); + _LIBCPP_ASSERT_INTERNAL(in_size == 0, "Windows getcwd() assumes in_size==0"); size_t buff_size = MAX_PATH + 10; std::unique_ptr<wchar_t, decltype(&::free)> buff(static_cast<wchar_t*>(malloc(buff_size * sizeof(wchar_t))), &::free); @@ -338,7 +338,7 @@ inline wchar_t* getcwd([[maybe_unused]] wchar_t* in_buf, [[maybe_unused]] size_t inline wchar_t* realpath(const wchar_t* path, [[maybe_unused]] wchar_t* resolved_name) { // Only expected to be used with us allocating the buffer. - _LIBCPP_ASSERT_UNCATEGORIZED(resolved_name == nullptr, "Windows realpath() assumes a null resolved_name"); + _LIBCPP_ASSERT_INTERNAL(resolved_name == nullptr, "Windows realpath() assumes a null resolved_name"); WinHandle h(path, FILE_READ_ATTRIBUTES, 0); if (!h) { diff --git a/contrib/libs/cxxsupp/libcxx/src/fstream.cpp b/contrib/libs/cxxsupp/libcxx/src/fstream.cpp new file mode 100644 index 0000000000..55a4442b9c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/fstream.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include <__config> +#include <cstdio> +#include <fstream> + +#if defined(_LIBCPP_WIN32API) +# define WIN32_LEAN_AND_MEAN +# define NOMINMAX +# include <io.h> +# include <windows.h> +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if defined(_LIBCPP_WIN32API) + +// Confirm that `HANDLE` is `void*` as implemented in `basic_filebuf` +static_assert(std::same_as<HANDLE, void*>); + +_LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) noexcept { + // https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=msvc-170 + intptr_t __handle = _get_osfhandle(fileno(__file)); + if (__handle == -1) + return nullptr; + return reinterpret_cast<void*>(__handle); +} + +#endif + +_LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/include/overridable_function.h b/contrib/libs/cxxsupp/libcxx/src/include/overridable_function.h new file mode 100644 index 0000000000..7b0fba10f4 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/include/overridable_function.h @@ -0,0 +1,119 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H +#define _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H + +#include <__config> +#include <cstdint> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +// +// This file provides the std::__is_function_overridden utility, which allows checking +// whether an overridable function (typically a weak symbol) like `operator new` +// has been overridden by a user or not. +// +// This is a low-level utility which does not work on all platforms, since it needs +// to make assumptions about the object file format in use. Furthermore, it requires +// the "base definition" of the function (the one we want to check whether it has been +// overridden) to be annotated with the _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE macro. +// +// This currently works with Mach-O files (used on Darwin) and with ELF files (used on Linux +// and others). On platforms where we know how to implement this detection, the macro +// _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION is defined to 1, and it is defined to 0 on +// other platforms. The _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE macro is defined to +// nothing on unsupported platforms so that it can be used to decorate functions regardless +// of whether detection is actually supported. +// +// How does this work? +// ------------------- +// +// Let's say we want to check whether a weak function `f` has been overridden by the user. +// The general mechanism works by placing `f`'s definition (in the libc++ built library) +// inside a special section, which we do using the `__section__` attribute via the +// _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE macro. +// +// Then, when comes the time to check whether the function has been overridden, we take +// the address of the function and we check whether it falls inside the special function +// we created. This can be done by finding pointers to the start and the end of the section +// (which is done differently for ELF and Mach-O), and then checking whether `f` falls +// within those bounds. If it falls within those bounds, then `f` is still inside the +// special section and so it is the version we defined in the libc++ built library, i.e. +// it was not overridden. Otherwise, it was overridden by the user because it falls +// outside of the section. +// +// Important note +// -------------- +// +// This mechanism should never be used outside of the libc++ built library. In particular, +// attempting to use this within the libc++ headers will not work at all because we don't +// want to be defining special sections inside user's executables which use our headers. +// This is provided inside libc++'s include tree solely to make it easier to share with +// libc++abi, which needs the same mechanism. +// + +#if defined(_LIBCPP_OBJECT_FORMAT_MACHO) + +# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1 +# define _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE \ + __attribute__((__section__("__TEXT,__lcxx_override,regular,pure_instructions"))) + +_LIBCPP_BEGIN_NAMESPACE_STD +template <class _Ret, class... _Args> +_LIBCPP_HIDE_FROM_ABI bool __is_function_overridden(_Ret (*__fptr)(_Args...)) noexcept { + // Declare two dummy bytes and give them these special `__asm` values. These values are + // defined by the linker, which means that referring to `&__lcxx_override_start` will + // effectively refer to the address where the section starts (and same for the end). + extern char __lcxx_override_start __asm("section$start$__TEXT$__lcxx_override"); + extern char __lcxx_override_end __asm("section$end$__TEXT$__lcxx_override"); + + // Now get a uintptr_t out of these locations, and out of the function pointer. + uintptr_t __start = reinterpret_cast<uintptr_t>(&__lcxx_override_start); + uintptr_t __end = reinterpret_cast<uintptr_t>(&__lcxx_override_end); + uintptr_t __ptr = reinterpret_cast<uintptr_t>(__fptr); + + // Finally, the function was overridden if it falls outside of the section's bounds. + return __ptr < __start || __ptr > __end; +} +_LIBCPP_END_NAMESPACE_STD + +#elif defined(_LIBCPP_OBJECT_FORMAT_ELF) + +# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1 +# define _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE __attribute__((__section__("__lcxx_override"))) + +// This is very similar to what we do for Mach-O above. The ELF linker will implicitly define +// variables with those names corresponding to the start and the end of the section. +// +// See https://stackoverflow.com/questions/16552710/how-do-you-get-the-start-and-end-addresses-of-a-custom-elf-section +extern char __start___lcxx_override; +extern char __stop___lcxx_override; + +_LIBCPP_BEGIN_NAMESPACE_STD +template <class _Ret, class... _Args> +_LIBCPP_HIDE_FROM_ABI bool __is_function_overridden(_Ret (*__fptr)(_Args...)) noexcept { + uintptr_t __start = reinterpret_cast<uintptr_t>(&__start___lcxx_override); + uintptr_t __end = reinterpret_cast<uintptr_t>(&__stop___lcxx_override); + uintptr_t __ptr = reinterpret_cast<uintptr_t>(__fptr); + + return __ptr < __start || __ptr > __end; +} +_LIBCPP_END_NAMESPACE_STD + +#else + +# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 0 +# define _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE /* nothing */ + +#endif + +#endif // _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H diff --git a/contrib/libs/cxxsupp/libcxx/src/include/to_chars_floating_point.h b/contrib/libs/cxxsupp/libcxx/src/include/to_chars_floating_point.h index 3110bc20e1..01c2618169 100644 --- a/contrib/libs/cxxsupp/libcxx/src/include/to_chars_floating_point.h +++ b/contrib/libs/cxxsupp/libcxx/src/include/to_chars_floating_point.h @@ -269,7 +269,7 @@ to_chars_result _Floating_to_chars_hex_precision( // * Print the leading hexit, then mask it away. { const uint32_t _Nibble = static_cast<uint32_t>(_Adjusted_mantissa >> _Adjusted_explicit_bits); - _LIBCPP_ASSERT_UNCATEGORIZED(_Nibble < 3, ""); + _LIBCPP_ASSERT_INTERNAL(_Nibble < 3, ""); const char _Leading_hexit = static_cast<char>('0' + _Nibble); *_First++ = _Leading_hexit; @@ -288,12 +288,12 @@ to_chars_result _Floating_to_chars_hex_precision( int32_t _Number_of_bits_remaining = _Adjusted_explicit_bits; // 24 for float, 52 for double for (;;) { - _LIBCPP_ASSERT_UNCATEGORIZED(_Number_of_bits_remaining >= 4, ""); - _LIBCPP_ASSERT_UNCATEGORIZED(_Number_of_bits_remaining % 4 == 0, ""); + _LIBCPP_ASSERT_INTERNAL(_Number_of_bits_remaining >= 4, ""); + _LIBCPP_ASSERT_INTERNAL(_Number_of_bits_remaining % 4 == 0, ""); _Number_of_bits_remaining -= 4; const uint32_t _Nibble = static_cast<uint32_t>(_Adjusted_mantissa >> _Number_of_bits_remaining); - _LIBCPP_ASSERT_UNCATEGORIZED(_Nibble < 16, ""); + _LIBCPP_ASSERT_INTERNAL(_Nibble < 16, ""); const char _Hexit = __itoa::_Charconv_digits[_Nibble]; *_First++ = _Hexit; @@ -415,12 +415,12 @@ to_chars_result _Floating_to_chars_hex_shortest( // '0' hexits, the same condition works (as we print the final hexit and mask it away); we don't need to test // _Number_of_bits_remaining. do { - _LIBCPP_ASSERT_UNCATEGORIZED(_Number_of_bits_remaining >= 4, ""); - _LIBCPP_ASSERT_UNCATEGORIZED(_Number_of_bits_remaining % 4 == 0, ""); + _LIBCPP_ASSERT_INTERNAL(_Number_of_bits_remaining >= 4, ""); + _LIBCPP_ASSERT_INTERNAL(_Number_of_bits_remaining % 4 == 0, ""); _Number_of_bits_remaining -= 4; const uint32_t _Nibble = static_cast<uint32_t>(_Adjusted_mantissa >> _Number_of_bits_remaining); - _LIBCPP_ASSERT_UNCATEGORIZED(_Nibble < 16, ""); + _LIBCPP_ASSERT_INTERNAL(_Nibble < 16, ""); const char _Hexit = __itoa::_Charconv_digits[_Nibble]; if (_First == _Last) { @@ -940,13 +940,13 @@ to_chars_result _Floating_to_chars_general_precision( _Effective_precision = std::min(_Precision - (_Scientific_exponent_X + 1), _Max_fixed_precision); const to_chars_result _Buf_result = _Floating_to_chars_fixed_precision(_Buffer, std::end(_Buffer), _Value, _Effective_precision); - _LIBCPP_ASSERT_UNCATEGORIZED(_Buf_result.ec == errc{}, ""); + _LIBCPP_ASSERT_INTERNAL(_Buf_result.ec == errc{}, ""); _Significand_last = _Buf_result.ptr; } else { _Effective_precision = std::min(_Precision - 1, _Max_scientific_precision); const to_chars_result _Buf_result = _Floating_to_chars_scientific_precision(_Buffer, std::end(_Buffer), _Value, _Effective_precision); - _LIBCPP_ASSERT_UNCATEGORIZED(_Buf_result.ec == errc{}, ""); + _LIBCPP_ASSERT_INTERNAL(_Buf_result.ec == errc{}, ""); _Significand_last = std::find(_Buffer, _Buf_result.ptr, 'e'); _Exponent_first = _Significand_last; _Exponent_last = _Buf_result.ptr; @@ -992,9 +992,9 @@ to_chars_result _Floating_to_chars( char* _First, char* const _Last, _Floating _Value, const chars_format _Fmt, const int _Precision) noexcept { if constexpr (_Overload == _Floating_to_chars_overload::_Plain) { - _LIBCPP_ASSERT_UNCATEGORIZED(_Fmt == chars_format{}, ""); // plain overload must pass chars_format{} internally + _LIBCPP_ASSERT_INTERNAL(_Fmt == chars_format{}, ""); // plain overload must pass chars_format{} internally } else { - _LIBCPP_ASSERT_UNCATEGORIZED(_Fmt == chars_format::general || _Fmt == chars_format::scientific + _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(_Fmt == chars_format::general || _Fmt == chars_format::scientific || _Fmt == chars_format::fixed || _Fmt == chars_format::hex, "invalid format in to_chars()"); } diff --git a/contrib/libs/cxxsupp/libcxx/src/include/tzdb/time_zone_link_private.h b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/time_zone_link_private.h new file mode 100644 index 0000000000..1392376252 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/time_zone_link_private.h @@ -0,0 +1,27 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html + +#ifndef _LIBCPP_SRC_INCLUDE_TZDB_TIME_ZONE_LINK_PRIVATE_H +#define _LIBCPP_SRC_INCLUDE_TZDB_TIME_ZONE_LINK_PRIVATE_H + +#include <chrono> + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace chrono { + +struct time_zone_link::__constructor_tag {}; + +} // namespace chrono + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_SRC_INCLUDE_TZDB_TIME_ZONE_LINK_PRIVATE_H diff --git a/contrib/libs/cxxsupp/libcxx/src/include/tzdb/time_zone_private.h b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/time_zone_private.h new file mode 100644 index 0000000000..039a3b0ffe --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/time_zone_private.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html + +#ifndef _LIBCPP_SRC_INCLUDE_TZDB_TIME_ZONE_PRIVATE_H +#define _LIBCPP_SRC_INCLUDE_TZDB_TIME_ZONE_PRIVATE_H + +#include <chrono> +#include <string> +#include <vector> + +#include "types_private.h" + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace chrono { + +class time_zone::__impl { +public: + explicit _LIBCPP_HIDE_FROM_ABI __impl(string&& __name) : __name_(std::move(__name)) {} + + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_view __name() const noexcept { return __name_; } + + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI vector<__tz::__continuation>& __continuations() { return __continuations_; } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const vector<__tz::__continuation>& __continuations() const { + return __continuations_; + } + +private: + string __name_; + // Note the first line has a name + __continuation, the other lines + // are just __continuations. So there is always at least one item in + // the vector. + vector<__tz::__continuation> __continuations_; +}; + +} // namespace chrono + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_SRC_INCLUDE_TZDB_TIME_ZONE_PRIVATE_H diff --git a/contrib/libs/cxxsupp/libcxx/src/include/tzdb/types_private.h b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/types_private.h new file mode 100644 index 0000000000..4604b9fc88 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/types_private.h @@ -0,0 +1,106 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html + +#ifndef __LIBCPP_SRC_INCLUDE_TZDB_TYPES_PRIVATE_H +#define __LIBCPP_SRC_INCLUDE_TZDB_TYPES_PRIVATE_H + +#include <chrono> +#include <string> +#include <utility> +#include <variant> +#include <vector> + +_LIBCPP_BEGIN_NAMESPACE_STD + +// TODO TZDB +// The helper classes in this header have no constructor but are loaded with +// dedicated parse functions. In the original design this header was public and +// the parsing was done in the dylib. In that design having constructors would +// expand the ABI interface. Since this header is now in the dylib that design +// should be reconsidered. (For now the design is kept as is, in case this +// header needs to be public for unforseen reasons.) + +namespace chrono::__tz { + +// Sun>=8 first Sunday on or after the eighth +// Sun<=25 last Sunday on or before the 25th +struct __constrained_weekday { + /* year_month_day operator()(year __year, month __month);*/ // needed but not implemented + + weekday __weekday; + enum __comparison_t { __le, __ge } __comparison; + day __day; +}; + +// The on field has a few alternative presentations +// 5 the fifth of the month +// lastSun the last Sunday in the month +// lastMon the last Monday in the month +// Sun>=8 first Sunday on or after the eighth +// Sun<=25 last Sunday on or before the 25th +using __on = variant<day, weekday_last, __constrained_weekday>; + +enum class __clock { __local, __standard, __universal }; + +struct __at { + seconds __time{0}; + __tz::__clock __clock{__tz::__clock::__local}; +}; + +struct __save { + seconds __time; + bool __is_dst; +}; + +// The names of the fields match the fields of a Rule. +struct __rule { + year __from; + year __to; + month __in; + __tz::__on __on; + __tz::__at __at; + __tz::__save __save; + string __letters; +}; + +using __rules_storage_type = std::vector<std::pair<string, vector<__tz::__rule>>>; // TODO TZDB use flat_map; + +struct __continuation { + // Non-owning link to the RULE entries. + __tz::__rules_storage_type* __rule_database_; + + seconds __stdoff; + + // The RULES is either a SAVE or a NAME. + // The size_t is used as cache. After loading the rules they are + // sorted and remain stable, then an index in the vector can be + // used. + // If this field contains - then standard time always + // applies. This is indicated by the monostate. + using __rules_t = variant<monostate, __tz::__save, string, size_t>; + + __rules_t __rules; + + string __format; + // TODO TZDB the until field can contain more than just a year. + // Parts of the UNTIL, the optional parts are default initialized + // optional<year> __until_; + year __year = chrono::year::min(); + month __in{January}; + __tz::__on __on{chrono::day{1}}; + __tz::__at __at{chrono::seconds{0}, __tz::__clock::__local}; +}; + +} // namespace chrono::__tz + +_LIBCPP_END_NAMESPACE_STD + +#endif // __LIBCPP_SRC_INCLUDE_TZDB_TYPES_PRIVATE_H diff --git a/contrib/libs/cxxsupp/libcxx/src/include/tzdb/tzdb_list_private.h b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/tzdb_list_private.h new file mode 100644 index 0000000000..f43d7d8ea7 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/tzdb_list_private.h @@ -0,0 +1,104 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html + +#ifndef _LIBCPP_SRC_INCLUDE_TZDB_TZDB_LIST_PRIVATE_H +#define _LIBCPP_SRC_INCLUDE_TZDB_TZDB_LIST_PRIVATE_H + +#include <__mutex/unique_lock.h> +#include <forward_list> + +// When threads are not available the locking is not required. +#ifndef _LIBCPP_HAS_NO_THREADS +# include <shared_mutex> +#endif + +#include "types_private.h" +#include "tzdb_private.h" + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace chrono { + +//===----------------------------------------------------------------------===// +// Private API +//===----------------------------------------------------------------------===// + +// The tzdb_list stores a list of "tzdb" entries. +// +// The public tzdb database does not store the RULE entries of the IANA +// database. These entries are considered an implementation detail. Since most +// of the tzdb_list interface is exposed as "a list of tzdb entries" it's not +// possible to use a helper struct that stores a tzdb and the RULE database. +// Instead this class stores these in parallel forward lists. +// +// Since the nodes of a forward_list are stable it's possible to store pointers +// and references to these nodes. +class tzdb_list::__impl { +public: + __impl() { __load_no_lock(); } + + [[nodiscard]] const tzdb& __load() { +#ifndef _LIBCPP_HAS_NO_THREADS + unique_lock __lock{__mutex_}; +#endif + __load_no_lock(); + return __tzdb_.front(); + } + + using const_iterator = tzdb_list::const_iterator; + + const tzdb& front() const noexcept { +#ifndef _LIBCPP_HAS_NO_THREADS + shared_lock __lock{__mutex_}; +#endif + return __tzdb_.front(); + } + + const_iterator erase_after(const_iterator __p) { +#ifndef _LIBCPP_HAS_NO_THREADS + unique_lock __lock{__mutex_}; +#endif + + __rules_.erase_after(std::next(__rules_.cbegin(), std::distance(__tzdb_.cbegin(), __p))); + return __tzdb_.erase_after(__p); + } + + const_iterator begin() const noexcept { +#ifndef _LIBCPP_HAS_NO_THREADS + shared_lock __lock{__mutex_}; +#endif + return __tzdb_.begin(); + } + const_iterator end() const noexcept { + // forward_list<T>::end does not access the list, so no need to take a lock. + return __tzdb_.end(); + } + + const_iterator cbegin() const noexcept { return begin(); } + const_iterator cend() const noexcept { return end(); } + +private: + // Loads the tzdbs + // pre: The caller ensures the locking, if needed, is done. + void __load_no_lock() { chrono::__init_tzdb(__tzdb_.emplace_front(), __rules_.emplace_front()); } + +#ifndef _LIBCPP_HAS_NO_THREADS + mutable shared_mutex __mutex_; +#endif + forward_list<tzdb> __tzdb_; + + forward_list<__tz::__rules_storage_type> __rules_; +}; + +} // namespace chrono + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_SRC_INCLUDE_TZDB_TZDB_LIST_PRIVATE_H diff --git a/contrib/libs/cxxsupp/libcxx/src/include/tzdb/tzdb_private.h b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/tzdb_private.h new file mode 100644 index 0000000000..8ec3f890ef --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/include/tzdb/tzdb_private.h @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html + +#ifndef _LIBCPP_SRC_INCLUDE_TZDB_TZ_PRIVATE_H +#define _LIBCPP_SRC_INCLUDE_TZDB_TZ_PRIVATE_H + +#include <chrono> + +#include "types_private.h" + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace chrono { + +void __init_tzdb(tzdb& __tzdb, __tz::__rules_storage_type& __rules); + +} // namespace chrono + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_SRC_INCLUDE_TZDB_TZ_PRIVATE_H diff --git a/contrib/libs/cxxsupp/libcxx/src/iostream.cpp b/contrib/libs/cxxsupp/libcxx/src/iostream.cpp index 93edf3a0d5..029de4a680 100644 --- a/contrib/libs/cxxsupp/libcxx/src/iostream.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/iostream.cpp @@ -22,127 +22,119 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) -_ALIGNAS_TYPE(istream) char _cin[sizeof(istream)]; +alignas(istream) char _cin[sizeof(istream)]; _LIBCPP_EXPORTED_FROM_ABI istream& cin = *reinterpret_cast<istream*>(_cin); #else -_ALIGNAS_TYPE(istream) -_LIBCPP_EXPORTED_FROM_ABI char cin[sizeof(istream)] -# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +alignas(istream) _LIBCPP_EXPORTED_FROM_ABI 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 ; #endif -_ALIGNAS_TYPE(__stdinbuf<char>) static char __cin[sizeof(__stdinbuf<char>)]; +alignas(__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)]; +alignas(wistream) char _wcin[sizeof(wistream)]; _LIBCPP_EXPORTED_FROM_ABI wistream& wcin = *reinterpret_cast<wistream*>(_wcin); # else -_ALIGNAS_TYPE(wistream) -_LIBCPP_EXPORTED_FROM_ABI char wcin[sizeof(wistream)] -# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +alignas(wistream) _LIBCPP_EXPORTED_FROM_ABI 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>)]; + ; +#endif +alignas(__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)]; +alignas(ostream) char _cout[sizeof(ostream)]; _LIBCPP_EXPORTED_FROM_ABI ostream& cout = *reinterpret_cast<ostream*>(_cout); #else -_ALIGNAS_TYPE(ostream) -_LIBCPP_EXPORTED_FROM_ABI char cout[sizeof(ostream)] -# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI 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 ; #endif -_ALIGNAS_TYPE(__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)]; +alignas(__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)]; +alignas(wostream) char _wcout[sizeof(wostream)]; _LIBCPP_EXPORTED_FROM_ABI wostream& wcout = *reinterpret_cast<wostream*>(_wcout); # else -_ALIGNAS_TYPE(wostream) -_LIBCPP_EXPORTED_FROM_ABI char wcout[sizeof(wostream)] -# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI 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>)]; + ; +#endif +alignas(__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)]; +alignas(ostream) char _cerr[sizeof(ostream)]; _LIBCPP_EXPORTED_FROM_ABI ostream& cerr = *reinterpret_cast<ostream*>(_cerr); #else -_ALIGNAS_TYPE(ostream) -_LIBCPP_EXPORTED_FROM_ABI char cerr[sizeof(ostream)] -# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI 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 ; #endif -_ALIGNAS_TYPE(__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)]; +alignas(__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)]; +alignas(wostream) char _wcerr[sizeof(wostream)]; _LIBCPP_EXPORTED_FROM_ABI wostream& wcerr = *reinterpret_cast<wostream*>(_wcerr); # else -_ALIGNAS_TYPE(wostream) -_LIBCPP_EXPORTED_FROM_ABI char wcerr[sizeof(wostream)] -# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI 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 ; # endif -_ALIGNAS_TYPE(__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)]; +alignas(__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)]; +alignas(ostream) char _clog[sizeof(ostream)]; _LIBCPP_EXPORTED_FROM_ABI ostream& clog = *reinterpret_cast<ostream*>(_clog); #else -_ALIGNAS_TYPE(ostream) -_LIBCPP_EXPORTED_FROM_ABI char clog[sizeof(ostream)] -# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI 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 ; #endif #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS # if defined(_LIBCPP_ABI_MICROSOFT) && !defined(__clang__) -_ALIGNAS_TYPE(wostream) char _wclog[sizeof(wostream)]; +alignas(wostream) char _wclog[sizeof(wostream)]; _LIBCPP_EXPORTED_FROM_ABI wostream& wclog = *reinterpret_cast<wostream*>(_wclog); # else -_ALIGNAS_TYPE(wostream) -_LIBCPP_EXPORTED_FROM_ABI char wclog[sizeof(wostream)] -# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI 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 #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 diff --git a/contrib/libs/cxxsupp/libcxx/src/locale.cpp b/contrib/libs/cxxsupp/libcxx/src/locale.cpp index 433394d58f..1b937dcf97 100644 --- a/contrib/libs/cxxsupp/libcxx/src/locale.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/locale.cpp @@ -34,9 +34,7 @@ # define _CTYPE_DISABLE_MACROS #endif -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) -# include "__support/win32/locale_win32.h" -#elif !defined(__BIONIC__) && !defined(__NuttX__) +#if !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) && !defined(__BIONIC__) && !defined(__NuttX__) # include <langinfo.h> #endif diff --git a/contrib/libs/cxxsupp/libcxx/src/memory_resource.cpp b/contrib/libs/cxxsupp/libcxx/src/memory_resource.cpp index afd1b89208..2117238e63 100644 --- a/contrib/libs/cxxsupp/libcxx/src/memory_resource.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/memory_resource.cpp @@ -189,7 +189,8 @@ void unsynchronized_pool_resource::__adhoc_pool::__do_deallocate( return; } } - _LIBCPP_ASSERT_UNCATEGORIZED(false, "deallocating a block that was not allocated with this allocator"); + // The request to deallocate memory ends up being a no-op, likely resulting in a memory leak. + _LIBCPP_ASSERT_VALID_DEALLOCATION(false, "deallocating a block that was not allocated with this allocator"); } } @@ -230,7 +231,7 @@ public: } void* __allocate_in_new_chunk(memory_resource* upstream, size_t block_size, size_t chunk_size) { - _LIBCPP_ASSERT_UNCATEGORIZED(chunk_size % block_size == 0, ""); + _LIBCPP_ASSERT_INTERNAL(chunk_size % block_size == 0, ""); static_assert(__default_alignment >= alignof(std::max_align_t), ""); static_assert(__default_alignment >= alignof(__chunk_footer), ""); static_assert(__default_alignment >= alignof(__vacancy_header), ""); diff --git a/contrib/libs/cxxsupp/libcxx/src/mutex.cpp b/contrib/libs/cxxsupp/libcxx/src/mutex.cpp index 13c63247f1..26b26b691a 100644 --- a/contrib/libs/cxxsupp/libcxx/src/mutex.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/mutex.cpp @@ -38,7 +38,8 @@ bool mutex::try_lock() noexcept { return __libcpp_mutex_trylock(&__m_); } void mutex::unlock() noexcept { int ec = __libcpp_mutex_unlock(&__m_); (void)ec; - _LIBCPP_ASSERT_UNCATEGORIZED(ec == 0, "call to mutex::unlock failed"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL( + ec == 0, "call to mutex::unlock failed. A possible reason is that the mutex wasn't locked"); } // recursive_mutex @@ -52,7 +53,7 @@ recursive_mutex::recursive_mutex() { recursive_mutex::~recursive_mutex() { int e = __libcpp_recursive_mutex_destroy(&__m_); (void)e; - _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to ~recursive_mutex() failed"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(e == 0, "call to ~recursive_mutex() failed"); } void recursive_mutex::lock() { @@ -64,7 +65,8 @@ void recursive_mutex::lock() { void recursive_mutex::unlock() noexcept { int e = __libcpp_recursive_mutex_unlock(&__m_); (void)e; - _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to recursive_mutex::unlock() failed"); + _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL( + e == 0, "call to recursive_mutex::unlock() failed. A possible reason is that the mutex wasn't locked"); } bool recursive_mutex::try_lock() noexcept { return __libcpp_recursive_mutex_trylock(&__m_); } diff --git a/contrib/libs/cxxsupp/libcxx/src/mutex_destructor.cpp b/contrib/libs/cxxsupp/libcxx/src/mutex_destructor.cpp index d5ac257f94..a6ceaaaf23 100644 --- a/contrib/libs/cxxsupp/libcxx/src/mutex_destructor.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/mutex_destructor.cpp @@ -17,7 +17,7 @@ // _LIBCPP_BUILDING_LIBRARY to change the definition in the headers. #include <__config> -#include <__threading_support> +#include <__thread/support.h> #if _LIBCPP_ABI_VERSION == 1 || !defined(_LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION) # define NEEDS_MUTEX_DESTRUCTOR diff --git a/contrib/libs/cxxsupp/libcxx/src/new.cpp b/contrib/libs/cxxsupp/libcxx/src/new.cpp index e9a4adcfdf..7f1cc671f1 100644 --- a/contrib/libs/cxxsupp/libcxx/src/new.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/new.cpp @@ -6,7 +6,10 @@ // //===----------------------------------------------------------------------===// +#include "include/overridable_function.h" +#include <__assert> #include <__memory/aligned_alloc.h> +#include <cstddef> #include <cstdlib> #include <new> @@ -15,12 +18,22 @@ // The code below is copied as-is into libc++abi's libcxxabi/src/stdlib_new_delete.cpp // file. The version in this file is the canonical one. +inline void __throw_bad_alloc_shim() { +# ifdef __EMSCRIPTEN__ + abort(); +#else + std::__throw_bad_alloc(); +#endif +} + +# define _LIBCPP_ASSERT_SHIM(expr, str) _LIBCPP_ASSERT(expr, str) + // ------------------ BEGIN COPY ------------------ // Implement all new and delete operators as weak definitions // in this shared library, so that they can be overridden by programs // that define non-weak copies of the functions. -static void* operator_new_impl(std::size_t size) noexcept { +static void* operator_new_impl(std::size_t size) { if (size == 0) size = 1; void* p; @@ -36,51 +49,63 @@ static void* operator_new_impl(std::size_t size) noexcept { return p; } -_LIBCPP_WEAK void* operator new(std::size_t size) _THROW_BAD_ALLOC { +_LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void* operator new(std::size_t size) _THROW_BAD_ALLOC { void* p = operator_new_impl(size); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS - if (p == nullptr) - throw std::bad_alloc(); -# else -# ifdef __EMSCRIPTEN__ if (p == nullptr) - // 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(); -# endif -# endif + __throw_bad_alloc_shim(); return p; } _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept { +# ifdef _LIBCPP_HAS_NO_EXCEPTIONS +# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION + _LIBCPP_ASSERT_SHIM( + !std::__is_function_overridden(static_cast<void* (*)(std::size_t)>(&operator new)), + "libc++ was configured with exceptions disabled and `operator new(size_t)` has been overridden, " + "but `operator new(size_t, nothrow_t)` has not been overridden. This is problematic because " + "`operator new(size_t, nothrow_t)` must call `operator new(size_t)`, which will terminate in case " + "it fails to allocate, making it impossible for `operator new(size_t, nothrow_t)` to fulfill its " + "contract (since it should return nullptr upon failure). Please make sure you override " + "`operator new(size_t, nothrow_t)` as well."); +# endif + + return operator_new_impl(size); +# else void* p = nullptr; -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif // _LIBCPP_HAS_NO_EXCEPTIONS p = ::operator new(size); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -# endif // _LIBCPP_HAS_NO_EXCEPTIONS return p; +# endif } -_LIBCPP_WEAK void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); } +_LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void* operator new[](size_t size) _THROW_BAD_ALLOC { + return ::operator new(size); +} _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept { +# ifdef _LIBCPP_HAS_NO_EXCEPTIONS +# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION + _LIBCPP_ASSERT_SHIM( + !std::__is_function_overridden(static_cast<void* (*)(std::size_t)>(&operator new[])), + "libc++ was configured with exceptions disabled and `operator new[](size_t)` has been overridden, " + "but `operator new[](size_t, nothrow_t)` has not been overridden. This is problematic because " + "`operator new[](size_t, nothrow_t)` must call `operator new[](size_t)`, which will terminate in case " + "it fails to allocate, making it impossible for `operator new[](size_t, nothrow_t)` to fulfill its " + "contract (since it should return nullptr upon failure). Please make sure you override " + "`operator new[](size_t, nothrow_t)` as well."); +# endif + + return operator_new_impl(size); +# else void* p = nullptr; -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif // _LIBCPP_HAS_NO_EXCEPTIONS p = ::operator new[](size); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -# endif // _LIBCPP_HAS_NO_EXCEPTIONS return p; +# endif } _LIBCPP_WEAK void operator delete(void* ptr) noexcept { std::free(ptr); } @@ -97,7 +122,7 @@ _LIBCPP_WEAK void operator delete[](void* ptr, size_t) noexcept { ::operator del # if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) -static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignment) noexcept { +static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignment) { if (size == 0) size = 1; if (static_cast<size_t>(alignment) < sizeof(void*)) @@ -117,43 +142,66 @@ static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignm return p; } -_LIBCPP_WEAK void* operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC { +_LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void* +operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC { void* p = operator_new_aligned_impl(size, alignment); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS if (p == nullptr) - throw std::bad_alloc(); -# endif + __throw_bad_alloc_shim(); return p; } _LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept { +# ifdef _LIBCPP_HAS_NO_EXCEPTIONS +# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION + _LIBCPP_ASSERT_SHIM( + !std::__is_function_overridden(static_cast<void* (*)(std::size_t, std::align_val_t)>(&operator new)), + "libc++ was configured with exceptions disabled and `operator new(size_t, align_val_t)` has been overridden, " + "but `operator new(size_t, align_val_t, nothrow_t)` has not been overridden. This is problematic because " + "`operator new(size_t, align_val_t, nothrow_t)` must call `operator new(size_t, align_val_t)`, which will " + "terminate in case it fails to allocate, making it impossible for `operator new(size_t, align_val_t, nothrow_t)` " + "to fulfill its contract (since it should return nullptr upon failure). Please make sure you override " + "`operator new(size_t, align_val_t, nothrow_t)` as well."); +# endif + + return operator_new_aligned_impl(size, alignment); +# else void* p = nullptr; -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif // _LIBCPP_HAS_NO_EXCEPTIONS p = ::operator new(size, alignment); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -# endif // _LIBCPP_HAS_NO_EXCEPTIONS return p; +# endif } -_LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC { +_LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void* +operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC { return ::operator new(size, alignment); } _LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept { +# ifdef _LIBCPP_HAS_NO_EXCEPTIONS +# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION + _LIBCPP_ASSERT_SHIM( + !std::__is_function_overridden(static_cast<void* (*)(std::size_t, std::align_val_t)>(&operator new[])), + "libc++ was configured with exceptions disabled and `operator new[](size_t, align_val_t)` has been overridden, " + "but `operator new[](size_t, align_val_t, nothrow_t)` has not been overridden. This is problematic because " + "`operator new[](size_t, align_val_t, nothrow_t)` must call `operator new[](size_t, align_val_t)`, which will " + "terminate in case it fails to allocate, making it impossible for `operator new[](size_t, align_val_t, " + "nothrow_t)` to fulfill its contract (since it should return nullptr upon failure). Please make sure you " + "override " + "`operator new[](size_t, align_val_t, nothrow_t)` as well."); +# endif + + return operator_new_aligned_impl(size, alignment); +# else void* p = nullptr; -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif // _LIBCPP_HAS_NO_EXCEPTIONS p = ::operator new[](size, alignment); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -# endif // _LIBCPP_HAS_NO_EXCEPTIONS return p; +# endif } _LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); } diff --git a/contrib/libs/cxxsupp/libcxx/src/ostream.cpp b/contrib/libs/cxxsupp/libcxx/src/ostream.cpp new file mode 100644 index 0000000000..443dce9a39 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/ostream.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include <__availability> +#include <__config> +#ifndef _LIBCPP_HAS_NO_FILESYSTEM +# include <fstream> +#endif +#include <ostream> + +#include "std_stream.h" + +_LIBCPP_BEGIN_NAMESPACE_STD + +_LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) { + // dynamic_cast requires RTTI, this only affects users whose vendor builds + // the dylib with RTTI disabled. It does not affect users who build with RTTI + // disabled but use a dylib where the RTTI is enabled. + // + // Returning a nullptr means the stream is not considered a terminal and the + // special terminal handling is not done. The terminal handling is mainly of + // importance on Windows. +#ifndef _LIBCPP_HAS_NO_RTTI + auto* __rdbuf = __os.rdbuf(); +# ifndef _LIBCPP_HAS_NO_FILESYSTEM + if (auto* __buffer = dynamic_cast<filebuf*>(__rdbuf)) + return __buffer->__file_; +# endif + + if (auto* __buffer = dynamic_cast<__stdoutbuf<char>*>(__rdbuf)) + return __buffer->__file_; +#endif // _LIBCPP_HAS_NO_RTTI + + return nullptr; +} + +_LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/print.cpp b/contrib/libs/cxxsupp/libcxx/src/print.cpp index 3692187a59..8fa59fdd09 100644 --- a/contrib/libs/cxxsupp/libcxx/src/print.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/print.cpp @@ -8,22 +8,26 @@ #include <__config> -#if defined(_LIBCPP_WIN32API) +#include <cstdlib> +#include <print> + +#include <__system_error/system_error.h> -# include <cstdlib> -# include <print> +#include "filesystem/error.h" +#if defined(_LIBCPP_WIN32API) # define WIN32_LEAN_AND_MEAN # define NOMINMAX # include <io.h> # include <windows.h> - -# include <__system_error/system_error.h> - -# include "filesystem/error.h" +#elif __has_include(<unistd.h>) +# include <unistd.h> +#endif _LIBCPP_BEGIN_NAMESPACE_STD +#if defined(_LIBCPP_WIN32API) + _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream) { // Note the Standard does this in one call, but it's unclear whether // an invalid handle is allowed when calling GetConsoleMode. @@ -52,6 +56,9 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst } # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_END_NAMESPACE_STD +#elif __has_include(<unistd.h>) // !_LIBCPP_WIN32API -#endif // !_LIBCPP_WIN32API +_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream) { return isatty(fileno(__stream)); } +#endif + +_LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/std_stream.h b/contrib/libs/cxxsupp/libcxx/src/std_stream.h index c4e9733601..e55cd0b6b7 100644 --- a/contrib/libs/cxxsupp/libcxx/src/std_stream.h +++ b/contrib/libs/cxxsupp/libcxx/src/std_stream.h @@ -269,6 +269,8 @@ private: __stdoutbuf(const __stdoutbuf&); __stdoutbuf& operator=(const __stdoutbuf&); + + _LIBCPP_EXPORTED_FROM_ABI friend FILE* __get_ostream_file(ostream&); }; template <class _CharT> diff --git a/contrib/libs/cxxsupp/libcxx/src/strstream.cpp b/contrib/libs/cxxsupp/libcxx/src/strstream.cpp index a9b5989ec4..70374191c6 100644 --- a/contrib/libs/cxxsupp/libcxx/src/strstream.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/strstream.cpp @@ -120,7 +120,7 @@ strstreambuf::int_type strstreambuf::overflow(int_type __c) { if (buf == nullptr) return int_type(EOF); if (old_size != 0) { - _LIBCPP_ASSERT_UNCATEGORIZED(eback(), "overflow copying from NULL"); + _LIBCPP_ASSERT_INTERNAL(eback(), "strstreambuf::overflow reallocating but the get area is a null pointer"); memcpy(buf, eback(), static_cast<size_t>(old_size)); } ptrdiff_t ninp = gptr() - eback(); diff --git a/contrib/libs/cxxsupp/libcxx/src/support/ibm/xlocale_zos.cpp b/contrib/libs/cxxsupp/libcxx/src/support/ibm/xlocale_zos.cpp index 4c20997b4e..9a90e08e11 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/ibm/xlocale_zos.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/support/ibm/xlocale_zos.cpp @@ -103,7 +103,7 @@ locale_t uselocale(locale_t newloc) { tokenized.push_back(s); } - _LIBCPP_ASSERT_UNCATEGORIZED(tokenized.size() >= _NCAT, "locale-name list is too short"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(tokenized.size() >= _NCAT, "locale-name list is too short"); previous_loc->lc_collate = tokenized[LC_COLLATE]; previous_loc->lc_ctype = tokenized[LC_CTYPE]; diff --git a/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp b/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp index c07de5838b..bdb17b9996 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp +++ b/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp @@ -28,6 +28,14 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept { return *this; } +exception_ptr exception_ptr::__from_native_exception_pointer(void* __e) noexcept { + exception_ptr ptr; + ptr.__ptr_ = __e; + __cxa_increment_exception_refcount(ptr.__ptr_); + + return ptr; +} + nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {} nested_exception::~nested_exception() noexcept {} diff --git a/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp b/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp index 8e0e63cd4d..6dad248f9e 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp +++ b/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp @@ -23,6 +23,7 @@ namespace __exception_ptr { struct exception_ptr { void* __ptr_; + explicit exception_ptr(void*) noexcept; exception_ptr(const exception_ptr&) noexcept; exception_ptr& operator=(const exception_ptr&) noexcept; ~exception_ptr() noexcept; @@ -45,6 +46,13 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept { return *this; } +exception_ptr exception_ptr::__from_native_exception_pointer(void* __e) noexcept { + exception_ptr ptr{}; + new (reinterpret_cast<void*>(&ptr)) __exception_ptr::exception_ptr(__e); + + return ptr; +} + nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {} _LIBCPP_NORETURN void nested_exception::rethrow_nested() const { diff --git a/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp b/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp index de0605d777..e12b0caf41 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp +++ b/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp @@ -30,6 +30,12 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept { ::abort(); } +exception_ptr exception_ptr::__from_native_exception_pointer(void *__e) noexcept { +#warning exception_ptr not yet implemented + fprintf(stderr, "exception_ptr not yet implemented\n"); + ::abort(); +} + nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {} #if !defined(__GLIBCXX__) diff --git a/contrib/libs/cxxsupp/libcxx/src/support/win32/thread_win32.cpp b/contrib/libs/cxxsupp/libcxx/src/support/win32/thread_win32.cpp index 8736a53207..a2585c0b89 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/win32/thread_win32.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/support/win32/thread_win32.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include <__threading_support> +#include <__thread/support/windows.h> #include <chrono> #define NOMINMAX diff --git a/contrib/libs/cxxsupp/libcxx/src/system_error.cpp b/contrib/libs/cxxsupp/libcxx/src/system_error.cpp index 034b73c548..f518b480a2 100644 --- a/contrib/libs/cxxsupp/libcxx/src/system_error.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/system_error.cpp @@ -68,7 +68,7 @@ __attribute__((unused)) const char* handle_strerror_r_return(int strerror_return if (new_errno == EINVAL) return ""; - _LIBCPP_ASSERT_UNCATEGORIZED(new_errno == ERANGE, "unexpected error from ::strerror_r"); + _LIBCPP_ASSERT_INTERNAL(new_errno == ERANGE, "unexpected error from ::strerror_r"); // FIXME maybe? 'strerror_buff_size' is likely to exceed the // maximum error size so ERANGE shouldn't be returned. std::abort(); diff --git a/contrib/libs/cxxsupp/libcxx/src/time_zone.cpp b/contrib/libs/cxxsupp/libcxx/src/time_zone.cpp new file mode 100644 index 0000000000..b6bf06a116 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/time_zone.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html + +#include <chrono> + +#include "include/tzdb/time_zone_private.h" + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace chrono { + +[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI time_zone time_zone::__create(unique_ptr<time_zone::__impl>&& __p) { + _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "initialized time_zone without a valid pimpl object"); + time_zone result; + result.__impl_ = std::move(__p); + return result; +} + +_LIBCPP_EXPORTED_FROM_ABI time_zone::~time_zone() = default; + +[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI string_view time_zone::__name() const noexcept { return __impl_->__name(); } + +} // namespace chrono + +_LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/tz.cpp b/contrib/libs/cxxsupp/libcxx/src/tz.cpp deleted file mode 100644 index 4425f0e6b9..0000000000 --- a/contrib/libs/cxxsupp/libcxx/src/tz.cpp +++ /dev/null @@ -1,146 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html - -#include <chrono> -#include <filesystem> -#include <fstream> -#include <stdexcept> -#include <string> - -// Contains a parser for the IANA time zone data files. -// -// These files can be found at https://data.iana.org/time-zones/ and are in the -// public domain. Information regarding the input can be found at -// https://data.iana.org/time-zones/tz-how-to.html and -// https://man7.org/linux/man-pages/man8/zic.8.html. -// -// As indicated at https://howardhinnant.github.io/date/tz.html#Installation -// For Windows another file seems to be required -// https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml -// This file seems to contain the mapping of Windows time zone name to IANA -// time zone names. -// -// However this article mentions another way to do the mapping on Windows -// https://devblogs.microsoft.com/oldnewthing/20210527-00/?p=105255 -// This requires Windows 10 Version 1903, which was released in May of 2019 -// and considered end of life in December 2020 -// https://learn.microsoft.com/en-us/lifecycle/announcements/windows-10-1903-end-of-servicing -// -// TODO TZDB Implement the Windows mapping in tzdb::current_zone - -_LIBCPP_BEGIN_NAMESPACE_STD - -namespace chrono { - -// This function is weak so it can be overriden in the tests. The -// declaration is in the test header test/support/test_tzdb.h -_LIBCPP_WEAK string_view __libcpp_tzdb_directory() { -#if defined(__linux__) - return "/usr/share/zoneinfo/"; -#else -# error "unknown path to the IANA Time Zone Database" -#endif -} - -[[nodiscard]] static bool __is_whitespace(int __c) { return __c == ' ' || __c == '\t'; } - -static void __skip_optional_whitespace(istream& __input) { - while (chrono::__is_whitespace(__input.peek())) - __input.get(); -} - -static void __skip_mandatory_whitespace(istream& __input) { - if (!chrono::__is_whitespace(__input.get())) - std::__throw_runtime_error("corrupt tzdb: expected whitespace"); - - chrono::__skip_optional_whitespace(__input); -} - -static void __matches(istream& __input, char __expected) { - if (std::tolower(__input.get()) != __expected) - std::__throw_runtime_error((string("corrupt tzdb: expected character '") + __expected + '\'').c_str()); -} - -static void __matches(istream& __input, string_view __expected) { - for (auto __c : __expected) - if (std::tolower(__input.get()) != __c) - std::__throw_runtime_error((string("corrupt tzdb: expected string '") + string(__expected) + '\'').c_str()); -} - -[[nodiscard]] static string __parse_string(istream& __input) { - string __result; - while (true) { - int __c = __input.get(); - switch (__c) { - case ' ': - case '\t': - case '\n': - __input.unget(); - [[fallthrough]]; - case istream::traits_type::eof(): - if (__result.empty()) - std::__throw_runtime_error("corrupt tzdb: expected a string"); - - return __result; - - default: - __result.push_back(__c); - } - } -} - -static string __parse_version(istream& __input) { - // The first line in tzdata.zi contains - // # version YYYYw - // The parser expects this pattern - // #\s*version\s*\(.*) - // This part is not documented. - chrono::__matches(__input, '#'); - chrono::__skip_optional_whitespace(__input); - chrono::__matches(__input, "version"); - chrono::__skip_mandatory_whitespace(__input); - return chrono::__parse_string(__input); -} - -static tzdb __make_tzdb() { - tzdb __result; - - filesystem::path __root = chrono::__libcpp_tzdb_directory(); - ifstream __tzdata{__root / "tzdata.zi"}; - - __result.version = chrono::__parse_version(__tzdata); - return __result; -} - -//===----------------------------------------------------------------------===// -// Public API -//===----------------------------------------------------------------------===// - -_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI tzdb_list& get_tzdb_list() { - static tzdb_list __result{chrono::__make_tzdb()}; - return __result; -} - -_LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb() { - if (chrono::remote_version() == chrono::get_tzdb().version) - return chrono::get_tzdb(); - - return chrono::get_tzdb_list().__emplace_front(chrono::__make_tzdb()); -} - -_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version() { - filesystem::path __root = chrono::__libcpp_tzdb_directory(); - ifstream __tzdata{__root / "tzdata.zi"}; - return chrono::__parse_version(__tzdata); -} - -} // namespace chrono - -_LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/tzdb.cpp b/contrib/libs/cxxsupp/libcxx/src/tzdb.cpp new file mode 100644 index 0000000000..2bb801e486 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/src/tzdb.cpp @@ -0,0 +1,641 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html + +#include <algorithm> +#include <chrono> +#include <filesystem> +#include <fstream> +#include <stdexcept> +#include <string> + +#include "include/tzdb/time_zone_link_private.h" +#include "include/tzdb/time_zone_private.h" +#include "include/tzdb/types_private.h" +#include "include/tzdb/tzdb_list_private.h" +#include "include/tzdb/tzdb_private.h" + +// Contains a parser for the IANA time zone data files. +// +// These files can be found at https://data.iana.org/time-zones/ and are in the +// public domain. Information regarding the input can be found at +// https://data.iana.org/time-zones/tz-how-to.html and +// https://man7.org/linux/man-pages/man8/zic.8.html. +// +// As indicated at https://howardhinnant.github.io/date/tz.html#Installation +// For Windows another file seems to be required +// https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml +// This file seems to contain the mapping of Windows time zone name to IANA +// time zone names. +// +// However this article mentions another way to do the mapping on Windows +// https://devblogs.microsoft.com/oldnewthing/20210527-00/?p=105255 +// This requires Windows 10 Version 1903, which was released in May of 2019 +// and considered end of life in December 2020 +// https://learn.microsoft.com/en-us/lifecycle/announcements/windows-10-1903-end-of-servicing +// +// TODO TZDB Implement the Windows mapping in tzdb::current_zone + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace chrono { + +// This function is weak so it can be overriden in the tests. The +// declaration is in the test header test/support/test_tzdb.h +_LIBCPP_WEAK string_view __libcpp_tzdb_directory() { +#if defined(__linux__) + return "/usr/share/zoneinfo/"; +#else +# error "unknown path to the IANA Time Zone Database" +#endif +} + +//===----------------------------------------------------------------------===// +// Details +//===----------------------------------------------------------------------===// + +[[nodiscard]] static bool __is_whitespace(int __c) { return __c == ' ' || __c == '\t'; } + +static void __skip_optional_whitespace(istream& __input) { + while (chrono::__is_whitespace(__input.peek())) + __input.get(); +} + +static void __skip_mandatory_whitespace(istream& __input) { + if (!chrono::__is_whitespace(__input.get())) + std::__throw_runtime_error("corrupt tzdb: expected whitespace"); + + chrono::__skip_optional_whitespace(__input); +} + +[[nodiscard]] static bool __is_eol(int __c) { return __c == '\n' || __c == std::char_traits<char>::eof(); } + +static void __skip_line(istream& __input) { + while (!chrono::__is_eol(__input.peek())) { + __input.get(); + } + __input.get(); +} + +static void __skip(istream& __input, char __suffix) { + if (std::tolower(__input.peek()) == __suffix) + __input.get(); +} + +static void __skip(istream& __input, string_view __suffix) { + for (auto __c : __suffix) + if (std::tolower(__input.peek()) == __c) + __input.get(); +} + +static void __matches(istream& __input, char __expected) { + if (std::tolower(__input.get()) != __expected) + std::__throw_runtime_error((string("corrupt tzdb: expected character '") + __expected + '\'').c_str()); +} + +static void __matches(istream& __input, string_view __expected) { + for (auto __c : __expected) + if (std::tolower(__input.get()) != __c) + std::__throw_runtime_error((string("corrupt tzdb: expected string '") + string(__expected) + '\'').c_str()); +} + +[[nodiscard]] static string __parse_string(istream& __input) { + string __result; + while (true) { + int __c = __input.get(); + switch (__c) { + case ' ': + case '\t': + case '\n': + __input.unget(); + [[fallthrough]]; + case istream::traits_type::eof(): + if (__result.empty()) + std::__throw_runtime_error("corrupt tzdb: expected a string"); + + return __result; + + default: + __result.push_back(__c); + } + } +} + +[[nodiscard]] static int64_t __parse_integral(istream& __input, bool __leading_zero_allowed) { + int64_t __result = __input.get(); + if (__leading_zero_allowed) { + if (__result < '0' || __result > '9') + std::__throw_runtime_error("corrupt tzdb: expected a digit"); + } else { + if (__result < '1' || __result > '9') + std::__throw_runtime_error("corrupt tzdb: expected a non-zero digit"); + } + __result -= '0'; + while (true) { + if (__input.peek() < '0' || __input.peek() > '9') + return __result; + + // In order to avoid possible overflows we limit the accepted range. + // Most values parsed are expected to be very small: + // - 8784 hours in a year + // - 31 days in a month + // - year no real maximum, these values are expected to be less than + // the range of the year type. + // + // However the leapseconds use a seconds after epoch value. Using an + // int would run into an overflow in 2038. By using a 64-bit value + // the range is large enough for the bilions of years. Limiting that + // range slightly to make the code easier is not an issue. + if (__result > (std::numeric_limits<int64_t>::max() / 16)) + std::__throw_runtime_error("corrupt tzdb: integral too large"); + + __result *= 10; + __result += __input.get() - '0'; + } +} + +//===----------------------------------------------------------------------===// +// Calendar +//===----------------------------------------------------------------------===// + +[[nodiscard]] static day __parse_day(istream& __input) { + unsigned __result = chrono::__parse_integral(__input, false); + if (__result > 31) + std::__throw_runtime_error("corrupt tzdb day: value too large"); + return day{__result}; +} + +[[nodiscard]] static weekday __parse_weekday(istream& __input) { + // TZDB allows the shortest unique name. + switch (std::tolower(__input.get())) { + case 'f': + chrono::__skip(__input, "riday"); + return Friday; + + case 'm': + chrono::__skip(__input, "onday"); + return Monday; + + case 's': + switch (std::tolower(__input.get())) { + case 'a': + chrono::__skip(__input, "turday"); + return Saturday; + + case 'u': + chrono::__skip(__input, "nday"); + return Sunday; + } + break; + + case 't': + switch (std::tolower(__input.get())) { + case 'h': + chrono::__skip(__input, "ursday"); + return Thursday; + + case 'u': + chrono::__skip(__input, "esday"); + return Tuesday; + } + break; + case 'w': + chrono::__skip(__input, "ednesday"); + return Wednesday; + } + + std::__throw_runtime_error("corrupt tzdb weekday: invalid name"); +} + +[[nodiscard]] static month __parse_month(istream& __input) { + // TZDB allows the shortest unique name. + switch (std::tolower(__input.get())) { + case 'a': + switch (std::tolower(__input.get())) { + case 'p': + chrono::__skip(__input, "ril"); + return April; + + case 'u': + chrono::__skip(__input, "gust"); + return August; + } + break; + + case 'd': + chrono::__skip(__input, "ecember"); + return December; + + case 'f': + chrono::__skip(__input, "ebruary"); + return February; + + case 'j': + switch (std::tolower(__input.get())) { + case 'a': + chrono::__skip(__input, "nuary"); + return January; + + case 'u': + switch (std::tolower(__input.get())) { + case 'n': + chrono::__skip(__input, 'e'); + return June; + + case 'l': + chrono::__skip(__input, 'y'); + return July; + } + } + break; + + case 'm': + if (std::tolower(__input.get()) == 'a') + switch (std::tolower(__input.get())) { + case 'y': + return May; + + case 'r': + chrono::__skip(__input, "ch"); + return March; + } + break; + + case 'n': + chrono::__skip(__input, "ovember"); + return November; + + case 'o': + chrono::__skip(__input, "ctober"); + return October; + + case 's': + chrono::__skip(__input, "eptember"); + return September; + } + std::__throw_runtime_error("corrupt tzdb month: invalid name"); +} + +[[nodiscard]] static year __parse_year_value(istream& __input) { + bool __negative = __input.peek() == '-'; + if (__negative) [[unlikely]] + __input.get(); + + int64_t __result = __parse_integral(__input, true); + if (__result > static_cast<int>(year::max())) { + if (__negative) + std::__throw_runtime_error("corrupt tzdb year: year is less than the minimum"); + + std::__throw_runtime_error("corrupt tzdb year: year is greater than the maximum"); + } + + return year{static_cast<int>(__negative ? -__result : __result)}; +} + +[[nodiscard]] static year __parse_year(istream& __input) { + if (std::tolower(__input.peek()) != 'm') [[likely]] + return chrono::__parse_year_value(__input); + + __input.get(); + switch (std::tolower(__input.peek())) { + case 'i': + __input.get(); + chrono::__skip(__input, 'n'); + [[fallthrough]]; + + case ' ': + // The m is minimum, even when that is ambiguous. + return year::min(); + + case 'a': + __input.get(); + chrono::__skip(__input, 'x'); + return year::max(); + } + + std::__throw_runtime_error("corrupt tzdb year: expected 'min' or 'max'"); +} + +//===----------------------------------------------------------------------===// +// TZDB fields +//===----------------------------------------------------------------------===// + +[[nodiscard]] static year __parse_to(istream& __input, year __only) { + if (std::tolower(__input.peek()) != 'o') + return chrono::__parse_year(__input); + + __input.get(); + chrono::__skip(__input, "nly"); + return __only; +} + +[[nodiscard]] static __tz::__constrained_weekday::__comparison_t __parse_comparison(istream& __input) { + switch (__input.get()) { + case '>': + chrono::__matches(__input, '='); + return __tz::__constrained_weekday::__ge; + + case '<': + chrono::__matches(__input, '='); + return __tz::__constrained_weekday::__le; + } + std::__throw_runtime_error("corrupt tzdb on: expected '>=' or '<='"); +} + +[[nodiscard]] static __tz::__on __parse_on(istream& __input) { + if (std::isdigit(__input.peek())) + return chrono::__parse_day(__input); + + if (std::tolower(__input.peek()) == 'l') { + chrono::__matches(__input, "last"); + return weekday_last(chrono::__parse_weekday(__input)); + } + + return __tz::__constrained_weekday{ + chrono::__parse_weekday(__input), chrono::__parse_comparison(__input), chrono::__parse_day(__input)}; +} + +[[nodiscard]] static seconds __parse_duration(istream& __input) { + seconds __result{0}; + int __c = __input.peek(); + bool __negative = __c == '-'; + if (__negative) { + __input.get(); + // Negative is either a negative value or a single -. + // The latter means 0 and the parsing is complete. + if (!std::isdigit(__input.peek())) + return __result; + } + + __result += hours(__parse_integral(__input, true)); + if (__input.peek() != ':') + return __negative ? -__result : __result; + + __input.get(); + __result += minutes(__parse_integral(__input, true)); + if (__input.peek() != ':') + return __negative ? -__result : __result; + + __input.get(); + __result += seconds(__parse_integral(__input, true)); + if (__input.peek() != '.') + return __negative ? -__result : __result; + + __input.get(); + (void)__parse_integral(__input, true); // Truncate the digits. + + return __negative ? -__result : __result; +} + +[[nodiscard]] static __tz::__clock __parse_clock(istream& __input) { + switch (__input.get()) { // case sensitive + case 'w': + return __tz::__clock::__local; + case 's': + return __tz::__clock::__standard; + + case 'u': + case 'g': + case 'z': + return __tz::__clock::__universal; + } + + __input.unget(); + return __tz::__clock::__local; +} + +[[nodiscard]] static bool __parse_dst(istream& __input, seconds __offset) { + switch (__input.get()) { // case sensitive + case 's': + return false; + + case 'd': + return true; + } + + __input.unget(); + return __offset != 0s; +} + +[[nodiscard]] static __tz::__at __parse_at(istream& __input) { + return {__parse_duration(__input), __parse_clock(__input)}; +} + +[[nodiscard]] static __tz::__save __parse_save(istream& __input) { + seconds __time = chrono::__parse_duration(__input); + return {__time, chrono::__parse_dst(__input, __time)}; +} + +[[nodiscard]] static string __parse_letters(istream& __input) { + string __result = __parse_string(__input); + // Canonicalize "-" to "" since they are equivalent in the specification. + return __result != "-" ? __result : ""; +} + +[[nodiscard]] static __tz::__continuation::__rules_t __parse_rules(istream& __input) { + int __c = __input.peek(); + // A single - is not a SAVE but a special case. + if (__c == '-') { + __input.get(); + if (chrono::__is_whitespace(__input.peek())) + return monostate{}; + __input.unget(); + return chrono::__parse_save(__input); + } + + if (std::isdigit(__c) || __c == '+') + return chrono::__parse_save(__input); + + return chrono::__parse_string(__input); +} + +[[nodiscard]] static __tz::__continuation __parse_continuation(__tz::__rules_storage_type& __rules, istream& __input) { + __tz::__continuation __result; + + __result.__rule_database_ = std::addressof(__rules); + + // Note STDOFF is specified as + // This field has the same format as the AT and SAVE fields of rule lines; + // These fields have different suffix letters, these letters seem + // not to be used so do not allow any of them. + + __result.__stdoff = chrono::__parse_duration(__input); + chrono::__skip_mandatory_whitespace(__input); + __result.__rules = chrono::__parse_rules(__input); + chrono::__skip_mandatory_whitespace(__input); + __result.__format = chrono::__parse_string(__input); + chrono::__skip_optional_whitespace(__input); + + if (chrono::__is_eol(__input.peek())) + return __result; + __result.__year = chrono::__parse_year(__input); + chrono::__skip_optional_whitespace(__input); + + if (chrono::__is_eol(__input.peek())) + return __result; + __result.__in = chrono::__parse_month(__input); + chrono::__skip_optional_whitespace(__input); + + if (chrono::__is_eol(__input.peek())) + return __result; + __result.__on = chrono::__parse_on(__input); + chrono::__skip_optional_whitespace(__input); + + if (chrono::__is_eol(__input.peek())) + return __result; + __result.__at = __parse_at(__input); + + return __result; +} + +//===----------------------------------------------------------------------===// +// Time Zone Database entries +//===----------------------------------------------------------------------===// + +static string __parse_version(istream& __input) { + // The first line in tzdata.zi contains + // # version YYYYw + // The parser expects this pattern + // #\s*version\s*\(.*) + // This part is not documented. + chrono::__matches(__input, '#'); + chrono::__skip_optional_whitespace(__input); + chrono::__matches(__input, "version"); + chrono::__skip_mandatory_whitespace(__input); + return chrono::__parse_string(__input); +} + +static void __parse_rule(tzdb& __tzdb, __tz::__rules_storage_type& __rules, istream& __input) { + chrono::__skip_mandatory_whitespace(__input); + string __name = chrono::__parse_string(__input); + + if (__rules.empty() || __rules.back().first != __name) + __rules.emplace_back(__name, vector<__tz::__rule>{}); + + __tz::__rule& __rule = __rules.back().second.emplace_back(); + + chrono::__skip_mandatory_whitespace(__input); + __rule.__from = chrono::__parse_year(__input); + chrono::__skip_mandatory_whitespace(__input); + __rule.__to = chrono::__parse_to(__input, __rule.__from); + chrono::__skip_mandatory_whitespace(__input); + chrono::__matches(__input, '-'); + chrono::__skip_mandatory_whitespace(__input); + __rule.__in = chrono::__parse_month(__input); + chrono::__skip_mandatory_whitespace(__input); + __rule.__on = chrono::__parse_on(__input); + chrono::__skip_mandatory_whitespace(__input); + __rule.__at = __parse_at(__input); + chrono::__skip_mandatory_whitespace(__input); + __rule.__save = __parse_save(__input); + chrono::__skip_mandatory_whitespace(__input); + __rule.__letters = chrono::__parse_letters(__input); + chrono::__skip_line(__input); +} + +static void __parse_zone(tzdb& __tzdb, __tz::__rules_storage_type& __rules, istream& __input) { + chrono::__skip_mandatory_whitespace(__input); + auto __p = std::make_unique<time_zone::__impl>(chrono::__parse_string(__input)); + vector<__tz::__continuation>& __continuations = __p->__continuations(); + chrono::__skip_mandatory_whitespace(__input); + + do { + // The first line must be valid, continuations are optional. + __continuations.emplace_back(__parse_continuation(__rules, __input)); + chrono::__skip_line(__input); + chrono::__skip_optional_whitespace(__input); + } while (std::isdigit(__input.peek()) || __input.peek() == '-'); + + __tzdb.zones.emplace_back(time_zone::__create(std::move(__p))); +} + +static void __parse_link(tzdb& __tzdb, istream& __input) { + chrono::__skip_mandatory_whitespace(__input); + string __target = chrono::__parse_string(__input); + chrono::__skip_mandatory_whitespace(__input); + string __name = chrono::__parse_string(__input); + chrono::__skip_line(__input); + + __tzdb.links.emplace_back(time_zone_link::__constructor_tag{}, std::move(__name), std::move(__target)); +} + +static void __parse_tzdata(tzdb& __db, __tz::__rules_storage_type& __rules, istream& __input) { + while (true) { + int __c = std::tolower(__input.get()); + + switch (__c) { + case istream::traits_type::eof(): + return; + + case ' ': + case '\t': + case '\n': + break; + + case '#': + chrono::__skip_line(__input); + break; + + case 'r': + chrono::__skip(__input, "ule"); + chrono::__parse_rule(__db, __rules, __input); + break; + + case 'z': + chrono::__skip(__input, "one"); + chrono::__parse_zone(__db, __rules, __input); + break; + + case 'l': + chrono::__skip(__input, "ink"); + chrono::__parse_link(__db, __input); + break; + + default: + std::__throw_runtime_error("corrupt tzdb: unexpected input"); + } + } +} + +void __init_tzdb(tzdb& __tzdb, __tz::__rules_storage_type& __rules) { + filesystem::path __root = chrono::__libcpp_tzdb_directory(); + ifstream __tzdata{__root / "tzdata.zi"}; + + __tzdb.version = chrono::__parse_version(__tzdata); + chrono::__parse_tzdata(__tzdb, __rules, __tzdata); + std::ranges::sort(__tzdb.zones); + std::ranges::sort(__tzdb.links); + std::ranges::sort(__rules, {}, [](const auto& p) { return p.first; }); +} + +//===----------------------------------------------------------------------===// +// Public API +//===----------------------------------------------------------------------===// + +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI tzdb_list& get_tzdb_list() { + static tzdb_list __result{new tzdb_list::__impl()}; + return __result; +} + +_LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb() { + if (chrono::remote_version() == chrono::get_tzdb().version) + return chrono::get_tzdb(); + + return chrono::get_tzdb_list().__implementation().__load(); +} + +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version() { + filesystem::path __root = chrono::__libcpp_tzdb_directory(); + ifstream __tzdata{__root / "tzdata.zi"}; + return chrono::__parse_version(__tzdata); +} + +} // namespace chrono + +_LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/tzdb_list.cpp b/contrib/libs/cxxsupp/libcxx/src/tzdb_list.cpp index 7eaaedc6ed..d3ee8b58f9 100644 --- a/contrib/libs/cxxsupp/libcxx/src/tzdb_list.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/tzdb_list.cpp @@ -10,76 +10,12 @@ #include <chrono> -#include <__mutex/unique_lock.h> -#include <forward_list> - -// When threads are not available the locking is not required. -#ifndef _LIBCPP_HAS_NO_THREADS -# include <shared_mutex> -#endif +#include "include/tzdb/tzdb_list_private.h" _LIBCPP_BEGIN_NAMESPACE_STD namespace chrono { -//===----------------------------------------------------------------------===// -// Private API -//===----------------------------------------------------------------------===// - -class tzdb_list::__impl { -public: - explicit __impl(tzdb&& __tzdb) { __tzdb_.push_front(std::move(__tzdb)); } - - using const_iterator = tzdb_list::const_iterator; - - const tzdb& front() const noexcept { -#ifndef _LIBCPP_HAS_NO_THREADS - shared_lock __lock{__mutex_}; -#endif - return __tzdb_.front(); - } - - const_iterator erase_after(const_iterator __p) { -#ifndef _LIBCPP_HAS_NO_THREADS - unique_lock __lock{__mutex_}; -#endif - return __tzdb_.erase_after(__p); - } - - tzdb& __emplace_front(tzdb&& __tzdb) { -#ifndef _LIBCPP_HAS_NO_THREADS - unique_lock __lock{__mutex_}; -#endif - return __tzdb_.emplace_front(std::move(__tzdb)); - } - - const_iterator begin() const noexcept { -#ifndef _LIBCPP_HAS_NO_THREADS - shared_lock __lock{__mutex_}; -#endif - return __tzdb_.begin(); - } - const_iterator end() const noexcept { - // forward_list<T>::end does not access the list, so no need to take a lock. - return __tzdb_.end(); - } - - const_iterator cbegin() const noexcept { return begin(); } - const_iterator cend() const noexcept { return end(); } - -private: -#ifndef _LIBCPP_HAS_NO_THREADS - mutable shared_mutex __mutex_; -#endif - forward_list<tzdb> __tzdb_; -}; - -//===----------------------------------------------------------------------===// -// Public API -//===----------------------------------------------------------------------===// - -_LIBCPP_EXPORTED_FROM_ABI tzdb_list::tzdb_list(tzdb&& __tzdb) : __impl_{new __impl(std::move(__tzdb))} {} - _LIBCPP_EXPORTED_FROM_ABI tzdb_list::~tzdb_list() { delete __impl_; } _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const tzdb& tzdb_list::front() const noexcept { @@ -90,10 +26,6 @@ _LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::erase_after(const return __impl_->erase_after(__p); } -_LIBCPP_EXPORTED_FROM_ABI tzdb& tzdb_list::__emplace_front(tzdb&& __tzdb) { - return __impl_->__emplace_front(std::move(__tzdb)); -} - _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::begin() const noexcept { return __impl_->begin(); } diff --git a/contrib/libs/cxxsupp/libcxx/ya.make b/contrib/libs/cxxsupp/libcxx/ya.make index 948d390d82..14b64b35b1 100644 --- a/contrib/libs/cxxsupp/libcxx/ya.make +++ b/contrib/libs/cxxsupp/libcxx/ya.make @@ -14,9 +14,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(2023-12-18) +VERSION(2024-03-05) -ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7.tar.gz) +ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/80f9458cf30d13eef21b09042ea590945c5e64db.tar.gz) ADDINCL( GLOBAL contrib/libs/cxxsupp/libcxx/include @@ -204,6 +204,7 @@ SRCS( src/filesystem/filesystem_error.cpp src/filesystem/operations.cpp src/filesystem/path.cpp + src/fstream.cpp src/functional.cpp src/future.cpp src/hash.cpp @@ -217,6 +218,7 @@ SRCS( src/mutex.cpp src/mutex_destructor.cpp src/optional.cpp + src/ostream.cpp src/print.cpp src/random.cpp src/random_shuffle.cpp @@ -247,7 +249,8 @@ ENDIF() IF (OS_LINUX) SRCS( - src/tz.cpp + src/time_zone.cpp + src/tzdb.cpp src/tzdb_list.cpp ) ENDIF() diff --git a/contrib/libs/cxxsupp/libcxxabi/patches/07-__threading_support.sh b/contrib/libs/cxxsupp/libcxxabi/patches/07-__threading_support.sh new file mode 100644 index 0000000000..a32602a55a --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxabi/patches/07-__threading_support.sh @@ -0,0 +1,6 @@ +( + find . -type f -name '*.cpp' + find . -type f -name '*.h' +) | while read l; do + sed -i 's|#include <__threading_support>|#include <__thread/support.h>|g' ${l} +done diff --git a/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception_storage.cpp b/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception_storage.cpp index 3a3233a1b9..2479f550e0 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception_storage.cpp +++ b/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception_storage.cpp @@ -12,7 +12,7 @@ #include "cxa_exception.h" -#include <__threading_support> +#include <__thread/support.h> #if defined(_LIBCXXABI_HAS_NO_THREADS) diff --git a/contrib/libs/cxxsupp/libcxxabi/src/cxa_guard_impl.h b/contrib/libs/cxxsupp/libcxxabi/src/cxa_guard_impl.h index e00d54b3a7..7b140d3c36 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/cxa_guard_impl.h +++ b/contrib/libs/cxxsupp/libcxxabi/src/cxa_guard_impl.h @@ -55,7 +55,7 @@ # endif #endif -#include <__threading_support> +#include <__thread/support.h> #include <cstdint> #include <cstring> #include <limits.h> diff --git a/contrib/libs/cxxsupp/libcxxabi/src/cxa_thread_atexit.cpp b/contrib/libs/cxxsupp/libcxxabi/src/cxa_thread_atexit.cpp index bd7677a10e..de27ee612e 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/cxa_thread_atexit.cpp +++ b/contrib/libs/cxxsupp/libcxxabi/src/cxa_thread_atexit.cpp @@ -8,7 +8,7 @@ #include "abort_message.h" #include "cxxabi.h" -#include <__threading_support> +#include <__thread/support.h> #ifndef _LIBCXXABI_HAS_NO_THREADS #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB) #pragma comment(lib, "pthread") diff --git a/contrib/libs/cxxsupp/libcxxabi/src/fallback_malloc.cpp b/contrib/libs/cxxsupp/libcxxabi/src/fallback_malloc.cpp index f9fb1bc463..11e79740ff 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/fallback_malloc.cpp +++ b/contrib/libs/cxxsupp/libcxxabi/src/fallback_malloc.cpp @@ -8,7 +8,7 @@ #include "fallback_malloc.h" -#include <__threading_support> +#include <__thread/support.h> #ifndef _LIBCXXABI_HAS_NO_THREADS #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB) #pragma comment(lib, "pthread") |