diff options
author | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
---|---|---|
committer | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
commit | 06e5c21a835c0e923506c4ff27929f34e00761c2 (patch) | |
tree | 75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /contrib/restricted/abseil-cpp | |
parent | 03f024c4412e3aa613bb543cf1660176320ba8f4 (diff) | |
download | ydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz |
fix ya.make
Diffstat (limited to 'contrib/restricted/abseil-cpp')
249 files changed, 1842 insertions, 28075 deletions
diff --git a/contrib/restricted/abseil-cpp/.yandex_meta/devtools.copyrights.report b/contrib/restricted/abseil-cpp/.yandex_meta/devtools.copyrights.report deleted file mode 100644 index 52e2892efe..0000000000 --- a/contrib/restricted/abseil-cpp/.yandex_meta/devtools.copyrights.report +++ /dev/null @@ -1,520 +0,0 @@ -# File format ($ symbol means the beginning of a line): -# -# $ # this message -# $ # ======================= -# $ # comments (all commentaries should starts with some number of spaces and # symbol) -# ${action} {license id} {license text hash} -# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make -# ${all_file_action} filename -# $ # user commentaries (many lines) -# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) -# ${action} {license spdx} {license text hash} -# $BELONGS ./ya/make/file/relative/path/3/ya.make -# ${all_file_action} filename -# $ # user commentaries -# $ generated description -# $ ... -# -# You can modify action, all_file_action and add commentaries -# Available actions: -# keep - keep license in contrib and use in credits -# skip - skip license -# remove - remove all files with this license -# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file -# -# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) -# We suppose that that files can contain some license info -# Available all file actions: -# FILE_IGNORE - ignore file (do nothing) -# FILE_INCLUDE - include all file data into licenses text file -# ======================= - -KEEP COPYRIGHT_SERVICE_LABEL 02e3ff10f74acdb217118846c5465fc1 -BELONGS absl/algorithm/ya.make absl/base/ya.make absl/container/ya.make absl/debugging/internal/ya.make absl/debugging/ya.make absl/memory/ya.make absl/meta/ya.make absl/numeric/ya.make absl/strings/internal/str_format/ya.make absl/strings/ya.make absl/synchronization/internal/ya.make absl/synchronization/ya.make absl/time/ya.make absl/types/internal/ya.make absl/types/ya.make absl/utility/ya.make ya.make - License text: - // Copyright 2017 The Abseil Authors. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - absl/algorithm/algorithm.h [1:1] - absl/algorithm/container.h [1:1] - absl/base/attributes.h [1:1] - absl/base/call_once.h [1:1] - absl/base/casts.h [2:2] - absl/base/config.h [2:2] - absl/base/const_init.h [1:1] - absl/base/dynamic_annotations.h [1:1] - absl/base/internal/atomic_hook.h [1:1] - absl/base/internal/atomic_hook_test_helper.h [1:1] - absl/base/internal/cycleclock.cc [1:1] - absl/base/internal/cycleclock.h [2:2] - absl/base/internal/direct_mmap.h [1:1] - absl/base/internal/dynamic_annotations.h [1:1] - absl/base/internal/endian.h [1:1] - absl/base/internal/errno_saver.h [1:1] - absl/base/internal/exception_safety_testing.h [1:1] - absl/base/internal/exception_testing.h [1:1] - absl/base/internal/identity.h [1:1] - absl/base/internal/inline_variable.h [1:1] - absl/base/internal/inline_variable_testing.h [1:1] - absl/base/internal/invoke.h [1:1] - absl/base/internal/low_level_alloc.cc [1:1] - absl/base/internal/low_level_alloc.h [1:1] - absl/base/internal/low_level_scheduling.h [1:1] - absl/base/internal/per_thread_tls.h [1:1] - absl/base/internal/pretty_function.h [1:1] - absl/base/internal/raw_logging.cc [1:1] - absl/base/internal/raw_logging.h [1:1] - absl/base/internal/scheduling_mode.h [1:1] - absl/base/internal/spinlock.cc [1:1] - absl/base/internal/spinlock.h [2:2] - absl/base/internal/spinlock_akaros.inc [1:1] - absl/base/internal/spinlock_posix.inc [1:1] - absl/base/internal/spinlock_wait.cc [1:1] - absl/base/internal/spinlock_wait.h [1:1] - absl/base/internal/spinlock_win32.inc [1:1] - absl/base/internal/sysinfo.cc [1:1] - absl/base/internal/sysinfo.h [1:1] - absl/base/internal/thread_identity.cc [1:1] - absl/base/internal/thread_identity.h [1:1] - absl/base/internal/throw_delegate.cc [1:1] - absl/base/internal/throw_delegate.h [2:2] - absl/base/internal/tsan_mutex_interface.h [1:1] - absl/base/internal/unaligned_access.h [2:2] - absl/base/internal/unscaledcycleclock.cc [1:1] - absl/base/internal/unscaledcycleclock.h [1:1] - absl/base/log_severity.cc [1:1] - absl/base/log_severity.h [1:1] - absl/base/macros.h [2:2] - absl/base/optimization.h [2:2] - absl/base/policy_checks.h [1:1] - absl/base/port.h [1:1] - absl/base/thread_annotations.h [1:1] - absl/container/internal/test_instance_tracker.h [1:1] - absl/debugging/internal/address_is_readable.cc [1:1] - absl/debugging/internal/address_is_readable.h [1:1] - absl/debugging/internal/elf_mem_image.cc [1:1] - absl/debugging/internal/elf_mem_image.h [2:2] - absl/debugging/internal/stacktrace_arm-inl.inc [1:1] - absl/debugging/internal/stacktrace_config.h [2:2] - absl/debugging/internal/stacktrace_emscripten-inl.inc [1:1] - absl/debugging/internal/stacktrace_generic-inl.inc [1:1] - absl/debugging/internal/stacktrace_powerpc-inl.inc [1:1] - absl/debugging/internal/stacktrace_win32-inl.inc [1:1] - absl/debugging/internal/stacktrace_x86-inl.inc [1:1] - absl/debugging/internal/vdso_support.cc [1:1] - absl/debugging/internal/vdso_support.h [2:2] - absl/debugging/leak_check.cc [1:1] - absl/debugging/leak_check_disable.cc [1:1] - absl/debugging/stacktrace.cc [1:1] - absl/memory/memory.h [1:1] - absl/meta/type_traits.h [2:2] - absl/numeric/int128.cc [1:1] - absl/numeric/int128.h [2:2] - absl/numeric/int128_have_intrinsic.inc [2:2] - absl/numeric/int128_no_intrinsic.inc [2:2] - absl/random/bernoulli_distribution.h [1:1] - absl/random/beta_distribution.h [1:1] - absl/random/discrete_distribution.cc [1:1] - absl/random/discrete_distribution.h [1:1] - absl/random/distributions.h [1:1] - absl/random/exponential_distribution.h [1:1] - absl/random/gaussian_distribution.h [1:1] - absl/random/internal/chi_square.cc [1:1] - absl/random/internal/chi_square.h [1:1] - absl/random/internal/distribution_test_util.cc [1:1] - absl/random/internal/distribution_test_util.h [1:1] - absl/random/internal/explicit_seed_seq.h [1:1] - absl/random/internal/fast_uniform_bits.h [1:1] - absl/random/internal/fastmath.h [1:1] - absl/random/internal/generate_real.h [1:1] - absl/random/internal/iostream_state_saver.h [1:1] - absl/random/internal/nonsecure_base.h [1:1] - absl/random/internal/platform.h [1:1] - absl/random/internal/pool_urbg.cc [1:1] - absl/random/internal/pool_urbg.h [1:1] - absl/random/internal/randen.cc [1:1] - absl/random/internal/randen.h [1:1] - absl/random/internal/randen_detect.cc [1:1] - absl/random/internal/randen_detect.h [1:1] - absl/random/internal/randen_engine.h [1:1] - absl/random/internal/randen_hwaes.cc [1:1] - absl/random/internal/randen_hwaes.h [1:1] - absl/random/internal/randen_round_keys.cc [1:1] - absl/random/internal/randen_slow.cc [1:1] - absl/random/internal/randen_slow.h [1:1] - absl/random/internal/randen_traits.h [1:1] - absl/random/internal/salted_seed_seq.h [1:1] - absl/random/internal/seed_material.cc [1:1] - absl/random/internal/seed_material.h [1:1] - absl/random/internal/sequence_urbg.h [1:1] - absl/random/internal/traits.h [1:1] - absl/random/internal/wide_multiply.h [1:1] - absl/random/log_uniform_int_distribution.h [1:1] - absl/random/poisson_distribution.h [1:1] - absl/random/random.h [1:1] - absl/random/seed_gen_exception.cc [1:1] - absl/random/seed_gen_exception.h [1:1] - absl/random/seed_sequences.cc [1:1] - absl/random/seed_sequences.h [1:1] - absl/random/uniform_int_distribution.h [1:1] - absl/random/uniform_real_distribution.h [1:1] - absl/random/zipf_distribution.h [1:1] - absl/strings/ascii.cc [1:1] - absl/strings/ascii.h [2:2] - absl/strings/escaping.cc [1:1] - absl/strings/escaping.h [2:2] - absl/strings/internal/char_map.h [1:1] - absl/strings/internal/escaping_test_common.h [1:1] - absl/strings/internal/memutil.cc [1:1] - absl/strings/internal/memutil.h [2:2] - absl/strings/internal/numbers_test_common.h [1:1] - absl/strings/internal/ostringstream.cc [1:1] - absl/strings/internal/ostringstream.h [1:1] - absl/strings/internal/resize_uninitialized.h [2:2] - absl/strings/internal/stl_type_traits.h [1:1] - absl/strings/internal/str_format/extension.cc [2:2] - absl/strings/internal/str_format/extension.h [2:2] - absl/strings/internal/str_format/output.cc [1:1] - absl/strings/internal/str_format/output.h [1:1] - absl/strings/internal/str_join_internal.h [2:2] - absl/strings/internal/str_split_internal.h [1:1] - absl/strings/internal/utf8.cc [1:1] - absl/strings/internal/utf8.h [1:1] - absl/strings/match.cc [1:1] - absl/strings/match.h [2:2] - absl/strings/numbers.cc [1:1] - absl/strings/numbers.h [1:1] - absl/strings/str_cat.cc [1:1] - absl/strings/str_cat.h [2:2] - absl/strings/str_join.h [2:2] - absl/strings/str_replace.cc [1:1] - absl/strings/str_replace.h [2:2] - absl/strings/str_split.cc [1:1] - absl/strings/str_split.h [2:2] - absl/strings/string_view.cc [1:1] - absl/strings/string_view.h [2:2] - absl/strings/strip.h [2:2] - absl/strings/substitute.cc [1:1] - absl/strings/substitute.h [2:2] - absl/synchronization/barrier.cc [1:1] - absl/synchronization/barrier.h [1:1] - absl/synchronization/blocking_counter.cc [1:1] - absl/synchronization/blocking_counter.h [2:2] - absl/synchronization/internal/create_thread_identity.cc [1:1] - absl/synchronization/internal/create_thread_identity.h [2:2] - absl/synchronization/internal/graphcycles.cc [1:1] - absl/synchronization/internal/graphcycles.h [1:1] - absl/synchronization/internal/kernel_timeout.h [1:1] - absl/synchronization/internal/per_thread_sem.cc [1:1] - absl/synchronization/internal/per_thread_sem.h [1:1] - absl/synchronization/internal/thread_pool.h [1:1] - absl/synchronization/internal/waiter.cc [1:1] - absl/synchronization/internal/waiter.h [1:1] - absl/synchronization/mutex.cc [1:1] - absl/synchronization/mutex.h [1:1] - absl/synchronization/notification.cc [1:1] - absl/synchronization/notification.h [1:1] - absl/time/clock.cc [1:1] - absl/time/clock.h [1:1] - absl/time/duration.cc [1:1] - absl/time/format.cc [1:1] - absl/time/internal/test_util.h [1:1] - absl/time/time.cc [1:1] - absl/time/time.h [1:1] - absl/types/any.h [2:2] - absl/types/bad_any_cast.cc [1:1] - absl/types/bad_optional_access.cc [1:1] - absl/types/bad_variant_access.cc [1:1] - absl/types/internal/optional.h [1:1] - absl/types/optional.h [1:1] - absl/types/span.h [2:2] - absl/utility/utility.h [1:1] - -KEEP COPYRIGHT_SERVICE_LABEL 05bdd09fb9fdb384a61f2eb54df462d6 -BELONGS absl/time/ya.make - License text: - // Copyright 2016 Google Inc. All Rights Reserved. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - absl/time/internal/cctz/include/cctz/civil_time.h [1:1] - absl/time/internal/cctz/include/cctz/civil_time_detail.h [1:1] - absl/time/internal/cctz/include/cctz/time_zone.h [1:1] - absl/time/internal/cctz/include/cctz/zone_info_source.h [1:1] - absl/time/internal/cctz/src/civil_time_detail.cc [1:1] - absl/time/internal/cctz/src/time_zone_fixed.cc [1:1] - absl/time/internal/cctz/src/time_zone_fixed.h [1:1] - absl/time/internal/cctz/src/time_zone_format.cc [1:1] - absl/time/internal/cctz/src/time_zone_if.cc [1:1] - absl/time/internal/cctz/src/time_zone_if.h [1:1] - absl/time/internal/cctz/src/time_zone_impl.cc [1:1] - absl/time/internal/cctz/src/time_zone_impl.h [1:1] - absl/time/internal/cctz/src/time_zone_info.cc [1:1] - absl/time/internal/cctz/src/time_zone_info.h [1:1] - absl/time/internal/cctz/src/time_zone_libc.cc [1:1] - absl/time/internal/cctz/src/time_zone_libc.h [1:1] - absl/time/internal/cctz/src/time_zone_lookup.cc [1:1] - absl/time/internal/cctz/src/time_zone_posix.cc [1:1] - absl/time/internal/cctz/src/time_zone_posix.h [1:1] - absl/time/internal/cctz/src/zone_info_source.cc [1:1] - -KEEP COPYRIGHT_SERVICE_LABEL 2277624a2da390a98ec17138cb6dc2a5 -BELONGS absl/base/ya.make absl/container/ya.make absl/flags/ya.make absl/functional/ya.make absl/status/ya.make absl/strings/ya.make absl/types/internal/ya.make ya.make - License text: - // Copyright 2019 The Abseil Authors. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - absl/base/internal/scoped_set_env.cc [1:1] - absl/base/internal/scoped_set_env.h [2:2] - absl/base/internal/thread_annotations.h [1:1] - absl/base/options.h [1:1] - absl/container/inlined_vector.h [1:1] - absl/container/internal/inlined_vector.h [1:1] - absl/container/internal/unordered_map_members_test.h [1:1] - absl/container/internal/unordered_set_members_test.h [1:1] - absl/flags/config.h [2:2] - absl/flags/declare.h [2:2] - absl/flags/flag.cc [2:2] - absl/flags/flag.h [2:2] - absl/flags/internal/commandlineflag.h [2:2] - absl/flags/internal/flag.cc [2:2] - absl/flags/internal/flag.h [2:2] - absl/flags/internal/parse.h [2:2] - absl/flags/internal/path_util.h [2:2] - absl/flags/internal/program_name.cc [2:2] - absl/flags/internal/program_name.h [2:2] - absl/flags/internal/registry.h [2:2] - absl/flags/internal/usage.cc [2:2] - absl/flags/internal/usage.h [2:2] - absl/flags/marshalling.cc [2:2] - absl/flags/marshalling.h [2:2] - absl/flags/parse.cc [2:2] - absl/flags/parse.h [2:2] - absl/flags/usage.cc [2:2] - absl/flags/usage.h [2:2] - absl/flags/usage_config.cc [2:2] - absl/flags/usage_config.h [2:2] - absl/functional/function_ref.h [1:1] - absl/functional/internal/function_ref.h [1:1] - absl/profiling/internal/exponential_biased.cc [1:1] - absl/profiling/internal/exponential_biased.h [1:1] - absl/profiling/internal/periodic_sampler.cc [1:1] - absl/profiling/internal/periodic_sampler.h [1:1] - absl/random/internal/mock_helpers.h [2:2] - absl/random/internal/mock_overload_set.h [2:2] - absl/random/internal/uniform_helper.h [1:1] - absl/status/internal/status_internal.h [1:1] - absl/status/status.cc [1:1] - absl/status/status.h [1:1] - absl/status/status_payload_printer.cc [1:1] - absl/status/status_payload_printer.h [1:1] - absl/strings/internal/cordz_functions.cc [1:1] - absl/strings/internal/cordz_functions.h [1:1] - absl/strings/internal/cordz_handle.cc [1:1] - absl/strings/internal/cordz_handle.h [1:1] - absl/strings/internal/cordz_info.cc [1:1] - absl/strings/internal/cordz_info.h [1:1] - absl/strings/internal/cordz_sample_token.cc [1:1] - absl/strings/internal/cordz_sample_token.h [1:1] - absl/strings/internal/cordz_statistics.h [1:1] - absl/types/internal/conformance_archetype.h [1:1] - absl/types/internal/conformance_profile.h [1:1] - absl/types/internal/conformance_testing.h [1:1] - absl/types/internal/conformance_testing_helpers.h [1:1] - absl/types/internal/parentheses.h [1:1] - absl/types/internal/span.h [2:2] - absl/types/internal/transform_args.h [1:1] - -KEEP COPYRIGHT_SERVICE_LABEL 3fb410b721d46624abdaeb2473ffa5d6 -BELONGS absl/base/ya.make absl/container/ya.make absl/debugging/internal/ya.make absl/debugging/ya.make absl/functional/ya.make absl/hash/internal/ya.make absl/hash/ya.make absl/strings/ya.make absl/time/ya.make absl/types/internal/ya.make absl/types/ya.make ya.make - License text: - // Copyright 2018 The Abseil Authors. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - absl/base/internal/hide_ptr.h [1:1] - absl/base/internal/spinlock_linux.inc [1:1] - absl/container/btree_map.h [1:1] - absl/container/btree_set.h [1:1] - absl/container/btree_test.h [1:1] - absl/container/fixed_array.h [1:1] - absl/container/flat_hash_map.h [1:1] - absl/container/flat_hash_set.h [1:1] - absl/container/internal/btree.h [1:1] - absl/container/internal/btree_container.h [1:1] - absl/container/internal/common.h [1:1] - absl/container/internal/compressed_tuple.h [1:1] - absl/container/internal/container_memory.h [1:1] - absl/container/internal/counting_allocator.h [1:1] - absl/container/internal/hash_function_defaults.h [1:1] - absl/container/internal/hash_generator_testing.h [1:1] - absl/container/internal/hash_policy_testing.h [1:1] - absl/container/internal/hash_policy_traits.h [1:1] - absl/container/internal/hashtable_debug.h [1:1] - absl/container/internal/hashtable_debug_hooks.h [1:1] - absl/container/internal/hashtablez_sampler.cc [1:1] - absl/container/internal/hashtablez_sampler.h [1:1] - absl/container/internal/hashtablez_sampler_force_weak_definition.cc [1:1] - absl/container/internal/have_sse.h [1:1] - absl/container/internal/layout.h [1:1] - absl/container/internal/node_hash_policy.h [1:1] - absl/container/internal/raw_hash_map.h [1:1] - absl/container/internal/raw_hash_set.cc [1:1] - absl/container/internal/raw_hash_set.h [1:1] - absl/container/internal/tracked.h [1:1] - absl/container/internal/unordered_map_constructor_test.h [1:1] - absl/container/internal/unordered_map_lookup_test.h [1:1] - absl/container/internal/unordered_map_modifiers_test.h [1:1] - absl/container/internal/unordered_set_constructor_test.h [1:1] - absl/container/internal/unordered_set_lookup_test.h [1:1] - absl/container/internal/unordered_set_modifiers_test.h [1:1] - absl/container/node_hash_map.h [1:1] - absl/container/node_hash_set.h [1:1] - absl/debugging/failure_signal_handler.cc [2:2] - absl/debugging/failure_signal_handler.h [1:1] - absl/debugging/internal/demangle.cc [1:1] - absl/debugging/internal/demangle.h [1:1] - absl/debugging/internal/examine_stack.cc [2:2] - absl/debugging/internal/examine_stack.h [2:2] - absl/debugging/internal/stack_consumption.h [2:2] - absl/debugging/internal/symbolize.h [1:1] - absl/debugging/leak_check.h [1:1] - absl/debugging/stacktrace.h [1:1] - absl/debugging/symbolize.cc [1:1] - absl/debugging/symbolize.h [1:1] - absl/debugging/symbolize_elf.inc [1:1] - absl/debugging/symbolize_unimplemented.inc [1:1] - absl/debugging/symbolize_win32.inc [1:1] - absl/functional/bind_front.h [1:1] - absl/functional/internal/front_binder.h [1:1] - absl/hash/hash.h [1:1] - absl/hash/hash_testing.h [1:1] - absl/hash/internal/city.cc [1:1] - absl/hash/internal/city.h [1:1] - absl/hash/internal/hash.cc [1:1] - absl/hash/internal/hash.h [1:1] - absl/hash/internal/spy_hash_state.h [1:1] - absl/profiling/internal/sample_recorder.h [1:1] - absl/random/bit_gen_ref.h [2:2] - absl/random/internal/distribution_caller.h [2:2] - absl/random/internal/pcg_engine.h [1:1] - absl/random/mock_distributions.h [1:1] - absl/random/mocking_bit_gen.h [1:1] - absl/strings/charconv.cc [1:1] - absl/strings/charconv.h [1:1] - absl/strings/cord_test_helpers.h [2:2] - absl/strings/internal/charconv_bigint.cc [1:1] - absl/strings/internal/charconv_bigint.h [1:1] - absl/strings/internal/charconv_parse.cc [1:1] - absl/strings/internal/charconv_parse.h [1:1] - absl/strings/internal/pow10_helper.h [2:2] - absl/strings/str_format.h [2:2] - absl/time/civil_time.cc [1:1] - absl/time/civil_time.h [1:1] - absl/time/internal/get_current_time_chrono.inc [1:1] - absl/types/bad_any_cast.h [1:1] - absl/types/bad_optional_access.h [1:1] - absl/types/bad_variant_access.h [1:1] - absl/types/compare.h [1:1] - absl/types/internal/conformance_aliases.h [1:1] - absl/types/internal/variant.h [1:1] - absl/types/variant.h [1:1] - -KEEP COPYRIGHT_SERVICE_LABEL 58e60221a225d38384f3c66b2400cc91 -BELONGS absl/debugging/internal/ya.make absl/flags/ya.make absl/numeric/ya.make absl/strings/ya.make ya.make - License text: - // Copyright 2021 The Abseil Authors. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - absl/cleanup/cleanup.h [1:1] - absl/cleanup/internal/cleanup.h [1:1] - absl/debugging/internal/stacktrace_riscv-inl.inc [1:1] - absl/flags/internal/flag_msvc.inc [2:2] - absl/numeric/internal/representation.h [1:1] - absl/strings/cordz_test_helpers.h [1:1] - absl/strings/internal/cord_internal.h [1:1] - absl/strings/internal/cord_rep_btree.cc [1:1] - absl/strings/internal/cord_rep_btree.h [1:1] - absl/strings/internal/cord_rep_btree_navigator.cc [1:1] - absl/strings/internal/cord_rep_btree_navigator.h [1:1] - absl/strings/internal/cord_rep_btree_reader.cc [1:1] - absl/strings/internal/cord_rep_btree_reader.h [1:1] - absl/strings/internal/cord_rep_consume.cc [1:1] - absl/strings/internal/cord_rep_consume.h [1:1] - absl/strings/internal/cord_rep_ring_reader.h [1:1] - absl/strings/internal/cord_rep_test_util.h [1:1] - absl/strings/internal/cordz_update_scope.h [1:1] - absl/strings/internal/cordz_update_tracker.h [1:1] - -KEEP COPYRIGHT_SERVICE_LABEL 6499e2ad737f62db5558c81fbd2749a7 -BELONGS ya.make - License text: - // Copyright 2017 Google Inc. All Rights Reserved. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - absl/random/internal/nanobenchmark.h [1:1] - -KEEP COPYRIGHT_SERVICE_LABEL d34864d3c7c7a5ffae3d414344aa54a8 -BELONGS absl/base/ya.make absl/debugging/ya.make absl/flags/ya.make absl/hash/internal/ya.make absl/numeric/ya.make absl/status/ya.make absl/strings/internal/str_format/ya.make absl/strings/ya.make absl/synchronization/internal/ya.make - License text: - // Copyright 2020 The Abseil Authors. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - absl/base/internal/fast_type_id.h [2:2] - absl/base/internal/strerror.cc [1:1] - absl/base/internal/strerror.h [1:1] - absl/debugging/symbolize_darwin.inc [1:1] - absl/debugging/symbolize_emscripten.inc [1:1] - absl/flags/commandlineflag.cc [2:2] - absl/flags/commandlineflag.h [2:2] - absl/flags/internal/commandlineflag.cc [2:2] - absl/flags/internal/private_handle_accessor.cc [2:2] - absl/flags/internal/private_handle_accessor.h [2:2] - absl/flags/internal/sequence_lock.h [2:2] - absl/flags/reflection.cc [2:2] - absl/flags/reflection.h [2:2] - absl/hash/internal/low_level_hash.cc [1:1] - absl/hash/internal/low_level_hash.h [1:1] - absl/numeric/bits.h [1:1] - absl/numeric/internal/bits.h [1:1] - absl/status/internal/statusor_internal.h [1:1] - absl/status/statusor.cc [1:1] - absl/status/statusor.h [1:1] - absl/strings/cord.cc [1:1] - absl/strings/cord.h [1:1] - absl/strings/internal/cord_internal.cc [1:1] - absl/strings/internal/cord_rep_flat.h [1:1] - absl/strings/internal/cord_rep_ring.cc [1:1] - absl/strings/internal/cord_rep_ring.h [1:1] - absl/strings/internal/escaping.cc [1:1] - absl/strings/internal/escaping.h [1:1] - absl/strings/internal/str_format/arg.cc [1:1] - absl/strings/internal/str_format/arg.h [1:1] - absl/strings/internal/str_format/bind.cc [1:1] - absl/strings/internal/str_format/bind.h [1:1] - absl/strings/internal/str_format/checker.h [1:1] - absl/strings/internal/str_format/float_conversion.cc [1:1] - absl/strings/internal/str_format/float_conversion.h [1:1] - absl/strings/internal/str_format/parser.cc [1:1] - absl/strings/internal/str_format/parser.h [1:1] - absl/strings/internal/string_constant.h [1:1] - absl/synchronization/internal/futex.h [1:1] diff --git a/contrib/restricted/abseil-cpp/.yandex_meta/devtools.licenses.report b/contrib/restricted/abseil-cpp/.yandex_meta/devtools.licenses.report deleted file mode 100644 index e81554edb2..0000000000 --- a/contrib/restricted/abseil-cpp/.yandex_meta/devtools.licenses.report +++ /dev/null @@ -1,609 +0,0 @@ -# File format ($ symbol means the beginning of a line): -# -# $ # this message -# $ # ======================= -# $ # comments (all commentaries should starts with some number of spaces and # symbol) -# ${action} {license id} {license text hash} -# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make -# ${all_file_action} filename -# $ # user commentaries (many lines) -# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) -# ${action} {license spdx} {license text hash} -# $BELONGS ./ya/make/file/relative/path/3/ya.make -# ${all_file_action} filename -# $ # user commentaries -# $ generated description -# $ ... -# -# You can modify action, all_file_action and add commentaries -# Available actions: -# keep - keep license in contrib and use in credits -# skip - skip license -# remove - remove all files with this license -# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file -# -# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) -# We suppose that that files can contain some license info -# Available all file actions: -# FILE_IGNORE - ignore file (do nothing) -# FILE_INCLUDE - include all file data into licenses text file -# ======================= - -KEEP Apache-2.0 0e8699c5f5ea602534a6558430df2b8d -BELONGS absl/debugging/internal/ya.make absl/hash/internal/ya.make absl/numeric/ya.make absl/strings/ya.make ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : NOTICE - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - absl/debugging/internal/stacktrace_riscv-inl.inc [3:13] - absl/hash/internal/low_level_hash.cc [3:13] - absl/hash/internal/low_level_hash.h [3:13] - absl/numeric/bits.h [3:13] - absl/numeric/internal/bits.h [3:13] - absl/numeric/internal/representation.h [3:13] - absl/profiling/internal/exponential_biased.cc [3:13] - absl/profiling/internal/exponential_biased.h [3:13] - absl/random/internal/nanobenchmark.h [3:13] - absl/strings/cordz_test_helpers.h [3:13] - absl/strings/internal/cord_rep_btree.cc [3:13] - absl/strings/internal/cord_rep_btree.h [3:13] - absl/strings/internal/cord_rep_btree_navigator.cc [3:13] - absl/strings/internal/cord_rep_btree_navigator.h [3:13] - absl/strings/internal/cord_rep_btree_reader.cc [3:13] - absl/strings/internal/cord_rep_btree_reader.h [3:13] - absl/strings/internal/cord_rep_consume.cc [3:13] - absl/strings/internal/cord_rep_consume.h [3:13] - absl/strings/internal/cord_rep_flat.h [3:13] - absl/strings/internal/cord_rep_ring.cc [3:13] - absl/strings/internal/cord_rep_ring.h [3:13] - absl/strings/internal/cord_rep_ring_reader.h [3:13] - absl/strings/internal/cord_rep_test_util.h [3:13] - absl/strings/internal/cordz_update_scope.h [3:13] - absl/strings/internal/cordz_update_tracker.h [3:13] - -KEEP Apache-2.0 0f66a26c8211d9f8c21369fcb6702370 -BELONGS absl/time/ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : NOTICE - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - absl/time/internal/cctz/include/cctz/civil_time.h [3:13] - absl/time/internal/cctz/include/cctz/civil_time_detail.h [3:13] - absl/time/internal/cctz/include/cctz/time_zone.h [3:13] - absl/time/internal/cctz/include/cctz/zone_info_source.h [3:13] - absl/time/internal/cctz/src/civil_time_detail.cc [3:13] - absl/time/internal/cctz/src/time_zone_fixed.cc [3:13] - absl/time/internal/cctz/src/time_zone_fixed.h [3:13] - absl/time/internal/cctz/src/time_zone_format.cc [3:13] - absl/time/internal/cctz/src/time_zone_if.cc [3:13] - absl/time/internal/cctz/src/time_zone_if.h [3:13] - absl/time/internal/cctz/src/time_zone_impl.cc [3:13] - absl/time/internal/cctz/src/time_zone_impl.h [3:13] - absl/time/internal/cctz/src/time_zone_info.cc [3:13] - absl/time/internal/cctz/src/time_zone_info.h [3:13] - absl/time/internal/cctz/src/time_zone_libc.cc [3:13] - absl/time/internal/cctz/src/time_zone_libc.h [3:13] - absl/time/internal/cctz/src/time_zone_lookup.cc [3:13] - absl/time/internal/cctz/src/time_zone_posix.cc [3:13] - absl/time/internal/cctz/src/time_zone_posix.h [3:13] - absl/time/internal/cctz/src/zone_info_source.cc [3:13] - -KEEP Apache-2.0 3493ceb30c6c8a1d5127bc1f0b030380 -BELONGS ya.make - License text: - \## License - The Abseil C++ library is licensed under the terms of the Apache - license. See [LICENSE](LICENSE) for more information. - Scancode info: - Original SPDX id: Apache-2.0 - Score : 62.50 - Match type : NOTICE - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - README.md [128:131] - -KEEP Public-Domain 3a682fe6def1cddc889298ee2a043f6f -BELONGS absl/time/ya.make - License text: - ** This file is in the public domain, so clarified as of - Scancode info: - Original SPDX id: LicenseRef-scancode-public-domain - Score : 100.00 - Match type : TEXT - 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: - absl/time/internal/cctz/src/tzfile.h [8:8] - -KEEP Apache-2.0 3ea5060c4f08f5769674fbf0c0fb3992 -BELONGS absl/algorithm/ya.make absl/base/ya.make absl/container/ya.make absl/debugging/internal/ya.make absl/debugging/ya.make absl/flags/ya.make absl/functional/ya.make absl/hash/internal/ya.make absl/hash/ya.make absl/memory/ya.make absl/meta/ya.make absl/numeric/ya.make absl/status/ya.make absl/strings/internal/str_format/ya.make absl/strings/ya.make absl/synchronization/internal/ya.make absl/synchronization/ya.make absl/time/ya.make absl/types/internal/ya.make absl/types/ya.make absl/utility/ya.make ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : NOTICE - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - absl/algorithm/algorithm.h [3:13] - absl/algorithm/container.h [3:13] - absl/base/attributes.h [3:13] - absl/base/call_once.h [3:13] - absl/base/casts.h [4:14] - absl/base/config.h [4:14] - absl/base/const_init.h [3:13] - absl/base/dynamic_annotations.h [3:13] - absl/base/internal/atomic_hook.h [3:13] - absl/base/internal/atomic_hook_test_helper.h [3:13] - absl/base/internal/cycleclock.cc [3:13] - absl/base/internal/cycleclock.h [4:14] - absl/base/internal/direct_mmap.h [3:13] - absl/base/internal/dynamic_annotations.h [3:13] - absl/base/internal/endian.h [3:13] - absl/base/internal/errno_saver.h [3:13] - absl/base/internal/exception_safety_testing.h [3:13] - absl/base/internal/exception_testing.h [3:13] - absl/base/internal/fast_type_id.h [4:14] - absl/base/internal/hide_ptr.h [3:13] - absl/base/internal/identity.h [3:13] - absl/base/internal/inline_variable.h [3:13] - absl/base/internal/inline_variable_testing.h [3:13] - absl/base/internal/invoke.h [3:13] - absl/base/internal/low_level_alloc.cc [3:13] - absl/base/internal/low_level_alloc.h [3:13] - absl/base/internal/low_level_scheduling.h [3:13] - absl/base/internal/per_thread_tls.h [3:13] - absl/base/internal/pretty_function.h [3:13] - absl/base/internal/raw_logging.cc [3:13] - absl/base/internal/raw_logging.h [3:13] - absl/base/internal/scheduling_mode.h [3:13] - absl/base/internal/scoped_set_env.cc [3:13] - absl/base/internal/scoped_set_env.h [4:14] - absl/base/internal/spinlock.cc [3:13] - absl/base/internal/spinlock.h [4:14] - absl/base/internal/spinlock_akaros.inc [3:13] - absl/base/internal/spinlock_linux.inc [3:13] - absl/base/internal/spinlock_posix.inc [3:13] - absl/base/internal/spinlock_wait.cc [3:13] - absl/base/internal/spinlock_wait.h [3:13] - absl/base/internal/spinlock_win32.inc [3:13] - absl/base/internal/strerror.cc [3:13] - absl/base/internal/strerror.h [3:13] - absl/base/internal/sysinfo.cc [3:13] - absl/base/internal/sysinfo.h [3:13] - absl/base/internal/thread_annotations.h [3:13] - absl/base/internal/thread_identity.cc [3:13] - absl/base/internal/thread_identity.h [3:13] - absl/base/internal/throw_delegate.cc [3:13] - absl/base/internal/throw_delegate.h [4:14] - absl/base/internal/tsan_mutex_interface.h [3:13] - absl/base/internal/unaligned_access.h [4:14] - absl/base/internal/unscaledcycleclock.cc [3:13] - absl/base/internal/unscaledcycleclock.h [3:13] - absl/base/log_severity.cc [3:13] - absl/base/log_severity.h [3:13] - absl/base/macros.h [4:14] - absl/base/optimization.h [4:14] - absl/base/options.h [3:13] - absl/base/policy_checks.h [3:13] - absl/base/port.h [3:13] - absl/base/thread_annotations.h [3:13] - absl/cleanup/cleanup.h [3:13] - absl/cleanup/internal/cleanup.h [3:13] - absl/container/btree_map.h [3:13] - absl/container/btree_set.h [3:13] - absl/container/btree_test.h [3:13] - absl/container/fixed_array.h [3:13] - absl/container/flat_hash_map.h [3:13] - absl/container/flat_hash_set.h [3:13] - absl/container/inlined_vector.h [3:13] - absl/container/internal/btree.h [3:13] - absl/container/internal/btree_container.h [3:13] - absl/container/internal/common.h [3:13] - absl/container/internal/compressed_tuple.h [3:13] - absl/container/internal/container_memory.h [3:13] - absl/container/internal/counting_allocator.h [3:13] - absl/container/internal/hash_function_defaults.h [3:13] - absl/container/internal/hash_generator_testing.h [3:13] - absl/container/internal/hash_policy_testing.h [3:13] - absl/container/internal/hash_policy_traits.h [3:13] - absl/container/internal/hashtable_debug.h [3:13] - absl/container/internal/hashtable_debug_hooks.h [3:13] - absl/container/internal/hashtablez_sampler.cc [3:13] - absl/container/internal/hashtablez_sampler.h [3:13] - absl/container/internal/hashtablez_sampler_force_weak_definition.cc [3:13] - absl/container/internal/have_sse.h [3:13] - absl/container/internal/inlined_vector.h [3:13] - absl/container/internal/layout.h [3:13] - absl/container/internal/node_hash_policy.h [3:13] - absl/container/internal/raw_hash_map.h [3:13] - absl/container/internal/raw_hash_set.cc [3:13] - absl/container/internal/raw_hash_set.h [3:13] - absl/container/internal/test_instance_tracker.h [3:13] - absl/container/internal/tracked.h [3:13] - absl/container/internal/unordered_map_constructor_test.h [3:13] - absl/container/internal/unordered_map_lookup_test.h [3:13] - absl/container/internal/unordered_map_members_test.h [3:13] - absl/container/internal/unordered_map_modifiers_test.h [3:13] - absl/container/internal/unordered_set_constructor_test.h [3:13] - absl/container/internal/unordered_set_lookup_test.h [3:13] - absl/container/internal/unordered_set_members_test.h [3:13] - absl/container/internal/unordered_set_modifiers_test.h [3:13] - absl/container/node_hash_map.h [3:13] - absl/container/node_hash_set.h [3:13] - absl/debugging/failure_signal_handler.cc [4:14] - absl/debugging/failure_signal_handler.h [3:13] - absl/debugging/internal/address_is_readable.cc [3:13] - absl/debugging/internal/address_is_readable.h [3:13] - absl/debugging/internal/demangle.cc [3:13] - absl/debugging/internal/demangle.h [3:13] - absl/debugging/internal/elf_mem_image.cc [3:13] - absl/debugging/internal/examine_stack.cc [4:14] - absl/debugging/internal/examine_stack.h [4:14] - absl/debugging/internal/stack_consumption.h [4:14] - absl/debugging/internal/stacktrace_arm-inl.inc [3:13] - absl/debugging/internal/stacktrace_emscripten-inl.inc [3:13] - absl/debugging/internal/stacktrace_generic-inl.inc [3:13] - absl/debugging/internal/stacktrace_powerpc-inl.inc [3:13] - absl/debugging/internal/stacktrace_win32-inl.inc [3:13] - absl/debugging/internal/stacktrace_x86-inl.inc [3:13] - absl/debugging/internal/symbolize.h [3:13] - absl/debugging/internal/vdso_support.cc [3:13] - absl/debugging/internal/vdso_support.h [4:14] - absl/debugging/leak_check.cc [3:13] - absl/debugging/leak_check.h [3:13] - absl/debugging/leak_check_disable.cc [3:13] - absl/debugging/stacktrace.cc [3:13] - absl/debugging/stacktrace.h [3:13] - absl/debugging/symbolize.cc [3:13] - absl/debugging/symbolize.h [3:13] - absl/debugging/symbolize_darwin.inc [3:13] - absl/debugging/symbolize_elf.inc [3:13] - absl/debugging/symbolize_emscripten.inc [3:13] - absl/debugging/symbolize_unimplemented.inc [3:13] - absl/debugging/symbolize_win32.inc [3:13] - absl/flags/commandlineflag.cc [4:14] - absl/flags/commandlineflag.h [4:14] - absl/flags/config.h [4:14] - absl/flags/declare.h [4:14] - absl/flags/flag.cc [4:14] - absl/flags/flag.h [4:14] - absl/flags/internal/commandlineflag.cc [4:14] - absl/flags/internal/commandlineflag.h [4:14] - absl/flags/internal/flag.cc [4:14] - absl/flags/internal/flag.h [4:14] - absl/flags/internal/flag_msvc.inc [4:14] - absl/flags/internal/parse.h [4:14] - absl/flags/internal/path_util.h [4:14] - absl/flags/internal/private_handle_accessor.cc [4:14] - absl/flags/internal/private_handle_accessor.h [4:14] - absl/flags/internal/program_name.cc [4:14] - absl/flags/internal/program_name.h [4:14] - absl/flags/internal/registry.h [4:14] - absl/flags/internal/sequence_lock.h [4:14] - absl/flags/internal/usage.cc [4:14] - absl/flags/internal/usage.h [4:14] - absl/flags/marshalling.cc [4:14] - absl/flags/marshalling.h [4:14] - absl/flags/parse.cc [4:14] - absl/flags/parse.h [4:14] - absl/flags/reflection.cc [4:14] - absl/flags/reflection.h [4:14] - absl/flags/usage.cc [4:14] - absl/flags/usage.h [4:14] - absl/flags/usage_config.cc [4:14] - absl/flags/usage_config.h [4:14] - absl/functional/bind_front.h [3:13] - absl/functional/function_ref.h [3:13] - absl/functional/internal/front_binder.h [3:13] - absl/functional/internal/function_ref.h [3:13] - absl/hash/hash.h [3:13] - absl/hash/hash_testing.h [3:13] - absl/hash/internal/city.cc [3:13] - absl/hash/internal/city.h [3:13] - absl/hash/internal/hash.cc [3:13] - absl/hash/internal/hash.h [3:13] - absl/hash/internal/spy_hash_state.h [3:13] - absl/memory/memory.h [3:13] - absl/meta/type_traits.h [4:14] - absl/numeric/int128.cc [3:13] - absl/numeric/int128.h [4:14] - absl/numeric/int128_have_intrinsic.inc [4:14] - absl/numeric/int128_no_intrinsic.inc [4:14] - absl/profiling/internal/periodic_sampler.cc [3:13] - absl/profiling/internal/periodic_sampler.h [3:13] - absl/profiling/internal/sample_recorder.h [3:13] - absl/random/bernoulli_distribution.h [3:13] - absl/random/beta_distribution.h [3:13] - absl/random/bit_gen_ref.h [4:14] - absl/random/discrete_distribution.cc [3:13] - absl/random/discrete_distribution.h [3:13] - absl/random/distributions.h [3:13] - absl/random/exponential_distribution.h [3:13] - absl/random/gaussian_distribution.h [3:13] - absl/random/internal/chi_square.cc [3:13] - absl/random/internal/chi_square.h [3:13] - absl/random/internal/distribution_caller.h [4:14] - absl/random/internal/distribution_test_util.cc [3:13] - absl/random/internal/distribution_test_util.h [3:13] - absl/random/internal/explicit_seed_seq.h [3:13] - absl/random/internal/fast_uniform_bits.h [3:13] - absl/random/internal/fastmath.h [3:13] - absl/random/internal/generate_real.h [3:13] - absl/random/internal/iostream_state_saver.h [3:13] - absl/random/internal/mock_helpers.h [4:14] - absl/random/internal/mock_overload_set.h [4:14] - absl/random/internal/nonsecure_base.h [3:13] - absl/random/internal/pcg_engine.h [3:13] - absl/random/internal/platform.h [3:13] - absl/random/internal/pool_urbg.cc [3:13] - absl/random/internal/pool_urbg.h [3:13] - absl/random/internal/randen.cc [3:13] - absl/random/internal/randen.h [3:13] - absl/random/internal/randen_detect.cc [3:13] - absl/random/internal/randen_detect.h [3:13] - absl/random/internal/randen_engine.h [3:13] - absl/random/internal/randen_hwaes.cc [3:13] - absl/random/internal/randen_hwaes.h [3:13] - absl/random/internal/randen_round_keys.cc [3:13] - absl/random/internal/randen_slow.cc [3:13] - absl/random/internal/randen_slow.h [3:13] - absl/random/internal/randen_traits.h [3:13] - absl/random/internal/salted_seed_seq.h [3:13] - absl/random/internal/seed_material.cc [3:13] - absl/random/internal/seed_material.h [3:13] - absl/random/internal/sequence_urbg.h [3:13] - absl/random/internal/traits.h [3:13] - absl/random/internal/uniform_helper.h [3:13] - absl/random/internal/wide_multiply.h [3:13] - absl/random/log_uniform_int_distribution.h [3:13] - absl/random/mock_distributions.h [3:13] - absl/random/mocking_bit_gen.h [3:13] - absl/random/poisson_distribution.h [3:13] - absl/random/random.h [3:13] - absl/random/seed_gen_exception.cc [3:13] - absl/random/seed_gen_exception.h [3:13] - absl/random/seed_sequences.cc [3:13] - absl/random/seed_sequences.h [3:13] - absl/random/uniform_int_distribution.h [3:13] - absl/random/uniform_real_distribution.h [3:13] - absl/random/zipf_distribution.h [3:13] - absl/status/internal/status_internal.h [3:13] - absl/status/internal/statusor_internal.h [3:13] - absl/status/status.cc [3:13] - absl/status/status.h [3:13] - absl/status/status_payload_printer.cc [3:13] - absl/status/status_payload_printer.h [3:13] - absl/status/statusor.cc [3:13] - absl/status/statusor.h [3:13] - absl/strings/ascii.cc [3:13] - absl/strings/ascii.h [4:14] - absl/strings/charconv.cc [3:13] - absl/strings/charconv.h [3:13] - absl/strings/cord.cc [3:13] - absl/strings/cord.h [3:13] - absl/strings/cord_test_helpers.h [4:14] - absl/strings/escaping.cc [3:13] - absl/strings/escaping.h [4:14] - absl/strings/internal/char_map.h [3:13] - absl/strings/internal/charconv_bigint.cc [3:13] - absl/strings/internal/charconv_bigint.h [3:13] - absl/strings/internal/charconv_parse.cc [3:13] - absl/strings/internal/charconv_parse.h [3:13] - absl/strings/internal/cord_internal.cc [3:13] - absl/strings/internal/cord_internal.h [3:13] - absl/strings/internal/cordz_functions.cc [3:13] - absl/strings/internal/cordz_functions.h [3:13] - absl/strings/internal/cordz_handle.cc [3:13] - absl/strings/internal/cordz_handle.h [3:13] - absl/strings/internal/cordz_info.cc [3:13] - absl/strings/internal/cordz_info.h [3:13] - absl/strings/internal/cordz_sample_token.cc [3:13] - absl/strings/internal/cordz_sample_token.h [3:13] - absl/strings/internal/cordz_statistics.h [3:13] - absl/strings/internal/escaping.cc [3:13] - absl/strings/internal/escaping.h [3:13] - absl/strings/internal/escaping_test_common.h [3:13] - absl/strings/internal/memutil.cc [3:13] - absl/strings/internal/memutil.h [4:14] - absl/strings/internal/numbers_test_common.h [3:13] - absl/strings/internal/ostringstream.cc [3:13] - absl/strings/internal/ostringstream.h [3:13] - absl/strings/internal/pow10_helper.h [4:14] - absl/strings/internal/resize_uninitialized.h [4:14] - absl/strings/internal/stl_type_traits.h [3:13] - absl/strings/internal/str_format/arg.cc [3:13] - absl/strings/internal/str_format/arg.h [3:13] - absl/strings/internal/str_format/bind.cc [3:13] - absl/strings/internal/str_format/bind.h [3:13] - absl/strings/internal/str_format/checker.h [3:13] - absl/strings/internal/str_format/extension.cc [4:14] - absl/strings/internal/str_format/extension.h [4:14] - absl/strings/internal/str_format/float_conversion.cc [3:13] - absl/strings/internal/str_format/float_conversion.h [3:13] - absl/strings/internal/str_format/output.cc [3:13] - absl/strings/internal/str_format/output.h [3:13] - absl/strings/internal/str_format/parser.cc [3:13] - absl/strings/internal/str_format/parser.h [3:13] - absl/strings/internal/str_join_internal.h [4:14] - absl/strings/internal/str_split_internal.h [3:13] - absl/strings/internal/string_constant.h [3:13] - absl/strings/internal/utf8.cc [3:13] - absl/strings/internal/utf8.h [3:13] - absl/strings/match.cc [3:13] - absl/strings/match.h [4:14] - absl/strings/numbers.cc [3:13] - absl/strings/numbers.h [3:13] - absl/strings/str_cat.cc [3:13] - absl/strings/str_cat.h [4:14] - absl/strings/str_format.h [4:14] - absl/strings/str_join.h [4:14] - absl/strings/str_replace.cc [3:13] - absl/strings/str_replace.h [4:14] - absl/strings/str_split.cc [3:13] - absl/strings/str_split.h [4:14] - absl/strings/string_view.cc [3:13] - absl/strings/string_view.h [4:14] - absl/strings/strip.h [4:14] - absl/strings/substitute.cc [3:13] - absl/strings/substitute.h [4:14] - absl/synchronization/barrier.cc [3:13] - absl/synchronization/barrier.h [3:13] - absl/synchronization/blocking_counter.cc [3:13] - absl/synchronization/blocking_counter.h [4:14] - absl/synchronization/internal/create_thread_identity.cc [3:13] - absl/synchronization/internal/futex.h [3:13] - absl/synchronization/internal/graphcycles.cc [3:13] - absl/synchronization/internal/graphcycles.h [3:13] - absl/synchronization/internal/kernel_timeout.h [3:13] - absl/synchronization/internal/per_thread_sem.cc [3:13] - absl/synchronization/internal/per_thread_sem.h [3:13] - absl/synchronization/internal/thread_pool.h [3:13] - absl/synchronization/internal/waiter.cc [3:13] - absl/synchronization/internal/waiter.h [3:13] - absl/synchronization/mutex.cc [3:13] - absl/synchronization/mutex.h [3:13] - absl/synchronization/notification.cc [3:13] - absl/synchronization/notification.h [3:13] - absl/time/civil_time.cc [3:13] - absl/time/civil_time.h [3:13] - absl/time/clock.cc [3:13] - absl/time/clock.h [3:13] - absl/time/duration.cc [3:13] - absl/time/format.cc [3:13] - absl/time/internal/get_current_time_chrono.inc [3:13] - absl/time/internal/test_util.h [3:13] - absl/time/time.cc [3:13] - absl/time/time.h [3:13] - absl/types/any.h [4:14] - absl/types/bad_any_cast.cc [3:13] - absl/types/bad_any_cast.h [3:13] - absl/types/bad_optional_access.cc [3:13] - absl/types/bad_optional_access.h [3:13] - absl/types/bad_variant_access.cc [3:13] - absl/types/bad_variant_access.h [3:13] - absl/types/compare.h [3:13] - absl/types/internal/conformance_aliases.h [3:13] - absl/types/internal/conformance_archetype.h [3:13] - absl/types/internal/conformance_profile.h [3:13] - absl/types/internal/conformance_testing.h [3:13] - absl/types/internal/conformance_testing_helpers.h [3:13] - absl/types/internal/optional.h [3:13] - absl/types/internal/parentheses.h [3:13] - absl/types/internal/span.h [4:14] - absl/types/internal/transform_args.h [3:13] - absl/types/internal/variant.h [3:13] - absl/types/optional.h [3:13] - absl/types/span.h [4:14] - absl/types/variant.h [3:13] - absl/utility/utility.h [3:13] - -SKIP LicenseRef-scancode-warranty-disclaimer 5ba761db85e57267704f71a6bcf20c2a -BELONGS absl/container/ya.make ya.make - License text: - // This utility is internal-only. Use at your own risk. - Scancode info: - Original SPDX id: LicenseRef-scancode-warranty-disclaimer - Score : 100.00 - Match type : TEXT - Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/warranty-disclaimer.LICENSE - Files with this license: - absl/container/internal/hashtablez_sampler.h [37:37] - absl/profiling/internal/sample_recorder.h [22:22] - -SKIP LicenseRef-scancode-generic-cla 5d780ffa423067f23c6a123ae33e7c18 -BELONGS ya.make - License text: - \## Contributor License Agreement - Scancode info: - Original SPDX id: LicenseRef-scancode-generic-cla - Score : 16.00 - Match type : NOTICE - Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/generic-cla.LICENSE - Files with this license: - CONTRIBUTING.md [9:9] - -SKIP LicenseRef-scancode-unknown-license-reference 8e1ade755f3bfad0a6736f291073f1ac -BELONGS ya.make - License text: - license. See [LICENSE](LICENSE) for more information. - Scancode info: - Original SPDX id: LicenseRef-scancode-unknown-license-reference - Score : 100.00 - Match type : REFERENCE - Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.LICENSE - Files with this license: - README.md [131:131] - -SKIP LicenseRef-scancode-generic-exception 99cf00730bf3973359b67cfa5b7ac051 -BELONGS absl/synchronization/ya.make - License text: - // logging; as a special exception, the function may acquire other mutexes - Scancode info: - Original SPDX id: LicenseRef-scancode-generic-exception - Score : 16.00 - Match type : INTRO - Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/generic-exception.LICENSE - Files with this license: - absl/synchronization/mutex.h [289:289] - -KEEP Apache-2.0 cac6cbe8ed5a3da569f7c01e4e486688 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : TEXT - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - LICENSE [2:202] - -KEEP Apache-2.0 d4afbfe97ca1f27103271d24e8af5b32 -BELONGS absl/debugging/internal/ya.make absl/synchronization/internal/ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : NOTICE - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - absl/debugging/internal/elf_mem_image.h [4:14] - absl/debugging/internal/stacktrace_config.h [4:14] - absl/synchronization/internal/create_thread_identity.h [4:14] - -SKIP LicenseRef-scancode-generic-cla d72fcd21b18e44b666a94e6225ed43eb -BELONGS ya.make - License text: - Contributions to this project must be accompanied by a Contributor License - Agreement. You (or your employer) retain the copyright to your contribution, - Scancode info: - Original SPDX id: LicenseRef-scancode-generic-cla - Score : 16.00 - Match type : NOTICE - Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/generic-cla.LICENSE - Files with this license: - CONTRIBUTING.md [11:12] - -SKIP BSD-2-Clause AND GPL-2.0-only e12cf8844c9d92dd647ddf4320b73d06 -BELONGS absl/strings/ya.make -# not a license - License text: - // input unless explicitly stated otherwise. All functions returning a CordRep* - Scancode info: - Original SPDX id: BSD-2-Clause - Score : 8.16 - Match type : NOTICE - Links : http://opensource.org/licenses/bsd-license.php, http://www.opensource.org/licenses/BSD-2-Clause, https://spdx.org/licenses/BSD-2-Clause - Files with this license: - absl/strings/internal/cord_rep_btree.h [49:49] - Scancode info: - Original SPDX id: GPL-2.0-only - Score : 8.16 - Match type : NOTICE - Links : http://www.gnu.org/licenses/gpl-2.0.html, http://www.gnu.org/licenses/gpl-2.0.txt, https://spdx.org/licenses/GPL-2.0-only - Files with this license: - absl/strings/internal/cord_rep_btree.h [49:49] diff --git a/contrib/restricted/abseil-cpp/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/.yandex_meta/licenses.list.txt deleted file mode 100644 index c89f4aa6f3..0000000000 --- a/contrib/restricted/abseil-cpp/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,257 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - https://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0==================== -## License - -The Abseil C++ library is licensed under the terms of the Apache -license. See [LICENSE](LICENSE) for more information. - - -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 Google Inc. All Rights Reserved. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2019 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2021 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/CMakeLists.linux.txt deleted file mode 100644 index 5252bb9cb7..0000000000 --- a/contrib/restricted/abseil-cpp/CMakeLists.linux.txt +++ /dev/null @@ -1,86 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(contrib-restricted-abseil-cpp INTERFACE) -target_link_libraries(contrib-restricted-abseil-cpp INTERFACE - abseil-cpp-absl-algorithm - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-scoped_set_env - base-internal-spinlock_wait - base-internal-strerror - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-city - abseil-cpp-absl-container - container-internal-absl_hashtablez_sampler - container-internal-raw_hash_set - abseil-cpp-absl-debugging - absl-debugging-failure_signal_handler - absl-debugging-internal - absl-debugging-leak_check - absl-debugging-leak_check_disable - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-flags - absl-flags-commandlineflag - flags-internal-commandlineflag - flags-internal-flag - flags-internal-private_handle_accessor - flags-internal-program_name - flags-internal-usage - absl-flags-marshalling - absl-flags-parse - absl-flags-reflection - absl-flags-usage - absl-flags-usage_config - abseil-cpp-absl-functional - abseil-cpp-absl-hash - absl-hash-internal - abseil-cpp-absl-memory - abseil-cpp-absl-meta - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - profiling-internal-periodic_sampler - absl-random-absl_random_distributions - random-internal-absl_random_internal_distribution_test_util - random-internal-pool_urbg - random-internal-randen - random-internal-randen_detect - random-internal-randen_hwaes - random-internal-randen_round_keys - random-internal-randen_slow - random-internal-seed_material - absl-random-seed_gen_exception - absl-random-seed_sequences - abseil-cpp-absl-status - absl-status-statusor - abseil-cpp-absl-strings - absl-strings-cord - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - strings-internal-cordz_sample_token - strings-internal-str_format - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - abseil-cpp-absl-types - absl-types-bad_any_cast - absl-types-bad_optional_access - absl-types-bad_variant_access - absl-types-internal - abseil-cpp-absl-utility -) diff --git a/contrib/restricted/abseil-cpp/CMakeLists.txt b/contrib/restricted/abseil-cpp/CMakeLists.txt index e8c98bfd99..5252bb9cb7 100644 --- a/contrib/restricted/abseil-cpp/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/CMakeLists.txt @@ -6,6 +6,81 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(contrib-restricted-abseil-cpp INTERFACE) +target_link_libraries(contrib-restricted-abseil-cpp INTERFACE + abseil-cpp-absl-algorithm + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-scoped_set_env + base-internal-spinlock_wait + base-internal-strerror + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-city + abseil-cpp-absl-container + container-internal-absl_hashtablez_sampler + container-internal-raw_hash_set + abseil-cpp-absl-debugging + absl-debugging-failure_signal_handler + absl-debugging-internal + absl-debugging-leak_check + absl-debugging-leak_check_disable + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-flags + absl-flags-commandlineflag + flags-internal-commandlineflag + flags-internal-flag + flags-internal-private_handle_accessor + flags-internal-program_name + flags-internal-usage + absl-flags-marshalling + absl-flags-parse + absl-flags-reflection + absl-flags-usage + absl-flags-usage_config + abseil-cpp-absl-functional + abseil-cpp-absl-hash + absl-hash-internal + abseil-cpp-absl-memory + abseil-cpp-absl-meta + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + profiling-internal-periodic_sampler + absl-random-absl_random_distributions + random-internal-absl_random_internal_distribution_test_util + random-internal-pool_urbg + random-internal-randen + random-internal-randen_detect + random-internal-randen_hwaes + random-internal-randen_round_keys + random-internal-randen_slow + random-internal-seed_material + absl-random-seed_gen_exception + absl-random-seed_sequences + abseil-cpp-absl-status + absl-status-statusor + abseil-cpp-absl-strings + absl-strings-cord + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + strings-internal-cordz_sample_token + strings-internal-str_format + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + abseil-cpp-absl-types + absl-types-bad_any_cast + absl-types-bad_optional_access + absl-types-bad_variant_access + absl-types-internal + abseil-cpp-absl-utility +) diff --git a/contrib/restricted/abseil-cpp/absl/algorithm/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/algorithm/.yandex_meta/licenses.list.txt deleted file mode 100644 index 7be6b42848..0000000000 --- a/contrib/restricted/abseil-cpp/absl/algorithm/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,16 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/algorithm/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/algorithm/CMakeLists.linux.txt deleted file mode 100644 index 58e0590374..0000000000 --- a/contrib/restricted/abseil-cpp/absl/algorithm/CMakeLists.linux.txt +++ /dev/null @@ -1,10 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-algorithm INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/algorithm/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/algorithm/CMakeLists.txt index e8c98bfd99..58e0590374 100644 --- a/contrib/restricted/abseil-cpp/absl/algorithm/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/algorithm/CMakeLists.txt @@ -6,6 +6,5 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-algorithm INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/base/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/base/.yandex_meta/licenses.list.txt deleted file mode 100644 index 9035904094..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,28 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2019 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2020 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/base/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/base/CMakeLists.linux.txt deleted file mode 100644 index 8ff5c8c5f2..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/CMakeLists.linux.txt +++ /dev/null @@ -1,30 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-base) -target_compile_options(abseil-cpp-absl-base PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-base PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-base PUBLIC - contrib-libs-cxxsupp - base-internal-raw_logging - base-internal-spinlock_wait - absl-base-log_severity -) -target_sources(abseil-cpp-absl-base PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/cycleclock.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/spinlock.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/sysinfo.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/thread_identity.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/unscaledcycleclock.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/base/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/base/CMakeLists.txt index e8c98bfd99..8ff5c8c5f2 100644 --- a/contrib/restricted/abseil-cpp/absl/base/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/base/CMakeLists.txt @@ -6,6 +6,25 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-base) +target_compile_options(abseil-cpp-absl-base PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-base PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-base PUBLIC + contrib-libs-cxxsupp + base-internal-raw_logging + base-internal-spinlock_wait + absl-base-log_severity +) +target_sources(abseil-cpp-absl-base PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/cycleclock.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/spinlock.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/sysinfo.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/thread_identity.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/atomic_hook_test_helper.h b/contrib/restricted/abseil-cpp/absl/base/internal/atomic_hook_test_helper.h deleted file mode 100644 index 3e72b4977d..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/atomic_hook_test_helper.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_BASE_ATOMIC_HOOK_TEST_HELPER_H_ -#define ABSL_BASE_ATOMIC_HOOK_TEST_HELPER_H_ - -#include "absl/base/internal/atomic_hook.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace atomic_hook_internal { - -using VoidF = void (*)(); -extern absl::base_internal::AtomicHook<VoidF> func; -extern int default_func_calls; -void DefaultFunc(); -void RegisterFunc(VoidF func); - -} // namespace atomic_hook_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_BASE_ATOMIC_HOOK_TEST_HELPER_H_ diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/exception_safety_testing.h b/contrib/restricted/abseil-cpp/absl/base/internal/exception_safety_testing.h deleted file mode 100644 index 77a5aec642..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/exception_safety_testing.h +++ /dev/null @@ -1,1109 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Utilities for testing exception-safety - -#ifndef ABSL_BASE_INTERNAL_EXCEPTION_SAFETY_TESTING_H_ -#define ABSL_BASE_INTERNAL_EXCEPTION_SAFETY_TESTING_H_ - -#include "absl/base/config.h" - -#ifdef ABSL_HAVE_EXCEPTIONS - -#include <cstddef> -#include <cstdint> -#include <functional> -#include <initializer_list> -#include <iosfwd> -#include <string> -#include <tuple> -#include <unordered_map> - -#include "gtest/gtest.h" -#include "absl/base/internal/pretty_function.h" -#include "absl/memory/memory.h" -#include "absl/meta/type_traits.h" -#include "absl/strings/string_view.h" -#include "absl/strings/substitute.h" -#include "absl/utility/utility.h" - -namespace testing { - -enum class TypeSpec; -enum class AllocSpec; - -constexpr TypeSpec operator|(TypeSpec a, TypeSpec b) { - using T = absl::underlying_type_t<TypeSpec>; - return static_cast<TypeSpec>(static_cast<T>(a) | static_cast<T>(b)); -} - -constexpr TypeSpec operator&(TypeSpec a, TypeSpec b) { - using T = absl::underlying_type_t<TypeSpec>; - return static_cast<TypeSpec>(static_cast<T>(a) & static_cast<T>(b)); -} - -constexpr AllocSpec operator|(AllocSpec a, AllocSpec b) { - using T = absl::underlying_type_t<AllocSpec>; - return static_cast<AllocSpec>(static_cast<T>(a) | static_cast<T>(b)); -} - -constexpr AllocSpec operator&(AllocSpec a, AllocSpec b) { - using T = absl::underlying_type_t<AllocSpec>; - return static_cast<AllocSpec>(static_cast<T>(a) & static_cast<T>(b)); -} - -namespace exceptions_internal { - -std::string GetSpecString(TypeSpec); -std::string GetSpecString(AllocSpec); - -struct NoThrowTag {}; -struct StrongGuaranteeTagType {}; - -// A simple exception class. We throw this so that test code can catch -// exceptions specifically thrown by ThrowingValue. -class TestException { - public: - explicit TestException(absl::string_view msg) : msg_(msg) {} - virtual ~TestException() {} - virtual const char* what() const noexcept { return msg_.c_str(); } - - private: - std::string msg_; -}; - -// TestBadAllocException exists because allocation functions must throw an -// exception which can be caught by a handler of std::bad_alloc. We use a child -// class of std::bad_alloc so we can customise the error message, and also -// derive from TestException so we don't accidentally end up catching an actual -// bad_alloc exception in TestExceptionSafety. -class TestBadAllocException : public std::bad_alloc, public TestException { - public: - explicit TestBadAllocException(absl::string_view msg) : TestException(msg) {} - using TestException::what; -}; - -extern int countdown; - -// Allows the countdown variable to be set manually (defaulting to the initial -// value of 0) -inline void SetCountdown(int i = 0) { countdown = i; } -// Sets the countdown to the terminal value -1 -inline void UnsetCountdown() { SetCountdown(-1); } - -void MaybeThrow(absl::string_view msg, bool throw_bad_alloc = false); - -testing::AssertionResult FailureMessage(const TestException& e, - int countdown) noexcept; - -struct TrackedAddress { - bool is_alive; - std::string description; -}; - -// Inspects the constructions and destructions of anything inheriting from -// TrackedObject. This allows us to safely "leak" TrackedObjects, as -// ConstructorTracker will destroy everything left over in its destructor. -class ConstructorTracker { - public: - explicit ConstructorTracker(int count) : countdown_(count) { - assert(current_tracker_instance_ == nullptr); - current_tracker_instance_ = this; - } - - ~ConstructorTracker() { - assert(current_tracker_instance_ == this); - current_tracker_instance_ = nullptr; - - for (auto& it : address_map_) { - void* address = it.first; - TrackedAddress& tracked_address = it.second; - if (tracked_address.is_alive) { - ADD_FAILURE() << ErrorMessage(address, tracked_address.description, - countdown_, "Object was not destroyed."); - } - } - } - - static void ObjectConstructed(void* address, std::string description) { - if (!CurrentlyTracking()) return; - - TrackedAddress& tracked_address = - current_tracker_instance_->address_map_[address]; - if (tracked_address.is_alive) { - ADD_FAILURE() << ErrorMessage( - address, tracked_address.description, - current_tracker_instance_->countdown_, - "Object was re-constructed. Current object was constructed by " + - description); - } - tracked_address = {true, std::move(description)}; - } - - static void ObjectDestructed(void* address) { - if (!CurrentlyTracking()) return; - - auto it = current_tracker_instance_->address_map_.find(address); - // Not tracked. Ignore. - if (it == current_tracker_instance_->address_map_.end()) return; - - TrackedAddress& tracked_address = it->second; - if (!tracked_address.is_alive) { - ADD_FAILURE() << ErrorMessage(address, tracked_address.description, - current_tracker_instance_->countdown_, - "Object was re-destroyed."); - } - tracked_address.is_alive = false; - } - - private: - static bool CurrentlyTracking() { - return current_tracker_instance_ != nullptr; - } - - static std::string ErrorMessage(void* address, - const std::string& address_description, - int countdown, - const std::string& error_description) { - return absl::Substitute( - "With coundtown at $0:\n" - " $1\n" - " Object originally constructed by $2\n" - " Object address: $3\n", - countdown, error_description, address_description, address); - } - - std::unordered_map<void*, TrackedAddress> address_map_; - int countdown_; - - static ConstructorTracker* current_tracker_instance_; -}; - -class TrackedObject { - public: - TrackedObject(const TrackedObject&) = delete; - TrackedObject(TrackedObject&&) = delete; - - protected: - explicit TrackedObject(std::string description) { - ConstructorTracker::ObjectConstructed(this, std::move(description)); - } - - ~TrackedObject() noexcept { ConstructorTracker::ObjectDestructed(this); } -}; -} // namespace exceptions_internal - -extern exceptions_internal::NoThrowTag nothrow_ctor; - -extern exceptions_internal::StrongGuaranteeTagType strong_guarantee; - -// A test class which is convertible to bool. The conversion can be -// instrumented to throw at a controlled time. -class ThrowingBool { - public: - ThrowingBool(bool b) noexcept : b_(b) {} // NOLINT(runtime/explicit) - operator bool() const { // NOLINT - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return b_; - } - - private: - bool b_; -}; - -/* - * Configuration enum for the ThrowingValue type that defines behavior for the - * lifetime of the instance. Use testing::nothrow_ctor to prevent the integer - * constructor from throwing. - * - * kEverythingThrows: Every operation can throw an exception - * kNoThrowCopy: Copy construction and copy assignment will not throw - * kNoThrowMove: Move construction and move assignment will not throw - * kNoThrowNew: Overloaded operators new and new[] will not throw - */ -enum class TypeSpec { - kEverythingThrows = 0, - kNoThrowCopy = 1, - kNoThrowMove = 1 << 1, - kNoThrowNew = 1 << 2, -}; - -/* - * A testing class instrumented to throw an exception at a controlled time. - * - * ThrowingValue implements a slightly relaxed version of the Regular concept -- - * that is it's a value type with the expected semantics. It also implements - * arithmetic operations. It doesn't implement member and pointer operators - * like operator-> or operator[]. - * - * ThrowingValue can be instrumented to have certain operations be noexcept by - * using compile-time bitfield template arguments. That is, to make an - * ThrowingValue which has noexcept move construction/assignment and noexcept - * copy construction/assignment, use the following: - * ThrowingValue<testing::kNoThrowMove | testing::kNoThrowCopy> my_thrwr{val}; - */ -template <TypeSpec Spec = TypeSpec::kEverythingThrows> -class ThrowingValue : private exceptions_internal::TrackedObject { - static constexpr bool IsSpecified(TypeSpec spec) { - return static_cast<bool>(Spec & spec); - } - - static constexpr int kDefaultValue = 0; - static constexpr int kBadValue = 938550620; - - public: - ThrowingValue() : TrackedObject(GetInstanceString(kDefaultValue)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ = kDefaultValue; - } - - ThrowingValue(const ThrowingValue& other) noexcept( - IsSpecified(TypeSpec::kNoThrowCopy)) - : TrackedObject(GetInstanceString(other.dummy_)) { - if (!IsSpecified(TypeSpec::kNoThrowCopy)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - } - dummy_ = other.dummy_; - } - - ThrowingValue(ThrowingValue&& other) noexcept( - IsSpecified(TypeSpec::kNoThrowMove)) - : TrackedObject(GetInstanceString(other.dummy_)) { - if (!IsSpecified(TypeSpec::kNoThrowMove)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - } - dummy_ = other.dummy_; - } - - explicit ThrowingValue(int i) : TrackedObject(GetInstanceString(i)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ = i; - } - - ThrowingValue(int i, exceptions_internal::NoThrowTag) noexcept - : TrackedObject(GetInstanceString(i)), dummy_(i) {} - - // absl expects nothrow destructors - ~ThrowingValue() noexcept = default; - - ThrowingValue& operator=(const ThrowingValue& other) noexcept( - IsSpecified(TypeSpec::kNoThrowCopy)) { - dummy_ = kBadValue; - if (!IsSpecified(TypeSpec::kNoThrowCopy)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - } - dummy_ = other.dummy_; - return *this; - } - - ThrowingValue& operator=(ThrowingValue&& other) noexcept( - IsSpecified(TypeSpec::kNoThrowMove)) { - dummy_ = kBadValue; - if (!IsSpecified(TypeSpec::kNoThrowMove)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - } - dummy_ = other.dummy_; - return *this; - } - - // Arithmetic Operators - ThrowingValue operator+(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ + other.dummy_, nothrow_ctor); - } - - ThrowingValue operator+() const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_, nothrow_ctor); - } - - ThrowingValue operator-(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ - other.dummy_, nothrow_ctor); - } - - ThrowingValue operator-() const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(-dummy_, nothrow_ctor); - } - - ThrowingValue& operator++() { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - ++dummy_; - return *this; - } - - ThrowingValue operator++(int) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - auto out = ThrowingValue(dummy_, nothrow_ctor); - ++dummy_; - return out; - } - - ThrowingValue& operator--() { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - --dummy_; - return *this; - } - - ThrowingValue operator--(int) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - auto out = ThrowingValue(dummy_, nothrow_ctor); - --dummy_; - return out; - } - - ThrowingValue operator*(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ * other.dummy_, nothrow_ctor); - } - - ThrowingValue operator/(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ / other.dummy_, nothrow_ctor); - } - - ThrowingValue operator%(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ % other.dummy_, nothrow_ctor); - } - - ThrowingValue operator<<(int shift) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ << shift, nothrow_ctor); - } - - ThrowingValue operator>>(int shift) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ >> shift, nothrow_ctor); - } - - // Comparison Operators - // NOTE: We use `ThrowingBool` instead of `bool` because most STL - // types/containers requires T to be convertible to bool. - friend ThrowingBool operator==(const ThrowingValue& a, - const ThrowingValue& b) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return a.dummy_ == b.dummy_; - } - friend ThrowingBool operator!=(const ThrowingValue& a, - const ThrowingValue& b) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return a.dummy_ != b.dummy_; - } - friend ThrowingBool operator<(const ThrowingValue& a, - const ThrowingValue& b) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return a.dummy_ < b.dummy_; - } - friend ThrowingBool operator<=(const ThrowingValue& a, - const ThrowingValue& b) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return a.dummy_ <= b.dummy_; - } - friend ThrowingBool operator>(const ThrowingValue& a, - const ThrowingValue& b) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return a.dummy_ > b.dummy_; - } - friend ThrowingBool operator>=(const ThrowingValue& a, - const ThrowingValue& b) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return a.dummy_ >= b.dummy_; - } - - // Logical Operators - ThrowingBool operator!() const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return !dummy_; - } - - ThrowingBool operator&&(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return dummy_ && other.dummy_; - } - - ThrowingBool operator||(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return dummy_ || other.dummy_; - } - - // Bitwise Logical Operators - ThrowingValue operator~() const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(~dummy_, nothrow_ctor); - } - - ThrowingValue operator&(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ & other.dummy_, nothrow_ctor); - } - - ThrowingValue operator|(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ | other.dummy_, nothrow_ctor); - } - - ThrowingValue operator^(const ThrowingValue& other) const { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return ThrowingValue(dummy_ ^ other.dummy_, nothrow_ctor); - } - - // Compound Assignment operators - ThrowingValue& operator+=(const ThrowingValue& other) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ += other.dummy_; - return *this; - } - - ThrowingValue& operator-=(const ThrowingValue& other) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ -= other.dummy_; - return *this; - } - - ThrowingValue& operator*=(const ThrowingValue& other) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ *= other.dummy_; - return *this; - } - - ThrowingValue& operator/=(const ThrowingValue& other) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ /= other.dummy_; - return *this; - } - - ThrowingValue& operator%=(const ThrowingValue& other) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ %= other.dummy_; - return *this; - } - - ThrowingValue& operator&=(const ThrowingValue& other) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ &= other.dummy_; - return *this; - } - - ThrowingValue& operator|=(const ThrowingValue& other) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ |= other.dummy_; - return *this; - } - - ThrowingValue& operator^=(const ThrowingValue& other) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ ^= other.dummy_; - return *this; - } - - ThrowingValue& operator<<=(int shift) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ <<= shift; - return *this; - } - - ThrowingValue& operator>>=(int shift) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ >>= shift; - return *this; - } - - // Pointer operators - void operator&() const = delete; // NOLINT(runtime/operator) - - // Stream operators - friend std::ostream& operator<<(std::ostream& os, const ThrowingValue& tv) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return os << GetInstanceString(tv.dummy_); - } - - friend std::istream& operator>>(std::istream& is, const ThrowingValue&) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - return is; - } - - // Memory management operators - static void* operator new(size_t s) noexcept( - IsSpecified(TypeSpec::kNoThrowNew)) { - if (!IsSpecified(TypeSpec::kNoThrowNew)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION, true); - } - return ::operator new(s); - } - - static void* operator new[](size_t s) noexcept( - IsSpecified(TypeSpec::kNoThrowNew)) { - if (!IsSpecified(TypeSpec::kNoThrowNew)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION, true); - } - return ::operator new[](s); - } - - template <typename... Args> - static void* operator new(size_t s, Args&&... args) noexcept( - IsSpecified(TypeSpec::kNoThrowNew)) { - if (!IsSpecified(TypeSpec::kNoThrowNew)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION, true); - } - return ::operator new(s, std::forward<Args>(args)...); - } - - template <typename... Args> - static void* operator new[](size_t s, Args&&... args) noexcept( - IsSpecified(TypeSpec::kNoThrowNew)) { - if (!IsSpecified(TypeSpec::kNoThrowNew)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION, true); - } - return ::operator new[](s, std::forward<Args>(args)...); - } - - // Abseil doesn't support throwing overloaded operator delete. These are - // provided so a throwing operator-new can clean up after itself. - void operator delete(void* p) noexcept { ::operator delete(p); } - - template <typename... Args> - void operator delete(void* p, Args&&... args) noexcept { - ::operator delete(p, std::forward<Args>(args)...); - } - - void operator delete[](void* p) noexcept { return ::operator delete[](p); } - - template <typename... Args> - void operator delete[](void* p, Args&&... args) noexcept { - return ::operator delete[](p, std::forward<Args>(args)...); - } - - // Non-standard access to the actual contained value. No need for this to - // throw. - int& Get() noexcept { return dummy_; } - const int& Get() const noexcept { return dummy_; } - - private: - static std::string GetInstanceString(int dummy) { - return absl::StrCat("ThrowingValue<", - exceptions_internal::GetSpecString(Spec), ">(", dummy, - ")"); - } - - int dummy_; -}; -// While not having to do with exceptions, explicitly delete comma operator, to -// make sure we don't use it on user-supplied types. -template <TypeSpec Spec, typename T> -void operator,(const ThrowingValue<Spec>&, T&&) = delete; -template <TypeSpec Spec, typename T> -void operator,(T&&, const ThrowingValue<Spec>&) = delete; - -/* - * Configuration enum for the ThrowingAllocator type that defines behavior for - * the lifetime of the instance. - * - * kEverythingThrows: Calls to the member functions may throw - * kNoThrowAllocate: Calls to the member functions will not throw - */ -enum class AllocSpec { - kEverythingThrows = 0, - kNoThrowAllocate = 1, -}; - -/* - * An allocator type which is instrumented to throw at a controlled time, or not - * to throw, using AllocSpec. The supported settings are the default of every - * function which is allowed to throw in a conforming allocator possibly - * throwing, or nothing throws, in line with the ABSL_ALLOCATOR_THROWS - * configuration macro. - */ -template <typename T, AllocSpec Spec = AllocSpec::kEverythingThrows> -class ThrowingAllocator : private exceptions_internal::TrackedObject { - static constexpr bool IsSpecified(AllocSpec spec) { - return static_cast<bool>(Spec & spec); - } - - public: - using pointer = T*; - using const_pointer = const T*; - using reference = T&; - using const_reference = const T&; - using void_pointer = void*; - using const_void_pointer = const void*; - using value_type = T; - using size_type = size_t; - using difference_type = ptrdiff_t; - - using is_nothrow = - std::integral_constant<bool, Spec == AllocSpec::kNoThrowAllocate>; - using propagate_on_container_copy_assignment = std::true_type; - using propagate_on_container_move_assignment = std::true_type; - using propagate_on_container_swap = std::true_type; - using is_always_equal = std::false_type; - - ThrowingAllocator() : TrackedObject(GetInstanceString(next_id_)) { - exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION); - dummy_ = std::make_shared<const int>(next_id_++); - } - - template <typename U> - ThrowingAllocator(const ThrowingAllocator<U, Spec>& other) noexcept // NOLINT - : TrackedObject(GetInstanceString(*other.State())), - dummy_(other.State()) {} - - // According to C++11 standard [17.6.3.5], Table 28, the move/copy ctors of - // allocator shall not exit via an exception, thus they are marked noexcept. - ThrowingAllocator(const ThrowingAllocator& other) noexcept - : TrackedObject(GetInstanceString(*other.State())), - dummy_(other.State()) {} - - template <typename U> - ThrowingAllocator(ThrowingAllocator<U, Spec>&& other) noexcept // NOLINT - : TrackedObject(GetInstanceString(*other.State())), - dummy_(std::move(other.State())) {} - - ThrowingAllocator(ThrowingAllocator&& other) noexcept - : TrackedObject(GetInstanceString(*other.State())), - dummy_(std::move(other.State())) {} - - ~ThrowingAllocator() noexcept = default; - - ThrowingAllocator& operator=(const ThrowingAllocator& other) noexcept { - dummy_ = other.State(); - return *this; - } - - template <typename U> - ThrowingAllocator& operator=( - const ThrowingAllocator<U, Spec>& other) noexcept { - dummy_ = other.State(); - return *this; - } - - template <typename U> - ThrowingAllocator& operator=(ThrowingAllocator<U, Spec>&& other) noexcept { - dummy_ = std::move(other.State()); - return *this; - } - - template <typename U> - struct rebind { - using other = ThrowingAllocator<U, Spec>; - }; - - pointer allocate(size_type n) noexcept( - IsSpecified(AllocSpec::kNoThrowAllocate)) { - ReadStateAndMaybeThrow(ABSL_PRETTY_FUNCTION); - return static_cast<pointer>(::operator new(n * sizeof(T))); - } - - pointer allocate(size_type n, const_void_pointer) noexcept( - IsSpecified(AllocSpec::kNoThrowAllocate)) { - return allocate(n); - } - - void deallocate(pointer ptr, size_type) noexcept { - ReadState(); - ::operator delete(static_cast<void*>(ptr)); - } - - template <typename U, typename... Args> - void construct(U* ptr, Args&&... args) noexcept( - IsSpecified(AllocSpec::kNoThrowAllocate)) { - ReadStateAndMaybeThrow(ABSL_PRETTY_FUNCTION); - ::new (static_cast<void*>(ptr)) U(std::forward<Args>(args)...); - } - - template <typename U> - void destroy(U* p) noexcept { - ReadState(); - p->~U(); - } - - size_type max_size() const noexcept { - return (std::numeric_limits<difference_type>::max)() / sizeof(value_type); - } - - ThrowingAllocator select_on_container_copy_construction() noexcept( - IsSpecified(AllocSpec::kNoThrowAllocate)) { - ReadStateAndMaybeThrow(ABSL_PRETTY_FUNCTION); - return *this; - } - - template <typename U> - bool operator==(const ThrowingAllocator<U, Spec>& other) const noexcept { - return dummy_ == other.dummy_; - } - - template <typename U> - bool operator!=(const ThrowingAllocator<U, Spec>& other) const noexcept { - return dummy_ != other.dummy_; - } - - template <typename, AllocSpec> - friend class ThrowingAllocator; - - private: - static std::string GetInstanceString(int dummy) { - return absl::StrCat("ThrowingAllocator<", - exceptions_internal::GetSpecString(Spec), ">(", dummy, - ")"); - } - - const std::shared_ptr<const int>& State() const { return dummy_; } - std::shared_ptr<const int>& State() { return dummy_; } - - void ReadState() { - // we know that this will never be true, but the compiler doesn't, so this - // should safely force a read of the value. - if (*dummy_ < 0) std::abort(); - } - - void ReadStateAndMaybeThrow(absl::string_view msg) const { - if (!IsSpecified(AllocSpec::kNoThrowAllocate)) { - exceptions_internal::MaybeThrow( - absl::Substitute("Allocator id $0 threw from $1", *dummy_, msg)); - } - } - - static int next_id_; - std::shared_ptr<const int> dummy_; -}; - -template <typename T, AllocSpec Spec> -int ThrowingAllocator<T, Spec>::next_id_ = 0; - -// Tests for resource leaks by attempting to construct a T using args repeatedly -// until successful, using the countdown method. Side effects can then be -// tested for resource leaks. -template <typename T, typename... Args> -void TestThrowingCtor(Args&&... args) { - struct Cleanup { - ~Cleanup() { exceptions_internal::UnsetCountdown(); } - } c; - for (int count = 0;; ++count) { - exceptions_internal::ConstructorTracker ct(count); - exceptions_internal::SetCountdown(count); - try { - T temp(std::forward<Args>(args)...); - static_cast<void>(temp); - break; - } catch (const exceptions_internal::TestException&) { - } - } -} - -// Tests the nothrow guarantee of the provided nullary operation. If the an -// exception is thrown, the result will be AssertionFailure(). Otherwise, it -// will be AssertionSuccess(). -template <typename Operation> -testing::AssertionResult TestNothrowOp(const Operation& operation) { - struct Cleanup { - Cleanup() { exceptions_internal::SetCountdown(); } - ~Cleanup() { exceptions_internal::UnsetCountdown(); } - } c; - try { - operation(); - return testing::AssertionSuccess(); - } catch (const exceptions_internal::TestException&) { - return testing::AssertionFailure() - << "TestException thrown during call to operation() when nothrow " - "guarantee was expected."; - } catch (...) { - return testing::AssertionFailure() - << "Unknown exception thrown during call to operation() when " - "nothrow guarantee was expected."; - } -} - -namespace exceptions_internal { - -// Dummy struct for ExceptionSafetyTestBuilder<> partial state. -struct UninitializedT {}; - -template <typename T> -class DefaultFactory { - public: - explicit DefaultFactory(const T& t) : t_(t) {} - std::unique_ptr<T> operator()() const { return absl::make_unique<T>(t_); } - - private: - T t_; -}; - -template <size_t LazyContractsCount, typename LazyFactory, - typename LazyOperation> -using EnableIfTestable = typename absl::enable_if_t< - LazyContractsCount != 0 && - !std::is_same<LazyFactory, UninitializedT>::value && - !std::is_same<LazyOperation, UninitializedT>::value>; - -template <typename Factory = UninitializedT, - typename Operation = UninitializedT, typename... Contracts> -class ExceptionSafetyTestBuilder; - -} // namespace exceptions_internal - -/* - * Constructs an empty ExceptionSafetyTestBuilder. All - * ExceptionSafetyTestBuilder objects are immutable and all With[thing] mutation - * methods return new instances of ExceptionSafetyTestBuilder. - * - * In order to test a T for exception safety, a factory for that T, a testable - * operation, and at least one contract callback returning an assertion - * result must be applied using the respective methods. - */ -exceptions_internal::ExceptionSafetyTestBuilder<> MakeExceptionSafetyTester(); - -namespace exceptions_internal { -template <typename T> -struct IsUniquePtr : std::false_type {}; - -template <typename T, typename D> -struct IsUniquePtr<std::unique_ptr<T, D>> : std::true_type {}; - -template <typename Factory> -struct FactoryPtrTypeHelper { - using type = decltype(std::declval<const Factory&>()()); - - static_assert(IsUniquePtr<type>::value, "Factories must return a unique_ptr"); -}; - -template <typename Factory> -using FactoryPtrType = typename FactoryPtrTypeHelper<Factory>::type; - -template <typename Factory> -using FactoryElementType = typename FactoryPtrType<Factory>::element_type; - -template <typename T> -class ExceptionSafetyTest { - using Factory = std::function<std::unique_ptr<T>()>; - using Operation = std::function<void(T*)>; - using Contract = std::function<AssertionResult(T*)>; - - public: - template <typename... Contracts> - explicit ExceptionSafetyTest(const Factory& f, const Operation& op, - const Contracts&... contracts) - : factory_(f), operation_(op), contracts_{WrapContract(contracts)...} {} - - AssertionResult Test() const { - for (int count = 0;; ++count) { - exceptions_internal::ConstructorTracker ct(count); - - for (const auto& contract : contracts_) { - auto t_ptr = factory_(); - try { - SetCountdown(count); - operation_(t_ptr.get()); - // Unset for the case that the operation throws no exceptions, which - // would leave the countdown set and break the *next* exception safety - // test after this one. - UnsetCountdown(); - return AssertionSuccess(); - } catch (const exceptions_internal::TestException& e) { - if (!contract(t_ptr.get())) { - return AssertionFailure() << e.what() << " failed contract check"; - } - } - } - } - } - - private: - template <typename ContractFn> - Contract WrapContract(const ContractFn& contract) { - return [contract](T* t_ptr) { return AssertionResult(contract(t_ptr)); }; - } - - Contract WrapContract(StrongGuaranteeTagType) { - return [this](T* t_ptr) { return AssertionResult(*factory_() == *t_ptr); }; - } - - Factory factory_; - Operation operation_; - std::vector<Contract> contracts_; -}; - -/* - * Builds a tester object that tests if performing a operation on a T follows - * exception safety guarantees. Verification is done via contract assertion - * callbacks applied to T instances post-throw. - * - * Template parameters for ExceptionSafetyTestBuilder: - * - * - Factory: The factory object (passed in via tester.WithFactory(...) or - * tester.WithInitialValue(...)) must be invocable with the signature - * `std::unique_ptr<T> operator()() const` where T is the type being tested. - * It is used for reliably creating identical T instances to test on. - * - * - Operation: The operation object (passsed in via tester.WithOperation(...) - * or tester.Test(...)) must be invocable with the signature - * `void operator()(T*) const` where T is the type being tested. It is used - * for performing steps on a T instance that may throw and that need to be - * checked for exception safety. Each call to the operation will receive a - * fresh T instance so it's free to modify and destroy the T instances as it - * pleases. - * - * - Contracts...: The contract assertion callback objects (passed in via - * tester.WithContracts(...)) must be invocable with the signature - * `testing::AssertionResult operator()(T*) const` where T is the type being - * tested. Contract assertion callbacks are provided T instances post-throw. - * They must return testing::AssertionSuccess when the type contracts of the - * provided T instance hold. If the type contracts of the T instance do not - * hold, they must return testing::AssertionFailure. Execution order of - * Contracts... is unspecified. They will each individually get a fresh T - * instance so they are free to modify and destroy the T instances as they - * please. - */ -template <typename Factory, typename Operation, typename... Contracts> -class ExceptionSafetyTestBuilder { - public: - /* - * Returns a new ExceptionSafetyTestBuilder with an included T factory based - * on the provided T instance. The existing factory will not be included in - * the newly created tester instance. The created factory returns a new T - * instance by copy-constructing the provided const T& t. - * - * Preconditions for tester.WithInitialValue(const T& t): - * - * - The const T& t object must be copy-constructible where T is the type - * being tested. For non-copy-constructible objects, use the method - * tester.WithFactory(...). - */ - template <typename T> - ExceptionSafetyTestBuilder<DefaultFactory<T>, Operation, Contracts...> - WithInitialValue(const T& t) const { - return WithFactory(DefaultFactory<T>(t)); - } - - /* - * Returns a new ExceptionSafetyTestBuilder with the provided T factory - * included. The existing factory will not be included in the newly-created - * tester instance. This method is intended for use with types lacking a copy - * constructor. Types that can be copy-constructed should instead use the - * method tester.WithInitialValue(...). - */ - template <typename NewFactory> - ExceptionSafetyTestBuilder<absl::decay_t<NewFactory>, Operation, Contracts...> - WithFactory(const NewFactory& new_factory) const { - return {new_factory, operation_, contracts_}; - } - - /* - * Returns a new ExceptionSafetyTestBuilder with the provided testable - * operation included. The existing operation will not be included in the - * newly created tester. - */ - template <typename NewOperation> - ExceptionSafetyTestBuilder<Factory, absl::decay_t<NewOperation>, Contracts...> - WithOperation(const NewOperation& new_operation) const { - return {factory_, new_operation, contracts_}; - } - - /* - * Returns a new ExceptionSafetyTestBuilder with the provided MoreContracts... - * combined with the Contracts... that were already included in the instance - * on which the method was called. Contracts... cannot be removed or replaced - * once added to an ExceptionSafetyTestBuilder instance. A fresh object must - * be created in order to get an empty Contracts... list. - * - * In addition to passing in custom contract assertion callbacks, this method - * accepts `testing::strong_guarantee` as an argument which checks T instances - * post-throw against freshly created T instances via operator== to verify - * that any state changes made during the execution of the operation were - * properly rolled back. - */ - template <typename... MoreContracts> - ExceptionSafetyTestBuilder<Factory, Operation, Contracts..., - absl::decay_t<MoreContracts>...> - WithContracts(const MoreContracts&... more_contracts) const { - return { - factory_, operation_, - std::tuple_cat(contracts_, std::tuple<absl::decay_t<MoreContracts>...>( - more_contracts...))}; - } - - /* - * Returns a testing::AssertionResult that is the reduced result of the - * exception safety algorithm. The algorithm short circuits and returns - * AssertionFailure after the first contract callback returns an - * AssertionFailure. Otherwise, if all contract callbacks return an - * AssertionSuccess, the reduced result is AssertionSuccess. - * - * The passed-in testable operation will not be saved in a new tester instance - * nor will it modify/replace the existing tester instance. This is useful - * when each operation being tested is unique and does not need to be reused. - * - * Preconditions for tester.Test(const NewOperation& new_operation): - * - * - May only be called after at least one contract assertion callback and a - * factory or initial value have been provided. - */ - template < - typename NewOperation, - typename = EnableIfTestable<sizeof...(Contracts), Factory, NewOperation>> - testing::AssertionResult Test(const NewOperation& new_operation) const { - return TestImpl(new_operation, absl::index_sequence_for<Contracts...>()); - } - - /* - * Returns a testing::AssertionResult that is the reduced result of the - * exception safety algorithm. The algorithm short circuits and returns - * AssertionFailure after the first contract callback returns an - * AssertionFailure. Otherwise, if all contract callbacks return an - * AssertionSuccess, the reduced result is AssertionSuccess. - * - * Preconditions for tester.Test(): - * - * - May only be called after at least one contract assertion callback, a - * factory or initial value and a testable operation have been provided. - */ - template < - typename LazyOperation = Operation, - typename = EnableIfTestable<sizeof...(Contracts), Factory, LazyOperation>> - testing::AssertionResult Test() const { - return Test(operation_); - } - - private: - template <typename, typename, typename...> - friend class ExceptionSafetyTestBuilder; - - friend ExceptionSafetyTestBuilder<> testing::MakeExceptionSafetyTester(); - - ExceptionSafetyTestBuilder() {} - - ExceptionSafetyTestBuilder(const Factory& f, const Operation& o, - const std::tuple<Contracts...>& i) - : factory_(f), operation_(o), contracts_(i) {} - - template <typename SelectedOperation, size_t... Indices> - testing::AssertionResult TestImpl(SelectedOperation selected_operation, - absl::index_sequence<Indices...>) const { - return ExceptionSafetyTest<FactoryElementType<Factory>>( - factory_, selected_operation, std::get<Indices>(contracts_)...) - .Test(); - } - - Factory factory_; - Operation operation_; - std::tuple<Contracts...> contracts_; -}; - -} // namespace exceptions_internal - -} // namespace testing - -#endif // ABSL_HAVE_EXCEPTIONS - -#endif // ABSL_BASE_INTERNAL_EXCEPTION_SAFETY_TESTING_H_ diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/exception_testing.h b/contrib/restricted/abseil-cpp/absl/base/internal/exception_testing.h deleted file mode 100644 index 01b5465571..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/exception_testing.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Testing utilities for ABSL types which throw exceptions. - -#ifndef ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_ -#define ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_ - -#include "gtest/gtest.h" -#include "absl/base/config.h" - -// ABSL_BASE_INTERNAL_EXPECT_FAIL tests either for a specified thrown exception -// if exceptions are enabled, or for death with a specified text in the error -// message -#ifdef ABSL_HAVE_EXCEPTIONS - -#define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \ - EXPECT_THROW(expr, exception_t) - -#elif defined(__ANDROID__) -// Android asserts do not log anywhere that gtest can currently inspect. -// So we expect exit, but cannot match the message. -#define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \ - EXPECT_DEATH(expr, ".*") -#else -#define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \ - EXPECT_DEATH_IF_SUPPORTED(expr, text) - -#endif - -#endif // ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_ diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/inline_variable_testing.h b/contrib/restricted/abseil-cpp/absl/base/internal/inline_variable_testing.h deleted file mode 100644 index 3856b9f80f..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/inline_variable_testing.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_BASE_INLINE_VARIABLE_TESTING_H_ -#define ABSL_BASE_INLINE_VARIABLE_TESTING_H_ - -#include "absl/base/internal/inline_variable.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace inline_variable_testing_internal { - -struct Foo { - int value = 5; -}; - -ABSL_INTERNAL_INLINE_CONSTEXPR(Foo, inline_variable_foo, {}); -ABSL_INTERNAL_INLINE_CONSTEXPR(Foo, other_inline_variable_foo, {}); - -ABSL_INTERNAL_INLINE_CONSTEXPR(int, inline_variable_int, 5); -ABSL_INTERNAL_INLINE_CONSTEXPR(int, other_inline_variable_int, 5); - -ABSL_INTERNAL_INLINE_CONSTEXPR(void(*)(), inline_variable_fun_ptr, nullptr); - -const Foo& get_foo_a(); -const Foo& get_foo_b(); - -const int& get_int_a(); -const int& get_int_b(); - -} // namespace inline_variable_testing_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_BASE_INLINE_VARIABLE_TESTING_H_ diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc/CMakeLists.linux.txt deleted file mode 100644 index cad84ea37a..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc/CMakeLists.linux.txt +++ /dev/null @@ -1,27 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(base-internal-low_level_alloc) -target_compile_options(base-internal-low_level_alloc PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(base-internal-low_level_alloc PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(base-internal-low_level_alloc PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - absl-base-log_severity -) -target_sources(base-internal-low_level_alloc PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc/CMakeLists.txt index e8c98bfd99..cad84ea37a 100644 --- a/contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc/CMakeLists.txt @@ -6,6 +6,22 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(base-internal-low_level_alloc) +target_compile_options(base-internal-low_level_alloc PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(base-internal-low_level_alloc PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(base-internal-low_level_alloc PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + absl-base-log_severity +) +target_sources(base-internal-low_level_alloc PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/pretty_function.h b/contrib/restricted/abseil-cpp/absl/base/internal/pretty_function.h deleted file mode 100644 index 35d51676dc..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/pretty_function.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_BASE_INTERNAL_PRETTY_FUNCTION_H_ -#define ABSL_BASE_INTERNAL_PRETTY_FUNCTION_H_ - -// ABSL_PRETTY_FUNCTION -// -// In C++11, __func__ gives the undecorated name of the current function. That -// is, "main", not "int main()". Various compilers give extra macros to get the -// decorated function name, including return type and arguments, to -// differentiate between overload sets. ABSL_PRETTY_FUNCTION is a portable -// version of these macros which forwards to the correct macro on each compiler. -#if defined(_MSC_VER) -#define ABSL_PRETTY_FUNCTION __FUNCSIG__ -#elif defined(__GNUC__) -#define ABSL_PRETTY_FUNCTION __PRETTY_FUNCTION__ -#else -#error "Unsupported compiler" -#endif - -#endif // ABSL_BASE_INTERNAL_PRETTY_FUNCTION_H_ diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/raw_logging/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/base/internal/raw_logging/CMakeLists.linux.txt deleted file mode 100644 index 48c8b28911..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/raw_logging/CMakeLists.linux.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(base-internal-raw_logging) -target_compile_options(base-internal-raw_logging PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(base-internal-raw_logging PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(base-internal-raw_logging PUBLIC - contrib-libs-cxxsupp - absl-base-log_severity -) -target_sources(base-internal-raw_logging PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/raw_logging.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/raw_logging/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/base/internal/raw_logging/CMakeLists.txt index e8c98bfd99..48c8b28911 100644 --- a/contrib/restricted/abseil-cpp/absl/base/internal/raw_logging/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/base/internal/raw_logging/CMakeLists.txt @@ -6,6 +6,19 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(base-internal-raw_logging) +target_compile_options(base-internal-raw_logging PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(base-internal-raw_logging PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(base-internal-raw_logging PUBLIC + contrib-libs-cxxsupp + absl-base-log_severity +) +target_sources(base-internal-raw_logging PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/raw_logging.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env/CMakeLists.linux.txt deleted file mode 100644 index a4619d6d8b..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env/CMakeLists.linux.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(base-internal-scoped_set_env) -target_compile_options(base-internal-scoped_set_env PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(base-internal-scoped_set_env PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(base-internal-scoped_set_env PUBLIC - contrib-libs-cxxsupp - base-internal-raw_logging - absl-base-log_severity -) -target_sources(base-internal-scoped_set_env PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env/CMakeLists.txt index e8c98bfd99..a4619d6d8b 100644 --- a/contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env/CMakeLists.txt @@ -6,6 +6,20 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(base-internal-scoped_set_env) +target_compile_options(base-internal-scoped_set_env PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(base-internal-scoped_set_env PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(base-internal-scoped_set_env PUBLIC + contrib-libs-cxxsupp + base-internal-raw_logging + absl-base-log_severity +) +target_sources(base-internal-scoped_set_env PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait/CMakeLists.linux.txt deleted file mode 100644 index e8cf0b391a..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(base-internal-spinlock_wait) -target_compile_options(base-internal-spinlock_wait PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(base-internal-spinlock_wait PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(base-internal-spinlock_wait PUBLIC - contrib-libs-cxxsupp -) -target_sources(base-internal-spinlock_wait PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait/CMakeLists.txt index e8c98bfd99..e8cf0b391a 100644 --- a/contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(base-internal-spinlock_wait) +target_compile_options(base-internal-spinlock_wait PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(base-internal-spinlock_wait PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(base-internal-spinlock_wait PUBLIC + contrib-libs-cxxsupp +) +target_sources(base-internal-spinlock_wait PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/strerror/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/base/internal/strerror/CMakeLists.linux.txt deleted file mode 100644 index 3025035ded..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/strerror/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(base-internal-strerror) -target_compile_options(base-internal-strerror PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(base-internal-strerror PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(base-internal-strerror PUBLIC - contrib-libs-cxxsupp -) -target_sources(base-internal-strerror PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/strerror.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/strerror/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/base/internal/strerror/CMakeLists.txt index e8c98bfd99..3025035ded 100644 --- a/contrib/restricted/abseil-cpp/absl/base/internal/strerror/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/base/internal/strerror/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(base-internal-strerror) +target_compile_options(base-internal-strerror PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(base-internal-strerror PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(base-internal-strerror PUBLIC + contrib-libs-cxxsupp +) +target_sources(base-internal-strerror PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/strerror.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate/CMakeLists.linux.txt deleted file mode 100644 index 03d464885c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate/CMakeLists.linux.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(base-internal-throw_delegate) -target_compile_options(base-internal-throw_delegate PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(base-internal-throw_delegate PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(base-internal-throw_delegate PUBLIC - contrib-libs-cxxsupp - base-internal-raw_logging - absl-base-log_severity -) -target_sources(base-internal-throw_delegate PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate/CMakeLists.txt index e8c98bfd99..03d464885c 100644 --- a/contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate/CMakeLists.txt @@ -6,6 +6,20 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(base-internal-throw_delegate) +target_compile_options(base-internal-throw_delegate PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(base-internal-throw_delegate PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(base-internal-throw_delegate PUBLIC + contrib-libs-cxxsupp + base-internal-raw_logging + absl-base-log_severity +) +target_sources(base-internal-throw_delegate PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/base/log_severity/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/base/log_severity/CMakeLists.linux.txt deleted file mode 100644 index 6de168f87b..0000000000 --- a/contrib/restricted/abseil-cpp/absl/base/log_severity/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-base-log_severity) -target_compile_options(absl-base-log_severity PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-base-log_severity PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-base-log_severity PUBLIC - contrib-libs-cxxsupp -) -target_sources(absl-base-log_severity PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/log_severity.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/base/log_severity/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/base/log_severity/CMakeLists.txt index e8c98bfd99..6de168f87b 100644 --- a/contrib/restricted/abseil-cpp/absl/base/log_severity/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/base/log_severity/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-base-log_severity) +target_compile_options(absl-base-log_severity PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-base-log_severity PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-base-log_severity PUBLIC + contrib-libs-cxxsupp +) +target_sources(absl-base-log_severity PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/base/log_severity.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/city/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/city/CMakeLists.linux.txt deleted file mode 100644 index c314522422..0000000000 --- a/contrib/restricted/abseil-cpp/absl/city/CMakeLists.linux.txt +++ /dev/null @@ -1,27 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-city) -target_compile_options(abseil-cpp-absl-city PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-city PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-city PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - absl-base-log_severity -) -target_sources(abseil-cpp-absl-city PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/hash/internal/city.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/city/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/city/CMakeLists.txt index e8c98bfd99..c314522422 100644 --- a/contrib/restricted/abseil-cpp/absl/city/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/city/CMakeLists.txt @@ -6,6 +6,22 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-city) +target_compile_options(abseil-cpp-absl-city PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-city PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-city PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + absl-base-log_severity +) +target_sources(abseil-cpp-absl-city PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/hash/internal/city.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/cleanup/cleanup.h b/contrib/restricted/abseil-cpp/absl/cleanup/cleanup.h deleted file mode 100644 index 960ccd080e..0000000000 --- a/contrib/restricted/abseil-cpp/absl/cleanup/cleanup.h +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2021 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: cleanup.h -// ----------------------------------------------------------------------------- -// -// `absl::Cleanup` implements the scope guard idiom, invoking the contained -// callback's `operator()() &&` on scope exit. -// -// Example: -// -// ``` -// absl::Status CopyGoodData(const char* source_path, const char* sink_path) { -// FILE* source_file = fopen(source_path, "r"); -// if (source_file == nullptr) { -// return absl::NotFoundError("No source file"); // No cleanups execute -// } -// -// // C++17 style cleanup using class template argument deduction -// absl::Cleanup source_closer = [source_file] { fclose(source_file); }; -// -// FILE* sink_file = fopen(sink_path, "w"); -// if (sink_file == nullptr) { -// return absl::NotFoundError("No sink file"); // First cleanup executes -// } -// -// // C++11 style cleanup using the factory function -// auto sink_closer = absl::MakeCleanup([sink_file] { fclose(sink_file); }); -// -// Data data; -// while (ReadData(source_file, &data)) { -// if (!data.IsGood()) { -// absl::Status result = absl::FailedPreconditionError("Read bad data"); -// return result; // Both cleanups execute -// } -// SaveData(sink_file, &data); -// } -// -// return absl::OkStatus(); // Both cleanups execute -// } -// ``` -// -// Methods: -// -// `std::move(cleanup).Cancel()` will prevent the callback from executing. -// -// `std::move(cleanup).Invoke()` will execute the callback early, before -// destruction, and prevent the callback from executing in the destructor. -// -// Usage: -// -// `absl::Cleanup` is not an interface type. It is only intended to be used -// within the body of a function. It is not a value type and instead models a -// control flow construct. Check out `defer` in Golang for something similar. - -#ifndef ABSL_CLEANUP_CLEANUP_H_ -#define ABSL_CLEANUP_CLEANUP_H_ - -#include <utility> - -#include "absl/base/config.h" -#include "absl/base/macros.h" -#include "absl/cleanup/internal/cleanup.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -template <typename Arg, typename Callback = void()> -class ABSL_MUST_USE_RESULT Cleanup final { - static_assert(cleanup_internal::WasDeduced<Arg>(), - "Explicit template parameters are not supported."); - - static_assert(cleanup_internal::ReturnsVoid<Callback>(), - "Callbacks that return values are not supported."); - - public: - Cleanup(Callback callback) : storage_(std::move(callback)) {} // NOLINT - - Cleanup(Cleanup&& other) = default; - - void Cancel() && { - ABSL_HARDENING_ASSERT(storage_.IsCallbackEngaged()); - storage_.DestroyCallback(); - } - - void Invoke() && { - ABSL_HARDENING_ASSERT(storage_.IsCallbackEngaged()); - storage_.InvokeCallback(); - storage_.DestroyCallback(); - } - - ~Cleanup() { - if (storage_.IsCallbackEngaged()) { - storage_.InvokeCallback(); - storage_.DestroyCallback(); - } - } - - private: - cleanup_internal::Storage<Callback> storage_; -}; - -// `absl::Cleanup c = /* callback */;` -// -// C++17 type deduction API for creating an instance of `absl::Cleanup` -#if defined(ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION) -template <typename Callback> -Cleanup(Callback callback) -> Cleanup<cleanup_internal::Tag, Callback>; -#endif // defined(ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION) - -// `auto c = absl::MakeCleanup(/* callback */);` -// -// C++11 type deduction API for creating an instance of `absl::Cleanup` -template <typename... Args, typename Callback> -absl::Cleanup<cleanup_internal::Tag, Callback> MakeCleanup(Callback callback) { - static_assert(cleanup_internal::WasDeduced<cleanup_internal::Tag, Args...>(), - "Explicit template parameters are not supported."); - - static_assert(cleanup_internal::ReturnsVoid<Callback>(), - "Callbacks that return values are not supported."); - - return {std::move(callback)}; -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CLEANUP_CLEANUP_H_ diff --git a/contrib/restricted/abseil-cpp/absl/cleanup/internal/cleanup.h b/contrib/restricted/abseil-cpp/absl/cleanup/internal/cleanup.h deleted file mode 100644 index 2783fcb7c1..0000000000 --- a/contrib/restricted/abseil-cpp/absl/cleanup/internal/cleanup.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2021 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CLEANUP_INTERNAL_CLEANUP_H_ -#define ABSL_CLEANUP_INTERNAL_CLEANUP_H_ - -#include <new> -#include <type_traits> -#include <utility> - -#include "absl/base/internal/invoke.h" -#include "absl/base/macros.h" -#include "absl/base/thread_annotations.h" -#include "absl/utility/utility.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -namespace cleanup_internal { - -struct Tag {}; - -template <typename Arg, typename... Args> -constexpr bool WasDeduced() { - return (std::is_same<cleanup_internal::Tag, Arg>::value) && - (sizeof...(Args) == 0); -} - -template <typename Callback> -constexpr bool ReturnsVoid() { - return (std::is_same<base_internal::invoke_result_t<Callback>, void>::value); -} - -template <typename Callback> -class Storage { - public: - Storage() = delete; - - explicit Storage(Callback callback) { - // Placement-new into a character buffer is used for eager destruction when - // the cleanup is invoked or cancelled. To ensure this optimizes well, the - // behavior is implemented locally instead of using an absl::optional. - ::new (GetCallbackBuffer()) Callback(std::move(callback)); - is_callback_engaged_ = true; - } - - Storage(Storage&& other) { - ABSL_HARDENING_ASSERT(other.IsCallbackEngaged()); - - ::new (GetCallbackBuffer()) Callback(std::move(other.GetCallback())); - is_callback_engaged_ = true; - - other.DestroyCallback(); - } - - Storage(const Storage& other) = delete; - - Storage& operator=(Storage&& other) = delete; - - Storage& operator=(const Storage& other) = delete; - - void* GetCallbackBuffer() { return static_cast<void*>(+callback_buffer_); } - - Callback& GetCallback() { - return *reinterpret_cast<Callback*>(GetCallbackBuffer()); - } - - bool IsCallbackEngaged() const { return is_callback_engaged_; } - - void DestroyCallback() { - is_callback_engaged_ = false; - GetCallback().~Callback(); - } - - void InvokeCallback() ABSL_NO_THREAD_SAFETY_ANALYSIS { - std::move(GetCallback())(); - } - - private: - bool is_callback_engaged_; - alignas(Callback) char callback_buffer_[sizeof(Callback)]; -}; - -} // namespace cleanup_internal - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CLEANUP_INTERNAL_CLEANUP_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/container/.yandex_meta/licenses.list.txt deleted file mode 100644 index f39e683596..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,24 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2019 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/container/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/container/CMakeLists.linux.txt deleted file mode 100644 index 3f71875a2a..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/CMakeLists.linux.txt +++ /dev/null @@ -1,10 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-container INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/container/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/container/CMakeLists.txt index e8c98bfd99..3f71875a2a 100644 --- a/contrib/restricted/abseil-cpp/absl/container/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/container/CMakeLists.txt @@ -6,6 +6,5 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-container INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/container/btree_map.h b/contrib/restricted/abseil-cpp/absl/container/btree_map.h deleted file mode 100644 index f0a8d4a6a4..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/btree_map.h +++ /dev/null @@ -1,815 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: btree_map.h -// ----------------------------------------------------------------------------- -// -// This header file defines B-tree maps: sorted associative containers mapping -// keys to values. -// -// * `absl::btree_map<>` -// * `absl::btree_multimap<>` -// -// These B-tree types are similar to the corresponding types in the STL -// (`std::map` and `std::multimap`) and generally conform to the STL interfaces -// of those types. However, because they are implemented using B-trees, they -// are more efficient in most situations. -// -// Unlike `std::map` and `std::multimap`, which are commonly implemented using -// red-black tree nodes, B-tree maps use more generic B-tree nodes able to hold -// multiple values per node. Holding multiple values per node often makes -// B-tree maps perform better than their `std::map` counterparts, because -// multiple entries can be checked within the same cache hit. -// -// However, these types should not be considered drop-in replacements for -// `std::map` and `std::multimap` as there are some API differences, which are -// noted in this header file. -// -// Importantly, insertions and deletions may invalidate outstanding iterators, -// pointers, and references to elements. Such invalidations are typically only -// an issue if insertion and deletion operations are interleaved with the use of -// more than one iterator, pointer, or reference simultaneously. For this -// reason, `insert()` and `erase()` return a valid iterator at the current -// position. - -#ifndef ABSL_CONTAINER_BTREE_MAP_H_ -#define ABSL_CONTAINER_BTREE_MAP_H_ - -#include "absl/container/internal/btree.h" // IWYU pragma: export -#include "absl/container/internal/btree_container.h" // IWYU pragma: export - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// absl::btree_map<> -// -// An `absl::btree_map<K, V>` is an ordered associative container of -// unique keys and associated values designed to be a more efficient replacement -// for `std::map` (in most cases). -// -// Keys are sorted using an (optional) comparison function, which defaults to -// `std::less<K>`. -// -// An `absl::btree_map<K, V>` uses a default allocator of -// `std::allocator<std::pair<const K, V>>` to allocate (and deallocate) -// nodes, and construct and destruct values within those nodes. You may -// instead specify a custom allocator `A` (which in turn requires specifying a -// custom comparator `C`) as in `absl::btree_map<K, V, C, A>`. -// -template <typename Key, typename Value, typename Compare = std::less<Key>, - typename Alloc = std::allocator<std::pair<const Key, Value>>> -class btree_map - : public container_internal::btree_map_container< - container_internal::btree<container_internal::map_params< - Key, Value, Compare, Alloc, /*TargetNodeSize=*/256, - /*Multi=*/false>>> { - using Base = typename btree_map::btree_map_container; - - public: - // Constructors and Assignment Operators - // - // A `btree_map` supports the same overload set as `std::map` - // for construction and assignment: - // - // * Default constructor - // - // absl::btree_map<int, std::string> map1; - // - // * Initializer List constructor - // - // absl::btree_map<int, std::string> map2 = - // {{1, "huey"}, {2, "dewey"}, {3, "louie"},}; - // - // * Copy constructor - // - // absl::btree_map<int, std::string> map3(map2); - // - // * Copy assignment operator - // - // absl::btree_map<int, std::string> map4; - // map4 = map3; - // - // * Move constructor - // - // // Move is guaranteed efficient - // absl::btree_map<int, std::string> map5(std::move(map4)); - // - // * Move assignment operator - // - // // May be efficient if allocators are compatible - // absl::btree_map<int, std::string> map6; - // map6 = std::move(map5); - // - // * Range constructor - // - // std::vector<std::pair<int, std::string>> v = {{1, "a"}, {2, "b"}}; - // absl::btree_map<int, std::string> map7(v.begin(), v.end()); - btree_map() {} - using Base::Base; - - // btree_map::begin() - // - // Returns an iterator to the beginning of the `btree_map`. - using Base::begin; - - // btree_map::cbegin() - // - // Returns a const iterator to the beginning of the `btree_map`. - using Base::cbegin; - - // btree_map::end() - // - // Returns an iterator to the end of the `btree_map`. - using Base::end; - - // btree_map::cend() - // - // Returns a const iterator to the end of the `btree_map`. - using Base::cend; - - // btree_map::empty() - // - // Returns whether or not the `btree_map` is empty. - using Base::empty; - - // btree_map::max_size() - // - // Returns the largest theoretical possible number of elements within a - // `btree_map` under current memory constraints. This value can be thought - // of as the largest value of `std::distance(begin(), end())` for a - // `btree_map<Key, T>`. - using Base::max_size; - - // btree_map::size() - // - // Returns the number of elements currently within the `btree_map`. - using Base::size; - - // btree_map::clear() - // - // Removes all elements from the `btree_map`. Invalidates any references, - // pointers, or iterators referring to contained elements. - using Base::clear; - - // btree_map::erase() - // - // Erases elements within the `btree_map`. If an erase occurs, any references, - // pointers, or iterators are invalidated. - // Overloads are listed below. - // - // iterator erase(iterator position): - // iterator erase(const_iterator position): - // - // Erases the element at `position` of the `btree_map`, returning - // the iterator pointing to the element after the one that was erased - // (or end() if none exists). - // - // iterator erase(const_iterator first, const_iterator last): - // - // Erases the elements in the open interval [`first`, `last`), returning - // the iterator pointing to the element after the interval that was erased - // (or end() if none exists). - // - // template <typename K> size_type erase(const K& key): - // - // Erases the element with the matching key, if it exists, returning the - // number of elements erased (0 or 1). - using Base::erase; - - // btree_map::insert() - // - // Inserts an element of the specified value into the `btree_map`, - // returning an iterator pointing to the newly inserted element, provided that - // an element with the given key does not already exist. If an insertion - // occurs, any references, pointers, or iterators are invalidated. - // Overloads are listed below. - // - // std::pair<iterator,bool> insert(const value_type& value): - // - // Inserts a value into the `btree_map`. Returns a pair consisting of an - // iterator to the inserted element (or to the element that prevented the - // insertion) and a bool denoting whether the insertion took place. - // - // std::pair<iterator,bool> insert(value_type&& value): - // - // Inserts a moveable value into the `btree_map`. Returns a pair - // consisting of an iterator to the inserted element (or to the element that - // prevented the insertion) and a bool denoting whether the insertion took - // place. - // - // iterator insert(const_iterator hint, const value_type& value): - // iterator insert(const_iterator hint, value_type&& value): - // - // Inserts a value, using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. Returns an iterator to the - // inserted element, or to the existing element that prevented the - // insertion. - // - // void insert(InputIterator first, InputIterator last): - // - // Inserts a range of values [`first`, `last`). - // - // void insert(std::initializer_list<init_type> ilist): - // - // Inserts the elements within the initializer list `ilist`. - using Base::insert; - - // btree_map::insert_or_assign() - // - // Inserts an element of the specified value into the `btree_map` provided - // that a value with the given key does not already exist, or replaces the - // corresponding mapped type with the forwarded `obj` argument if a key for - // that value already exists, returning an iterator pointing to the newly - // inserted element. Overloads are listed below. - // - // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj): - // pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj): - // - // Inserts/Assigns (or moves) the element of the specified key into the - // `btree_map`. If the returned bool is true, insertion took place, and if - // it's false, assignment took place. - // - // iterator insert_or_assign(const_iterator hint, - // const key_type& k, M&& obj): - // iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj): - // - // Inserts/Assigns (or moves) the element of the specified key into the - // `btree_map` using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. - using Base::insert_or_assign; - - // btree_map::emplace() - // - // Inserts an element of the specified value by constructing it in-place - // within the `btree_map`, provided that no element with the given key - // already exists. - // - // The element may be constructed even if there already is an element with the - // key in the container, in which case the newly constructed element will be - // destroyed immediately. Prefer `try_emplace()` unless your key is not - // copyable or moveable. - // - // If an insertion occurs, any references, pointers, or iterators are - // invalidated. - using Base::emplace; - - // btree_map::emplace_hint() - // - // Inserts an element of the specified value by constructing it in-place - // within the `btree_map`, using the position of `hint` as a non-binding - // suggestion for where to begin the insertion search, and only inserts - // provided that no element with the given key already exists. - // - // The element may be constructed even if there already is an element with the - // key in the container, in which case the newly constructed element will be - // destroyed immediately. Prefer `try_emplace()` unless your key is not - // copyable or moveable. - // - // If an insertion occurs, any references, pointers, or iterators are - // invalidated. - using Base::emplace_hint; - - // btree_map::try_emplace() - // - // Inserts an element of the specified value by constructing it in-place - // within the `btree_map`, provided that no element with the given key - // already exists. Unlike `emplace()`, if an element with the given key - // already exists, we guarantee that no element is constructed. - // - // If an insertion occurs, any references, pointers, or iterators are - // invalidated. - // - // Overloads are listed below. - // - // std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args): - // std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args): - // - // Inserts (via copy or move) the element of the specified key into the - // `btree_map`. - // - // iterator try_emplace(const_iterator hint, - // const key_type& k, Args&&... args): - // iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args): - // - // Inserts (via copy or move) the element of the specified key into the - // `btree_map` using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. - using Base::try_emplace; - - // btree_map::extract() - // - // Extracts the indicated element, erasing it in the process, and returns it - // as a C++17-compatible node handle. Overloads are listed below. - // - // node_type extract(const_iterator position): - // - // Extracts the element at the indicated position and returns a node handle - // owning that extracted data. - // - // template <typename K> node_type extract(const K& k): - // - // Extracts the element with the key matching the passed key value and - // returns a node handle owning that extracted data. If the `btree_map` - // does not contain an element with a matching key, this function returns an - // empty node handle. - // - // NOTE: when compiled in an earlier version of C++ than C++17, - // `node_type::key()` returns a const reference to the key instead of a - // mutable reference. We cannot safely return a mutable reference without - // std::launder (which is not available before C++17). - // - // NOTE: In this context, `node_type` refers to the C++17 concept of a - // move-only type that owns and provides access to the elements in associative - // containers (https://en.cppreference.com/w/cpp/container/node_handle). - // It does NOT refer to the data layout of the underlying btree. - using Base::extract; - - // btree_map::merge() - // - // Extracts elements from a given `source` btree_map into this - // `btree_map`. If the destination `btree_map` already contains an - // element with an equivalent key, that element is not extracted. - using Base::merge; - - // btree_map::swap(btree_map& other) - // - // Exchanges the contents of this `btree_map` with those of the `other` - // btree_map, avoiding invocation of any move, copy, or swap operations on - // individual elements. - // - // All iterators and references on the `btree_map` remain valid, excepting - // for the past-the-end iterator, which is invalidated. - using Base::swap; - - // btree_map::at() - // - // Returns a reference to the mapped value of the element with key equivalent - // to the passed key. - using Base::at; - - // btree_map::contains() - // - // template <typename K> bool contains(const K& key) const: - // - // Determines whether an element comparing equal to the given `key` exists - // within the `btree_map`, returning `true` if so or `false` otherwise. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::contains; - - // btree_map::count() - // - // template <typename K> size_type count(const K& key) const: - // - // Returns the number of elements comparing equal to the given `key` within - // the `btree_map`. Note that this function will return either `1` or `0` - // since duplicate elements are not allowed within a `btree_map`. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::count; - - // btree_map::equal_range() - // - // Returns a half-open range [first, last), defined by a `std::pair` of two - // iterators, containing all elements with the passed key in the `btree_map`. - using Base::equal_range; - - // btree_map::find() - // - // template <typename K> iterator find(const K& key): - // template <typename K> const_iterator find(const K& key) const: - // - // Finds an element with the passed `key` within the `btree_map`. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::find; - - // btree_map::lower_bound() - // - // template <typename K> iterator lower_bound(const K& key): - // template <typename K> const_iterator lower_bound(const K& key) const: - // - // Finds the first element with a key that is not less than `key` within the - // `btree_map`. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::lower_bound; - - // btree_map::upper_bound() - // - // template <typename K> iterator upper_bound(const K& key): - // template <typename K> const_iterator upper_bound(const K& key) const: - // - // Finds the first element with a key that is greater than `key` within the - // `btree_map`. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::upper_bound; - - // btree_map::operator[]() - // - // Returns a reference to the value mapped to the passed key within the - // `btree_map`, performing an `insert()` if the key does not already - // exist. - // - // If an insertion occurs, any references, pointers, or iterators are - // invalidated. Otherwise iterators are not affected and references are not - // invalidated. Overloads are listed below. - // - // T& operator[](key_type&& key): - // T& operator[](const key_type& key): - // - // Inserts a value_type object constructed in-place if the element with the - // given key does not exist. - using Base::operator[]; - - // btree_map::get_allocator() - // - // Returns the allocator function associated with this `btree_map`. - using Base::get_allocator; - - // btree_map::key_comp(); - // - // Returns the key comparator associated with this `btree_map`. - using Base::key_comp; - - // btree_map::value_comp(); - // - // Returns the value comparator associated with this `btree_map`. - using Base::value_comp; -}; - -// absl::swap(absl::btree_map<>, absl::btree_map<>) -// -// Swaps the contents of two `absl::btree_map` containers. -template <typename K, typename V, typename C, typename A> -void swap(btree_map<K, V, C, A> &x, btree_map<K, V, C, A> &y) { - return x.swap(y); -} - -// absl::erase_if(absl::btree_map<>, Pred) -// -// Erases all elements that satisfy the predicate pred from the container. -template <typename K, typename V, typename C, typename A, typename Pred> -void erase_if(btree_map<K, V, C, A> &map, Pred pred) { - for (auto it = map.begin(); it != map.end();) { - if (pred(*it)) { - it = map.erase(it); - } else { - ++it; - } - } -} - -// absl::btree_multimap -// -// An `absl::btree_multimap<K, V>` is an ordered associative container of -// keys and associated values designed to be a more efficient replacement for -// `std::multimap` (in most cases). Unlike `absl::btree_map`, a B-tree multimap -// allows multiple elements with equivalent keys. -// -// Keys are sorted using an (optional) comparison function, which defaults to -// `std::less<K>`. -// -// An `absl::btree_multimap<K, V>` uses a default allocator of -// `std::allocator<std::pair<const K, V>>` to allocate (and deallocate) -// nodes, and construct and destruct values within those nodes. You may -// instead specify a custom allocator `A` (which in turn requires specifying a -// custom comparator `C`) as in `absl::btree_multimap<K, V, C, A>`. -// -template <typename Key, typename Value, typename Compare = std::less<Key>, - typename Alloc = std::allocator<std::pair<const Key, Value>>> -class btree_multimap - : public container_internal::btree_multimap_container< - container_internal::btree<container_internal::map_params< - Key, Value, Compare, Alloc, /*TargetNodeSize=*/256, - /*Multi=*/true>>> { - using Base = typename btree_multimap::btree_multimap_container; - - public: - // Constructors and Assignment Operators - // - // A `btree_multimap` supports the same overload set as `std::multimap` - // for construction and assignment: - // - // * Default constructor - // - // absl::btree_multimap<int, std::string> map1; - // - // * Initializer List constructor - // - // absl::btree_multimap<int, std::string> map2 = - // {{1, "huey"}, {2, "dewey"}, {3, "louie"},}; - // - // * Copy constructor - // - // absl::btree_multimap<int, std::string> map3(map2); - // - // * Copy assignment operator - // - // absl::btree_multimap<int, std::string> map4; - // map4 = map3; - // - // * Move constructor - // - // // Move is guaranteed efficient - // absl::btree_multimap<int, std::string> map5(std::move(map4)); - // - // * Move assignment operator - // - // // May be efficient if allocators are compatible - // absl::btree_multimap<int, std::string> map6; - // map6 = std::move(map5); - // - // * Range constructor - // - // std::vector<std::pair<int, std::string>> v = {{1, "a"}, {2, "b"}}; - // absl::btree_multimap<int, std::string> map7(v.begin(), v.end()); - btree_multimap() {} - using Base::Base; - - // btree_multimap::begin() - // - // Returns an iterator to the beginning of the `btree_multimap`. - using Base::begin; - - // btree_multimap::cbegin() - // - // Returns a const iterator to the beginning of the `btree_multimap`. - using Base::cbegin; - - // btree_multimap::end() - // - // Returns an iterator to the end of the `btree_multimap`. - using Base::end; - - // btree_multimap::cend() - // - // Returns a const iterator to the end of the `btree_multimap`. - using Base::cend; - - // btree_multimap::empty() - // - // Returns whether or not the `btree_multimap` is empty. - using Base::empty; - - // btree_multimap::max_size() - // - // Returns the largest theoretical possible number of elements within a - // `btree_multimap` under current memory constraints. This value can be - // thought of as the largest value of `std::distance(begin(), end())` for a - // `btree_multimap<Key, T>`. - using Base::max_size; - - // btree_multimap::size() - // - // Returns the number of elements currently within the `btree_multimap`. - using Base::size; - - // btree_multimap::clear() - // - // Removes all elements from the `btree_multimap`. Invalidates any references, - // pointers, or iterators referring to contained elements. - using Base::clear; - - // btree_multimap::erase() - // - // Erases elements within the `btree_multimap`. If an erase occurs, any - // references, pointers, or iterators are invalidated. - // Overloads are listed below. - // - // iterator erase(iterator position): - // iterator erase(const_iterator position): - // - // Erases the element at `position` of the `btree_multimap`, returning - // the iterator pointing to the element after the one that was erased - // (or end() if none exists). - // - // iterator erase(const_iterator first, const_iterator last): - // - // Erases the elements in the open interval [`first`, `last`), returning - // the iterator pointing to the element after the interval that was erased - // (or end() if none exists). - // - // template <typename K> size_type erase(const K& key): - // - // Erases the elements matching the key, if any exist, returning the - // number of elements erased. - using Base::erase; - - // btree_multimap::insert() - // - // Inserts an element of the specified value into the `btree_multimap`, - // returning an iterator pointing to the newly inserted element. - // Any references, pointers, or iterators are invalidated. Overloads are - // listed below. - // - // iterator insert(const value_type& value): - // - // Inserts a value into the `btree_multimap`, returning an iterator to the - // inserted element. - // - // iterator insert(value_type&& value): - // - // Inserts a moveable value into the `btree_multimap`, returning an iterator - // to the inserted element. - // - // iterator insert(const_iterator hint, const value_type& value): - // iterator insert(const_iterator hint, value_type&& value): - // - // Inserts a value, using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. Returns an iterator to the - // inserted element. - // - // void insert(InputIterator first, InputIterator last): - // - // Inserts a range of values [`first`, `last`). - // - // void insert(std::initializer_list<init_type> ilist): - // - // Inserts the elements within the initializer list `ilist`. - using Base::insert; - - // btree_multimap::emplace() - // - // Inserts an element of the specified value by constructing it in-place - // within the `btree_multimap`. Any references, pointers, or iterators are - // invalidated. - using Base::emplace; - - // btree_multimap::emplace_hint() - // - // Inserts an element of the specified value by constructing it in-place - // within the `btree_multimap`, using the position of `hint` as a non-binding - // suggestion for where to begin the insertion search. - // - // Any references, pointers, or iterators are invalidated. - using Base::emplace_hint; - - // btree_multimap::extract() - // - // Extracts the indicated element, erasing it in the process, and returns it - // as a C++17-compatible node handle. Overloads are listed below. - // - // node_type extract(const_iterator position): - // - // Extracts the element at the indicated position and returns a node handle - // owning that extracted data. - // - // template <typename K> node_type extract(const K& k): - // - // Extracts the element with the key matching the passed key value and - // returns a node handle owning that extracted data. If the `btree_multimap` - // does not contain an element with a matching key, this function returns an - // empty node handle. - // - // NOTE: when compiled in an earlier version of C++ than C++17, - // `node_type::key()` returns a const reference to the key instead of a - // mutable reference. We cannot safely return a mutable reference without - // std::launder (which is not available before C++17). - // - // NOTE: In this context, `node_type` refers to the C++17 concept of a - // move-only type that owns and provides access to the elements in associative - // containers (https://en.cppreference.com/w/cpp/container/node_handle). - // It does NOT refer to the data layout of the underlying btree. - using Base::extract; - - // btree_multimap::merge() - // - // Extracts all elements from a given `source` btree_multimap into this - // `btree_multimap`. - using Base::merge; - - // btree_multimap::swap(btree_multimap& other) - // - // Exchanges the contents of this `btree_multimap` with those of the `other` - // btree_multimap, avoiding invocation of any move, copy, or swap operations - // on individual elements. - // - // All iterators and references on the `btree_multimap` remain valid, - // excepting for the past-the-end iterator, which is invalidated. - using Base::swap; - - // btree_multimap::contains() - // - // template <typename K> bool contains(const K& key) const: - // - // Determines whether an element comparing equal to the given `key` exists - // within the `btree_multimap`, returning `true` if so or `false` otherwise. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::contains; - - // btree_multimap::count() - // - // template <typename K> size_type count(const K& key) const: - // - // Returns the number of elements comparing equal to the given `key` within - // the `btree_multimap`. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::count; - - // btree_multimap::equal_range() - // - // Returns a half-open range [first, last), defined by a `std::pair` of two - // iterators, containing all elements with the passed key in the - // `btree_multimap`. - using Base::equal_range; - - // btree_multimap::find() - // - // template <typename K> iterator find(const K& key): - // template <typename K> const_iterator find(const K& key) const: - // - // Finds an element with the passed `key` within the `btree_multimap`. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::find; - - // btree_multimap::lower_bound() - // - // template <typename K> iterator lower_bound(const K& key): - // template <typename K> const_iterator lower_bound(const K& key) const: - // - // Finds the first element with a key that is not less than `key` within the - // `btree_multimap`. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::lower_bound; - - // btree_multimap::upper_bound() - // - // template <typename K> iterator upper_bound(const K& key): - // template <typename K> const_iterator upper_bound(const K& key) const: - // - // Finds the first element with a key that is greater than `key` within the - // `btree_multimap`. - // - // Supports heterogeneous lookup, provided that the map has a compatible - // heterogeneous comparator. - using Base::upper_bound; - - // btree_multimap::get_allocator() - // - // Returns the allocator function associated with this `btree_multimap`. - using Base::get_allocator; - - // btree_multimap::key_comp(); - // - // Returns the key comparator associated with this `btree_multimap`. - using Base::key_comp; - - // btree_multimap::value_comp(); - // - // Returns the value comparator associated with this `btree_multimap`. - using Base::value_comp; -}; - -// absl::swap(absl::btree_multimap<>, absl::btree_multimap<>) -// -// Swaps the contents of two `absl::btree_multimap` containers. -template <typename K, typename V, typename C, typename A> -void swap(btree_multimap<K, V, C, A> &x, btree_multimap<K, V, C, A> &y) { - return x.swap(y); -} - -// absl::erase_if(absl::btree_multimap<>, Pred) -// -// Erases all elements that satisfy the predicate pred from the container. -template <typename K, typename V, typename C, typename A, typename Pred> -void erase_if(btree_multimap<K, V, C, A> &map, Pred pred) { - for (auto it = map.begin(); it != map.end();) { - if (pred(*it)) { - it = map.erase(it); - } else { - ++it; - } - } -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_BTREE_MAP_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/btree_set.h b/contrib/restricted/abseil-cpp/absl/container/btree_set.h deleted file mode 100644 index 8973900693..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/btree_set.h +++ /dev/null @@ -1,728 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: btree_set.h -// ----------------------------------------------------------------------------- -// -// This header file defines B-tree sets: sorted associative containers of -// values. -// -// * `absl::btree_set<>` -// * `absl::btree_multiset<>` -// -// These B-tree types are similar to the corresponding types in the STL -// (`std::set` and `std::multiset`) and generally conform to the STL interfaces -// of those types. However, because they are implemented using B-trees, they -// are more efficient in most situations. -// -// Unlike `std::set` and `std::multiset`, which are commonly implemented using -// red-black tree nodes, B-tree sets use more generic B-tree nodes able to hold -// multiple values per node. Holding multiple values per node often makes -// B-tree sets perform better than their `std::set` counterparts, because -// multiple entries can be checked within the same cache hit. -// -// However, these types should not be considered drop-in replacements for -// `std::set` and `std::multiset` as there are some API differences, which are -// noted in this header file. -// -// Importantly, insertions and deletions may invalidate outstanding iterators, -// pointers, and references to elements. Such invalidations are typically only -// an issue if insertion and deletion operations are interleaved with the use of -// more than one iterator, pointer, or reference simultaneously. For this -// reason, `insert()` and `erase()` return a valid iterator at the current -// position. - -#ifndef ABSL_CONTAINER_BTREE_SET_H_ -#define ABSL_CONTAINER_BTREE_SET_H_ - -#include "absl/container/internal/btree.h" // IWYU pragma: export -#include "absl/container/internal/btree_container.h" // IWYU pragma: export - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// absl::btree_set<> -// -// An `absl::btree_set<K>` is an ordered associative container of unique key -// values designed to be a more efficient replacement for `std::set` (in most -// cases). -// -// Keys are sorted using an (optional) comparison function, which defaults to -// `std::less<K>`. -// -// An `absl::btree_set<K>` uses a default allocator of `std::allocator<K>` to -// allocate (and deallocate) nodes, and construct and destruct values within -// those nodes. You may instead specify a custom allocator `A` (which in turn -// requires specifying a custom comparator `C`) as in -// `absl::btree_set<K, C, A>`. -// -template <typename Key, typename Compare = std::less<Key>, - typename Alloc = std::allocator<Key>> -class btree_set - : public container_internal::btree_set_container< - container_internal::btree<container_internal::set_params< - Key, Compare, Alloc, /*TargetNodeSize=*/256, - /*Multi=*/false>>> { - using Base = typename btree_set::btree_set_container; - - public: - // Constructors and Assignment Operators - // - // A `btree_set` supports the same overload set as `std::set` - // for construction and assignment: - // - // * Default constructor - // - // absl::btree_set<std::string> set1; - // - // * Initializer List constructor - // - // absl::btree_set<std::string> set2 = - // {{"huey"}, {"dewey"}, {"louie"},}; - // - // * Copy constructor - // - // absl::btree_set<std::string> set3(set2); - // - // * Copy assignment operator - // - // absl::btree_set<std::string> set4; - // set4 = set3; - // - // * Move constructor - // - // // Move is guaranteed efficient - // absl::btree_set<std::string> set5(std::move(set4)); - // - // * Move assignment operator - // - // // May be efficient if allocators are compatible - // absl::btree_set<std::string> set6; - // set6 = std::move(set5); - // - // * Range constructor - // - // std::vector<std::string> v = {"a", "b"}; - // absl::btree_set<std::string> set7(v.begin(), v.end()); - btree_set() {} - using Base::Base; - - // btree_set::begin() - // - // Returns an iterator to the beginning of the `btree_set`. - using Base::begin; - - // btree_set::cbegin() - // - // Returns a const iterator to the beginning of the `btree_set`. - using Base::cbegin; - - // btree_set::end() - // - // Returns an iterator to the end of the `btree_set`. - using Base::end; - - // btree_set::cend() - // - // Returns a const iterator to the end of the `btree_set`. - using Base::cend; - - // btree_set::empty() - // - // Returns whether or not the `btree_set` is empty. - using Base::empty; - - // btree_set::max_size() - // - // Returns the largest theoretical possible number of elements within a - // `btree_set` under current memory constraints. This value can be thought - // of as the largest value of `std::distance(begin(), end())` for a - // `btree_set<Key>`. - using Base::max_size; - - // btree_set::size() - // - // Returns the number of elements currently within the `btree_set`. - using Base::size; - - // btree_set::clear() - // - // Removes all elements from the `btree_set`. Invalidates any references, - // pointers, or iterators referring to contained elements. - using Base::clear; - - // btree_set::erase() - // - // Erases elements within the `btree_set`. Overloads are listed below. - // - // iterator erase(iterator position): - // iterator erase(const_iterator position): - // - // Erases the element at `position` of the `btree_set`, returning - // the iterator pointing to the element after the one that was erased - // (or end() if none exists). - // - // iterator erase(const_iterator first, const_iterator last): - // - // Erases the elements in the open interval [`first`, `last`), returning - // the iterator pointing to the element after the interval that was erased - // (or end() if none exists). - // - // template <typename K> size_type erase(const K& key): - // - // Erases the element with the matching key, if it exists, returning the - // number of elements erased (0 or 1). - using Base::erase; - - // btree_set::insert() - // - // Inserts an element of the specified value into the `btree_set`, - // returning an iterator pointing to the newly inserted element, provided that - // an element with the given key does not already exist. If an insertion - // occurs, any references, pointers, or iterators are invalidated. - // Overloads are listed below. - // - // std::pair<iterator,bool> insert(const value_type& value): - // - // Inserts a value into the `btree_set`. Returns a pair consisting of an - // iterator to the inserted element (or to the element that prevented the - // insertion) and a bool denoting whether the insertion took place. - // - // std::pair<iterator,bool> insert(value_type&& value): - // - // Inserts a moveable value into the `btree_set`. Returns a pair - // consisting of an iterator to the inserted element (or to the element that - // prevented the insertion) and a bool denoting whether the insertion took - // place. - // - // iterator insert(const_iterator hint, const value_type& value): - // iterator insert(const_iterator hint, value_type&& value): - // - // Inserts a value, using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. Returns an iterator to the - // inserted element, or to the existing element that prevented the - // insertion. - // - // void insert(InputIterator first, InputIterator last): - // - // Inserts a range of values [`first`, `last`). - // - // void insert(std::initializer_list<init_type> ilist): - // - // Inserts the elements within the initializer list `ilist`. - using Base::insert; - - // btree_set::emplace() - // - // Inserts an element of the specified value by constructing it in-place - // within the `btree_set`, provided that no element with the given key - // already exists. - // - // The element may be constructed even if there already is an element with the - // key in the container, in which case the newly constructed element will be - // destroyed immediately. - // - // If an insertion occurs, any references, pointers, or iterators are - // invalidated. - using Base::emplace; - - // btree_set::emplace_hint() - // - // Inserts an element of the specified value by constructing it in-place - // within the `btree_set`, using the position of `hint` as a non-binding - // suggestion for where to begin the insertion search, and only inserts - // provided that no element with the given key already exists. - // - // The element may be constructed even if there already is an element with the - // key in the container, in which case the newly constructed element will be - // destroyed immediately. - // - // If an insertion occurs, any references, pointers, or iterators are - // invalidated. - using Base::emplace_hint; - - // btree_set::extract() - // - // Extracts the indicated element, erasing it in the process, and returns it - // as a C++17-compatible node handle. Overloads are listed below. - // - // node_type extract(const_iterator position): - // - // Extracts the element at the indicated position and returns a node handle - // owning that extracted data. - // - // template <typename K> node_type extract(const K& k): - // - // Extracts the element with the key matching the passed key value and - // returns a node handle owning that extracted data. If the `btree_set` - // does not contain an element with a matching key, this function returns an - // empty node handle. - // - // NOTE: In this context, `node_type` refers to the C++17 concept of a - // move-only type that owns and provides access to the elements in associative - // containers (https://en.cppreference.com/w/cpp/container/node_handle). - // It does NOT refer to the data layout of the underlying btree. - using Base::extract; - - // btree_set::merge() - // - // Extracts elements from a given `source` btree_set into this - // `btree_set`. If the destination `btree_set` already contains an - // element with an equivalent key, that element is not extracted. - using Base::merge; - - // btree_set::swap(btree_set& other) - // - // Exchanges the contents of this `btree_set` with those of the `other` - // btree_set, avoiding invocation of any move, copy, or swap operations on - // individual elements. - // - // All iterators and references on the `btree_set` remain valid, excepting - // for the past-the-end iterator, which is invalidated. - using Base::swap; - - // btree_set::contains() - // - // template <typename K> bool contains(const K& key) const: - // - // Determines whether an element comparing equal to the given `key` exists - // within the `btree_set`, returning `true` if so or `false` otherwise. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::contains; - - // btree_set::count() - // - // template <typename K> size_type count(const K& key) const: - // - // Returns the number of elements comparing equal to the given `key` within - // the `btree_set`. Note that this function will return either `1` or `0` - // since duplicate elements are not allowed within a `btree_set`. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::count; - - // btree_set::equal_range() - // - // Returns a closed range [first, last], defined by a `std::pair` of two - // iterators, containing all elements with the passed key in the - // `btree_set`. - using Base::equal_range; - - // btree_set::find() - // - // template <typename K> iterator find(const K& key): - // template <typename K> const_iterator find(const K& key) const: - // - // Finds an element with the passed `key` within the `btree_set`. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::find; - - // btree_set::lower_bound() - // - // template <typename K> iterator lower_bound(const K& key): - // template <typename K> const_iterator lower_bound(const K& key) const: - // - // Finds the first element that is not less than `key` within the `btree_set`. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::lower_bound; - - // btree_set::upper_bound() - // - // template <typename K> iterator upper_bound(const K& key): - // template <typename K> const_iterator upper_bound(const K& key) const: - // - // Finds the first element that is greater than `key` within the `btree_set`. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::upper_bound; - - // btree_set::get_allocator() - // - // Returns the allocator function associated with this `btree_set`. - using Base::get_allocator; - - // btree_set::key_comp(); - // - // Returns the key comparator associated with this `btree_set`. - using Base::key_comp; - - // btree_set::value_comp(); - // - // Returns the value comparator associated with this `btree_set`. The keys to - // sort the elements are the values themselves, therefore `value_comp` and its - // sibling member function `key_comp` are equivalent. - using Base::value_comp; -}; - -// absl::swap(absl::btree_set<>, absl::btree_set<>) -// -// Swaps the contents of two `absl::btree_set` containers. -template <typename K, typename C, typename A> -void swap(btree_set<K, C, A> &x, btree_set<K, C, A> &y) { - return x.swap(y); -} - -// absl::erase_if(absl::btree_set<>, Pred) -// -// Erases all elements that satisfy the predicate pred from the container. -template <typename K, typename C, typename A, typename Pred> -void erase_if(btree_set<K, C, A> &set, Pred pred) { - for (auto it = set.begin(); it != set.end();) { - if (pred(*it)) { - it = set.erase(it); - } else { - ++it; - } - } -} - -// absl::btree_multiset<> -// -// An `absl::btree_multiset<K>` is an ordered associative container of -// keys and associated values designed to be a more efficient replacement -// for `std::multiset` (in most cases). Unlike `absl::btree_set`, a B-tree -// multiset allows equivalent elements. -// -// Keys are sorted using an (optional) comparison function, which defaults to -// `std::less<K>`. -// -// An `absl::btree_multiset<K>` uses a default allocator of `std::allocator<K>` -// to allocate (and deallocate) nodes, and construct and destruct values within -// those nodes. You may instead specify a custom allocator `A` (which in turn -// requires specifying a custom comparator `C`) as in -// `absl::btree_multiset<K, C, A>`. -// -template <typename Key, typename Compare = std::less<Key>, - typename Alloc = std::allocator<Key>> -class btree_multiset - : public container_internal::btree_multiset_container< - container_internal::btree<container_internal::set_params< - Key, Compare, Alloc, /*TargetNodeSize=*/256, - /*Multi=*/true>>> { - using Base = typename btree_multiset::btree_multiset_container; - - public: - // Constructors and Assignment Operators - // - // A `btree_multiset` supports the same overload set as `std::set` - // for construction and assignment: - // - // * Default constructor - // - // absl::btree_multiset<std::string> set1; - // - // * Initializer List constructor - // - // absl::btree_multiset<std::string> set2 = - // {{"huey"}, {"dewey"}, {"louie"},}; - // - // * Copy constructor - // - // absl::btree_multiset<std::string> set3(set2); - // - // * Copy assignment operator - // - // absl::btree_multiset<std::string> set4; - // set4 = set3; - // - // * Move constructor - // - // // Move is guaranteed efficient - // absl::btree_multiset<std::string> set5(std::move(set4)); - // - // * Move assignment operator - // - // // May be efficient if allocators are compatible - // absl::btree_multiset<std::string> set6; - // set6 = std::move(set5); - // - // * Range constructor - // - // std::vector<std::string> v = {"a", "b"}; - // absl::btree_multiset<std::string> set7(v.begin(), v.end()); - btree_multiset() {} - using Base::Base; - - // btree_multiset::begin() - // - // Returns an iterator to the beginning of the `btree_multiset`. - using Base::begin; - - // btree_multiset::cbegin() - // - // Returns a const iterator to the beginning of the `btree_multiset`. - using Base::cbegin; - - // btree_multiset::end() - // - // Returns an iterator to the end of the `btree_multiset`. - using Base::end; - - // btree_multiset::cend() - // - // Returns a const iterator to the end of the `btree_multiset`. - using Base::cend; - - // btree_multiset::empty() - // - // Returns whether or not the `btree_multiset` is empty. - using Base::empty; - - // btree_multiset::max_size() - // - // Returns the largest theoretical possible number of elements within a - // `btree_multiset` under current memory constraints. This value can be - // thought of as the largest value of `std::distance(begin(), end())` for a - // `btree_multiset<Key>`. - using Base::max_size; - - // btree_multiset::size() - // - // Returns the number of elements currently within the `btree_multiset`. - using Base::size; - - // btree_multiset::clear() - // - // Removes all elements from the `btree_multiset`. Invalidates any references, - // pointers, or iterators referring to contained elements. - using Base::clear; - - // btree_multiset::erase() - // - // Erases elements within the `btree_multiset`. Overloads are listed below. - // - // iterator erase(iterator position): - // iterator erase(const_iterator position): - // - // Erases the element at `position` of the `btree_multiset`, returning - // the iterator pointing to the element after the one that was erased - // (or end() if none exists). - // - // iterator erase(const_iterator first, const_iterator last): - // - // Erases the elements in the open interval [`first`, `last`), returning - // the iterator pointing to the element after the interval that was erased - // (or end() if none exists). - // - // template <typename K> size_type erase(const K& key): - // - // Erases the elements matching the key, if any exist, returning the - // number of elements erased. - using Base::erase; - - // btree_multiset::insert() - // - // Inserts an element of the specified value into the `btree_multiset`, - // returning an iterator pointing to the newly inserted element. - // Any references, pointers, or iterators are invalidated. Overloads are - // listed below. - // - // iterator insert(const value_type& value): - // - // Inserts a value into the `btree_multiset`, returning an iterator to the - // inserted element. - // - // iterator insert(value_type&& value): - // - // Inserts a moveable value into the `btree_multiset`, returning an iterator - // to the inserted element. - // - // iterator insert(const_iterator hint, const value_type& value): - // iterator insert(const_iterator hint, value_type&& value): - // - // Inserts a value, using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. Returns an iterator to the - // inserted element. - // - // void insert(InputIterator first, InputIterator last): - // - // Inserts a range of values [`first`, `last`). - // - // void insert(std::initializer_list<init_type> ilist): - // - // Inserts the elements within the initializer list `ilist`. - using Base::insert; - - // btree_multiset::emplace() - // - // Inserts an element of the specified value by constructing it in-place - // within the `btree_multiset`. Any references, pointers, or iterators are - // invalidated. - using Base::emplace; - - // btree_multiset::emplace_hint() - // - // Inserts an element of the specified value by constructing it in-place - // within the `btree_multiset`, using the position of `hint` as a non-binding - // suggestion for where to begin the insertion search. - // - // Any references, pointers, or iterators are invalidated. - using Base::emplace_hint; - - // btree_multiset::extract() - // - // Extracts the indicated element, erasing it in the process, and returns it - // as a C++17-compatible node handle. Overloads are listed below. - // - // node_type extract(const_iterator position): - // - // Extracts the element at the indicated position and returns a node handle - // owning that extracted data. - // - // template <typename K> node_type extract(const K& k): - // - // Extracts the element with the key matching the passed key value and - // returns a node handle owning that extracted data. If the `btree_multiset` - // does not contain an element with a matching key, this function returns an - // empty node handle. - // - // NOTE: In this context, `node_type` refers to the C++17 concept of a - // move-only type that owns and provides access to the elements in associative - // containers (https://en.cppreference.com/w/cpp/container/node_handle). - // It does NOT refer to the data layout of the underlying btree. - using Base::extract; - - // btree_multiset::merge() - // - // Extracts all elements from a given `source` btree_multiset into this - // `btree_multiset`. - using Base::merge; - - // btree_multiset::swap(btree_multiset& other) - // - // Exchanges the contents of this `btree_multiset` with those of the `other` - // btree_multiset, avoiding invocation of any move, copy, or swap operations - // on individual elements. - // - // All iterators and references on the `btree_multiset` remain valid, - // excepting for the past-the-end iterator, which is invalidated. - using Base::swap; - - // btree_multiset::contains() - // - // template <typename K> bool contains(const K& key) const: - // - // Determines whether an element comparing equal to the given `key` exists - // within the `btree_multiset`, returning `true` if so or `false` otherwise. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::contains; - - // btree_multiset::count() - // - // template <typename K> size_type count(const K& key) const: - // - // Returns the number of elements comparing equal to the given `key` within - // the `btree_multiset`. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::count; - - // btree_multiset::equal_range() - // - // Returns a closed range [first, last], defined by a `std::pair` of two - // iterators, containing all elements with the passed key in the - // `btree_multiset`. - using Base::equal_range; - - // btree_multiset::find() - // - // template <typename K> iterator find(const K& key): - // template <typename K> const_iterator find(const K& key) const: - // - // Finds an element with the passed `key` within the `btree_multiset`. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::find; - - // btree_multiset::lower_bound() - // - // template <typename K> iterator lower_bound(const K& key): - // template <typename K> const_iterator lower_bound(const K& key) const: - // - // Finds the first element that is not less than `key` within the - // `btree_multiset`. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::lower_bound; - - // btree_multiset::upper_bound() - // - // template <typename K> iterator upper_bound(const K& key): - // template <typename K> const_iterator upper_bound(const K& key) const: - // - // Finds the first element that is greater than `key` within the - // `btree_multiset`. - // - // Supports heterogeneous lookup, provided that the set has a compatible - // heterogeneous comparator. - using Base::upper_bound; - - // btree_multiset::get_allocator() - // - // Returns the allocator function associated with this `btree_multiset`. - using Base::get_allocator; - - // btree_multiset::key_comp(); - // - // Returns the key comparator associated with this `btree_multiset`. - using Base::key_comp; - - // btree_multiset::value_comp(); - // - // Returns the value comparator associated with this `btree_multiset`. The - // keys to sort the elements are the values themselves, therefore `value_comp` - // and its sibling member function `key_comp` are equivalent. - using Base::value_comp; -}; - -// absl::swap(absl::btree_multiset<>, absl::btree_multiset<>) -// -// Swaps the contents of two `absl::btree_multiset` containers. -template <typename K, typename C, typename A> -void swap(btree_multiset<K, C, A> &x, btree_multiset<K, C, A> &y) { - return x.swap(y); -} - -// absl::erase_if(absl::btree_multiset<>, Pred) -// -// Erases all elements that satisfy the predicate pred from the container. -template <typename K, typename C, typename A, typename Pred> -void erase_if(btree_multiset<K, C, A> &set, Pred pred) { - for (auto it = set.begin(); it != set.end();) { - if (pred(*it)) { - it = set.erase(it); - } else { - ++it; - } - } -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_BTREE_SET_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/btree_test.h b/contrib/restricted/abseil-cpp/absl/container/btree_test.h deleted file mode 100644 index 624908072d..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/btree_test.h +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_BTREE_TEST_H_ -#define ABSL_CONTAINER_BTREE_TEST_H_ - -#include <algorithm> -#include <cassert> -#include <random> -#include <string> -#include <utility> -#include <vector> - -#include "absl/container/btree_map.h" -#include "absl/container/btree_set.h" -#include "absl/container/flat_hash_set.h" -#include "absl/strings/cord.h" -#include "absl/time/time.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -// Like remove_const but propagates the removal through std::pair. -template <typename T> -struct remove_pair_const { - using type = typename std::remove_const<T>::type; -}; -template <typename T, typename U> -struct remove_pair_const<std::pair<T, U> > { - using type = std::pair<typename remove_pair_const<T>::type, - typename remove_pair_const<U>::type>; -}; - -// Utility class to provide an accessor for a key given a value. The default -// behavior is to treat the value as a pair and return the first element. -template <typename K, typename V> -struct KeyOfValue { - struct type { - const K& operator()(const V& p) const { return p.first; } - }; -}; - -// Partial specialization of KeyOfValue class for when the key and value are -// the same type such as in set<> and btree_set<>. -template <typename K> -struct KeyOfValue<K, K> { - struct type { - const K& operator()(const K& k) const { return k; } - }; -}; - -inline char* GenerateDigits(char buf[16], unsigned val, unsigned maxval) { - assert(val <= maxval); - constexpr unsigned kBase = 64; // avoid integer division. - unsigned p = 15; - buf[p--] = 0; - while (maxval > 0) { - buf[p--] = ' ' + (val % kBase); - val /= kBase; - maxval /= kBase; - } - return buf + p + 1; -} - -template <typename K> -struct Generator { - int maxval; - explicit Generator(int m) : maxval(m) {} - K operator()(int i) const { - assert(i <= maxval); - return K(i); - } -}; - -template <> -struct Generator<absl::Time> { - int maxval; - explicit Generator(int m) : maxval(m) {} - absl::Time operator()(int i) const { return absl::FromUnixMillis(i); } -}; - -template <> -struct Generator<std::string> { - int maxval; - explicit Generator(int m) : maxval(m) {} - std::string operator()(int i) const { - char buf[16]; - return GenerateDigits(buf, i, maxval); - } -}; - -template <> -struct Generator<Cord> { - int maxval; - explicit Generator(int m) : maxval(m) {} - Cord operator()(int i) const { - char buf[16]; - return Cord(GenerateDigits(buf, i, maxval)); - } -}; - -template <typename T, typename U> -struct Generator<std::pair<T, U> > { - Generator<typename remove_pair_const<T>::type> tgen; - Generator<typename remove_pair_const<U>::type> ugen; - - explicit Generator(int m) : tgen(m), ugen(m) {} - std::pair<T, U> operator()(int i) const { - return std::make_pair(tgen(i), ugen(i)); - } -}; - -// Generate n values for our tests and benchmarks. Value range is [0, maxval]. -inline std::vector<int> GenerateNumbersWithSeed(int n, int maxval, int seed) { - // NOTE: Some tests rely on generated numbers not changing between test runs. - // We use std::minstd_rand0 because it is well-defined, but don't use - // std::uniform_int_distribution because platforms use different algorithms. - std::minstd_rand0 rng(seed); - - std::vector<int> values; - absl::flat_hash_set<int> unique_values; - if (values.size() < n) { - for (int i = values.size(); i < n; i++) { - int value; - do { - value = static_cast<int>(rng()) % (maxval + 1); - } while (!unique_values.insert(value).second); - - values.push_back(value); - } - } - return values; -} - -// Generates n values in the range [0, maxval]. -template <typename V> -std::vector<V> GenerateValuesWithSeed(int n, int maxval, int seed) { - const std::vector<int> nums = GenerateNumbersWithSeed(n, maxval, seed); - Generator<V> gen(maxval); - std::vector<V> vec; - - vec.reserve(n); - for (int i = 0; i < n; i++) { - vec.push_back(gen(nums[i])); - } - - return vec; -} - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_BTREE_TEST_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/absl_hashtablez_sampler/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/container/internal/absl_hashtablez_sampler/CMakeLists.linux.txt deleted file mode 100644 index 05d2f8e871..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/absl_hashtablez_sampler/CMakeLists.linux.txt +++ /dev/null @@ -1,43 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(container-internal-absl_hashtablez_sampler) -target_compile_options(container-internal-absl_hashtablez_sampler PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(container-internal-absl_hashtablez_sampler PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(container-internal-absl_hashtablez_sampler PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone -) -target_sources(container-internal-absl_hashtablez_sampler PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/container/internal/hashtablez_sampler.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/absl_hashtablez_sampler/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/container/internal/absl_hashtablez_sampler/CMakeLists.txt index e8c98bfd99..05d2f8e871 100644 --- a/contrib/restricted/abseil-cpp/absl/container/internal/absl_hashtablez_sampler/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/container/internal/absl_hashtablez_sampler/CMakeLists.txt @@ -6,6 +6,38 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(container-internal-absl_hashtablez_sampler) +target_compile_options(container-internal-absl_hashtablez_sampler PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(container-internal-absl_hashtablez_sampler PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(container-internal-absl_hashtablez_sampler PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone +) +target_sources(container-internal-absl_hashtablez_sampler PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/container/internal/hashtablez_sampler.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/btree.h b/contrib/restricted/abseil-cpp/absl/container/internal/btree.h deleted file mode 100644 index f636c5fc73..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/btree.h +++ /dev/null @@ -1,2641 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// A btree implementation of the STL set and map interfaces. A btree is smaller -// and generally also faster than STL set/map (refer to the benchmarks below). -// The red-black tree implementation of STL set/map has an overhead of 3 -// pointers (left, right and parent) plus the node color information for each -// stored value. So a set<int32_t> consumes 40 bytes for each value stored in -// 64-bit mode. This btree implementation stores multiple values on fixed -// size nodes (usually 256 bytes) and doesn't store child pointers for leaf -// nodes. The result is that a btree_set<int32_t> may use much less memory per -// stored value. For the random insertion benchmark in btree_bench.cc, a -// btree_set<int32_t> with node-size of 256 uses 5.1 bytes per stored value. -// -// The packing of multiple values on to each node of a btree has another effect -// besides better space utilization: better cache locality due to fewer cache -// lines being accessed. Better cache locality translates into faster -// operations. -// -// CAVEATS -// -// Insertions and deletions on a btree can cause splitting, merging or -// rebalancing of btree nodes. And even without these operations, insertions -// and deletions on a btree will move values around within a node. In both -// cases, the result is that insertions and deletions can invalidate iterators -// pointing to values other than the one being inserted/deleted. Therefore, this -// container does not provide pointer stability. This is notably different from -// STL set/map which takes care to not invalidate iterators on insert/erase -// except, of course, for iterators pointing to the value being erased. A -// partial workaround when erasing is available: erase() returns an iterator -// pointing to the item just after the one that was erased (or end() if none -// exists). - -#ifndef ABSL_CONTAINER_INTERNAL_BTREE_H_ -#define ABSL_CONTAINER_INTERNAL_BTREE_H_ - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <cstdint> -#include <cstring> -#include <functional> -#include <iterator> -#include <limits> -#include <new> -#include <string> -#include <type_traits> -#include <utility> - -#include "absl/base/macros.h" -#include "absl/container/internal/common.h" -#include "absl/container/internal/compressed_tuple.h" -#include "absl/container/internal/container_memory.h" -#include "absl/container/internal/layout.h" -#include "absl/memory/memory.h" -#include "absl/meta/type_traits.h" -#include "absl/strings/cord.h" -#include "absl/strings/string_view.h" -#include "absl/types/compare.h" -#include "absl/utility/utility.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -// A helper class that indicates if the Compare parameter is a key-compare-to -// comparator. -template <typename Compare, typename T> -using btree_is_key_compare_to = - std::is_convertible<absl::result_of_t<Compare(const T &, const T &)>, - absl::weak_ordering>; - -struct StringBtreeDefaultLess { - using is_transparent = void; - - StringBtreeDefaultLess() = default; - - // Compatibility constructor. - StringBtreeDefaultLess(std::less<std::string>) {} // NOLINT - StringBtreeDefaultLess(std::less<absl::string_view>) {} // NOLINT - - // Allow converting to std::less for use in key_comp()/value_comp(). - explicit operator std::less<std::string>() const { return {}; } - explicit operator std::less<absl::string_view>() const { return {}; } - explicit operator std::less<absl::Cord>() const { return {}; } - - absl::weak_ordering operator()(absl::string_view lhs, - absl::string_view rhs) const { - return compare_internal::compare_result_as_ordering(lhs.compare(rhs)); - } - StringBtreeDefaultLess(std::less<absl::Cord>) {} // NOLINT - absl::weak_ordering operator()(const absl::Cord &lhs, - const absl::Cord &rhs) const { - return compare_internal::compare_result_as_ordering(lhs.Compare(rhs)); - } - absl::weak_ordering operator()(const absl::Cord &lhs, - absl::string_view rhs) const { - return compare_internal::compare_result_as_ordering(lhs.Compare(rhs)); - } - absl::weak_ordering operator()(absl::string_view lhs, - const absl::Cord &rhs) const { - return compare_internal::compare_result_as_ordering(-rhs.Compare(lhs)); - } -}; - -struct StringBtreeDefaultGreater { - using is_transparent = void; - - StringBtreeDefaultGreater() = default; - - StringBtreeDefaultGreater(std::greater<std::string>) {} // NOLINT - StringBtreeDefaultGreater(std::greater<absl::string_view>) {} // NOLINT - - // Allow converting to std::greater for use in key_comp()/value_comp(). - explicit operator std::greater<std::string>() const { return {}; } - explicit operator std::greater<absl::string_view>() const { return {}; } - explicit operator std::greater<absl::Cord>() const { return {}; } - - absl::weak_ordering operator()(absl::string_view lhs, - absl::string_view rhs) const { - return compare_internal::compare_result_as_ordering(rhs.compare(lhs)); - } - StringBtreeDefaultGreater(std::greater<absl::Cord>) {} // NOLINT - absl::weak_ordering operator()(const absl::Cord &lhs, - const absl::Cord &rhs) const { - return compare_internal::compare_result_as_ordering(rhs.Compare(lhs)); - } - absl::weak_ordering operator()(const absl::Cord &lhs, - absl::string_view rhs) const { - return compare_internal::compare_result_as_ordering(-lhs.Compare(rhs)); - } - absl::weak_ordering operator()(absl::string_view lhs, - const absl::Cord &rhs) const { - return compare_internal::compare_result_as_ordering(rhs.Compare(lhs)); - } -}; - -// A helper class to convert a boolean comparison into a three-way "compare-to" -// comparison that returns an `absl::weak_ordering`. This helper -// class is specialized for less<std::string>, greater<std::string>, -// less<string_view>, greater<string_view>, less<absl::Cord>, and -// greater<absl::Cord>. -// -// key_compare_to_adapter is provided so that btree users -// automatically get the more efficient compare-to code when using common -// Abseil string types with common comparison functors. -// These string-like specializations also turn on heterogeneous lookup by -// default. -template <typename Compare> -struct key_compare_to_adapter { - using type = Compare; -}; - -template <> -struct key_compare_to_adapter<std::less<std::string>> { - using type = StringBtreeDefaultLess; -}; - -template <> -struct key_compare_to_adapter<std::greater<std::string>> { - using type = StringBtreeDefaultGreater; -}; - -template <> -struct key_compare_to_adapter<std::less<absl::string_view>> { - using type = StringBtreeDefaultLess; -}; - -template <> -struct key_compare_to_adapter<std::greater<absl::string_view>> { - using type = StringBtreeDefaultGreater; -}; - -template <> -struct key_compare_to_adapter<std::less<absl::Cord>> { - using type = StringBtreeDefaultLess; -}; - -template <> -struct key_compare_to_adapter<std::greater<absl::Cord>> { - using type = StringBtreeDefaultGreater; -}; - -// Detects an 'absl_btree_prefer_linear_node_search' member. This is -// a protocol used as an opt-in or opt-out of linear search. -// -// For example, this would be useful for key types that wrap an integer -// and define their own cheap operator<(). For example: -// -// class K { -// public: -// using absl_btree_prefer_linear_node_search = std::true_type; -// ... -// private: -// friend bool operator<(K a, K b) { return a.k_ < b.k_; } -// int k_; -// }; -// -// btree_map<K, V> m; // Uses linear search -// -// If T has the preference tag, then it has a preference. -// Btree will use the tag's truth value. -template <typename T, typename = void> -struct has_linear_node_search_preference : std::false_type {}; -template <typename T, typename = void> -struct prefers_linear_node_search : std::false_type {}; -template <typename T> -struct has_linear_node_search_preference< - T, absl::void_t<typename T::absl_btree_prefer_linear_node_search>> - : std::true_type {}; -template <typename T> -struct prefers_linear_node_search< - T, absl::void_t<typename T::absl_btree_prefer_linear_node_search>> - : T::absl_btree_prefer_linear_node_search {}; - -template <typename Key, typename Compare, typename Alloc, int TargetNodeSize, - bool Multi, typename SlotPolicy> -struct common_params { - using original_key_compare = Compare; - - // If Compare is a common comparator for a string-like type, then we adapt it - // to use heterogeneous lookup and to be a key-compare-to comparator. - using key_compare = typename key_compare_to_adapter<Compare>::type; - // A type which indicates if we have a key-compare-to functor or a plain old - // key-compare functor. - using is_key_compare_to = btree_is_key_compare_to<key_compare, Key>; - - using allocator_type = Alloc; - using key_type = Key; - using size_type = std::make_signed<size_t>::type; - using difference_type = ptrdiff_t; - - using slot_policy = SlotPolicy; - using slot_type = typename slot_policy::slot_type; - using value_type = typename slot_policy::value_type; - using init_type = typename slot_policy::mutable_value_type; - using pointer = value_type *; - using const_pointer = const value_type *; - using reference = value_type &; - using const_reference = const value_type &; - - // For the given lookup key type, returns whether we can have multiple - // equivalent keys in the btree. If this is a multi-container, then we can. - // Otherwise, we can have multiple equivalent keys only if all of the - // following conditions are met: - // - The comparator is transparent. - // - The lookup key type is not the same as key_type. - // - The comparator is not a StringBtreeDefault{Less,Greater} comparator - // that we know has the same equivalence classes for all lookup types. - template <typename LookupKey> - constexpr static bool can_have_multiple_equivalent_keys() { - return Multi || - (IsTransparent<key_compare>::value && - !std::is_same<LookupKey, Key>::value && - !std::is_same<key_compare, StringBtreeDefaultLess>::value && - !std::is_same<key_compare, StringBtreeDefaultGreater>::value); - } - - enum { - kTargetNodeSize = TargetNodeSize, - - // Upper bound for the available space for values. This is largest for leaf - // nodes, which have overhead of at least a pointer + 4 bytes (for storing - // 3 field_types and an enum). - kNodeValueSpace = - TargetNodeSize - /*minimum overhead=*/(sizeof(void *) + 4), - }; - - // This is an integral type large enough to hold as many - // ValueSize-values as will fit a node of TargetNodeSize bytes. - using node_count_type = - absl::conditional_t<(kNodeValueSpace / sizeof(value_type) > - (std::numeric_limits<uint8_t>::max)()), - uint16_t, uint8_t>; // NOLINT - - // The following methods are necessary for passing this struct as PolicyTraits - // for node_handle and/or are used within btree. - static value_type &element(slot_type *slot) { - return slot_policy::element(slot); - } - static const value_type &element(const slot_type *slot) { - return slot_policy::element(slot); - } - template <class... Args> - static void construct(Alloc *alloc, slot_type *slot, Args &&... args) { - slot_policy::construct(alloc, slot, std::forward<Args>(args)...); - } - static void construct(Alloc *alloc, slot_type *slot, slot_type *other) { - slot_policy::construct(alloc, slot, other); - } - static void destroy(Alloc *alloc, slot_type *slot) { - slot_policy::destroy(alloc, slot); - } - static void transfer(Alloc *alloc, slot_type *new_slot, slot_type *old_slot) { - construct(alloc, new_slot, old_slot); - destroy(alloc, old_slot); - } - static void swap(Alloc *alloc, slot_type *a, slot_type *b) { - slot_policy::swap(alloc, a, b); - } - static void move(Alloc *alloc, slot_type *src, slot_type *dest) { - slot_policy::move(alloc, src, dest); - } -}; - -// A parameters structure for holding the type parameters for a btree_map. -// Compare and Alloc should be nothrow copy-constructible. -template <typename Key, typename Data, typename Compare, typename Alloc, - int TargetNodeSize, bool Multi> -struct map_params : common_params<Key, Compare, Alloc, TargetNodeSize, Multi, - map_slot_policy<Key, Data>> { - using super_type = typename map_params::common_params; - using mapped_type = Data; - // This type allows us to move keys when it is safe to do so. It is safe - // for maps in which value_type and mutable_value_type are layout compatible. - using slot_policy = typename super_type::slot_policy; - using slot_type = typename super_type::slot_type; - using value_type = typename super_type::value_type; - using init_type = typename super_type::init_type; - - using original_key_compare = typename super_type::original_key_compare; - // Reference: https://en.cppreference.com/w/cpp/container/map/value_compare - class value_compare { - template <typename Params> - friend class btree; - - protected: - explicit value_compare(original_key_compare c) : comp(std::move(c)) {} - - original_key_compare comp; // NOLINT - - public: - auto operator()(const value_type &lhs, const value_type &rhs) const - -> decltype(comp(lhs.first, rhs.first)) { - return comp(lhs.first, rhs.first); - } - }; - using is_map_container = std::true_type; - - template <typename V> - static auto key(const V &value) -> decltype(value.first) { - return value.first; - } - static const Key &key(const slot_type *s) { return slot_policy::key(s); } - static const Key &key(slot_type *s) { return slot_policy::key(s); } - // For use in node handle. - static auto mutable_key(slot_type *s) - -> decltype(slot_policy::mutable_key(s)) { - return slot_policy::mutable_key(s); - } - static mapped_type &value(value_type *value) { return value->second; } -}; - -// This type implements the necessary functions from the -// absl::container_internal::slot_type interface. -template <typename Key> -struct set_slot_policy { - using slot_type = Key; - using value_type = Key; - using mutable_value_type = Key; - - static value_type &element(slot_type *slot) { return *slot; } - static const value_type &element(const slot_type *slot) { return *slot; } - - template <typename Alloc, class... Args> - static void construct(Alloc *alloc, slot_type *slot, Args &&... args) { - absl::allocator_traits<Alloc>::construct(*alloc, slot, - std::forward<Args>(args)...); - } - - template <typename Alloc> - static void construct(Alloc *alloc, slot_type *slot, slot_type *other) { - absl::allocator_traits<Alloc>::construct(*alloc, slot, std::move(*other)); - } - - template <typename Alloc> - static void destroy(Alloc *alloc, slot_type *slot) { - absl::allocator_traits<Alloc>::destroy(*alloc, slot); - } - - template <typename Alloc> - static void swap(Alloc * /*alloc*/, slot_type *a, slot_type *b) { - using std::swap; - swap(*a, *b); - } - - template <typename Alloc> - static void move(Alloc * /*alloc*/, slot_type *src, slot_type *dest) { - *dest = std::move(*src); - } -}; - -// A parameters structure for holding the type parameters for a btree_set. -// Compare and Alloc should be nothrow copy-constructible. -template <typename Key, typename Compare, typename Alloc, int TargetNodeSize, - bool Multi> -struct set_params : common_params<Key, Compare, Alloc, TargetNodeSize, Multi, - set_slot_policy<Key>> { - using value_type = Key; - using slot_type = typename set_params::common_params::slot_type; - using value_compare = - typename set_params::common_params::original_key_compare; - using is_map_container = std::false_type; - - template <typename V> - static const V &key(const V &value) { return value; } - static const Key &key(const slot_type *slot) { return *slot; } - static const Key &key(slot_type *slot) { return *slot; } -}; - -// An adapter class that converts a lower-bound compare into an upper-bound -// compare. Note: there is no need to make a version of this adapter specialized -// for key-compare-to functors because the upper-bound (the first value greater -// than the input) is never an exact match. -template <typename Compare> -struct upper_bound_adapter { - explicit upper_bound_adapter(const Compare &c) : comp(c) {} - template <typename K1, typename K2> - bool operator()(const K1 &a, const K2 &b) const { - // Returns true when a is not greater than b. - return !compare_internal::compare_result_as_less_than(comp(b, a)); - } - - private: - Compare comp; -}; - -enum class MatchKind : uint8_t { kEq, kNe }; - -template <typename V, bool IsCompareTo> -struct SearchResult { - V value; - MatchKind match; - - static constexpr bool HasMatch() { return true; } - bool IsEq() const { return match == MatchKind::kEq; } -}; - -// When we don't use CompareTo, `match` is not present. -// This ensures that callers can't use it accidentally when it provides no -// useful information. -template <typename V> -struct SearchResult<V, false> { - SearchResult() {} - explicit SearchResult(V value) : value(value) {} - SearchResult(V value, MatchKind /*match*/) : value(value) {} - - V value; - - static constexpr bool HasMatch() { return false; } - static constexpr bool IsEq() { return false; } -}; - -// A node in the btree holding. The same node type is used for both internal -// and leaf nodes in the btree, though the nodes are allocated in such a way -// that the children array is only valid in internal nodes. -template <typename Params> -class btree_node { - using is_key_compare_to = typename Params::is_key_compare_to; - using field_type = typename Params::node_count_type; - using allocator_type = typename Params::allocator_type; - using slot_type = typename Params::slot_type; - - public: - using params_type = Params; - using key_type = typename Params::key_type; - using value_type = typename Params::value_type; - using pointer = typename Params::pointer; - using const_pointer = typename Params::const_pointer; - using reference = typename Params::reference; - using const_reference = typename Params::const_reference; - using key_compare = typename Params::key_compare; - using size_type = typename Params::size_type; - using difference_type = typename Params::difference_type; - - // Btree decides whether to use linear node search as follows: - // - If the comparator expresses a preference, use that. - // - If the key expresses a preference, use that. - // - If the key is arithmetic and the comparator is std::less or - // std::greater, choose linear. - // - Otherwise, choose binary. - // TODO(ezb): Might make sense to add condition(s) based on node-size. - using use_linear_search = std::integral_constant< - bool, - has_linear_node_search_preference<key_compare>::value - ? prefers_linear_node_search<key_compare>::value - : has_linear_node_search_preference<key_type>::value - ? prefers_linear_node_search<key_type>::value - : std::is_arithmetic<key_type>::value && - (std::is_same<std::less<key_type>, key_compare>::value || - std::is_same<std::greater<key_type>, - key_compare>::value)>; - - // This class is organized by absl::container_internal::Layout as if it had - // the following structure: - // // A pointer to the node's parent. - // btree_node *parent; - // - // // The position of the node in the node's parent. - // field_type position; - // // The index of the first populated value in `values`. - // // TODO(ezb): right now, `start` is always 0. Update insertion/merge - // // logic to allow for floating storage within nodes. - // field_type start; - // // The index after the last populated value in `values`. Currently, this - // // is the same as the count of values. - // field_type finish; - // // The maximum number of values the node can hold. This is an integer in - // // [1, kNodeSlots] for root leaf nodes, kNodeSlots for non-root leaf - // // nodes, and kInternalNodeMaxCount (as a sentinel value) for internal - // // nodes (even though there are still kNodeSlots values in the node). - // // TODO(ezb): make max_count use only 4 bits and record log2(capacity) - // // to free extra bits for is_root, etc. - // field_type max_count; - // - // // The array of values. The capacity is `max_count` for leaf nodes and - // // kNodeSlots for internal nodes. Only the values in - // // [start, finish) have been initialized and are valid. - // slot_type values[max_count]; - // - // // The array of child pointers. The keys in children[i] are all less - // // than key(i). The keys in children[i + 1] are all greater than key(i). - // // There are 0 children for leaf nodes and kNodeSlots + 1 children for - // // internal nodes. - // btree_node *children[kNodeSlots + 1]; - // - // This class is only constructed by EmptyNodeType. Normally, pointers to the - // layout above are allocated, cast to btree_node*, and de-allocated within - // the btree implementation. - ~btree_node() = default; - btree_node(btree_node const &) = delete; - btree_node &operator=(btree_node const &) = delete; - - // Public for EmptyNodeType. - constexpr static size_type Alignment() { - static_assert(LeafLayout(1).Alignment() == InternalLayout().Alignment(), - "Alignment of all nodes must be equal."); - return InternalLayout().Alignment(); - } - - protected: - btree_node() = default; - - private: - using layout_type = absl::container_internal::Layout<btree_node *, field_type, - slot_type, btree_node *>; - constexpr static size_type SizeWithNSlots(size_type n) { - return layout_type(/*parent*/ 1, - /*position, start, finish, max_count*/ 4, - /*slots*/ n, - /*children*/ 0) - .AllocSize(); - } - // A lower bound for the overhead of fields other than values in a leaf node. - constexpr static size_type MinimumOverhead() { - return SizeWithNSlots(1) - sizeof(value_type); - } - - // Compute how many values we can fit onto a leaf node taking into account - // padding. - constexpr static size_type NodeTargetSlots(const int begin, const int end) { - return begin == end ? begin - : SizeWithNSlots((begin + end) / 2 + 1) > - params_type::kTargetNodeSize - ? NodeTargetSlots(begin, (begin + end) / 2) - : NodeTargetSlots((begin + end) / 2 + 1, end); - } - - enum { - kTargetNodeSize = params_type::kTargetNodeSize, - kNodeTargetSlots = NodeTargetSlots(0, params_type::kTargetNodeSize), - - // We need a minimum of 3 slots per internal node in order to perform - // splitting (1 value for the two nodes involved in the split and 1 value - // propagated to the parent as the delimiter for the split). For performance - // reasons, we don't allow 3 slots-per-node due to bad worst case occupancy - // of 1/3 (for a node, not a b-tree). - kMinNodeSlots = 4, - - kNodeSlots = - kNodeTargetSlots >= kMinNodeSlots ? kNodeTargetSlots : kMinNodeSlots, - - // The node is internal (i.e. is not a leaf node) if and only if `max_count` - // has this value. - kInternalNodeMaxCount = 0, - }; - - // Leaves can have less than kNodeSlots values. - constexpr static layout_type LeafLayout(const int slot_count = kNodeSlots) { - return layout_type(/*parent*/ 1, - /*position, start, finish, max_count*/ 4, - /*slots*/ slot_count, - /*children*/ 0); - } - constexpr static layout_type InternalLayout() { - return layout_type(/*parent*/ 1, - /*position, start, finish, max_count*/ 4, - /*slots*/ kNodeSlots, - /*children*/ kNodeSlots + 1); - } - constexpr static size_type LeafSize(const int slot_count = kNodeSlots) { - return LeafLayout(slot_count).AllocSize(); - } - constexpr static size_type InternalSize() { - return InternalLayout().AllocSize(); - } - - // N is the index of the type in the Layout definition. - // ElementType<N> is the Nth type in the Layout definition. - template <size_type N> - inline typename layout_type::template ElementType<N> *GetField() { - // We assert that we don't read from values that aren't there. - assert(N < 3 || !leaf()); - return InternalLayout().template Pointer<N>(reinterpret_cast<char *>(this)); - } - template <size_type N> - inline const typename layout_type::template ElementType<N> *GetField() const { - assert(N < 3 || !leaf()); - return InternalLayout().template Pointer<N>( - reinterpret_cast<const char *>(this)); - } - void set_parent(btree_node *p) { *GetField<0>() = p; } - field_type &mutable_finish() { return GetField<1>()[2]; } - slot_type *slot(int i) { return &GetField<2>()[i]; } - slot_type *start_slot() { return slot(start()); } - slot_type *finish_slot() { return slot(finish()); } - const slot_type *slot(int i) const { return &GetField<2>()[i]; } - void set_position(field_type v) { GetField<1>()[0] = v; } - void set_start(field_type v) { GetField<1>()[1] = v; } - void set_finish(field_type v) { GetField<1>()[2] = v; } - // This method is only called by the node init methods. - void set_max_count(field_type v) { GetField<1>()[3] = v; } - - public: - // Whether this is a leaf node or not. This value doesn't change after the - // node is created. - bool leaf() const { return GetField<1>()[3] != kInternalNodeMaxCount; } - - // Getter for the position of this node in its parent. - field_type position() const { return GetField<1>()[0]; } - - // Getter for the offset of the first value in the `values` array. - field_type start() const { - // TODO(ezb): when floating storage is implemented, return GetField<1>()[1]; - assert(GetField<1>()[1] == 0); - return 0; - } - - // Getter for the offset after the last value in the `values` array. - field_type finish() const { return GetField<1>()[2]; } - - // Getters for the number of values stored in this node. - field_type count() const { - assert(finish() >= start()); - return finish() - start(); - } - field_type max_count() const { - // Internal nodes have max_count==kInternalNodeMaxCount. - // Leaf nodes have max_count in [1, kNodeSlots]. - const field_type max_count = GetField<1>()[3]; - return max_count == field_type{kInternalNodeMaxCount} - ? field_type{kNodeSlots} - : max_count; - } - - // Getter for the parent of this node. - btree_node *parent() const { return *GetField<0>(); } - // Getter for whether the node is the root of the tree. The parent of the - // root of the tree is the leftmost node in the tree which is guaranteed to - // be a leaf. - bool is_root() const { return parent()->leaf(); } - void make_root() { - assert(parent()->is_root()); - set_parent(parent()->parent()); - } - - // Getters for the key/value at position i in the node. - const key_type &key(int i) const { return params_type::key(slot(i)); } - reference value(int i) { return params_type::element(slot(i)); } - const_reference value(int i) const { return params_type::element(slot(i)); } - - // Getters/setter for the child at position i in the node. - btree_node *child(int i) const { return GetField<3>()[i]; } - btree_node *start_child() const { return child(start()); } - btree_node *&mutable_child(int i) { return GetField<3>()[i]; } - void clear_child(int i) { - absl::container_internal::SanitizerPoisonObject(&mutable_child(i)); - } - void set_child(int i, btree_node *c) { - absl::container_internal::SanitizerUnpoisonObject(&mutable_child(i)); - mutable_child(i) = c; - c->set_position(i); - } - void init_child(int i, btree_node *c) { - set_child(i, c); - c->set_parent(this); - } - - // Returns the position of the first value whose key is not less than k. - template <typename K> - SearchResult<int, is_key_compare_to::value> lower_bound( - const K &k, const key_compare &comp) const { - return use_linear_search::value ? linear_search(k, comp) - : binary_search(k, comp); - } - // Returns the position of the first value whose key is greater than k. - template <typename K> - int upper_bound(const K &k, const key_compare &comp) const { - auto upper_compare = upper_bound_adapter<key_compare>(comp); - return use_linear_search::value ? linear_search(k, upper_compare).value - : binary_search(k, upper_compare).value; - } - - template <typename K, typename Compare> - SearchResult<int, btree_is_key_compare_to<Compare, key_type>::value> - linear_search(const K &k, const Compare &comp) const { - return linear_search_impl(k, start(), finish(), comp, - btree_is_key_compare_to<Compare, key_type>()); - } - - template <typename K, typename Compare> - SearchResult<int, btree_is_key_compare_to<Compare, key_type>::value> - binary_search(const K &k, const Compare &comp) const { - return binary_search_impl(k, start(), finish(), comp, - btree_is_key_compare_to<Compare, key_type>()); - } - - // Returns the position of the first value whose key is not less than k using - // linear search performed using plain compare. - template <typename K, typename Compare> - SearchResult<int, false> linear_search_impl( - const K &k, int s, const int e, const Compare &comp, - std::false_type /* IsCompareTo */) const { - while (s < e) { - if (!comp(key(s), k)) { - break; - } - ++s; - } - return SearchResult<int, false>{s}; - } - - // Returns the position of the first value whose key is not less than k using - // linear search performed using compare-to. - template <typename K, typename Compare> - SearchResult<int, true> linear_search_impl( - const K &k, int s, const int e, const Compare &comp, - std::true_type /* IsCompareTo */) const { - while (s < e) { - const absl::weak_ordering c = comp(key(s), k); - if (c == 0) { - return {s, MatchKind::kEq}; - } else if (c > 0) { - break; - } - ++s; - } - return {s, MatchKind::kNe}; - } - - // Returns the position of the first value whose key is not less than k using - // binary search performed using plain compare. - template <typename K, typename Compare> - SearchResult<int, false> binary_search_impl( - const K &k, int s, int e, const Compare &comp, - std::false_type /* IsCompareTo */) const { - while (s != e) { - const int mid = (s + e) >> 1; - if (comp(key(mid), k)) { - s = mid + 1; - } else { - e = mid; - } - } - return SearchResult<int, false>{s}; - } - - // Returns the position of the first value whose key is not less than k using - // binary search performed using compare-to. - template <typename K, typename CompareTo> - SearchResult<int, true> binary_search_impl( - const K &k, int s, int e, const CompareTo &comp, - std::true_type /* IsCompareTo */) const { - if (params_type::template can_have_multiple_equivalent_keys<K>()) { - MatchKind exact_match = MatchKind::kNe; - while (s != e) { - const int mid = (s + e) >> 1; - const absl::weak_ordering c = comp(key(mid), k); - if (c < 0) { - s = mid + 1; - } else { - e = mid; - if (c == 0) { - // Need to return the first value whose key is not less than k, - // which requires continuing the binary search if there could be - // multiple equivalent keys. - exact_match = MatchKind::kEq; - } - } - } - return {s, exact_match}; - } else { // Can't have multiple equivalent keys. - while (s != e) { - const int mid = (s + e) >> 1; - const absl::weak_ordering c = comp(key(mid), k); - if (c < 0) { - s = mid + 1; - } else if (c > 0) { - e = mid; - } else { - return {mid, MatchKind::kEq}; - } - } - return {s, MatchKind::kNe}; - } - } - - // Emplaces a value at position i, shifting all existing values and - // children at positions >= i to the right by 1. - template <typename... Args> - void emplace_value(size_type i, allocator_type *alloc, Args &&... args); - - // Removes the values at positions [i, i + to_erase), shifting all existing - // values and children after that range to the left by to_erase. Clears all - // children between [i, i + to_erase). - void remove_values(field_type i, field_type to_erase, allocator_type *alloc); - - // Rebalances a node with its right sibling. - void rebalance_right_to_left(int to_move, btree_node *right, - allocator_type *alloc); - void rebalance_left_to_right(int to_move, btree_node *right, - allocator_type *alloc); - - // Splits a node, moving a portion of the node's values to its right sibling. - void split(int insert_position, btree_node *dest, allocator_type *alloc); - - // Merges a node with its right sibling, moving all of the values and the - // delimiting key in the parent node onto itself, and deleting the src node. - void merge(btree_node *src, allocator_type *alloc); - - // Node allocation/deletion routines. - void init_leaf(btree_node *parent, int max_count) { - set_parent(parent); - set_position(0); - set_start(0); - set_finish(0); - set_max_count(max_count); - absl::container_internal::SanitizerPoisonMemoryRegion( - start_slot(), max_count * sizeof(slot_type)); - } - void init_internal(btree_node *parent) { - init_leaf(parent, kNodeSlots); - // Set `max_count` to a sentinel value to indicate that this node is - // internal. - set_max_count(kInternalNodeMaxCount); - absl::container_internal::SanitizerPoisonMemoryRegion( - &mutable_child(start()), (kNodeSlots + 1) * sizeof(btree_node *)); - } - - static void deallocate(const size_type size, btree_node *node, - allocator_type *alloc) { - absl::container_internal::Deallocate<Alignment()>(alloc, node, size); - } - - // Deletes a node and all of its children. - static void clear_and_delete(btree_node *node, allocator_type *alloc); - - private: - template <typename... Args> - void value_init(const field_type i, allocator_type *alloc, Args &&... args) { - absl::container_internal::SanitizerUnpoisonObject(slot(i)); - params_type::construct(alloc, slot(i), std::forward<Args>(args)...); - } - void value_destroy(const field_type i, allocator_type *alloc) { - params_type::destroy(alloc, slot(i)); - absl::container_internal::SanitizerPoisonObject(slot(i)); - } - void value_destroy_n(const field_type i, const field_type n, - allocator_type *alloc) { - for (slot_type *s = slot(i), *end = slot(i + n); s != end; ++s) { - params_type::destroy(alloc, s); - absl::container_internal::SanitizerPoisonObject(s); - } - } - - static void transfer(slot_type *dest, slot_type *src, allocator_type *alloc) { - absl::container_internal::SanitizerUnpoisonObject(dest); - params_type::transfer(alloc, dest, src); - absl::container_internal::SanitizerPoisonObject(src); - } - - // Transfers value from slot `src_i` in `src_node` to slot `dest_i` in `this`. - void transfer(const size_type dest_i, const size_type src_i, - btree_node *src_node, allocator_type *alloc) { - transfer(slot(dest_i), src_node->slot(src_i), alloc); - } - - // Transfers `n` values starting at value `src_i` in `src_node` into the - // values starting at value `dest_i` in `this`. - void transfer_n(const size_type n, const size_type dest_i, - const size_type src_i, btree_node *src_node, - allocator_type *alloc) { - for (slot_type *src = src_node->slot(src_i), *end = src + n, - *dest = slot(dest_i); - src != end; ++src, ++dest) { - transfer(dest, src, alloc); - } - } - - // Same as above, except that we start at the end and work our way to the - // beginning. - void transfer_n_backward(const size_type n, const size_type dest_i, - const size_type src_i, btree_node *src_node, - allocator_type *alloc) { - for (slot_type *src = src_node->slot(src_i + n - 1), *end = src - n, - *dest = slot(dest_i + n - 1); - src != end; --src, --dest) { - transfer(dest, src, alloc); - } - } - - template <typename P> - friend class btree; - template <typename N, typename R, typename P> - friend struct btree_iterator; - friend class BtreeNodePeer; -}; - -template <typename Node, typename Reference, typename Pointer> -struct btree_iterator { - private: - using key_type = typename Node::key_type; - using size_type = typename Node::size_type; - using params_type = typename Node::params_type; - using is_map_container = typename params_type::is_map_container; - - using node_type = Node; - using normal_node = typename std::remove_const<Node>::type; - using const_node = const Node; - using normal_pointer = typename params_type::pointer; - using normal_reference = typename params_type::reference; - using const_pointer = typename params_type::const_pointer; - using const_reference = typename params_type::const_reference; - using slot_type = typename params_type::slot_type; - - using iterator = - btree_iterator<normal_node, normal_reference, normal_pointer>; - using const_iterator = - btree_iterator<const_node, const_reference, const_pointer>; - - public: - // These aliases are public for std::iterator_traits. - using difference_type = typename Node::difference_type; - using value_type = typename params_type::value_type; - using pointer = Pointer; - using reference = Reference; - using iterator_category = std::bidirectional_iterator_tag; - - btree_iterator() : node(nullptr), position(-1) {} - explicit btree_iterator(Node *n) : node(n), position(n->start()) {} - btree_iterator(Node *n, int p) : node(n), position(p) {} - - // NOTE: this SFINAE allows for implicit conversions from iterator to - // const_iterator, but it specifically avoids hiding the copy constructor so - // that the trivial one will be used when possible. - template <typename N, typename R, typename P, - absl::enable_if_t< - std::is_same<btree_iterator<N, R, P>, iterator>::value && - std::is_same<btree_iterator, const_iterator>::value, - int> = 0> - btree_iterator(const btree_iterator<N, R, P> other) // NOLINT - : node(other.node), position(other.position) {} - - private: - // This SFINAE allows explicit conversions from const_iterator to - // iterator, but also avoids hiding the copy constructor. - // NOTE: the const_cast is safe because this constructor is only called by - // non-const methods and the container owns the nodes. - template <typename N, typename R, typename P, - absl::enable_if_t< - std::is_same<btree_iterator<N, R, P>, const_iterator>::value && - std::is_same<btree_iterator, iterator>::value, - int> = 0> - explicit btree_iterator(const btree_iterator<N, R, P> other) - : node(const_cast<node_type *>(other.node)), position(other.position) {} - - // Increment/decrement the iterator. - void increment() { - if (node->leaf() && ++position < node->finish()) { - return; - } - increment_slow(); - } - void increment_slow(); - - void decrement() { - if (node->leaf() && --position >= node->start()) { - return; - } - decrement_slow(); - } - void decrement_slow(); - - public: - bool operator==(const iterator &other) const { - return node == other.node && position == other.position; - } - bool operator==(const const_iterator &other) const { - return node == other.node && position == other.position; - } - bool operator!=(const iterator &other) const { - return node != other.node || position != other.position; - } - bool operator!=(const const_iterator &other) const { - return node != other.node || position != other.position; - } - - // Accessors for the key/value the iterator is pointing at. - reference operator*() const { - ABSL_HARDENING_ASSERT(node != nullptr); - ABSL_HARDENING_ASSERT(node->start() <= position); - ABSL_HARDENING_ASSERT(node->finish() > position); - return node->value(position); - } - pointer operator->() const { return &operator*(); } - - btree_iterator &operator++() { - increment(); - return *this; - } - btree_iterator &operator--() { - decrement(); - return *this; - } - btree_iterator operator++(int) { - btree_iterator tmp = *this; - ++*this; - return tmp; - } - btree_iterator operator--(int) { - btree_iterator tmp = *this; - --*this; - return tmp; - } - - private: - friend iterator; - friend const_iterator; - template <typename Params> - friend class btree; - template <typename Tree> - friend class btree_container; - template <typename Tree> - friend class btree_set_container; - template <typename Tree> - friend class btree_map_container; - template <typename Tree> - friend class btree_multiset_container; - template <typename TreeType, typename CheckerType> - friend class base_checker; - - const key_type &key() const { return node->key(position); } - slot_type *slot() { return node->slot(position); } - - // The node in the tree the iterator is pointing at. - Node *node; - // The position within the node of the tree the iterator is pointing at. - // NOTE: this is an int rather than a field_type because iterators can point - // to invalid positions (such as -1) in certain circumstances. - int position; -}; - -template <typename Params> -class btree { - using node_type = btree_node<Params>; - using is_key_compare_to = typename Params::is_key_compare_to; - using init_type = typename Params::init_type; - using field_type = typename node_type::field_type; - - // We use a static empty node for the root/leftmost/rightmost of empty btrees - // in order to avoid branching in begin()/end(). - struct alignas(node_type::Alignment()) EmptyNodeType : node_type { - using field_type = typename node_type::field_type; - node_type *parent; - field_type position = 0; - field_type start = 0; - field_type finish = 0; - // max_count must be != kInternalNodeMaxCount (so that this node is regarded - // as a leaf node). max_count() is never called when the tree is empty. - field_type max_count = node_type::kInternalNodeMaxCount + 1; - -#ifdef _MSC_VER - // MSVC has constexpr code generations bugs here. - EmptyNodeType() : parent(this) {} -#else - constexpr EmptyNodeType(node_type *p) : parent(p) {} -#endif - }; - - static node_type *EmptyNode() { -#ifdef _MSC_VER - static EmptyNodeType *empty_node = new EmptyNodeType; - // This assert fails on some other construction methods. - assert(empty_node->parent == empty_node); - return empty_node; -#else - static constexpr EmptyNodeType empty_node( - const_cast<EmptyNodeType *>(&empty_node)); - return const_cast<EmptyNodeType *>(&empty_node); -#endif - } - - enum : uint32_t { - kNodeSlots = node_type::kNodeSlots, - kMinNodeValues = kNodeSlots / 2, - }; - - struct node_stats { - using size_type = typename Params::size_type; - - node_stats(size_type l, size_type i) : leaf_nodes(l), internal_nodes(i) {} - - node_stats &operator+=(const node_stats &other) { - leaf_nodes += other.leaf_nodes; - internal_nodes += other.internal_nodes; - return *this; - } - - size_type leaf_nodes; - size_type internal_nodes; - }; - - public: - using key_type = typename Params::key_type; - using value_type = typename Params::value_type; - using size_type = typename Params::size_type; - using difference_type = typename Params::difference_type; - using key_compare = typename Params::key_compare; - using original_key_compare = typename Params::original_key_compare; - using value_compare = typename Params::value_compare; - using allocator_type = typename Params::allocator_type; - using reference = typename Params::reference; - using const_reference = typename Params::const_reference; - using pointer = typename Params::pointer; - using const_pointer = typename Params::const_pointer; - using iterator = - typename btree_iterator<node_type, reference, pointer>::iterator; - using const_iterator = typename iterator::const_iterator; - using reverse_iterator = std::reverse_iterator<iterator>; - using const_reverse_iterator = std::reverse_iterator<const_iterator>; - using node_handle_type = node_handle<Params, Params, allocator_type>; - - // Internal types made public for use by btree_container types. - using params_type = Params; - using slot_type = typename Params::slot_type; - - private: - // For use in copy_or_move_values_in_order. - const value_type &maybe_move_from_iterator(const_iterator it) { return *it; } - value_type &&maybe_move_from_iterator(iterator it) { - // This is a destructive operation on the other container so it's safe for - // us to const_cast and move from the keys here even if it's a set. - return std::move(const_cast<value_type &>(*it)); - } - - // Copies or moves (depending on the template parameter) the values in - // other into this btree in their order in other. This btree must be empty - // before this method is called. This method is used in copy construction, - // copy assignment, and move assignment. - template <typename Btree> - void copy_or_move_values_in_order(Btree &other); - - // Validates that various assumptions/requirements are true at compile time. - constexpr static bool static_assert_validation(); - - public: - btree(const key_compare &comp, const allocator_type &alloc) - : root_(comp, alloc, EmptyNode()), rightmost_(EmptyNode()), size_(0) {} - - btree(const btree &other) : btree(other, other.allocator()) {} - btree(const btree &other, const allocator_type &alloc) - : btree(other.key_comp(), alloc) { - copy_or_move_values_in_order(other); - } - btree(btree &&other) noexcept - : root_(std::move(other.root_)), - rightmost_(absl::exchange(other.rightmost_, EmptyNode())), - size_(absl::exchange(other.size_, 0)) { - other.mutable_root() = EmptyNode(); - } - btree(btree &&other, const allocator_type &alloc) - : btree(other.key_comp(), alloc) { - if (alloc == other.allocator()) { - swap(other); - } else { - // Move values from `other` one at a time when allocators are different. - copy_or_move_values_in_order(other); - } - } - - ~btree() { - // Put static_asserts in destructor to avoid triggering them before the type - // is complete. - static_assert(static_assert_validation(), "This call must be elided."); - clear(); - } - - // Assign the contents of other to *this. - btree &operator=(const btree &other); - btree &operator=(btree &&other) noexcept; - - iterator begin() { return iterator(leftmost()); } - const_iterator begin() const { return const_iterator(leftmost()); } - iterator end() { return iterator(rightmost_, rightmost_->finish()); } - const_iterator end() const { - return const_iterator(rightmost_, rightmost_->finish()); - } - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { - return const_reverse_iterator(begin()); - } - - // Finds the first element whose key is not less than `key`. - template <typename K> - iterator lower_bound(const K &key) { - return internal_end(internal_lower_bound(key).value); - } - template <typename K> - const_iterator lower_bound(const K &key) const { - return internal_end(internal_lower_bound(key).value); - } - - // Finds the first element whose key is not less than `key` and also returns - // whether that element is equal to `key`. - template <typename K> - std::pair<iterator, bool> lower_bound_equal(const K &key) const; - - // Finds the first element whose key is greater than `key`. - template <typename K> - iterator upper_bound(const K &key) { - return internal_end(internal_upper_bound(key)); - } - template <typename K> - const_iterator upper_bound(const K &key) const { - return internal_end(internal_upper_bound(key)); - } - - // Finds the range of values which compare equal to key. The first member of - // the returned pair is equal to lower_bound(key). The second member of the - // pair is equal to upper_bound(key). - template <typename K> - std::pair<iterator, iterator> equal_range(const K &key); - template <typename K> - std::pair<const_iterator, const_iterator> equal_range(const K &key) const { - return const_cast<btree *>(this)->equal_range(key); - } - - // Inserts a value into the btree only if it does not already exist. The - // boolean return value indicates whether insertion succeeded or failed. - // Requirement: if `key` already exists in the btree, does not consume `args`. - // Requirement: `key` is never referenced after consuming `args`. - template <typename K, typename... Args> - std::pair<iterator, bool> insert_unique(const K &key, Args &&... args); - - // Inserts with hint. Checks to see if the value should be placed immediately - // before `position` in the tree. If so, then the insertion will take - // amortized constant time. If not, the insertion will take amortized - // logarithmic time as if a call to insert_unique() were made. - // Requirement: if `key` already exists in the btree, does not consume `args`. - // Requirement: `key` is never referenced after consuming `args`. - template <typename K, typename... Args> - std::pair<iterator, bool> insert_hint_unique(iterator position, - const K &key, - Args &&... args); - - // Insert a range of values into the btree. - // Note: the first overload avoids constructing a value_type if the key - // already exists in the btree. - template <typename InputIterator, - typename = decltype(std::declval<const key_compare &>()( - params_type::key(*std::declval<InputIterator>()), - std::declval<const key_type &>()))> - void insert_iterator_unique(InputIterator b, InputIterator e, int); - // We need the second overload for cases in which we need to construct a - // value_type in order to compare it with the keys already in the btree. - template <typename InputIterator> - void insert_iterator_unique(InputIterator b, InputIterator e, char); - - // Inserts a value into the btree. - template <typename ValueType> - iterator insert_multi(const key_type &key, ValueType &&v); - - // Inserts a value into the btree. - template <typename ValueType> - iterator insert_multi(ValueType &&v) { - return insert_multi(params_type::key(v), std::forward<ValueType>(v)); - } - - // Insert with hint. Check to see if the value should be placed immediately - // before position in the tree. If it does, then the insertion will take - // amortized constant time. If not, the insertion will take amortized - // logarithmic time as if a call to insert_multi(v) were made. - template <typename ValueType> - iterator insert_hint_multi(iterator position, ValueType &&v); - - // Insert a range of values into the btree. - template <typename InputIterator> - void insert_iterator_multi(InputIterator b, InputIterator e); - - // Erase the specified iterator from the btree. The iterator must be valid - // (i.e. not equal to end()). Return an iterator pointing to the node after - // the one that was erased (or end() if none exists). - // Requirement: does not read the value at `*iter`. - iterator erase(iterator iter); - - // Erases range. Returns the number of keys erased and an iterator pointing - // to the element after the last erased element. - std::pair<size_type, iterator> erase_range(iterator begin, iterator end); - - // Finds an element with key equivalent to `key` or returns `end()` if `key` - // is not present. - template <typename K> - iterator find(const K &key) { - return internal_end(internal_find(key)); - } - template <typename K> - const_iterator find(const K &key) const { - return internal_end(internal_find(key)); - } - - // Clear the btree, deleting all of the values it contains. - void clear(); - - // Swaps the contents of `this` and `other`. - void swap(btree &other); - - const key_compare &key_comp() const noexcept { - return root_.template get<0>(); - } - template <typename K1, typename K2> - bool compare_keys(const K1 &a, const K2 &b) const { - return compare_internal::compare_result_as_less_than(key_comp()(a, b)); - } - - value_compare value_comp() const { - return value_compare(original_key_compare(key_comp())); - } - - // Verifies the structure of the btree. - void verify() const; - - // Size routines. - size_type size() const { return size_; } - size_type max_size() const { return (std::numeric_limits<size_type>::max)(); } - bool empty() const { return size_ == 0; } - - // The height of the btree. An empty tree will have height 0. - size_type height() const { - size_type h = 0; - if (!empty()) { - // Count the length of the chain from the leftmost node up to the - // root. We actually count from the root back around to the level below - // the root, but the calculation is the same because of the circularity - // of that traversal. - const node_type *n = root(); - do { - ++h; - n = n->parent(); - } while (n != root()); - } - return h; - } - - // The number of internal, leaf and total nodes used by the btree. - size_type leaf_nodes() const { return internal_stats(root()).leaf_nodes; } - size_type internal_nodes() const { - return internal_stats(root()).internal_nodes; - } - size_type nodes() const { - node_stats stats = internal_stats(root()); - return stats.leaf_nodes + stats.internal_nodes; - } - - // The total number of bytes used by the btree. - size_type bytes_used() const { - node_stats stats = internal_stats(root()); - if (stats.leaf_nodes == 1 && stats.internal_nodes == 0) { - return sizeof(*this) + node_type::LeafSize(root()->max_count()); - } else { - return sizeof(*this) + stats.leaf_nodes * node_type::LeafSize() + - stats.internal_nodes * node_type::InternalSize(); - } - } - - // The average number of bytes used per value stored in the btree assuming - // random insertion order. - static double average_bytes_per_value() { - // The expected number of values per node with random insertion order is the - // average of the maximum and minimum numbers of values per node. - const double expected_values_per_node = - (kNodeSlots + kMinNodeValues) / 2.0; - return node_type::LeafSize() / expected_values_per_node; - } - - // The fullness of the btree. Computed as the number of elements in the btree - // divided by the maximum number of elements a tree with the current number - // of nodes could hold. A value of 1 indicates perfect space - // utilization. Smaller values indicate space wastage. - // Returns 0 for empty trees. - double fullness() const { - if (empty()) return 0.0; - return static_cast<double>(size()) / (nodes() * kNodeSlots); - } - // The overhead of the btree structure in bytes per node. Computed as the - // total number of bytes used by the btree minus the number of bytes used for - // storing elements divided by the number of elements. - // Returns 0 for empty trees. - double overhead() const { - if (empty()) return 0.0; - return (bytes_used() - size() * sizeof(value_type)) / - static_cast<double>(size()); - } - - // The allocator used by the btree. - allocator_type get_allocator() const { return allocator(); } - - private: - // Internal accessor routines. - node_type *root() { return root_.template get<2>(); } - const node_type *root() const { return root_.template get<2>(); } - node_type *&mutable_root() noexcept { return root_.template get<2>(); } - key_compare *mutable_key_comp() noexcept { return &root_.template get<0>(); } - - // The leftmost node is stored as the parent of the root node. - node_type *leftmost() { return root()->parent(); } - const node_type *leftmost() const { return root()->parent(); } - - // Allocator routines. - allocator_type *mutable_allocator() noexcept { - return &root_.template get<1>(); - } - const allocator_type &allocator() const noexcept { - return root_.template get<1>(); - } - - // Allocates a correctly aligned node of at least size bytes using the - // allocator. - node_type *allocate(const size_type size) { - return reinterpret_cast<node_type *>( - absl::container_internal::Allocate<node_type::Alignment()>( - mutable_allocator(), size)); - } - - // Node creation/deletion routines. - node_type *new_internal_node(node_type *parent) { - node_type *n = allocate(node_type::InternalSize()); - n->init_internal(parent); - return n; - } - node_type *new_leaf_node(node_type *parent) { - node_type *n = allocate(node_type::LeafSize()); - n->init_leaf(parent, kNodeSlots); - return n; - } - node_type *new_leaf_root_node(const int max_count) { - node_type *n = allocate(node_type::LeafSize(max_count)); - n->init_leaf(/*parent=*/n, max_count); - return n; - } - - // Deletion helper routines. - iterator rebalance_after_delete(iterator iter); - - // Rebalances or splits the node iter points to. - void rebalance_or_split(iterator *iter); - - // Merges the values of left, right and the delimiting key on their parent - // onto left, removing the delimiting key and deleting right. - void merge_nodes(node_type *left, node_type *right); - - // Tries to merge node with its left or right sibling, and failing that, - // rebalance with its left or right sibling. Returns true if a merge - // occurred, at which point it is no longer valid to access node. Returns - // false if no merging took place. - bool try_merge_or_rebalance(iterator *iter); - - // Tries to shrink the height of the tree by 1. - void try_shrink(); - - iterator internal_end(iterator iter) { - return iter.node != nullptr ? iter : end(); - } - const_iterator internal_end(const_iterator iter) const { - return iter.node != nullptr ? iter : end(); - } - - // Emplaces a value into the btree immediately before iter. Requires that - // key(v) <= iter.key() and (--iter).key() <= key(v). - template <typename... Args> - iterator internal_emplace(iterator iter, Args &&... args); - - // Returns an iterator pointing to the first value >= the value "iter" is - // pointing at. Note that "iter" might be pointing to an invalid location such - // as iter.position == iter.node->finish(). This routine simply moves iter up - // in the tree to a valid location. - // Requires: iter.node is non-null. - template <typename IterType> - static IterType internal_last(IterType iter); - - // Returns an iterator pointing to the leaf position at which key would - // reside in the tree, unless there is an exact match - in which case, the - // result may not be on a leaf. When there's a three-way comparator, we can - // return whether there was an exact match. This allows the caller to avoid a - // subsequent comparison to determine if an exact match was made, which is - // important for keys with expensive comparison, such as strings. - template <typename K> - SearchResult<iterator, is_key_compare_to::value> internal_locate( - const K &key) const; - - // Internal routine which implements lower_bound(). - template <typename K> - SearchResult<iterator, is_key_compare_to::value> internal_lower_bound( - const K &key) const; - - // Internal routine which implements upper_bound(). - template <typename K> - iterator internal_upper_bound(const K &key) const; - - // Internal routine which implements find(). - template <typename K> - iterator internal_find(const K &key) const; - - // Verifies the tree structure of node. - int internal_verify(const node_type *node, const key_type *lo, - const key_type *hi) const; - - node_stats internal_stats(const node_type *node) const { - // The root can be a static empty node. - if (node == nullptr || (node == root() && empty())) { - return node_stats(0, 0); - } - if (node->leaf()) { - return node_stats(1, 0); - } - node_stats res(0, 1); - for (int i = node->start(); i <= node->finish(); ++i) { - res += internal_stats(node->child(i)); - } - return res; - } - - // We use compressed tuple in order to save space because key_compare and - // allocator_type are usually empty. - absl::container_internal::CompressedTuple<key_compare, allocator_type, - node_type *> - root_; - - // A pointer to the rightmost node. Note that the leftmost node is stored as - // the root's parent. - node_type *rightmost_; - - // Number of values. - size_type size_; -}; - -//// -// btree_node methods -template <typename P> -template <typename... Args> -inline void btree_node<P>::emplace_value(const size_type i, - allocator_type *alloc, - Args &&... args) { - assert(i >= start()); - assert(i <= finish()); - // Shift old values to create space for new value and then construct it in - // place. - if (i < finish()) { - transfer_n_backward(finish() - i, /*dest_i=*/i + 1, /*src_i=*/i, this, - alloc); - } - value_init(i, alloc, std::forward<Args>(args)...); - set_finish(finish() + 1); - - if (!leaf() && finish() > i + 1) { - for (int j = finish(); j > i + 1; --j) { - set_child(j, child(j - 1)); - } - clear_child(i + 1); - } -} - -template <typename P> -inline void btree_node<P>::remove_values(const field_type i, - const field_type to_erase, - allocator_type *alloc) { - // Transfer values after the removed range into their new places. - value_destroy_n(i, to_erase, alloc); - const field_type orig_finish = finish(); - const field_type src_i = i + to_erase; - transfer_n(orig_finish - src_i, i, src_i, this, alloc); - - if (!leaf()) { - // Delete all children between begin and end. - for (int j = 0; j < to_erase; ++j) { - clear_and_delete(child(i + j + 1), alloc); - } - // Rotate children after end into new positions. - for (int j = i + to_erase + 1; j <= orig_finish; ++j) { - set_child(j - to_erase, child(j)); - clear_child(j); - } - } - set_finish(orig_finish - to_erase); -} - -template <typename P> -void btree_node<P>::rebalance_right_to_left(const int to_move, - btree_node *right, - allocator_type *alloc) { - assert(parent() == right->parent()); - assert(position() + 1 == right->position()); - assert(right->count() >= count()); - assert(to_move >= 1); - assert(to_move <= right->count()); - - // 1) Move the delimiting value in the parent to the left node. - transfer(finish(), position(), parent(), alloc); - - // 2) Move the (to_move - 1) values from the right node to the left node. - transfer_n(to_move - 1, finish() + 1, right->start(), right, alloc); - - // 3) Move the new delimiting value to the parent from the right node. - parent()->transfer(position(), right->start() + to_move - 1, right, alloc); - - // 4) Shift the values in the right node to their correct positions. - right->transfer_n(right->count() - to_move, right->start(), - right->start() + to_move, right, alloc); - - if (!leaf()) { - // Move the child pointers from the right to the left node. - for (int i = 0; i < to_move; ++i) { - init_child(finish() + i + 1, right->child(i)); - } - for (int i = right->start(); i <= right->finish() - to_move; ++i) { - assert(i + to_move <= right->max_count()); - right->init_child(i, right->child(i + to_move)); - right->clear_child(i + to_move); - } - } - - // Fixup `finish` on the left and right nodes. - set_finish(finish() + to_move); - right->set_finish(right->finish() - to_move); -} - -template <typename P> -void btree_node<P>::rebalance_left_to_right(const int to_move, - btree_node *right, - allocator_type *alloc) { - assert(parent() == right->parent()); - assert(position() + 1 == right->position()); - assert(count() >= right->count()); - assert(to_move >= 1); - assert(to_move <= count()); - - // Values in the right node are shifted to the right to make room for the - // new to_move values. Then, the delimiting value in the parent and the - // other (to_move - 1) values in the left node are moved into the right node. - // Lastly, a new delimiting value is moved from the left node into the - // parent, and the remaining empty left node entries are destroyed. - - // 1) Shift existing values in the right node to their correct positions. - right->transfer_n_backward(right->count(), right->start() + to_move, - right->start(), right, alloc); - - // 2) Move the delimiting value in the parent to the right node. - right->transfer(right->start() + to_move - 1, position(), parent(), alloc); - - // 3) Move the (to_move - 1) values from the left node to the right node. - right->transfer_n(to_move - 1, right->start(), finish() - (to_move - 1), this, - alloc); - - // 4) Move the new delimiting value to the parent from the left node. - parent()->transfer(position(), finish() - to_move, this, alloc); - - if (!leaf()) { - // Move the child pointers from the left to the right node. - for (int i = right->finish(); i >= right->start(); --i) { - right->init_child(i + to_move, right->child(i)); - right->clear_child(i); - } - for (int i = 1; i <= to_move; ++i) { - right->init_child(i - 1, child(finish() - to_move + i)); - clear_child(finish() - to_move + i); - } - } - - // Fixup the counts on the left and right nodes. - set_finish(finish() - to_move); - right->set_finish(right->finish() + to_move); -} - -template <typename P> -void btree_node<P>::split(const int insert_position, btree_node *dest, - allocator_type *alloc) { - assert(dest->count() == 0); - assert(max_count() == kNodeSlots); - - // We bias the split based on the position being inserted. If we're - // inserting at the beginning of the left node then bias the split to put - // more values on the right node. If we're inserting at the end of the - // right node then bias the split to put more values on the left node. - if (insert_position == start()) { - dest->set_finish(dest->start() + finish() - 1); - } else if (insert_position == kNodeSlots) { - dest->set_finish(dest->start()); - } else { - dest->set_finish(dest->start() + count() / 2); - } - set_finish(finish() - dest->count()); - assert(count() >= 1); - - // Move values from the left sibling to the right sibling. - dest->transfer_n(dest->count(), dest->start(), finish(), this, alloc); - - // The split key is the largest value in the left sibling. - --mutable_finish(); - parent()->emplace_value(position(), alloc, finish_slot()); - value_destroy(finish(), alloc); - parent()->init_child(position() + 1, dest); - - if (!leaf()) { - for (int i = dest->start(), j = finish() + 1; i <= dest->finish(); - ++i, ++j) { - assert(child(j) != nullptr); - dest->init_child(i, child(j)); - clear_child(j); - } - } -} - -template <typename P> -void btree_node<P>::merge(btree_node *src, allocator_type *alloc) { - assert(parent() == src->parent()); - assert(position() + 1 == src->position()); - - // Move the delimiting value to the left node. - value_init(finish(), alloc, parent()->slot(position())); - - // Move the values from the right to the left node. - transfer_n(src->count(), finish() + 1, src->start(), src, alloc); - - if (!leaf()) { - // Move the child pointers from the right to the left node. - for (int i = src->start(), j = finish() + 1; i <= src->finish(); ++i, ++j) { - init_child(j, src->child(i)); - src->clear_child(i); - } - } - - // Fixup `finish` on the src and dest nodes. - set_finish(start() + 1 + count() + src->count()); - src->set_finish(src->start()); - - // Remove the value on the parent node and delete the src node. - parent()->remove_values(position(), /*to_erase=*/1, alloc); -} - -template <typename P> -void btree_node<P>::clear_and_delete(btree_node *node, allocator_type *alloc) { - if (node->leaf()) { - node->value_destroy_n(node->start(), node->count(), alloc); - deallocate(LeafSize(node->max_count()), node, alloc); - return; - } - if (node->count() == 0) { - deallocate(InternalSize(), node, alloc); - return; - } - - // The parent of the root of the subtree we are deleting. - btree_node *delete_root_parent = node->parent(); - - // Navigate to the leftmost leaf under node, and then delete upwards. - while (!node->leaf()) node = node->start_child(); - // Use `int` because `pos` needs to be able to hold `kNodeSlots+1`, which - // isn't guaranteed to be a valid `field_type`. - int pos = node->position(); - btree_node *parent = node->parent(); - for (;;) { - // In each iteration of the next loop, we delete one leaf node and go right. - assert(pos <= parent->finish()); - do { - node = parent->child(pos); - if (!node->leaf()) { - // Navigate to the leftmost leaf under node. - while (!node->leaf()) node = node->start_child(); - pos = node->position(); - parent = node->parent(); - } - node->value_destroy_n(node->start(), node->count(), alloc); - deallocate(LeafSize(node->max_count()), node, alloc); - ++pos; - } while (pos <= parent->finish()); - - // Once we've deleted all children of parent, delete parent and go up/right. - assert(pos > parent->finish()); - do { - node = parent; - pos = node->position(); - parent = node->parent(); - node->value_destroy_n(node->start(), node->count(), alloc); - deallocate(InternalSize(), node, alloc); - if (parent == delete_root_parent) return; - ++pos; - } while (pos > parent->finish()); - } -} - -//// -// btree_iterator methods -template <typename N, typename R, typename P> -void btree_iterator<N, R, P>::increment_slow() { - if (node->leaf()) { - assert(position >= node->finish()); - btree_iterator save(*this); - while (position == node->finish() && !node->is_root()) { - assert(node->parent()->child(node->position()) == node); - position = node->position(); - node = node->parent(); - } - // TODO(ezb): assert we aren't incrementing end() instead of handling. - if (position == node->finish()) { - *this = save; - } - } else { - assert(position < node->finish()); - node = node->child(position + 1); - while (!node->leaf()) { - node = node->start_child(); - } - position = node->start(); - } -} - -template <typename N, typename R, typename P> -void btree_iterator<N, R, P>::decrement_slow() { - if (node->leaf()) { - assert(position <= -1); - btree_iterator save(*this); - while (position < node->start() && !node->is_root()) { - assert(node->parent()->child(node->position()) == node); - position = node->position() - 1; - node = node->parent(); - } - // TODO(ezb): assert we aren't decrementing begin() instead of handling. - if (position < node->start()) { - *this = save; - } - } else { - assert(position >= node->start()); - node = node->child(position); - while (!node->leaf()) { - node = node->child(node->finish()); - } - position = node->finish() - 1; - } -} - -//// -// btree methods -template <typename P> -template <typename Btree> -void btree<P>::copy_or_move_values_in_order(Btree &other) { - static_assert(std::is_same<btree, Btree>::value || - std::is_same<const btree, Btree>::value, - "Btree type must be same or const."); - assert(empty()); - - // We can avoid key comparisons because we know the order of the - // values is the same order we'll store them in. - auto iter = other.begin(); - if (iter == other.end()) return; - insert_multi(maybe_move_from_iterator(iter)); - ++iter; - for (; iter != other.end(); ++iter) { - // If the btree is not empty, we can just insert the new value at the end - // of the tree. - internal_emplace(end(), maybe_move_from_iterator(iter)); - } -} - -template <typename P> -constexpr bool btree<P>::static_assert_validation() { - static_assert(std::is_nothrow_copy_constructible<key_compare>::value, - "Key comparison must be nothrow copy constructible"); - static_assert(std::is_nothrow_copy_constructible<allocator_type>::value, - "Allocator must be nothrow copy constructible"); - static_assert(type_traits_internal::is_trivially_copyable<iterator>::value, - "iterator not trivially copyable."); - - // Note: We assert that kTargetValues, which is computed from - // Params::kTargetNodeSize, must fit the node_type::field_type. - static_assert( - kNodeSlots < (1 << (8 * sizeof(typename node_type::field_type))), - "target node size too large"); - - // Verify that key_compare returns an absl::{weak,strong}_ordering or bool. - using compare_result_type = - absl::result_of_t<key_compare(key_type, key_type)>; - static_assert( - std::is_same<compare_result_type, bool>::value || - std::is_convertible<compare_result_type, absl::weak_ordering>::value, - "key comparison function must return absl::{weak,strong}_ordering or " - "bool."); - - // Test the assumption made in setting kNodeValueSpace. - static_assert(node_type::MinimumOverhead() >= sizeof(void *) + 4, - "node space assumption incorrect"); - - return true; -} - -template <typename P> -template <typename K> -auto btree<P>::lower_bound_equal(const K &key) const - -> std::pair<iterator, bool> { - const SearchResult<iterator, is_key_compare_to::value> res = - internal_lower_bound(key); - const iterator lower = iterator(internal_end(res.value)); - const bool equal = res.HasMatch() - ? res.IsEq() - : lower != end() && !compare_keys(key, lower.key()); - return {lower, equal}; -} - -template <typename P> -template <typename K> -auto btree<P>::equal_range(const K &key) -> std::pair<iterator, iterator> { - const std::pair<iterator, bool> lower_and_equal = lower_bound_equal(key); - const iterator lower = lower_and_equal.first; - if (!lower_and_equal.second) { - return {lower, lower}; - } - - const iterator next = std::next(lower); - if (!params_type::template can_have_multiple_equivalent_keys<K>()) { - // The next iterator after lower must point to a key greater than `key`. - // Note: if this assert fails, then it may indicate that the comparator does - // not meet the equivalence requirements for Compare - // (see https://en.cppreference.com/w/cpp/named_req/Compare). - assert(next == end() || compare_keys(key, next.key())); - return {lower, next}; - } - // Try once more to avoid the call to upper_bound() if there's only one - // equivalent key. This should prevent all calls to upper_bound() in cases of - // unique-containers with heterogeneous comparators in which all comparison - // operators have the same equivalence classes. - if (next == end() || compare_keys(key, next.key())) return {lower, next}; - - // In this case, we need to call upper_bound() to avoid worst case O(N) - // behavior if we were to iterate over equal keys. - return {lower, upper_bound(key)}; -} - -template <typename P> -template <typename K, typename... Args> -auto btree<P>::insert_unique(const K &key, Args &&... args) - -> std::pair<iterator, bool> { - if (empty()) { - mutable_root() = rightmost_ = new_leaf_root_node(1); - } - - SearchResult<iterator, is_key_compare_to::value> res = internal_locate(key); - iterator iter = res.value; - - if (res.HasMatch()) { - if (res.IsEq()) { - // The key already exists in the tree, do nothing. - return {iter, false}; - } - } else { - iterator last = internal_last(iter); - if (last.node && !compare_keys(key, last.key())) { - // The key already exists in the tree, do nothing. - return {last, false}; - } - } - return {internal_emplace(iter, std::forward<Args>(args)...), true}; -} - -template <typename P> -template <typename K, typename... Args> -inline auto btree<P>::insert_hint_unique(iterator position, const K &key, - Args &&... args) - -> std::pair<iterator, bool> { - if (!empty()) { - if (position == end() || compare_keys(key, position.key())) { - if (position == begin() || compare_keys(std::prev(position).key(), key)) { - // prev.key() < key < position.key() - return {internal_emplace(position, std::forward<Args>(args)...), true}; - } - } else if (compare_keys(position.key(), key)) { - ++position; - if (position == end() || compare_keys(key, position.key())) { - // {original `position`}.key() < key < {current `position`}.key() - return {internal_emplace(position, std::forward<Args>(args)...), true}; - } - } else { - // position.key() == key - return {position, false}; - } - } - return insert_unique(key, std::forward<Args>(args)...); -} - -template <typename P> -template <typename InputIterator, typename> -void btree<P>::insert_iterator_unique(InputIterator b, InputIterator e, int) { - for (; b != e; ++b) { - insert_hint_unique(end(), params_type::key(*b), *b); - } -} - -template <typename P> -template <typename InputIterator> -void btree<P>::insert_iterator_unique(InputIterator b, InputIterator e, char) { - for (; b != e; ++b) { - init_type value(*b); - insert_hint_unique(end(), params_type::key(value), std::move(value)); - } -} - -template <typename P> -template <typename ValueType> -auto btree<P>::insert_multi(const key_type &key, ValueType &&v) -> iterator { - if (empty()) { - mutable_root() = rightmost_ = new_leaf_root_node(1); - } - - iterator iter = internal_upper_bound(key); - if (iter.node == nullptr) { - iter = end(); - } - return internal_emplace(iter, std::forward<ValueType>(v)); -} - -template <typename P> -template <typename ValueType> -auto btree<P>::insert_hint_multi(iterator position, ValueType &&v) -> iterator { - if (!empty()) { - const key_type &key = params_type::key(v); - if (position == end() || !compare_keys(position.key(), key)) { - if (position == begin() || - !compare_keys(key, std::prev(position).key())) { - // prev.key() <= key <= position.key() - return internal_emplace(position, std::forward<ValueType>(v)); - } - } else { - ++position; - if (position == end() || !compare_keys(position.key(), key)) { - // {original `position`}.key() < key < {current `position`}.key() - return internal_emplace(position, std::forward<ValueType>(v)); - } - } - } - return insert_multi(std::forward<ValueType>(v)); -} - -template <typename P> -template <typename InputIterator> -void btree<P>::insert_iterator_multi(InputIterator b, InputIterator e) { - for (; b != e; ++b) { - insert_hint_multi(end(), *b); - } -} - -template <typename P> -auto btree<P>::operator=(const btree &other) -> btree & { - if (this != &other) { - clear(); - - *mutable_key_comp() = other.key_comp(); - if (absl::allocator_traits< - allocator_type>::propagate_on_container_copy_assignment::value) { - *mutable_allocator() = other.allocator(); - } - - copy_or_move_values_in_order(other); - } - return *this; -} - -template <typename P> -auto btree<P>::operator=(btree &&other) noexcept -> btree & { - if (this != &other) { - clear(); - - using std::swap; - if (absl::allocator_traits< - allocator_type>::propagate_on_container_copy_assignment::value) { - // Note: `root_` also contains the allocator and the key comparator. - swap(root_, other.root_); - swap(rightmost_, other.rightmost_); - swap(size_, other.size_); - } else { - if (allocator() == other.allocator()) { - swap(mutable_root(), other.mutable_root()); - swap(*mutable_key_comp(), *other.mutable_key_comp()); - swap(rightmost_, other.rightmost_); - swap(size_, other.size_); - } else { - // We aren't allowed to propagate the allocator and the allocator is - // different so we can't take over its memory. We must move each element - // individually. We need both `other` and `this` to have `other`s key - // comparator while moving the values so we can't swap the key - // comparators. - *mutable_key_comp() = other.key_comp(); - copy_or_move_values_in_order(other); - } - } - } - return *this; -} - -template <typename P> -auto btree<P>::erase(iterator iter) -> iterator { - bool internal_delete = false; - if (!iter.node->leaf()) { - // Deletion of a value on an internal node. First, move the largest value - // from our left child here, then delete that position (in remove_values() - // below). We can get to the largest value from our left child by - // decrementing iter. - iterator internal_iter(iter); - --iter; - assert(iter.node->leaf()); - params_type::move(mutable_allocator(), iter.node->slot(iter.position), - internal_iter.node->slot(internal_iter.position)); - internal_delete = true; - } - - // Delete the key from the leaf. - iter.node->remove_values(iter.position, /*to_erase=*/1, mutable_allocator()); - --size_; - - // We want to return the next value after the one we just erased. If we - // erased from an internal node (internal_delete == true), then the next - // value is ++(++iter). If we erased from a leaf node (internal_delete == - // false) then the next value is ++iter. Note that ++iter may point to an - // internal node and the value in the internal node may move to a leaf node - // (iter.node) when rebalancing is performed at the leaf level. - - iterator res = rebalance_after_delete(iter); - - // If we erased from an internal node, advance the iterator. - if (internal_delete) { - ++res; - } - return res; -} - -template <typename P> -auto btree<P>::rebalance_after_delete(iterator iter) -> iterator { - // Merge/rebalance as we walk back up the tree. - iterator res(iter); - bool first_iteration = true; - for (;;) { - if (iter.node == root()) { - try_shrink(); - if (empty()) { - return end(); - } - break; - } - if (iter.node->count() >= kMinNodeValues) { - break; - } - bool merged = try_merge_or_rebalance(&iter); - // On the first iteration, we should update `res` with `iter` because `res` - // may have been invalidated. - if (first_iteration) { - res = iter; - first_iteration = false; - } - if (!merged) { - break; - } - iter.position = iter.node->position(); - iter.node = iter.node->parent(); - } - - // Adjust our return value. If we're pointing at the end of a node, advance - // the iterator. - if (res.position == res.node->finish()) { - res.position = res.node->finish() - 1; - ++res; - } - - return res; -} - -template <typename P> -auto btree<P>::erase_range(iterator begin, iterator end) - -> std::pair<size_type, iterator> { - difference_type count = std::distance(begin, end); - assert(count >= 0); - - if (count == 0) { - return {0, begin}; - } - - if (count == size_) { - clear(); - return {count, this->end()}; - } - - if (begin.node == end.node) { - assert(end.position > begin.position); - begin.node->remove_values(begin.position, end.position - begin.position, - mutable_allocator()); - size_ -= count; - return {count, rebalance_after_delete(begin)}; - } - - const size_type target_size = size_ - count; - while (size_ > target_size) { - if (begin.node->leaf()) { - const size_type remaining_to_erase = size_ - target_size; - const size_type remaining_in_node = begin.node->finish() - begin.position; - const size_type to_erase = - (std::min)(remaining_to_erase, remaining_in_node); - begin.node->remove_values(begin.position, to_erase, mutable_allocator()); - size_ -= to_erase; - begin = rebalance_after_delete(begin); - } else { - begin = erase(begin); - } - } - return {count, begin}; -} - -template <typename P> -void btree<P>::clear() { - if (!empty()) { - node_type::clear_and_delete(root(), mutable_allocator()); - } - mutable_root() = EmptyNode(); - rightmost_ = EmptyNode(); - size_ = 0; -} - -template <typename P> -void btree<P>::swap(btree &other) { - using std::swap; - if (absl::allocator_traits< - allocator_type>::propagate_on_container_swap::value) { - // Note: `root_` also contains the allocator and the key comparator. - swap(root_, other.root_); - } else { - // It's undefined behavior if the allocators are unequal here. - assert(allocator() == other.allocator()); - swap(mutable_root(), other.mutable_root()); - swap(*mutable_key_comp(), *other.mutable_key_comp()); - } - swap(rightmost_, other.rightmost_); - swap(size_, other.size_); -} - -template <typename P> -void btree<P>::verify() const { - assert(root() != nullptr); - assert(leftmost() != nullptr); - assert(rightmost_ != nullptr); - assert(empty() || size() == internal_verify(root(), nullptr, nullptr)); - assert(leftmost() == (++const_iterator(root(), -1)).node); - assert(rightmost_ == (--const_iterator(root(), root()->finish())).node); - assert(leftmost()->leaf()); - assert(rightmost_->leaf()); -} - -template <typename P> -void btree<P>::rebalance_or_split(iterator *iter) { - node_type *&node = iter->node; - int &insert_position = iter->position; - assert(node->count() == node->max_count()); - assert(kNodeSlots == node->max_count()); - - // First try to make room on the node by rebalancing. - node_type *parent = node->parent(); - if (node != root()) { - if (node->position() > parent->start()) { - // Try rebalancing with our left sibling. - node_type *left = parent->child(node->position() - 1); - assert(left->max_count() == kNodeSlots); - if (left->count() < kNodeSlots) { - // We bias rebalancing based on the position being inserted. If we're - // inserting at the end of the right node then we bias rebalancing to - // fill up the left node. - int to_move = (kNodeSlots - left->count()) / - (1 + (insert_position < static_cast<int>(kNodeSlots))); - to_move = (std::max)(1, to_move); - - if (insert_position - to_move >= node->start() || - left->count() + to_move < static_cast<int>(kNodeSlots)) { - left->rebalance_right_to_left(to_move, node, mutable_allocator()); - - assert(node->max_count() - node->count() == to_move); - insert_position = insert_position - to_move; - if (insert_position < node->start()) { - insert_position = insert_position + left->count() + 1; - node = left; - } - - assert(node->count() < node->max_count()); - return; - } - } - } - - if (node->position() < parent->finish()) { - // Try rebalancing with our right sibling. - node_type *right = parent->child(node->position() + 1); - assert(right->max_count() == kNodeSlots); - if (right->count() < kNodeSlots) { - // We bias rebalancing based on the position being inserted. If we're - // inserting at the beginning of the left node then we bias rebalancing - // to fill up the right node. - int to_move = (static_cast<int>(kNodeSlots) - right->count()) / - (1 + (insert_position > node->start())); - to_move = (std::max)(1, to_move); - - if (insert_position <= node->finish() - to_move || - right->count() + to_move < static_cast<int>(kNodeSlots)) { - node->rebalance_left_to_right(to_move, right, mutable_allocator()); - - if (insert_position > node->finish()) { - insert_position = insert_position - node->count() - 1; - node = right; - } - - assert(node->count() < node->max_count()); - return; - } - } - } - - // Rebalancing failed, make sure there is room on the parent node for a new - // value. - assert(parent->max_count() == kNodeSlots); - if (parent->count() == kNodeSlots) { - iterator parent_iter(node->parent(), node->position()); - rebalance_or_split(&parent_iter); - } - } else { - // Rebalancing not possible because this is the root node. - // Create a new root node and set the current root node as the child of the - // new root. - parent = new_internal_node(parent); - parent->init_child(parent->start(), root()); - mutable_root() = parent; - // If the former root was a leaf node, then it's now the rightmost node. - assert(!parent->start_child()->leaf() || - parent->start_child() == rightmost_); - } - - // Split the node. - node_type *split_node; - if (node->leaf()) { - split_node = new_leaf_node(parent); - node->split(insert_position, split_node, mutable_allocator()); - if (rightmost_ == node) rightmost_ = split_node; - } else { - split_node = new_internal_node(parent); - node->split(insert_position, split_node, mutable_allocator()); - } - - if (insert_position > node->finish()) { - insert_position = insert_position - node->count() - 1; - node = split_node; - } -} - -template <typename P> -void btree<P>::merge_nodes(node_type *left, node_type *right) { - left->merge(right, mutable_allocator()); - if (rightmost_ == right) rightmost_ = left; -} - -template <typename P> -bool btree<P>::try_merge_or_rebalance(iterator *iter) { - node_type *parent = iter->node->parent(); - if (iter->node->position() > parent->start()) { - // Try merging with our left sibling. - node_type *left = parent->child(iter->node->position() - 1); - assert(left->max_count() == kNodeSlots); - if (1U + left->count() + iter->node->count() <= kNodeSlots) { - iter->position += 1 + left->count(); - merge_nodes(left, iter->node); - iter->node = left; - return true; - } - } - if (iter->node->position() < parent->finish()) { - // Try merging with our right sibling. - node_type *right = parent->child(iter->node->position() + 1); - assert(right->max_count() == kNodeSlots); - if (1U + iter->node->count() + right->count() <= kNodeSlots) { - merge_nodes(iter->node, right); - return true; - } - // Try rebalancing with our right sibling. We don't perform rebalancing if - // we deleted the first element from iter->node and the node is not - // empty. This is a small optimization for the common pattern of deleting - // from the front of the tree. - if (right->count() > kMinNodeValues && - (iter->node->count() == 0 || iter->position > iter->node->start())) { - int to_move = (right->count() - iter->node->count()) / 2; - to_move = (std::min)(to_move, right->count() - 1); - iter->node->rebalance_right_to_left(to_move, right, mutable_allocator()); - return false; - } - } - if (iter->node->position() > parent->start()) { - // Try rebalancing with our left sibling. We don't perform rebalancing if - // we deleted the last element from iter->node and the node is not - // empty. This is a small optimization for the common pattern of deleting - // from the back of the tree. - node_type *left = parent->child(iter->node->position() - 1); - if (left->count() > kMinNodeValues && - (iter->node->count() == 0 || iter->position < iter->node->finish())) { - int to_move = (left->count() - iter->node->count()) / 2; - to_move = (std::min)(to_move, left->count() - 1); - left->rebalance_left_to_right(to_move, iter->node, mutable_allocator()); - iter->position += to_move; - return false; - } - } - return false; -} - -template <typename P> -void btree<P>::try_shrink() { - node_type *orig_root = root(); - if (orig_root->count() > 0) { - return; - } - // Deleted the last item on the root node, shrink the height of the tree. - if (orig_root->leaf()) { - assert(size() == 0); - mutable_root() = rightmost_ = EmptyNode(); - } else { - node_type *child = orig_root->start_child(); - child->make_root(); - mutable_root() = child; - } - node_type::clear_and_delete(orig_root, mutable_allocator()); -} - -template <typename P> -template <typename IterType> -inline IterType btree<P>::internal_last(IterType iter) { - assert(iter.node != nullptr); - while (iter.position == iter.node->finish()) { - iter.position = iter.node->position(); - iter.node = iter.node->parent(); - if (iter.node->leaf()) { - iter.node = nullptr; - break; - } - } - return iter; -} - -template <typename P> -template <typename... Args> -inline auto btree<P>::internal_emplace(iterator iter, Args &&... args) - -> iterator { - if (!iter.node->leaf()) { - // We can't insert on an internal node. Instead, we'll insert after the - // previous value which is guaranteed to be on a leaf node. - --iter; - ++iter.position; - } - const field_type max_count = iter.node->max_count(); - allocator_type *alloc = mutable_allocator(); - if (iter.node->count() == max_count) { - // Make room in the leaf for the new item. - if (max_count < kNodeSlots) { - // Insertion into the root where the root is smaller than the full node - // size. Simply grow the size of the root node. - assert(iter.node == root()); - iter.node = - new_leaf_root_node((std::min<int>)(kNodeSlots, 2 * max_count)); - // Transfer the values from the old root to the new root. - node_type *old_root = root(); - node_type *new_root = iter.node; - new_root->transfer_n(old_root->count(), new_root->start(), - old_root->start(), old_root, alloc); - new_root->set_finish(old_root->finish()); - old_root->set_finish(old_root->start()); - node_type::clear_and_delete(old_root, alloc); - mutable_root() = rightmost_ = new_root; - } else { - rebalance_or_split(&iter); - } - } - iter.node->emplace_value(iter.position, alloc, std::forward<Args>(args)...); - ++size_; - return iter; -} - -template <typename P> -template <typename K> -inline auto btree<P>::internal_locate(const K &key) const - -> SearchResult<iterator, is_key_compare_to::value> { - iterator iter(const_cast<node_type *>(root())); - for (;;) { - SearchResult<int, is_key_compare_to::value> res = - iter.node->lower_bound(key, key_comp()); - iter.position = res.value; - if (res.IsEq()) { - return {iter, MatchKind::kEq}; - } - // Note: in the non-key-compare-to case, we don't need to walk all the way - // down the tree if the keys are equal, but determining equality would - // require doing an extra comparison on each node on the way down, and we - // will need to go all the way to the leaf node in the expected case. - if (iter.node->leaf()) { - break; - } - iter.node = iter.node->child(iter.position); - } - // Note: in the non-key-compare-to case, the key may actually be equivalent - // here (and the MatchKind::kNe is ignored). - return {iter, MatchKind::kNe}; -} - -template <typename P> -template <typename K> -auto btree<P>::internal_lower_bound(const K &key) const - -> SearchResult<iterator, is_key_compare_to::value> { - if (!params_type::template can_have_multiple_equivalent_keys<K>()) { - SearchResult<iterator, is_key_compare_to::value> ret = internal_locate(key); - ret.value = internal_last(ret.value); - return ret; - } - iterator iter(const_cast<node_type *>(root())); - SearchResult<int, is_key_compare_to::value> res; - bool seen_eq = false; - for (;;) { - res = iter.node->lower_bound(key, key_comp()); - iter.position = res.value; - if (iter.node->leaf()) { - break; - } - seen_eq = seen_eq || res.IsEq(); - iter.node = iter.node->child(iter.position); - } - if (res.IsEq()) return {iter, MatchKind::kEq}; - return {internal_last(iter), seen_eq ? MatchKind::kEq : MatchKind::kNe}; -} - -template <typename P> -template <typename K> -auto btree<P>::internal_upper_bound(const K &key) const -> iterator { - iterator iter(const_cast<node_type *>(root())); - for (;;) { - iter.position = iter.node->upper_bound(key, key_comp()); - if (iter.node->leaf()) { - break; - } - iter.node = iter.node->child(iter.position); - } - return internal_last(iter); -} - -template <typename P> -template <typename K> -auto btree<P>::internal_find(const K &key) const -> iterator { - SearchResult<iterator, is_key_compare_to::value> res = internal_locate(key); - if (res.HasMatch()) { - if (res.IsEq()) { - return res.value; - } - } else { - const iterator iter = internal_last(res.value); - if (iter.node != nullptr && !compare_keys(key, iter.key())) { - return iter; - } - } - return {nullptr, 0}; -} - -template <typename P> -int btree<P>::internal_verify(const node_type *node, const key_type *lo, - const key_type *hi) const { - assert(node->count() > 0); - assert(node->count() <= node->max_count()); - if (lo) { - assert(!compare_keys(node->key(node->start()), *lo)); - } - if (hi) { - assert(!compare_keys(*hi, node->key(node->finish() - 1))); - } - for (int i = node->start() + 1; i < node->finish(); ++i) { - assert(!compare_keys(node->key(i), node->key(i - 1))); - } - int count = node->count(); - if (!node->leaf()) { - for (int i = node->start(); i <= node->finish(); ++i) { - assert(node->child(i) != nullptr); - assert(node->child(i)->parent() == node); - assert(node->child(i)->position() == i); - count += internal_verify(node->child(i), - i == node->start() ? lo : &node->key(i - 1), - i == node->finish() ? hi : &node->key(i)); - } - } - return count; -} - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_BTREE_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/btree_container.h b/contrib/restricted/abseil-cpp/absl/container/internal/btree_container.h deleted file mode 100644 index a99668c713..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/btree_container.h +++ /dev/null @@ -1,683 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_BTREE_CONTAINER_H_ -#define ABSL_CONTAINER_INTERNAL_BTREE_CONTAINER_H_ - -#include <algorithm> -#include <initializer_list> -#include <iterator> -#include <utility> - -#include "absl/base/attributes.h" -#include "absl/base/internal/throw_delegate.h" -#include "absl/container/internal/btree.h" // IWYU pragma: export -#include "absl/container/internal/common.h" -#include "absl/memory/memory.h" -#include "absl/meta/type_traits.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -// A common base class for btree_set, btree_map, btree_multiset, and -// btree_multimap. -template <typename Tree> -class btree_container { - using params_type = typename Tree::params_type; - - protected: - // Alias used for heterogeneous lookup functions. - // `key_arg<K>` evaluates to `K` when the functors are transparent and to - // `key_type` otherwise. It permits template argument deduction on `K` for the - // transparent case. - template <class K> - using key_arg = - typename KeyArg<IsTransparent<typename Tree::key_compare>::value>:: - template type<K, typename Tree::key_type>; - - public: - using key_type = typename Tree::key_type; - using value_type = typename Tree::value_type; - using size_type = typename Tree::size_type; - using difference_type = typename Tree::difference_type; - using key_compare = typename Tree::original_key_compare; - using value_compare = typename Tree::value_compare; - using allocator_type = typename Tree::allocator_type; - using reference = typename Tree::reference; - using const_reference = typename Tree::const_reference; - using pointer = typename Tree::pointer; - using const_pointer = typename Tree::const_pointer; - using iterator = typename Tree::iterator; - using const_iterator = typename Tree::const_iterator; - using reverse_iterator = typename Tree::reverse_iterator; - using const_reverse_iterator = typename Tree::const_reverse_iterator; - using node_type = typename Tree::node_handle_type; - - // Constructors/assignments. - btree_container() : tree_(key_compare(), allocator_type()) {} - explicit btree_container(const key_compare &comp, - const allocator_type &alloc = allocator_type()) - : tree_(comp, alloc) {} - explicit btree_container(const allocator_type &alloc) - : tree_(key_compare(), alloc) {} - - btree_container(const btree_container &other) - : btree_container(other, absl::allocator_traits<allocator_type>:: - select_on_container_copy_construction( - other.get_allocator())) {} - btree_container(const btree_container &other, const allocator_type &alloc) - : tree_(other.tree_, alloc) {} - - btree_container(btree_container &&other) noexcept( - std::is_nothrow_move_constructible<Tree>::value) = default; - btree_container(btree_container &&other, const allocator_type &alloc) - : tree_(std::move(other.tree_), alloc) {} - - btree_container &operator=(const btree_container &other) = default; - btree_container &operator=(btree_container &&other) noexcept( - std::is_nothrow_move_assignable<Tree>::value) = default; - - // Iterator routines. - iterator begin() { return tree_.begin(); } - const_iterator begin() const { return tree_.begin(); } - const_iterator cbegin() const { return tree_.begin(); } - iterator end() { return tree_.end(); } - const_iterator end() const { return tree_.end(); } - const_iterator cend() const { return tree_.end(); } - reverse_iterator rbegin() { return tree_.rbegin(); } - const_reverse_iterator rbegin() const { return tree_.rbegin(); } - const_reverse_iterator crbegin() const { return tree_.rbegin(); } - reverse_iterator rend() { return tree_.rend(); } - const_reverse_iterator rend() const { return tree_.rend(); } - const_reverse_iterator crend() const { return tree_.rend(); } - - // Lookup routines. - template <typename K = key_type> - size_type count(const key_arg<K> &key) const { - auto equal_range = this->equal_range(key); - return std::distance(equal_range.first, equal_range.second); - } - template <typename K = key_type> - iterator find(const key_arg<K> &key) { - return tree_.find(key); - } - template <typename K = key_type> - const_iterator find(const key_arg<K> &key) const { - return tree_.find(key); - } - template <typename K = key_type> - bool contains(const key_arg<K> &key) const { - return find(key) != end(); - } - template <typename K = key_type> - iterator lower_bound(const key_arg<K> &key) { - return tree_.lower_bound(key); - } - template <typename K = key_type> - const_iterator lower_bound(const key_arg<K> &key) const { - return tree_.lower_bound(key); - } - template <typename K = key_type> - iterator upper_bound(const key_arg<K> &key) { - return tree_.upper_bound(key); - } - template <typename K = key_type> - const_iterator upper_bound(const key_arg<K> &key) const { - return tree_.upper_bound(key); - } - template <typename K = key_type> - std::pair<iterator, iterator> equal_range(const key_arg<K> &key) { - return tree_.equal_range(key); - } - template <typename K = key_type> - std::pair<const_iterator, const_iterator> equal_range( - const key_arg<K> &key) const { - return tree_.equal_range(key); - } - - // Deletion routines. Note that there is also a deletion routine that is - // specific to btree_set_container/btree_multiset_container. - - // Erase the specified iterator from the btree. The iterator must be valid - // (i.e. not equal to end()). Return an iterator pointing to the node after - // the one that was erased (or end() if none exists). - iterator erase(const_iterator iter) { return tree_.erase(iterator(iter)); } - iterator erase(iterator iter) { return tree_.erase(iter); } - iterator erase(const_iterator first, const_iterator last) { - return tree_.erase_range(iterator(first), iterator(last)).second; - } - template <typename K = key_type> - size_type erase(const key_arg<K> &key) { - auto equal_range = this->equal_range(key); - return tree_.erase_range(equal_range.first, equal_range.second).first; - } - - // Extract routines. - node_type extract(iterator position) { - // Use Move instead of Transfer, because the rebalancing code expects to - // have a valid object to scribble metadata bits on top of. - auto node = CommonAccess::Move<node_type>(get_allocator(), position.slot()); - erase(position); - return node; - } - node_type extract(const_iterator position) { - return extract(iterator(position)); - } - - // Utility routines. - ABSL_ATTRIBUTE_REINITIALIZES void clear() { tree_.clear(); } - void swap(btree_container &other) { tree_.swap(other.tree_); } - void verify() const { tree_.verify(); } - - // Size routines. - size_type size() const { return tree_.size(); } - size_type max_size() const { return tree_.max_size(); } - bool empty() const { return tree_.empty(); } - - friend bool operator==(const btree_container &x, const btree_container &y) { - if (x.size() != y.size()) return false; - return std::equal(x.begin(), x.end(), y.begin()); - } - - friend bool operator!=(const btree_container &x, const btree_container &y) { - return !(x == y); - } - - friend bool operator<(const btree_container &x, const btree_container &y) { - return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); - } - - friend bool operator>(const btree_container &x, const btree_container &y) { - return y < x; - } - - friend bool operator<=(const btree_container &x, const btree_container &y) { - return !(y < x); - } - - friend bool operator>=(const btree_container &x, const btree_container &y) { - return !(x < y); - } - - // The allocator used by the btree. - allocator_type get_allocator() const { return tree_.get_allocator(); } - - // The key comparator used by the btree. - key_compare key_comp() const { return key_compare(tree_.key_comp()); } - value_compare value_comp() const { return tree_.value_comp(); } - - // Support absl::Hash. - template <typename State> - friend State AbslHashValue(State h, const btree_container &b) { - for (const auto &v : b) { - h = State::combine(std::move(h), v); - } - return State::combine(std::move(h), b.size()); - } - - protected: - Tree tree_; -}; - -// A common base class for btree_set and btree_map. -template <typename Tree> -class btree_set_container : public btree_container<Tree> { - using super_type = btree_container<Tree>; - using params_type = typename Tree::params_type; - using init_type = typename params_type::init_type; - using is_key_compare_to = typename params_type::is_key_compare_to; - friend class BtreeNodePeer; - - protected: - template <class K> - using key_arg = typename super_type::template key_arg<K>; - - public: - using key_type = typename Tree::key_type; - using value_type = typename Tree::value_type; - using size_type = typename Tree::size_type; - using key_compare = typename Tree::original_key_compare; - using allocator_type = typename Tree::allocator_type; - using iterator = typename Tree::iterator; - using const_iterator = typename Tree::const_iterator; - using node_type = typename super_type::node_type; - using insert_return_type = InsertReturnType<iterator, node_type>; - - // Inherit constructors. - using super_type::super_type; - btree_set_container() {} - - // Range constructors. - template <class InputIterator> - btree_set_container(InputIterator b, InputIterator e, - const key_compare &comp = key_compare(), - const allocator_type &alloc = allocator_type()) - : super_type(comp, alloc) { - insert(b, e); - } - template <class InputIterator> - btree_set_container(InputIterator b, InputIterator e, - const allocator_type &alloc) - : btree_set_container(b, e, key_compare(), alloc) {} - - // Initializer list constructors. - btree_set_container(std::initializer_list<init_type> init, - const key_compare &comp = key_compare(), - const allocator_type &alloc = allocator_type()) - : btree_set_container(init.begin(), init.end(), comp, alloc) {} - btree_set_container(std::initializer_list<init_type> init, - const allocator_type &alloc) - : btree_set_container(init.begin(), init.end(), alloc) {} - - // Insertion routines. - std::pair<iterator, bool> insert(const value_type &v) { - return this->tree_.insert_unique(params_type::key(v), v); - } - std::pair<iterator, bool> insert(value_type &&v) { - return this->tree_.insert_unique(params_type::key(v), std::move(v)); - } - template <typename... Args> - std::pair<iterator, bool> emplace(Args &&... args) { - init_type v(std::forward<Args>(args)...); - return this->tree_.insert_unique(params_type::key(v), std::move(v)); - } - iterator insert(const_iterator hint, const value_type &v) { - return this->tree_ - .insert_hint_unique(iterator(hint), params_type::key(v), v) - .first; - } - iterator insert(const_iterator hint, value_type &&v) { - return this->tree_ - .insert_hint_unique(iterator(hint), params_type::key(v), std::move(v)) - .first; - } - template <typename... Args> - iterator emplace_hint(const_iterator hint, Args &&... args) { - init_type v(std::forward<Args>(args)...); - return this->tree_ - .insert_hint_unique(iterator(hint), params_type::key(v), std::move(v)) - .first; - } - template <typename InputIterator> - void insert(InputIterator b, InputIterator e) { - this->tree_.insert_iterator_unique(b, e, 0); - } - void insert(std::initializer_list<init_type> init) { - this->tree_.insert_iterator_unique(init.begin(), init.end(), 0); - } - insert_return_type insert(node_type &&node) { - if (!node) return {this->end(), false, node_type()}; - std::pair<iterator, bool> res = - this->tree_.insert_unique(params_type::key(CommonAccess::GetSlot(node)), - CommonAccess::GetSlot(node)); - if (res.second) { - CommonAccess::Destroy(&node); - return {res.first, true, node_type()}; - } else { - return {res.first, false, std::move(node)}; - } - } - iterator insert(const_iterator hint, node_type &&node) { - if (!node) return this->end(); - std::pair<iterator, bool> res = this->tree_.insert_hint_unique( - iterator(hint), params_type::key(CommonAccess::GetSlot(node)), - CommonAccess::GetSlot(node)); - if (res.second) CommonAccess::Destroy(&node); - return res.first; - } - - // Node extraction routines. - template <typename K = key_type> - node_type extract(const key_arg<K> &key) { - const std::pair<iterator, bool> lower_and_equal = - this->tree_.lower_bound_equal(key); - return lower_and_equal.second ? extract(lower_and_equal.first) - : node_type(); - } - using super_type::extract; - - // Merge routines. - // Moves elements from `src` into `this`. If the element already exists in - // `this`, it is left unmodified in `src`. - template < - typename T, - typename absl::enable_if_t< - absl::conjunction< - std::is_same<value_type, typename T::value_type>, - std::is_same<allocator_type, typename T::allocator_type>, - std::is_same<typename params_type::is_map_container, - typename T::params_type::is_map_container>>::value, - int> = 0> - void merge(btree_container<T> &src) { // NOLINT - for (auto src_it = src.begin(); src_it != src.end();) { - if (insert(std::move(params_type::element(src_it.slot()))).second) { - src_it = src.erase(src_it); - } else { - ++src_it; - } - } - } - - template < - typename T, - typename absl::enable_if_t< - absl::conjunction< - std::is_same<value_type, typename T::value_type>, - std::is_same<allocator_type, typename T::allocator_type>, - std::is_same<typename params_type::is_map_container, - typename T::params_type::is_map_container>>::value, - int> = 0> - void merge(btree_container<T> &&src) { - merge(src); - } -}; - -// Base class for btree_map. -template <typename Tree> -class btree_map_container : public btree_set_container<Tree> { - using super_type = btree_set_container<Tree>; - using params_type = typename Tree::params_type; - friend class BtreeNodePeer; - - private: - template <class K> - using key_arg = typename super_type::template key_arg<K>; - - public: - using key_type = typename Tree::key_type; - using mapped_type = typename params_type::mapped_type; - using value_type = typename Tree::value_type; - using key_compare = typename Tree::original_key_compare; - using allocator_type = typename Tree::allocator_type; - using iterator = typename Tree::iterator; - using const_iterator = typename Tree::const_iterator; - - // Inherit constructors. - using super_type::super_type; - btree_map_container() {} - - // Insertion routines. - // Note: the nullptr template arguments and extra `const M&` overloads allow - // for supporting bitfield arguments. - template <typename K = key_type, class M> - std::pair<iterator, bool> insert_or_assign(const key_arg<K> &k, - const M &obj) { - return insert_or_assign_impl(k, obj); - } - template <typename K = key_type, class M, K * = nullptr> - std::pair<iterator, bool> insert_or_assign(key_arg<K> &&k, const M &obj) { - return insert_or_assign_impl(std::forward<K>(k), obj); - } - template <typename K = key_type, class M, M * = nullptr> - std::pair<iterator, bool> insert_or_assign(const key_arg<K> &k, M &&obj) { - return insert_or_assign_impl(k, std::forward<M>(obj)); - } - template <typename K = key_type, class M, K * = nullptr, M * = nullptr> - std::pair<iterator, bool> insert_or_assign(key_arg<K> &&k, M &&obj) { - return insert_or_assign_impl(std::forward<K>(k), std::forward<M>(obj)); - } - template <typename K = key_type, class M> - iterator insert_or_assign(const_iterator hint, const key_arg<K> &k, - const M &obj) { - return insert_or_assign_hint_impl(hint, k, obj); - } - template <typename K = key_type, class M, K * = nullptr> - iterator insert_or_assign(const_iterator hint, key_arg<K> &&k, const M &obj) { - return insert_or_assign_hint_impl(hint, std::forward<K>(k), obj); - } - template <typename K = key_type, class M, M * = nullptr> - iterator insert_or_assign(const_iterator hint, const key_arg<K> &k, M &&obj) { - return insert_or_assign_hint_impl(hint, k, std::forward<M>(obj)); - } - template <typename K = key_type, class M, K * = nullptr, M * = nullptr> - iterator insert_or_assign(const_iterator hint, key_arg<K> &&k, M &&obj) { - return insert_or_assign_hint_impl(hint, std::forward<K>(k), - std::forward<M>(obj)); - } - - template <typename K = key_type, typename... Args, - typename absl::enable_if_t< - !std::is_convertible<K, const_iterator>::value, int> = 0> - std::pair<iterator, bool> try_emplace(const key_arg<K> &k, Args &&... args) { - return try_emplace_impl(k, std::forward<Args>(args)...); - } - template <typename K = key_type, typename... Args, - typename absl::enable_if_t< - !std::is_convertible<K, const_iterator>::value, int> = 0> - std::pair<iterator, bool> try_emplace(key_arg<K> &&k, Args &&... args) { - return try_emplace_impl(std::forward<K>(k), std::forward<Args>(args)...); - } - template <typename K = key_type, typename... Args> - iterator try_emplace(const_iterator hint, const key_arg<K> &k, - Args &&... args) { - return try_emplace_hint_impl(hint, k, std::forward<Args>(args)...); - } - template <typename K = key_type, typename... Args> - iterator try_emplace(const_iterator hint, key_arg<K> &&k, Args &&... args) { - return try_emplace_hint_impl(hint, std::forward<K>(k), - std::forward<Args>(args)...); - } - - template <typename K = key_type> - mapped_type &operator[](const key_arg<K> &k) { - return try_emplace(k).first->second; - } - template <typename K = key_type> - mapped_type &operator[](key_arg<K> &&k) { - return try_emplace(std::forward<K>(k)).first->second; - } - - template <typename K = key_type> - mapped_type &at(const key_arg<K> &key) { - auto it = this->find(key); - if (it == this->end()) - base_internal::ThrowStdOutOfRange("absl::btree_map::at"); - return it->second; - } - template <typename K = key_type> - const mapped_type &at(const key_arg<K> &key) const { - auto it = this->find(key); - if (it == this->end()) - base_internal::ThrowStdOutOfRange("absl::btree_map::at"); - return it->second; - } - - private: - // Note: when we call `std::forward<M>(obj)` twice, it's safe because - // insert_unique/insert_hint_unique are guaranteed to not consume `obj` when - // `ret.second` is false. - template <class K, class M> - std::pair<iterator, bool> insert_or_assign_impl(K &&k, M &&obj) { - const std::pair<iterator, bool> ret = - this->tree_.insert_unique(k, std::forward<K>(k), std::forward<M>(obj)); - if (!ret.second) ret.first->second = std::forward<M>(obj); - return ret; - } - template <class K, class M> - iterator insert_or_assign_hint_impl(const_iterator hint, K &&k, M &&obj) { - const std::pair<iterator, bool> ret = this->tree_.insert_hint_unique( - iterator(hint), k, std::forward<K>(k), std::forward<M>(obj)); - if (!ret.second) ret.first->second = std::forward<M>(obj); - return ret.first; - } - - template <class K, class... Args> - std::pair<iterator, bool> try_emplace_impl(K &&k, Args &&... args) { - return this->tree_.insert_unique( - k, std::piecewise_construct, std::forward_as_tuple(std::forward<K>(k)), - std::forward_as_tuple(std::forward<Args>(args)...)); - } - template <class K, class... Args> - iterator try_emplace_hint_impl(const_iterator hint, K &&k, Args &&... args) { - return this->tree_ - .insert_hint_unique(iterator(hint), k, std::piecewise_construct, - std::forward_as_tuple(std::forward<K>(k)), - std::forward_as_tuple(std::forward<Args>(args)...)) - .first; - } -}; - -// A common base class for btree_multiset and btree_multimap. -template <typename Tree> -class btree_multiset_container : public btree_container<Tree> { - using super_type = btree_container<Tree>; - using params_type = typename Tree::params_type; - using init_type = typename params_type::init_type; - using is_key_compare_to = typename params_type::is_key_compare_to; - - template <class K> - using key_arg = typename super_type::template key_arg<K>; - - public: - using key_type = typename Tree::key_type; - using value_type = typename Tree::value_type; - using size_type = typename Tree::size_type; - using key_compare = typename Tree::original_key_compare; - using allocator_type = typename Tree::allocator_type; - using iterator = typename Tree::iterator; - using const_iterator = typename Tree::const_iterator; - using node_type = typename super_type::node_type; - - // Inherit constructors. - using super_type::super_type; - btree_multiset_container() {} - - // Range constructors. - template <class InputIterator> - btree_multiset_container(InputIterator b, InputIterator e, - const key_compare &comp = key_compare(), - const allocator_type &alloc = allocator_type()) - : super_type(comp, alloc) { - insert(b, e); - } - template <class InputIterator> - btree_multiset_container(InputIterator b, InputIterator e, - const allocator_type &alloc) - : btree_multiset_container(b, e, key_compare(), alloc) {} - - // Initializer list constructors. - btree_multiset_container(std::initializer_list<init_type> init, - const key_compare &comp = key_compare(), - const allocator_type &alloc = allocator_type()) - : btree_multiset_container(init.begin(), init.end(), comp, alloc) {} - btree_multiset_container(std::initializer_list<init_type> init, - const allocator_type &alloc) - : btree_multiset_container(init.begin(), init.end(), alloc) {} - - // Insertion routines. - iterator insert(const value_type &v) { return this->tree_.insert_multi(v); } - iterator insert(value_type &&v) { - return this->tree_.insert_multi(std::move(v)); - } - iterator insert(const_iterator hint, const value_type &v) { - return this->tree_.insert_hint_multi(iterator(hint), v); - } - iterator insert(const_iterator hint, value_type &&v) { - return this->tree_.insert_hint_multi(iterator(hint), std::move(v)); - } - template <typename InputIterator> - void insert(InputIterator b, InputIterator e) { - this->tree_.insert_iterator_multi(b, e); - } - void insert(std::initializer_list<init_type> init) { - this->tree_.insert_iterator_multi(init.begin(), init.end()); - } - template <typename... Args> - iterator emplace(Args &&... args) { - return this->tree_.insert_multi(init_type(std::forward<Args>(args)...)); - } - template <typename... Args> - iterator emplace_hint(const_iterator hint, Args &&... args) { - return this->tree_.insert_hint_multi( - iterator(hint), init_type(std::forward<Args>(args)...)); - } - iterator insert(node_type &&node) { - if (!node) return this->end(); - iterator res = - this->tree_.insert_multi(params_type::key(CommonAccess::GetSlot(node)), - CommonAccess::GetSlot(node)); - CommonAccess::Destroy(&node); - return res; - } - iterator insert(const_iterator hint, node_type &&node) { - if (!node) return this->end(); - iterator res = this->tree_.insert_hint_multi( - iterator(hint), - std::move(params_type::element(CommonAccess::GetSlot(node)))); - CommonAccess::Destroy(&node); - return res; - } - - // Node extraction routines. - template <typename K = key_type> - node_type extract(const key_arg<K> &key) { - const std::pair<iterator, bool> lower_and_equal = - this->tree_.lower_bound_equal(key); - return lower_and_equal.second ? extract(lower_and_equal.first) - : node_type(); - } - using super_type::extract; - - // Merge routines. - // Moves all elements from `src` into `this`. - template < - typename T, - typename absl::enable_if_t< - absl::conjunction< - std::is_same<value_type, typename T::value_type>, - std::is_same<allocator_type, typename T::allocator_type>, - std::is_same<typename params_type::is_map_container, - typename T::params_type::is_map_container>>::value, - int> = 0> - void merge(btree_container<T> &src) { // NOLINT - for (auto src_it = src.begin(), end = src.end(); src_it != end; ++src_it) { - insert(std::move(params_type::element(src_it.slot()))); - } - src.clear(); - } - - template < - typename T, - typename absl::enable_if_t< - absl::conjunction< - std::is_same<value_type, typename T::value_type>, - std::is_same<allocator_type, typename T::allocator_type>, - std::is_same<typename params_type::is_map_container, - typename T::params_type::is_map_container>>::value, - int> = 0> - void merge(btree_container<T> &&src) { - merge(src); - } -}; - -// A base class for btree_multimap. -template <typename Tree> -class btree_multimap_container : public btree_multiset_container<Tree> { - using super_type = btree_multiset_container<Tree>; - using params_type = typename Tree::params_type; - - public: - using mapped_type = typename params_type::mapped_type; - - // Inherit constructors. - using super_type::super_type; - btree_multimap_container() {} -}; - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_BTREE_CONTAINER_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/counting_allocator.h b/contrib/restricted/abseil-cpp/absl/container/internal/counting_allocator.h deleted file mode 100644 index 927cf08255..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/counting_allocator.h +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_COUNTING_ALLOCATOR_H_ -#define ABSL_CONTAINER_INTERNAL_COUNTING_ALLOCATOR_H_ - -#include <cstdint> -#include <memory> - -#include "absl/base/config.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -// This is a stateful allocator, but the state lives outside of the -// allocator (in whatever test is using the allocator). This is odd -// but helps in tests where the allocator is propagated into nested -// containers - that chain of allocators uses the same state and is -// thus easier to query for aggregate allocation information. -template <typename T> -class CountingAllocator { - public: - using Allocator = std::allocator<T>; - using AllocatorTraits = std::allocator_traits<Allocator>; - using value_type = typename AllocatorTraits::value_type; - using pointer = typename AllocatorTraits::pointer; - using const_pointer = typename AllocatorTraits::const_pointer; - using size_type = typename AllocatorTraits::size_type; - using difference_type = typename AllocatorTraits::difference_type; - - CountingAllocator() = default; - explicit CountingAllocator(int64_t* bytes_used) : bytes_used_(bytes_used) {} - CountingAllocator(int64_t* bytes_used, int64_t* instance_count) - : bytes_used_(bytes_used), instance_count_(instance_count) {} - - template <typename U> - CountingAllocator(const CountingAllocator<U>& x) - : bytes_used_(x.bytes_used_), instance_count_(x.instance_count_) {} - - pointer allocate( - size_type n, - typename AllocatorTraits::const_void_pointer hint = nullptr) { - Allocator allocator; - pointer ptr = AllocatorTraits::allocate(allocator, n, hint); - if (bytes_used_ != nullptr) { - *bytes_used_ += n * sizeof(T); - } - return ptr; - } - - void deallocate(pointer p, size_type n) { - Allocator allocator; - AllocatorTraits::deallocate(allocator, p, n); - if (bytes_used_ != nullptr) { - *bytes_used_ -= n * sizeof(T); - } - } - - template <typename U, typename... Args> - void construct(U* p, Args&&... args) { - Allocator allocator; - AllocatorTraits::construct(allocator, p, std::forward<Args>(args)...); - if (instance_count_ != nullptr) { - *instance_count_ += 1; - } - } - - template <typename U> - void destroy(U* p) { - Allocator allocator; - AllocatorTraits::destroy(allocator, p); - if (instance_count_ != nullptr) { - *instance_count_ -= 1; - } - } - - template <typename U> - class rebind { - public: - using other = CountingAllocator<U>; - }; - - friend bool operator==(const CountingAllocator& a, - const CountingAllocator& b) { - return a.bytes_used_ == b.bytes_used_ && - a.instance_count_ == b.instance_count_; - } - - friend bool operator!=(const CountingAllocator& a, - const CountingAllocator& b) { - return !(a == b); - } - - int64_t* bytes_used_ = nullptr; - int64_t* instance_count_ = nullptr; -}; - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_COUNTING_ALLOCATOR_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/hash_generator_testing.h b/contrib/restricted/abseil-cpp/absl/container/internal/hash_generator_testing.h deleted file mode 100644 index f1f555a5c1..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/hash_generator_testing.h +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Generates random values for testing. Specialized only for the few types we -// care about. - -#ifndef ABSL_CONTAINER_INTERNAL_HASH_GENERATOR_TESTING_H_ -#define ABSL_CONTAINER_INTERNAL_HASH_GENERATOR_TESTING_H_ - -#include <stdint.h> - -#include <algorithm> -#include <cassert> -#include <iosfwd> -#include <random> -#include <tuple> -#include <type_traits> -#include <utility> -#include <vector> - -#include "absl/container/internal/hash_policy_testing.h" -#include "absl/memory/memory.h" -#include "absl/meta/type_traits.h" -#include "absl/strings/string_view.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { -namespace hash_internal { -namespace generator_internal { - -template <class Container, class = void> -struct IsMap : std::false_type {}; - -template <class Map> -struct IsMap<Map, absl::void_t<typename Map::mapped_type>> : std::true_type {}; - -} // namespace generator_internal - -std::mt19937_64* GetSharedRng(); - -enum Enum { - kEnumEmpty, - kEnumDeleted, -}; - -enum class EnumClass : uint64_t { - kEmpty, - kDeleted, -}; - -inline std::ostream& operator<<(std::ostream& o, const EnumClass& ec) { - return o << static_cast<uint64_t>(ec); -} - -template <class T, class E = void> -struct Generator; - -template <class T> -struct Generator<T, typename std::enable_if<std::is_integral<T>::value>::type> { - T operator()() const { - std::uniform_int_distribution<T> dist; - return dist(*GetSharedRng()); - } -}; - -template <> -struct Generator<Enum> { - Enum operator()() const { - std::uniform_int_distribution<typename std::underlying_type<Enum>::type> - dist; - while (true) { - auto variate = dist(*GetSharedRng()); - if (variate != kEnumEmpty && variate != kEnumDeleted) - return static_cast<Enum>(variate); - } - } -}; - -template <> -struct Generator<EnumClass> { - EnumClass operator()() const { - std::uniform_int_distribution< - typename std::underlying_type<EnumClass>::type> - dist; - while (true) { - EnumClass variate = static_cast<EnumClass>(dist(*GetSharedRng())); - if (variate != EnumClass::kEmpty && variate != EnumClass::kDeleted) - return static_cast<EnumClass>(variate); - } - } -}; - -template <> -struct Generator<std::string> { - std::string operator()() const; -}; - -template <> -struct Generator<absl::string_view> { - absl::string_view operator()() const; -}; - -template <> -struct Generator<NonStandardLayout> { - NonStandardLayout operator()() const { - return NonStandardLayout(Generator<std::string>()()); - } -}; - -template <class K, class V> -struct Generator<std::pair<K, V>> { - std::pair<K, V> operator()() const { - return std::pair<K, V>(Generator<typename std::decay<K>::type>()(), - Generator<typename std::decay<V>::type>()()); - } -}; - -template <class... Ts> -struct Generator<std::tuple<Ts...>> { - std::tuple<Ts...> operator()() const { - return std::tuple<Ts...>(Generator<typename std::decay<Ts>::type>()()...); - } -}; - -template <class T> -struct Generator<std::unique_ptr<T>> { - std::unique_ptr<T> operator()() const { - return absl::make_unique<T>(Generator<T>()()); - } -}; - -template <class U> -struct Generator<U, absl::void_t<decltype(std::declval<U&>().key()), - decltype(std::declval<U&>().value())>> - : Generator<std::pair< - typename std::decay<decltype(std::declval<U&>().key())>::type, - typename std::decay<decltype(std::declval<U&>().value())>::type>> {}; - -template <class Container> -using GeneratedType = decltype( - std::declval<const Generator< - typename std::conditional<generator_internal::IsMap<Container>::value, - typename Container::value_type, - typename Container::key_type>::type>&>()()); - -// Naive wrapper that performs a linear search of previous values. -// Beware this is O(SQR), which is reasonable for smaller kMaxValues. -template <class T, size_t kMaxValues = 64, class E = void> -struct UniqueGenerator { - Generator<T, E> gen; - std::vector<T> values; - - T operator()() { - assert(values.size() < kMaxValues); - for (;;) { - T value = gen(); - if (std::find(values.begin(), values.end(), value) == values.end()) { - values.push_back(value); - return value; - } - } - } -}; - -} // namespace hash_internal -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_HASH_GENERATOR_TESTING_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/hash_policy_testing.h b/contrib/restricted/abseil-cpp/absl/container/internal/hash_policy_testing.h deleted file mode 100644 index 01c40d2e5c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/hash_policy_testing.h +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Utilities to help tests verify that hash tables properly handle stateful -// allocators and hash functions. - -#ifndef ABSL_CONTAINER_INTERNAL_HASH_POLICY_TESTING_H_ -#define ABSL_CONTAINER_INTERNAL_HASH_POLICY_TESTING_H_ - -#include <cstdlib> -#include <limits> -#include <memory> -#include <ostream> -#include <type_traits> -#include <utility> -#include <vector> - -#include "absl/hash/hash.h" -#include "absl/strings/string_view.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { -namespace hash_testing_internal { - -template <class Derived> -struct WithId { - WithId() : id_(next_id<Derived>()) {} - WithId(const WithId& that) : id_(that.id_) {} - WithId(WithId&& that) : id_(that.id_) { that.id_ = 0; } - WithId& operator=(const WithId& that) { - id_ = that.id_; - return *this; - } - WithId& operator=(WithId&& that) { - id_ = that.id_; - that.id_ = 0; - return *this; - } - - size_t id() const { return id_; } - - friend bool operator==(const WithId& a, const WithId& b) { - return a.id_ == b.id_; - } - friend bool operator!=(const WithId& a, const WithId& b) { return !(a == b); } - - protected: - explicit WithId(size_t id) : id_(id) {} - - private: - size_t id_; - - template <class T> - static size_t next_id() { - // 0 is reserved for moved from state. - static size_t gId = 1; - return gId++; - } -}; - -} // namespace hash_testing_internal - -struct NonStandardLayout { - NonStandardLayout() {} - explicit NonStandardLayout(std::string s) : value(std::move(s)) {} - virtual ~NonStandardLayout() {} - - friend bool operator==(const NonStandardLayout& a, - const NonStandardLayout& b) { - return a.value == b.value; - } - friend bool operator!=(const NonStandardLayout& a, - const NonStandardLayout& b) { - return a.value != b.value; - } - - template <typename H> - friend H AbslHashValue(H h, const NonStandardLayout& v) { - return H::combine(std::move(h), v.value); - } - - std::string value; -}; - -struct StatefulTestingHash - : absl::container_internal::hash_testing_internal::WithId< - StatefulTestingHash> { - template <class T> - size_t operator()(const T& t) const { - return absl::Hash<T>{}(t); - } -}; - -struct StatefulTestingEqual - : absl::container_internal::hash_testing_internal::WithId< - StatefulTestingEqual> { - template <class T, class U> - bool operator()(const T& t, const U& u) const { - return t == u; - } -}; - -// It is expected that Alloc() == Alloc() for all allocators so we cannot use -// WithId base. We need to explicitly assign ids. -template <class T = int> -struct Alloc : std::allocator<T> { - using propagate_on_container_swap = std::true_type; - - // Using old paradigm for this to ensure compatibility. - explicit Alloc(size_t id = 0) : id_(id) {} - - Alloc(const Alloc&) = default; - Alloc& operator=(const Alloc&) = default; - - template <class U> - Alloc(const Alloc<U>& that) : std::allocator<T>(that), id_(that.id()) {} - - template <class U> - struct rebind { - using other = Alloc<U>; - }; - - size_t id() const { return id_; } - - friend bool operator==(const Alloc& a, const Alloc& b) { - return a.id_ == b.id_; - } - friend bool operator!=(const Alloc& a, const Alloc& b) { return !(a == b); } - - private: - size_t id_ = (std::numeric_limits<size_t>::max)(); -}; - -template <class Map> -auto items(const Map& m) -> std::vector< - std::pair<typename Map::key_type, typename Map::mapped_type>> { - using std::get; - std::vector<std::pair<typename Map::key_type, typename Map::mapped_type>> res; - res.reserve(m.size()); - for (const auto& v : m) res.emplace_back(get<0>(v), get<1>(v)); - return res; -} - -template <class Set> -auto keys(const Set& s) - -> std::vector<typename std::decay<typename Set::key_type>::type> { - std::vector<typename std::decay<typename Set::key_type>::type> res; - res.reserve(s.size()); - for (const auto& v : s) res.emplace_back(v); - return res; -} - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -// ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS is false for glibcxx versions -// where the unordered containers are missing certain constructors that -// take allocator arguments. This test is defined ad-hoc for the platforms -// we care about (notably Crosstool 17) because libstdcxx's useless -// versioning scheme precludes a more principled solution. -// From GCC-4.9 Changelog: (src: https://gcc.gnu.org/gcc-4.9/changes.html) -// "the unordered associative containers in <unordered_map> and <unordered_set> -// meet the allocator-aware container requirements;" -#if (defined(__GLIBCXX__) && __GLIBCXX__ <= 20140425 ) || \ -( __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9 )) -#define ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS 0 -#else -#define ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS 1 -#endif - -#endif // ABSL_CONTAINER_INTERNAL_HASH_POLICY_TESTING_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/hashtable_debug.h b/contrib/restricted/abseil-cpp/absl/container/internal/hashtable_debug.h deleted file mode 100644 index 19d52121d6..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/hashtable_debug.h +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// This library provides APIs to debug the probing behavior of hash tables. -// -// In general, the probing behavior is a black box for users and only the -// side effects can be measured in the form of performance differences. -// These APIs give a glimpse on the actual behavior of the probing algorithms in -// these hashtables given a specified hash function and a set of elements. -// -// The probe count distribution can be used to assess the quality of the hash -// function for that particular hash table. Note that a hash function that -// performs well in one hash table implementation does not necessarily performs -// well in a different one. -// -// This library supports std::unordered_{set,map}, dense_hash_{set,map} and -// absl::{flat,node,string}_hash_{set,map}. - -#ifndef ABSL_CONTAINER_INTERNAL_HASHTABLE_DEBUG_H_ -#define ABSL_CONTAINER_INTERNAL_HASHTABLE_DEBUG_H_ - -#include <cstddef> -#include <algorithm> -#include <type_traits> -#include <vector> - -#include "absl/container/internal/hashtable_debug_hooks.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -// Returns the number of probes required to lookup `key`. Returns 0 for a -// search with no collisions. Higher values mean more hash collisions occurred; -// however, the exact meaning of this number varies according to the container -// type. -template <typename C> -size_t GetHashtableDebugNumProbes( - const C& c, const typename C::key_type& key) { - return absl::container_internal::hashtable_debug_internal:: - HashtableDebugAccess<C>::GetNumProbes(c, key); -} - -// Gets a histogram of the number of probes for each elements in the container. -// The sum of all the values in the vector is equal to container.size(). -template <typename C> -std::vector<size_t> GetHashtableDebugNumProbesHistogram(const C& container) { - std::vector<size_t> v; - for (auto it = container.begin(); it != container.end(); ++it) { - size_t num_probes = GetHashtableDebugNumProbes( - container, - absl::container_internal::hashtable_debug_internal::GetKey<C>(*it, 0)); - v.resize((std::max)(v.size(), num_probes + 1)); - v[num_probes]++; - } - return v; -} - -struct HashtableDebugProbeSummary { - size_t total_elements; - size_t total_num_probes; - double mean; -}; - -// Gets a summary of the probe count distribution for the elements in the -// container. -template <typename C> -HashtableDebugProbeSummary GetHashtableDebugProbeSummary(const C& container) { - auto probes = GetHashtableDebugNumProbesHistogram(container); - HashtableDebugProbeSummary summary = {}; - for (size_t i = 0; i < probes.size(); ++i) { - summary.total_elements += probes[i]; - summary.total_num_probes += probes[i] * i; - } - summary.mean = 1.0 * summary.total_num_probes / summary.total_elements; - return summary; -} - -// Returns the number of bytes requested from the allocator by the container -// and not freed. -template <typename C> -size_t AllocatedByteSize(const C& c) { - return absl::container_internal::hashtable_debug_internal:: - HashtableDebugAccess<C>::AllocatedByteSize(c); -} - -// Returns a tight lower bound for AllocatedByteSize(c) where `c` is of type `C` -// and `c.size()` is equal to `num_elements`. -template <typename C> -size_t LowerBoundAllocatedByteSize(size_t num_elements) { - return absl::container_internal::hashtable_debug_internal:: - HashtableDebugAccess<C>::LowerBoundAllocatedByteSize(num_elements); -} - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_HASHTABLE_DEBUG_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/node_hash_policy.h b/contrib/restricted/abseil-cpp/absl/container/internal/node_hash_policy.h deleted file mode 100644 index 4617162f0b..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/node_hash_policy.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Adapts a policy for nodes. -// -// The node policy should model: -// -// struct Policy { -// // Returns a new node allocated and constructed using the allocator, using -// // the specified arguments. -// template <class Alloc, class... Args> -// value_type* new_element(Alloc* alloc, Args&&... args) const; -// -// // Destroys and deallocates node using the allocator. -// template <class Alloc> -// void delete_element(Alloc* alloc, value_type* node) const; -// }; -// -// It may also optionally define `value()` and `apply()`. For documentation on -// these, see hash_policy_traits.h. - -#ifndef ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_ -#define ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_ - -#include <cassert> -#include <cstddef> -#include <memory> -#include <type_traits> -#include <utility> - -#include "absl/base/config.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -template <class Reference, class Policy> -struct node_hash_policy { - static_assert(std::is_lvalue_reference<Reference>::value, ""); - - using slot_type = typename std::remove_cv< - typename std::remove_reference<Reference>::type>::type*; - - template <class Alloc, class... Args> - static void construct(Alloc* alloc, slot_type* slot, Args&&... args) { - *slot = Policy::new_element(alloc, std::forward<Args>(args)...); - } - - template <class Alloc> - static void destroy(Alloc* alloc, slot_type* slot) { - Policy::delete_element(alloc, *slot); - } - - template <class Alloc> - static void transfer(Alloc*, slot_type* new_slot, slot_type* old_slot) { - *new_slot = *old_slot; - } - - static size_t space_used(const slot_type* slot) { - if (slot == nullptr) return Policy::element_space_used(nullptr); - return Policy::element_space_used(*slot); - } - - static Reference element(slot_type* slot) { return **slot; } - - template <class T, class P = Policy> - static auto value(T* elem) -> decltype(P::value(elem)) { - return P::value(elem); - } - - template <class... Ts, class P = Policy> - static auto apply(Ts&&... ts) -> decltype(P::apply(std::forward<Ts>(ts)...)) { - return P::apply(std::forward<Ts>(ts)...); - } -}; - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set/CMakeLists.linux.txt deleted file mode 100644 index d261502851..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set/CMakeLists.linux.txt +++ /dev/null @@ -1,46 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(container-internal-raw_hash_set) -target_compile_options(container-internal-raw_hash_set PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(container-internal-raw_hash_set PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(container-internal-raw_hash_set PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - container-internal-absl_hashtablez_sampler - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-hash - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - abseil-cpp-absl-types - absl-types-bad_optional_access -) -target_sources(container-internal-raw_hash_set PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set/CMakeLists.txt index e8c98bfd99..d261502851 100644 --- a/contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set/CMakeLists.txt @@ -6,6 +6,41 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(container-internal-raw_hash_set) +target_compile_options(container-internal-raw_hash_set PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(container-internal-raw_hash_set PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(container-internal-raw_hash_set PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + container-internal-absl_hashtablez_sampler + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-hash + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + abseil-cpp-absl-types + absl-types-bad_optional_access +) +target_sources(container-internal-raw_hash_set PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/test_instance_tracker.h b/contrib/restricted/abseil-cpp/absl/container/internal/test_instance_tracker.h deleted file mode 100644 index 5ff6fd714e..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/test_instance_tracker.h +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_TEST_INSTANCE_TRACKER_H_ -#define ABSL_CONTAINER_INTERNAL_TEST_INSTANCE_TRACKER_H_ - -#include <cstdlib> -#include <ostream> - -#include "absl/types/compare.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace test_internal { - -// A type that counts number of occurrences of the type, the live occurrences of -// the type, as well as the number of copies, moves, swaps, and comparisons that -// have occurred on the type. This is used as a base class for the copyable, -// copyable+movable, and movable types below that are used in actual tests. Use -// InstanceTracker in tests to track the number of instances. -class BaseCountedInstance { - public: - explicit BaseCountedInstance(int x) : value_(x) { - ++num_instances_; - ++num_live_instances_; - } - BaseCountedInstance(const BaseCountedInstance& x) - : value_(x.value_), is_live_(x.is_live_) { - ++num_instances_; - if (is_live_) ++num_live_instances_; - ++num_copies_; - } - BaseCountedInstance(BaseCountedInstance&& x) - : value_(x.value_), is_live_(x.is_live_) { - x.is_live_ = false; - ++num_instances_; - ++num_moves_; - } - ~BaseCountedInstance() { - --num_instances_; - if (is_live_) --num_live_instances_; - } - - BaseCountedInstance& operator=(const BaseCountedInstance& x) { - value_ = x.value_; - if (is_live_) --num_live_instances_; - is_live_ = x.is_live_; - if (is_live_) ++num_live_instances_; - ++num_copies_; - return *this; - } - BaseCountedInstance& operator=(BaseCountedInstance&& x) { - value_ = x.value_; - if (is_live_) --num_live_instances_; - is_live_ = x.is_live_; - x.is_live_ = false; - ++num_moves_; - return *this; - } - - bool operator==(const BaseCountedInstance& x) const { - ++num_comparisons_; - return value_ == x.value_; - } - - bool operator!=(const BaseCountedInstance& x) const { - ++num_comparisons_; - return value_ != x.value_; - } - - bool operator<(const BaseCountedInstance& x) const { - ++num_comparisons_; - return value_ < x.value_; - } - - bool operator>(const BaseCountedInstance& x) const { - ++num_comparisons_; - return value_ > x.value_; - } - - bool operator<=(const BaseCountedInstance& x) const { - ++num_comparisons_; - return value_ <= x.value_; - } - - bool operator>=(const BaseCountedInstance& x) const { - ++num_comparisons_; - return value_ >= x.value_; - } - - absl::weak_ordering compare(const BaseCountedInstance& x) const { - ++num_comparisons_; - return value_ < x.value_ - ? absl::weak_ordering::less - : value_ == x.value_ ? absl::weak_ordering::equivalent - : absl::weak_ordering::greater; - } - - int value() const { - if (!is_live_) std::abort(); - return value_; - } - - friend std::ostream& operator<<(std::ostream& o, - const BaseCountedInstance& v) { - return o << "[value:" << v.value() << "]"; - } - - // Implementation of efficient swap() that counts swaps. - static void SwapImpl( - BaseCountedInstance& lhs, // NOLINT(runtime/references) - BaseCountedInstance& rhs) { // NOLINT(runtime/references) - using std::swap; - swap(lhs.value_, rhs.value_); - swap(lhs.is_live_, rhs.is_live_); - ++BaseCountedInstance::num_swaps_; - } - - private: - friend class InstanceTracker; - - int value_; - - // Indicates if the value is live, ie it hasn't been moved away from. - bool is_live_ = true; - - // Number of instances. - static int num_instances_; - - // Number of live instances (those that have not been moved away from.) - static int num_live_instances_; - - // Number of times that BaseCountedInstance objects were moved. - static int num_moves_; - - // Number of times that BaseCountedInstance objects were copied. - static int num_copies_; - - // Number of times that BaseCountedInstance objects were swapped. - static int num_swaps_; - - // Number of times that BaseCountedInstance objects were compared. - static int num_comparisons_; -}; - -// Helper to track the BaseCountedInstance instance counters. Expects that the -// number of instances and live_instances are the same when it is constructed -// and when it is destructed. -class InstanceTracker { - public: - InstanceTracker() - : start_instances_(BaseCountedInstance::num_instances_), - start_live_instances_(BaseCountedInstance::num_live_instances_) { - ResetCopiesMovesSwaps(); - } - ~InstanceTracker() { - if (instances() != 0) std::abort(); - if (live_instances() != 0) std::abort(); - } - - // Returns the number of BaseCountedInstance instances both containing valid - // values and those moved away from compared to when the InstanceTracker was - // constructed - int instances() const { - return BaseCountedInstance::num_instances_ - start_instances_; - } - - // Returns the number of live BaseCountedInstance instances compared to when - // the InstanceTracker was constructed - int live_instances() const { - return BaseCountedInstance::num_live_instances_ - start_live_instances_; - } - - // Returns the number of moves on BaseCountedInstance objects since - // construction or since the last call to ResetCopiesMovesSwaps(). - int moves() const { return BaseCountedInstance::num_moves_ - start_moves_; } - - // Returns the number of copies on BaseCountedInstance objects since - // construction or the last call to ResetCopiesMovesSwaps(). - int copies() const { - return BaseCountedInstance::num_copies_ - start_copies_; - } - - // Returns the number of swaps on BaseCountedInstance objects since - // construction or the last call to ResetCopiesMovesSwaps(). - int swaps() const { return BaseCountedInstance::num_swaps_ - start_swaps_; } - - // Returns the number of comparisons on BaseCountedInstance objects since - // construction or the last call to ResetCopiesMovesSwaps(). - int comparisons() const { - return BaseCountedInstance::num_comparisons_ - start_comparisons_; - } - - // Resets the base values for moves, copies, comparisons, and swaps to the - // current values, so that subsequent Get*() calls for moves, copies, - // comparisons, and swaps will compare to the situation at the point of this - // call. - void ResetCopiesMovesSwaps() { - start_moves_ = BaseCountedInstance::num_moves_; - start_copies_ = BaseCountedInstance::num_copies_; - start_swaps_ = BaseCountedInstance::num_swaps_; - start_comparisons_ = BaseCountedInstance::num_comparisons_; - } - - private: - int start_instances_; - int start_live_instances_; - int start_moves_; - int start_copies_; - int start_swaps_; - int start_comparisons_; -}; - -// Copyable, not movable. -class CopyableOnlyInstance : public BaseCountedInstance { - public: - explicit CopyableOnlyInstance(int x) : BaseCountedInstance(x) {} - CopyableOnlyInstance(const CopyableOnlyInstance& rhs) = default; - CopyableOnlyInstance& operator=(const CopyableOnlyInstance& rhs) = default; - - friend void swap(CopyableOnlyInstance& lhs, CopyableOnlyInstance& rhs) { - BaseCountedInstance::SwapImpl(lhs, rhs); - } - - static bool supports_move() { return false; } -}; - -// Copyable and movable. -class CopyableMovableInstance : public BaseCountedInstance { - public: - explicit CopyableMovableInstance(int x) : BaseCountedInstance(x) {} - CopyableMovableInstance(const CopyableMovableInstance& rhs) = default; - CopyableMovableInstance(CopyableMovableInstance&& rhs) = default; - CopyableMovableInstance& operator=(const CopyableMovableInstance& rhs) = - default; - CopyableMovableInstance& operator=(CopyableMovableInstance&& rhs) = default; - - friend void swap(CopyableMovableInstance& lhs, CopyableMovableInstance& rhs) { - BaseCountedInstance::SwapImpl(lhs, rhs); - } - - static bool supports_move() { return true; } -}; - -// Only movable, not default-constructible. -class MovableOnlyInstance : public BaseCountedInstance { - public: - explicit MovableOnlyInstance(int x) : BaseCountedInstance(x) {} - MovableOnlyInstance(MovableOnlyInstance&& other) = default; - MovableOnlyInstance& operator=(MovableOnlyInstance&& other) = default; - - friend void swap(MovableOnlyInstance& lhs, MovableOnlyInstance& rhs) { - BaseCountedInstance::SwapImpl(lhs, rhs); - } - - static bool supports_move() { return true; } -}; - -} // namespace test_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_TEST_INSTANCE_TRACKER_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/tracked.h b/contrib/restricted/abseil-cpp/absl/container/internal/tracked.h deleted file mode 100644 index 29f5829f71..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/tracked.h +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_TRACKED_H_ -#define ABSL_CONTAINER_INTERNAL_TRACKED_H_ - -#include <stddef.h> - -#include <memory> -#include <utility> - -#include "absl/base/config.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -// A class that tracks its copies and moves so that it can be queried in tests. -template <class T> -class Tracked { - public: - Tracked() {} - // NOLINTNEXTLINE(runtime/explicit) - Tracked(const T& val) : val_(val) {} - Tracked(const Tracked& that) - : val_(that.val_), - num_moves_(that.num_moves_), - num_copies_(that.num_copies_) { - ++(*num_copies_); - } - Tracked(Tracked&& that) - : val_(std::move(that.val_)), - num_moves_(std::move(that.num_moves_)), - num_copies_(std::move(that.num_copies_)) { - ++(*num_moves_); - } - Tracked& operator=(const Tracked& that) { - val_ = that.val_; - num_moves_ = that.num_moves_; - num_copies_ = that.num_copies_; - ++(*num_copies_); - } - Tracked& operator=(Tracked&& that) { - val_ = std::move(that.val_); - num_moves_ = std::move(that.num_moves_); - num_copies_ = std::move(that.num_copies_); - ++(*num_moves_); - } - - const T& val() const { return val_; } - - friend bool operator==(const Tracked& a, const Tracked& b) { - return a.val_ == b.val_; - } - friend bool operator!=(const Tracked& a, const Tracked& b) { - return !(a == b); - } - - size_t num_copies() { return *num_copies_; } - size_t num_moves() { return *num_moves_; } - - private: - T val_; - std::shared_ptr<size_t> num_moves_ = std::make_shared<size_t>(0); - std::shared_ptr<size_t> num_copies_ = std::make_shared<size_t>(0); -}; - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_TRACKED_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h b/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h deleted file mode 100644 index c1d20f3c52..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_CONSTRUCTOR_TEST_H_ -#define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_CONSTRUCTOR_TEST_H_ - -#include <algorithm> -#include <unordered_map> -#include <vector> - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/container/internal/hash_generator_testing.h" -#include "absl/container/internal/hash_policy_testing.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -template <class UnordMap> -class ConstructorTest : public ::testing::Test {}; - -TYPED_TEST_SUITE_P(ConstructorTest); - -TYPED_TEST_P(ConstructorTest, NoArgs) { - TypeParam m; - EXPECT_TRUE(m.empty()); - EXPECT_THAT(m, ::testing::UnorderedElementsAre()); -} - -TYPED_TEST_P(ConstructorTest, BucketCount) { - TypeParam m(123); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(m, ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountHash) { - using H = typename TypeParam::hasher; - H hasher; - TypeParam m(123, hasher); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(m, ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountHashEqual) { - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - H hasher; - E equal; - TypeParam m(123, hasher, equal); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.key_eq(), equal); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(m, ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountHashEqualAlloc) { - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - TypeParam m(123, hasher, equal, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.key_eq(), equal); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(m, ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -template <typename T> -struct is_std_unordered_map : std::false_type {}; - -template <typename... T> -struct is_std_unordered_map<std::unordered_map<T...>> : std::true_type {}; - -#if defined(UNORDERED_MAP_CXX14) || defined(UNORDERED_MAP_CXX17) -using has_cxx14_std_apis = std::true_type; -#else -using has_cxx14_std_apis = std::false_type; -#endif - -template <typename T> -using expect_cxx14_apis = - absl::disjunction<absl::negation<is_std_unordered_map<T>>, - has_cxx14_std_apis>; - -template <typename TypeParam> -void BucketCountAllocTest(std::false_type) {} - -template <typename TypeParam> -void BucketCountAllocTest(std::true_type) { - using A = typename TypeParam::allocator_type; - A alloc(0); - TypeParam m(123, alloc); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(m, ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountAlloc) { - BucketCountAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -template <typename TypeParam> -void BucketCountHashAllocTest(std::false_type) {} - -template <typename TypeParam> -void BucketCountHashAllocTest(std::true_type) { - using H = typename TypeParam::hasher; - using A = typename TypeParam::allocator_type; - H hasher; - A alloc(0); - TypeParam m(123, hasher, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(m, ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountHashAlloc) { - BucketCountHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -#if ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS -using has_alloc_std_constructors = std::true_type; -#else -using has_alloc_std_constructors = std::false_type; -#endif - -template <typename T> -using expect_alloc_constructors = - absl::disjunction<absl::negation<is_std_unordered_map<T>>, - has_alloc_std_constructors>; - -template <typename TypeParam> -void AllocTest(std::false_type) {} - -template <typename TypeParam> -void AllocTest(std::true_type) { - using A = typename TypeParam::allocator_type; - A alloc(0); - TypeParam m(alloc); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(m, ::testing::UnorderedElementsAre()); -} - -TYPED_TEST_P(ConstructorTest, Alloc) { - AllocTest<TypeParam>(expect_alloc_constructors<TypeParam>()); -} - -TYPED_TEST_P(ConstructorTest, InputIteratorBucketHashEqualAlloc) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::UniqueGenerator<T>()); - TypeParam m(values.begin(), values.end(), 123, hasher, equal, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.key_eq(), equal); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -template <typename TypeParam> -void InputIteratorBucketAllocTest(std::false_type) {} - -template <typename TypeParam> -void InputIteratorBucketAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using A = typename TypeParam::allocator_type; - A alloc(0); - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::UniqueGenerator<T>()); - TypeParam m(values.begin(), values.end(), 123, alloc); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, InputIteratorBucketAlloc) { - InputIteratorBucketAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -template <typename TypeParam> -void InputIteratorBucketHashAllocTest(std::false_type) {} - -template <typename TypeParam> -void InputIteratorBucketHashAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using A = typename TypeParam::allocator_type; - H hasher; - A alloc(0); - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::UniqueGenerator<T>()); - TypeParam m(values.begin(), values.end(), 123, hasher, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, InputIteratorBucketHashAlloc) { - InputIteratorBucketHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -TYPED_TEST_P(ConstructorTest, CopyConstructor) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - hash_internal::UniqueGenerator<T> gen; - TypeParam m(123, hasher, equal, alloc); - for (size_t i = 0; i != 10; ++i) m.insert(gen()); - TypeParam n(m); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_EQ(m.get_allocator(), n.get_allocator()); - EXPECT_EQ(m, n); -} - -template <typename TypeParam> -void CopyConstructorAllocTest(std::false_type) {} - -template <typename TypeParam> -void CopyConstructorAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - hash_internal::UniqueGenerator<T> gen; - TypeParam m(123, hasher, equal, alloc); - for (size_t i = 0; i != 10; ++i) m.insert(gen()); - TypeParam n(m, A(11)); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_NE(m.get_allocator(), n.get_allocator()); - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, CopyConstructorAlloc) { - CopyConstructorAllocTest<TypeParam>(expect_alloc_constructors<TypeParam>()); -} - -// TODO(alkis): Test non-propagating allocators on copy constructors. - -TYPED_TEST_P(ConstructorTest, MoveConstructor) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - hash_internal::UniqueGenerator<T> gen; - TypeParam m(123, hasher, equal, alloc); - for (size_t i = 0; i != 10; ++i) m.insert(gen()); - TypeParam t(m); - TypeParam n(std::move(t)); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_EQ(m.get_allocator(), n.get_allocator()); - EXPECT_EQ(m, n); -} - -template <typename TypeParam> -void MoveConstructorAllocTest(std::false_type) {} - -template <typename TypeParam> -void MoveConstructorAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - hash_internal::UniqueGenerator<T> gen; - TypeParam m(123, hasher, equal, alloc); - for (size_t i = 0; i != 10; ++i) m.insert(gen()); - TypeParam t(m); - TypeParam n(std::move(t), A(1)); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_NE(m.get_allocator(), n.get_allocator()); - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, MoveConstructorAlloc) { - MoveConstructorAllocTest<TypeParam>(expect_alloc_constructors<TypeParam>()); -} - -// TODO(alkis): Test non-propagating allocators on move constructors. - -TYPED_TEST_P(ConstructorTest, InitializerListBucketHashEqualAlloc) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::UniqueGenerator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - TypeParam m(values, 123, hasher, equal, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.key_eq(), equal); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -template <typename TypeParam> -void InitializerListBucketAllocTest(std::false_type) {} - -template <typename TypeParam> -void InitializerListBucketAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using A = typename TypeParam::allocator_type; - hash_internal::UniqueGenerator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - A alloc(0); - TypeParam m(values, 123, alloc); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, InitializerListBucketAlloc) { - InitializerListBucketAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -template <typename TypeParam> -void InitializerListBucketHashAllocTest(std::false_type) {} - -template <typename TypeParam> -void InitializerListBucketHashAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using A = typename TypeParam::allocator_type; - H hasher; - A alloc(0); - hash_internal::UniqueGenerator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - TypeParam m(values, 123, hasher, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, InitializerListBucketHashAlloc) { - InitializerListBucketHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -TYPED_TEST_P(ConstructorTest, Assignment) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - hash_internal::UniqueGenerator<T> gen; - TypeParam m({gen(), gen(), gen()}, 123, hasher, equal, alloc); - TypeParam n; - n = m; - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_EQ(m, n); -} - -// TODO(alkis): Test [non-]propagating allocators on move/copy assignments -// (it depends on traits). - -TYPED_TEST_P(ConstructorTest, MoveAssignment) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - hash_internal::UniqueGenerator<T> gen; - TypeParam m({gen(), gen(), gen()}, 123, hasher, equal, alloc); - TypeParam t(m); - TypeParam n; - n = std::move(t); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, AssignmentFromInitializerList) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::UniqueGenerator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - TypeParam m; - m = values; - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); -} - -TYPED_TEST_P(ConstructorTest, AssignmentOverwritesExisting) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::UniqueGenerator<T> gen; - TypeParam m({gen(), gen(), gen()}); - TypeParam n({gen()}); - n = m; - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, MoveAssignmentOverwritesExisting) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::UniqueGenerator<T> gen; - TypeParam m({gen(), gen(), gen()}); - TypeParam t(m); - TypeParam n({gen()}); - n = std::move(t); - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, AssignmentFromInitializerListOverwritesExisting) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::UniqueGenerator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - TypeParam m; - m = values; - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); -} - -TYPED_TEST_P(ConstructorTest, AssignmentOnSelf) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::UniqueGenerator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - TypeParam m(values); - m = *&m; // Avoid -Wself-assign - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); -} - -// We cannot test self move as standard states that it leaves standard -// containers in unspecified state (and in practice in causes memory-leak -// according to heap-checker!). - -REGISTER_TYPED_TEST_CASE_P( - ConstructorTest, NoArgs, BucketCount, BucketCountHash, BucketCountHashEqual, - BucketCountHashEqualAlloc, BucketCountAlloc, BucketCountHashAlloc, Alloc, - InputIteratorBucketHashEqualAlloc, InputIteratorBucketAlloc, - InputIteratorBucketHashAlloc, CopyConstructor, CopyConstructorAlloc, - MoveConstructor, MoveConstructorAlloc, InitializerListBucketHashEqualAlloc, - InitializerListBucketAlloc, InitializerListBucketHashAlloc, Assignment, - MoveAssignment, AssignmentFromInitializerList, AssignmentOverwritesExisting, - MoveAssignmentOverwritesExisting, - AssignmentFromInitializerListOverwritesExisting, AssignmentOnSelf); - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_CONSTRUCTOR_TEST_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h b/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h deleted file mode 100644 index e76421e508..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_LOOKUP_TEST_H_ -#define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_LOOKUP_TEST_H_ - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/container/internal/hash_generator_testing.h" -#include "absl/container/internal/hash_policy_testing.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -template <class UnordMap> -class LookupTest : public ::testing::Test {}; - -TYPED_TEST_SUITE_P(LookupTest); - -TYPED_TEST_P(LookupTest, At) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m(values.begin(), values.end()); - for (const auto& p : values) { - const auto& val = m.at(p.first); - EXPECT_EQ(p.second, val) << ::testing::PrintToString(p.first); - } -} - -TYPED_TEST_P(LookupTest, OperatorBracket) { - using T = hash_internal::GeneratedType<TypeParam>; - using V = typename TypeParam::mapped_type; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m; - for (const auto& p : values) { - auto& val = m[p.first]; - EXPECT_EQ(V(), val) << ::testing::PrintToString(p.first); - val = p.second; - } - for (const auto& p : values) - EXPECT_EQ(p.second, m[p.first]) << ::testing::PrintToString(p.first); -} - -TYPED_TEST_P(LookupTest, Count) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m; - for (const auto& p : values) - EXPECT_EQ(0, m.count(p.first)) << ::testing::PrintToString(p.first); - m.insert(values.begin(), values.end()); - for (const auto& p : values) - EXPECT_EQ(1, m.count(p.first)) << ::testing::PrintToString(p.first); -} - -TYPED_TEST_P(LookupTest, Find) { - using std::get; - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m; - for (const auto& p : values) - EXPECT_TRUE(m.end() == m.find(p.first)) - << ::testing::PrintToString(p.first); - m.insert(values.begin(), values.end()); - for (const auto& p : values) { - auto it = m.find(p.first); - EXPECT_TRUE(m.end() != it) << ::testing::PrintToString(p.first); - EXPECT_EQ(p.second, get<1>(*it)) << ::testing::PrintToString(p.first); - } -} - -TYPED_TEST_P(LookupTest, EqualRange) { - using std::get; - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m; - for (const auto& p : values) { - auto r = m.equal_range(p.first); - ASSERT_EQ(0, std::distance(r.first, r.second)); - } - m.insert(values.begin(), values.end()); - for (const auto& p : values) { - auto r = m.equal_range(p.first); - ASSERT_EQ(1, std::distance(r.first, r.second)); - EXPECT_EQ(p.second, get<1>(*r.first)) << ::testing::PrintToString(p.first); - } -} - -REGISTER_TYPED_TEST_CASE_P(LookupTest, At, OperatorBracket, Count, Find, - EqualRange); - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_LOOKUP_TEST_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_members_test.h b/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_members_test.h deleted file mode 100644 index 7d48cdb890..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_members_test.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MEMBERS_TEST_H_ -#define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MEMBERS_TEST_H_ - -#include <type_traits> -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/meta/type_traits.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -template <class UnordMap> -class MembersTest : public ::testing::Test {}; - -TYPED_TEST_SUITE_P(MembersTest); - -template <typename T> -void UseType() {} - -TYPED_TEST_P(MembersTest, Typedefs) { - EXPECT_TRUE((std::is_same<std::pair<const typename TypeParam::key_type, - typename TypeParam::mapped_type>, - typename TypeParam::value_type>())); - EXPECT_TRUE((absl::conjunction< - absl::negation<std::is_signed<typename TypeParam::size_type>>, - std::is_integral<typename TypeParam::size_type>>())); - EXPECT_TRUE((absl::conjunction< - std::is_signed<typename TypeParam::difference_type>, - std::is_integral<typename TypeParam::difference_type>>())); - EXPECT_TRUE((std::is_convertible< - decltype(std::declval<const typename TypeParam::hasher&>()( - std::declval<const typename TypeParam::key_type&>())), - size_t>())); - EXPECT_TRUE((std::is_convertible< - decltype(std::declval<const typename TypeParam::key_equal&>()( - std::declval<const typename TypeParam::key_type&>(), - std::declval<const typename TypeParam::key_type&>())), - bool>())); - EXPECT_TRUE((std::is_same<typename TypeParam::allocator_type::value_type, - typename TypeParam::value_type>())); - EXPECT_TRUE((std::is_same<typename TypeParam::value_type&, - typename TypeParam::reference>())); - EXPECT_TRUE((std::is_same<const typename TypeParam::value_type&, - typename TypeParam::const_reference>())); - EXPECT_TRUE((std::is_same<typename std::allocator_traits< - typename TypeParam::allocator_type>::pointer, - typename TypeParam::pointer>())); - EXPECT_TRUE( - (std::is_same<typename std::allocator_traits< - typename TypeParam::allocator_type>::const_pointer, - typename TypeParam::const_pointer>())); -} - -TYPED_TEST_P(MembersTest, SimpleFunctions) { - EXPECT_GT(TypeParam().max_size(), 0); -} - -TYPED_TEST_P(MembersTest, BeginEnd) { - TypeParam t = {typename TypeParam::value_type{}}; - EXPECT_EQ(t.begin(), t.cbegin()); - EXPECT_EQ(t.end(), t.cend()); - EXPECT_NE(t.begin(), t.end()); - EXPECT_NE(t.cbegin(), t.cend()); -} - -REGISTER_TYPED_TEST_SUITE_P(MembersTest, Typedefs, SimpleFunctions, BeginEnd); - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MEMBERS_TEST_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h b/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h deleted file mode 100644 index d3543936f7..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MODIFIERS_TEST_H_ -#define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MODIFIERS_TEST_H_ - -#include <memory> - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/container/internal/hash_generator_testing.h" -#include "absl/container/internal/hash_policy_testing.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -template <class UnordMap> -class ModifiersTest : public ::testing::Test {}; - -TYPED_TEST_SUITE_P(ModifiersTest); - -TYPED_TEST_P(ModifiersTest, Clear) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m(values.begin(), values.end()); - ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - m.clear(); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAre()); - EXPECT_TRUE(m.empty()); -} - -TYPED_TEST_P(ModifiersTest, Insert) { - using T = hash_internal::GeneratedType<TypeParam>; - using V = typename TypeParam::mapped_type; - T val = hash_internal::Generator<T>()(); - TypeParam m; - auto p = m.insert(val); - EXPECT_TRUE(p.second); - EXPECT_EQ(val, *p.first); - T val2 = {val.first, hash_internal::Generator<V>()()}; - p = m.insert(val2); - EXPECT_FALSE(p.second); - EXPECT_EQ(val, *p.first); -} - -TYPED_TEST_P(ModifiersTest, InsertHint) { - using T = hash_internal::GeneratedType<TypeParam>; - using V = typename TypeParam::mapped_type; - T val = hash_internal::Generator<T>()(); - TypeParam m; - auto it = m.insert(m.end(), val); - EXPECT_TRUE(it != m.end()); - EXPECT_EQ(val, *it); - T val2 = {val.first, hash_internal::Generator<V>()()}; - it = m.insert(it, val2); - EXPECT_TRUE(it != m.end()); - EXPECT_EQ(val, *it); -} - -TYPED_TEST_P(ModifiersTest, InsertRange) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m; - m.insert(values.begin(), values.end()); - ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); -} - -TYPED_TEST_P(ModifiersTest, InsertWithinCapacity) { - using T = hash_internal::GeneratedType<TypeParam>; - using V = typename TypeParam::mapped_type; - T val = hash_internal::Generator<T>()(); - TypeParam m; - m.reserve(10); - const size_t original_capacity = m.bucket_count(); - m.insert(val); - EXPECT_EQ(m.bucket_count(), original_capacity); - T val2 = {val.first, hash_internal::Generator<V>()()}; - m.insert(val2); - EXPECT_EQ(m.bucket_count(), original_capacity); -} - -TYPED_TEST_P(ModifiersTest, InsertRangeWithinCapacity) { -#if !defined(__GLIBCXX__) - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> base_values; - std::generate_n(std::back_inserter(base_values), 10, - hash_internal::Generator<T>()); - std::vector<T> values; - while (values.size() != 100) { - std::copy_n(base_values.begin(), 10, std::back_inserter(values)); - } - TypeParam m; - m.reserve(10); - const size_t original_capacity = m.bucket_count(); - m.insert(values.begin(), values.end()); - EXPECT_EQ(m.bucket_count(), original_capacity); -#endif -} - -TYPED_TEST_P(ModifiersTest, InsertOrAssign) { -#ifdef UNORDERED_MAP_CXX17 - using std::get; - using K = typename TypeParam::key_type; - using V = typename TypeParam::mapped_type; - K k = hash_internal::Generator<K>()(); - V val = hash_internal::Generator<V>()(); - TypeParam m; - auto p = m.insert_or_assign(k, val); - EXPECT_TRUE(p.second); - EXPECT_EQ(k, get<0>(*p.first)); - EXPECT_EQ(val, get<1>(*p.first)); - V val2 = hash_internal::Generator<V>()(); - p = m.insert_or_assign(k, val2); - EXPECT_FALSE(p.second); - EXPECT_EQ(k, get<0>(*p.first)); - EXPECT_EQ(val2, get<1>(*p.first)); -#endif -} - -TYPED_TEST_P(ModifiersTest, InsertOrAssignHint) { -#ifdef UNORDERED_MAP_CXX17 - using std::get; - using K = typename TypeParam::key_type; - using V = typename TypeParam::mapped_type; - K k = hash_internal::Generator<K>()(); - V val = hash_internal::Generator<V>()(); - TypeParam m; - auto it = m.insert_or_assign(m.end(), k, val); - EXPECT_TRUE(it != m.end()); - EXPECT_EQ(k, get<0>(*it)); - EXPECT_EQ(val, get<1>(*it)); - V val2 = hash_internal::Generator<V>()(); - it = m.insert_or_assign(it, k, val2); - EXPECT_EQ(k, get<0>(*it)); - EXPECT_EQ(val2, get<1>(*it)); -#endif -} - -TYPED_TEST_P(ModifiersTest, Emplace) { - using T = hash_internal::GeneratedType<TypeParam>; - using V = typename TypeParam::mapped_type; - T val = hash_internal::Generator<T>()(); - TypeParam m; - // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps - // with test traits/policy. - auto p = m.emplace(val); - EXPECT_TRUE(p.second); - EXPECT_EQ(val, *p.first); - T val2 = {val.first, hash_internal::Generator<V>()()}; - p = m.emplace(val2); - EXPECT_FALSE(p.second); - EXPECT_EQ(val, *p.first); -} - -TYPED_TEST_P(ModifiersTest, EmplaceHint) { - using T = hash_internal::GeneratedType<TypeParam>; - using V = typename TypeParam::mapped_type; - T val = hash_internal::Generator<T>()(); - TypeParam m; - // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps - // with test traits/policy. - auto it = m.emplace_hint(m.end(), val); - EXPECT_EQ(val, *it); - T val2 = {val.first, hash_internal::Generator<V>()()}; - it = m.emplace_hint(it, val2); - EXPECT_EQ(val, *it); -} - -TYPED_TEST_P(ModifiersTest, TryEmplace) { -#ifdef UNORDERED_MAP_CXX17 - using T = hash_internal::GeneratedType<TypeParam>; - using V = typename TypeParam::mapped_type; - T val = hash_internal::Generator<T>()(); - TypeParam m; - // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps - // with test traits/policy. - auto p = m.try_emplace(val.first, val.second); - EXPECT_TRUE(p.second); - EXPECT_EQ(val, *p.first); - T val2 = {val.first, hash_internal::Generator<V>()()}; - p = m.try_emplace(val2.first, val2.second); - EXPECT_FALSE(p.second); - EXPECT_EQ(val, *p.first); -#endif -} - -TYPED_TEST_P(ModifiersTest, TryEmplaceHint) { -#ifdef UNORDERED_MAP_CXX17 - using T = hash_internal::GeneratedType<TypeParam>; - using V = typename TypeParam::mapped_type; - T val = hash_internal::Generator<T>()(); - TypeParam m; - // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps - // with test traits/policy. - auto it = m.try_emplace(m.end(), val.first, val.second); - EXPECT_EQ(val, *it); - T val2 = {val.first, hash_internal::Generator<V>()()}; - it = m.try_emplace(it, val2.first, val2.second); - EXPECT_EQ(val, *it); -#endif -} - -template <class V> -using IfNotVoid = typename std::enable_if<!std::is_void<V>::value, V>::type; - -// In openmap we chose not to return the iterator from erase because that's -// more expensive. As such we adapt erase to return an iterator here. -struct EraseFirst { - template <class Map> - auto operator()(Map* m, int) const - -> IfNotVoid<decltype(m->erase(m->begin()))> { - return m->erase(m->begin()); - } - template <class Map> - typename Map::iterator operator()(Map* m, ...) const { - auto it = m->begin(); - m->erase(it++); - return it; - } -}; - -TYPED_TEST_P(ModifiersTest, Erase) { - using T = hash_internal::GeneratedType<TypeParam>; - using std::get; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m(values.begin(), values.end()); - ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - auto& first = *m.begin(); - std::vector<T> values2; - for (const auto& val : values) - if (get<0>(val) != get<0>(first)) values2.push_back(val); - auto it = EraseFirst()(&m, 0); - ASSERT_TRUE(it != m.end()); - EXPECT_EQ(1, std::count(values2.begin(), values2.end(), *it)); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values2.begin(), - values2.end())); -} - -TYPED_TEST_P(ModifiersTest, EraseRange) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m(values.begin(), values.end()); - ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - auto it = m.erase(m.begin(), m.end()); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAre()); - EXPECT_TRUE(it == m.end()); -} - -TYPED_TEST_P(ModifiersTest, EraseKey) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m(values.begin(), values.end()); - ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_EQ(1, m.erase(values[0].first)); - EXPECT_EQ(0, std::count(m.begin(), m.end(), values[0])); - EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values.begin() + 1, - values.end())); -} - -TYPED_TEST_P(ModifiersTest, Swap) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> v1; - std::vector<T> v2; - std::generate_n(std::back_inserter(v1), 5, hash_internal::Generator<T>()); - std::generate_n(std::back_inserter(v2), 5, hash_internal::Generator<T>()); - TypeParam m1(v1.begin(), v1.end()); - TypeParam m2(v2.begin(), v2.end()); - EXPECT_THAT(items(m1), ::testing::UnorderedElementsAreArray(v1)); - EXPECT_THAT(items(m2), ::testing::UnorderedElementsAreArray(v2)); - m1.swap(m2); - EXPECT_THAT(items(m1), ::testing::UnorderedElementsAreArray(v2)); - EXPECT_THAT(items(m2), ::testing::UnorderedElementsAreArray(v1)); -} - -// TODO(alkis): Write tests for extract. -// TODO(alkis): Write tests for merge. - -REGISTER_TYPED_TEST_CASE_P(ModifiersTest, Clear, Insert, InsertHint, - InsertRange, InsertWithinCapacity, - InsertRangeWithinCapacity, InsertOrAssign, - InsertOrAssignHint, Emplace, EmplaceHint, TryEmplace, - TryEmplaceHint, Erase, EraseRange, EraseKey, Swap); - -template <typename Type> -struct is_unique_ptr : std::false_type {}; - -template <typename Type> -struct is_unique_ptr<std::unique_ptr<Type>> : std::true_type {}; - -template <class UnordMap> -class UniquePtrModifiersTest : public ::testing::Test { - protected: - UniquePtrModifiersTest() { - static_assert(is_unique_ptr<typename UnordMap::mapped_type>::value, - "UniquePtrModifiersTyest may only be called with a " - "std::unique_ptr value type."); - } -}; - -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(UniquePtrModifiersTest); - -TYPED_TEST_SUITE_P(UniquePtrModifiersTest); - -// Test that we do not move from rvalue arguments if an insertion does not -// happen. -TYPED_TEST_P(UniquePtrModifiersTest, TryEmplace) { -#ifdef UNORDERED_MAP_CXX17 - using T = hash_internal::GeneratedType<TypeParam>; - using V = typename TypeParam::mapped_type; - T val = hash_internal::Generator<T>()(); - TypeParam m; - auto p = m.try_emplace(val.first, std::move(val.second)); - EXPECT_TRUE(p.second); - // A moved from std::unique_ptr is guaranteed to be nullptr. - EXPECT_EQ(val.second, nullptr); - T val2 = {val.first, hash_internal::Generator<V>()()}; - p = m.try_emplace(val2.first, std::move(val2.second)); - EXPECT_FALSE(p.second); - EXPECT_NE(val2.second, nullptr); -#endif -} - -REGISTER_TYPED_TEST_SUITE_P(UniquePtrModifiersTest, TryEmplace); - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MODIFIERS_TEST_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h b/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h deleted file mode 100644 index 41165b05e9..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h +++ /dev/null @@ -1,496 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_CONSTRUCTOR_TEST_H_ -#define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_CONSTRUCTOR_TEST_H_ - -#include <algorithm> -#include <unordered_set> -#include <vector> - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/container/internal/hash_generator_testing.h" -#include "absl/container/internal/hash_policy_testing.h" -#include "absl/meta/type_traits.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -template <class UnordMap> -class ConstructorTest : public ::testing::Test {}; - -TYPED_TEST_SUITE_P(ConstructorTest); - -TYPED_TEST_P(ConstructorTest, NoArgs) { - TypeParam m; - EXPECT_TRUE(m.empty()); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); -} - -TYPED_TEST_P(ConstructorTest, BucketCount) { - TypeParam m(123); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountHash) { - using H = typename TypeParam::hasher; - H hasher; - TypeParam m(123, hasher); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountHashEqual) { - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - H hasher; - E equal; - TypeParam m(123, hasher, equal); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.key_eq(), equal); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountHashEqualAlloc) { - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - TypeParam m(123, hasher, equal, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.key_eq(), equal); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); - - const auto& cm = m; - EXPECT_EQ(cm.hash_function(), hasher); - EXPECT_EQ(cm.key_eq(), equal); - EXPECT_EQ(cm.get_allocator(), alloc); - EXPECT_TRUE(cm.empty()); - EXPECT_THAT(keys(cm), ::testing::UnorderedElementsAre()); - EXPECT_GE(cm.bucket_count(), 123); -} - -template <typename T> -struct is_std_unordered_set : std::false_type {}; - -template <typename... T> -struct is_std_unordered_set<std::unordered_set<T...>> : std::true_type {}; - -#if defined(UNORDERED_SET_CXX14) || defined(UNORDERED_SET_CXX17) -using has_cxx14_std_apis = std::true_type; -#else -using has_cxx14_std_apis = std::false_type; -#endif - -template <typename T> -using expect_cxx14_apis = - absl::disjunction<absl::negation<is_std_unordered_set<T>>, - has_cxx14_std_apis>; - -template <typename TypeParam> -void BucketCountAllocTest(std::false_type) {} - -template <typename TypeParam> -void BucketCountAllocTest(std::true_type) { - using A = typename TypeParam::allocator_type; - A alloc(0); - TypeParam m(123, alloc); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountAlloc) { - BucketCountAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -template <typename TypeParam> -void BucketCountHashAllocTest(std::false_type) {} - -template <typename TypeParam> -void BucketCountHashAllocTest(std::true_type) { - using H = typename TypeParam::hasher; - using A = typename TypeParam::allocator_type; - H hasher; - A alloc(0); - TypeParam m(123, hasher, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, BucketCountHashAlloc) { - BucketCountHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -#if ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS -using has_alloc_std_constructors = std::true_type; -#else -using has_alloc_std_constructors = std::false_type; -#endif - -template <typename T> -using expect_alloc_constructors = - absl::disjunction<absl::negation<is_std_unordered_set<T>>, - has_alloc_std_constructors>; - -template <typename TypeParam> -void AllocTest(std::false_type) {} - -template <typename TypeParam> -void AllocTest(std::true_type) { - using A = typename TypeParam::allocator_type; - A alloc(0); - TypeParam m(alloc); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_TRUE(m.empty()); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); -} - -TYPED_TEST_P(ConstructorTest, Alloc) { - AllocTest<TypeParam>(expect_alloc_constructors<TypeParam>()); -} - -TYPED_TEST_P(ConstructorTest, InputIteratorBucketHashEqualAlloc) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - std::vector<T> values; - for (size_t i = 0; i != 10; ++i) - values.push_back(hash_internal::Generator<T>()()); - TypeParam m(values.begin(), values.end(), 123, hasher, equal, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.key_eq(), equal); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -template <typename TypeParam> -void InputIteratorBucketAllocTest(std::false_type) {} - -template <typename TypeParam> -void InputIteratorBucketAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using A = typename TypeParam::allocator_type; - A alloc(0); - std::vector<T> values; - for (size_t i = 0; i != 10; ++i) - values.push_back(hash_internal::Generator<T>()()); - TypeParam m(values.begin(), values.end(), 123, alloc); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, InputIteratorBucketAlloc) { - InputIteratorBucketAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -template <typename TypeParam> -void InputIteratorBucketHashAllocTest(std::false_type) {} - -template <typename TypeParam> -void InputIteratorBucketHashAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using A = typename TypeParam::allocator_type; - H hasher; - A alloc(0); - std::vector<T> values; - for (size_t i = 0; i != 10; ++i) - values.push_back(hash_internal::Generator<T>()()); - TypeParam m(values.begin(), values.end(), 123, hasher, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, InputIteratorBucketHashAlloc) { - InputIteratorBucketHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -TYPED_TEST_P(ConstructorTest, CopyConstructor) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - TypeParam m(123, hasher, equal, alloc); - for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()()); - TypeParam n(m); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_EQ(m.get_allocator(), n.get_allocator()); - EXPECT_EQ(m, n); - EXPECT_NE(TypeParam(0, hasher, equal, alloc), n); -} - -template <typename TypeParam> -void CopyConstructorAllocTest(std::false_type) {} - -template <typename TypeParam> -void CopyConstructorAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - TypeParam m(123, hasher, equal, alloc); - for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()()); - TypeParam n(m, A(11)); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_NE(m.get_allocator(), n.get_allocator()); - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, CopyConstructorAlloc) { - CopyConstructorAllocTest<TypeParam>(expect_alloc_constructors<TypeParam>()); -} - -// TODO(alkis): Test non-propagating allocators on copy constructors. - -TYPED_TEST_P(ConstructorTest, MoveConstructor) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - TypeParam m(123, hasher, equal, alloc); - for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()()); - TypeParam t(m); - TypeParam n(std::move(t)); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_EQ(m.get_allocator(), n.get_allocator()); - EXPECT_EQ(m, n); -} - -template <typename TypeParam> -void MoveConstructorAllocTest(std::false_type) {} - -template <typename TypeParam> -void MoveConstructorAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - TypeParam m(123, hasher, equal, alloc); - for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()()); - TypeParam t(m); - TypeParam n(std::move(t), A(1)); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_NE(m.get_allocator(), n.get_allocator()); - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, MoveConstructorAlloc) { - MoveConstructorAllocTest<TypeParam>(expect_alloc_constructors<TypeParam>()); -} - -// TODO(alkis): Test non-propagating allocators on move constructors. - -TYPED_TEST_P(ConstructorTest, InitializerListBucketHashEqualAlloc) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::Generator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - TypeParam m(values, 123, hasher, equal, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.key_eq(), equal); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -template <typename TypeParam> -void InitializerListBucketAllocTest(std::false_type) {} - -template <typename TypeParam> -void InitializerListBucketAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using A = typename TypeParam::allocator_type; - hash_internal::Generator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - A alloc(0); - TypeParam m(values, 123, alloc); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, InitializerListBucketAlloc) { - InitializerListBucketAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -template <typename TypeParam> -void InitializerListBucketHashAllocTest(std::false_type) {} - -template <typename TypeParam> -void InitializerListBucketHashAllocTest(std::true_type) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using A = typename TypeParam::allocator_type; - H hasher; - A alloc(0); - hash_internal::Generator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - TypeParam m(values, 123, hasher, alloc); - EXPECT_EQ(m.hash_function(), hasher); - EXPECT_EQ(m.get_allocator(), alloc); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_GE(m.bucket_count(), 123); -} - -TYPED_TEST_P(ConstructorTest, InitializerListBucketHashAlloc) { - InitializerListBucketHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>()); -} - -TYPED_TEST_P(ConstructorTest, CopyAssignment) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - hash_internal::Generator<T> gen; - TypeParam m({gen(), gen(), gen()}, 123, hasher, equal, alloc); - TypeParam n; - n = m; - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_EQ(m, n); -} - -// TODO(alkis): Test [non-]propagating allocators on move/copy assignments -// (it depends on traits). - -TYPED_TEST_P(ConstructorTest, MoveAssignment) { - using T = hash_internal::GeneratedType<TypeParam>; - using H = typename TypeParam::hasher; - using E = typename TypeParam::key_equal; - using A = typename TypeParam::allocator_type; - H hasher; - E equal; - A alloc(0); - hash_internal::Generator<T> gen; - TypeParam m({gen(), gen(), gen()}, 123, hasher, equal, alloc); - TypeParam t(m); - TypeParam n; - n = std::move(t); - EXPECT_EQ(m.hash_function(), n.hash_function()); - EXPECT_EQ(m.key_eq(), n.key_eq()); - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, AssignmentFromInitializerList) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::Generator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - TypeParam m; - m = values; - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); -} - -TYPED_TEST_P(ConstructorTest, AssignmentOverwritesExisting) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::Generator<T> gen; - TypeParam m({gen(), gen(), gen()}); - TypeParam n({gen()}); - n = m; - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, MoveAssignmentOverwritesExisting) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::Generator<T> gen; - TypeParam m({gen(), gen(), gen()}); - TypeParam t(m); - TypeParam n({gen()}); - n = std::move(t); - EXPECT_EQ(m, n); -} - -TYPED_TEST_P(ConstructorTest, AssignmentFromInitializerListOverwritesExisting) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::Generator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - TypeParam m; - m = values; - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); -} - -TYPED_TEST_P(ConstructorTest, AssignmentOnSelf) { - using T = hash_internal::GeneratedType<TypeParam>; - hash_internal::Generator<T> gen; - std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()}; - TypeParam m(values); - m = *&m; // Avoid -Wself-assign. - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); -} - -REGISTER_TYPED_TEST_CASE_P( - ConstructorTest, NoArgs, BucketCount, BucketCountHash, BucketCountHashEqual, - BucketCountHashEqualAlloc, BucketCountAlloc, BucketCountHashAlloc, Alloc, - InputIteratorBucketHashEqualAlloc, InputIteratorBucketAlloc, - InputIteratorBucketHashAlloc, CopyConstructor, CopyConstructorAlloc, - MoveConstructor, MoveConstructorAlloc, InitializerListBucketHashEqualAlloc, - InitializerListBucketAlloc, InitializerListBucketHashAlloc, CopyAssignment, - MoveAssignment, AssignmentFromInitializerList, AssignmentOverwritesExisting, - MoveAssignmentOverwritesExisting, - AssignmentFromInitializerListOverwritesExisting, AssignmentOnSelf); - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_CONSTRUCTOR_TEST_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h b/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h deleted file mode 100644 index 8f2f4b207e..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_LOOKUP_TEST_H_ -#define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_LOOKUP_TEST_H_ - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/container/internal/hash_generator_testing.h" -#include "absl/container/internal/hash_policy_testing.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -template <class UnordSet> -class LookupTest : public ::testing::Test {}; - -TYPED_TEST_SUITE_P(LookupTest); - -TYPED_TEST_P(LookupTest, Count) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m; - for (const auto& v : values) - EXPECT_EQ(0, m.count(v)) << ::testing::PrintToString(v); - m.insert(values.begin(), values.end()); - for (const auto& v : values) - EXPECT_EQ(1, m.count(v)) << ::testing::PrintToString(v); -} - -TYPED_TEST_P(LookupTest, Find) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m; - for (const auto& v : values) - EXPECT_TRUE(m.end() == m.find(v)) << ::testing::PrintToString(v); - m.insert(values.begin(), values.end()); - for (const auto& v : values) { - typename TypeParam::iterator it = m.find(v); - static_assert(std::is_same<const typename TypeParam::value_type&, - decltype(*it)>::value, - ""); - static_assert(std::is_same<const typename TypeParam::value_type*, - decltype(it.operator->())>::value, - ""); - EXPECT_TRUE(m.end() != it) << ::testing::PrintToString(v); - EXPECT_EQ(v, *it) << ::testing::PrintToString(v); - } -} - -TYPED_TEST_P(LookupTest, EqualRange) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m; - for (const auto& v : values) { - auto r = m.equal_range(v); - ASSERT_EQ(0, std::distance(r.first, r.second)); - } - m.insert(values.begin(), values.end()); - for (const auto& v : values) { - auto r = m.equal_range(v); - ASSERT_EQ(1, std::distance(r.first, r.second)); - EXPECT_EQ(v, *r.first); - } -} - -REGISTER_TYPED_TEST_CASE_P(LookupTest, Count, Find, EqualRange); - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_LOOKUP_TEST_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_members_test.h b/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_members_test.h deleted file mode 100644 index 4c5e104af2..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_members_test.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MEMBERS_TEST_H_ -#define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MEMBERS_TEST_H_ - -#include <type_traits> -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/meta/type_traits.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -template <class UnordSet> -class MembersTest : public ::testing::Test {}; - -TYPED_TEST_SUITE_P(MembersTest); - -template <typename T> -void UseType() {} - -TYPED_TEST_P(MembersTest, Typedefs) { - EXPECT_TRUE((std::is_same<typename TypeParam::key_type, - typename TypeParam::value_type>())); - EXPECT_TRUE((absl::conjunction< - absl::negation<std::is_signed<typename TypeParam::size_type>>, - std::is_integral<typename TypeParam::size_type>>())); - EXPECT_TRUE((absl::conjunction< - std::is_signed<typename TypeParam::difference_type>, - std::is_integral<typename TypeParam::difference_type>>())); - EXPECT_TRUE((std::is_convertible< - decltype(std::declval<const typename TypeParam::hasher&>()( - std::declval<const typename TypeParam::key_type&>())), - size_t>())); - EXPECT_TRUE((std::is_convertible< - decltype(std::declval<const typename TypeParam::key_equal&>()( - std::declval<const typename TypeParam::key_type&>(), - std::declval<const typename TypeParam::key_type&>())), - bool>())); - EXPECT_TRUE((std::is_same<typename TypeParam::allocator_type::value_type, - typename TypeParam::value_type>())); - EXPECT_TRUE((std::is_same<typename TypeParam::value_type&, - typename TypeParam::reference>())); - EXPECT_TRUE((std::is_same<const typename TypeParam::value_type&, - typename TypeParam::const_reference>())); - EXPECT_TRUE((std::is_same<typename std::allocator_traits< - typename TypeParam::allocator_type>::pointer, - typename TypeParam::pointer>())); - EXPECT_TRUE( - (std::is_same<typename std::allocator_traits< - typename TypeParam::allocator_type>::const_pointer, - typename TypeParam::const_pointer>())); -} - -TYPED_TEST_P(MembersTest, SimpleFunctions) { - EXPECT_GT(TypeParam().max_size(), 0); -} - -TYPED_TEST_P(MembersTest, BeginEnd) { - TypeParam t = {typename TypeParam::value_type{}}; - EXPECT_EQ(t.begin(), t.cbegin()); - EXPECT_EQ(t.end(), t.cend()); - EXPECT_NE(t.begin(), t.end()); - EXPECT_NE(t.cbegin(), t.cend()); -} - -REGISTER_TYPED_TEST_SUITE_P(MembersTest, Typedefs, SimpleFunctions, BeginEnd); - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MEMBERS_TEST_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h b/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h deleted file mode 100644 index 6e473e45da..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MODIFIERS_TEST_H_ -#define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MODIFIERS_TEST_H_ - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/container/internal/hash_generator_testing.h" -#include "absl/container/internal/hash_policy_testing.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { - -template <class UnordSet> -class ModifiersTest : public ::testing::Test {}; - -TYPED_TEST_SUITE_P(ModifiersTest); - -TYPED_TEST_P(ModifiersTest, Clear) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m(values.begin(), values.end()); - ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - m.clear(); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); - EXPECT_TRUE(m.empty()); -} - -TYPED_TEST_P(ModifiersTest, Insert) { - using T = hash_internal::GeneratedType<TypeParam>; - T val = hash_internal::Generator<T>()(); - TypeParam m; - auto p = m.insert(val); - EXPECT_TRUE(p.second); - EXPECT_EQ(val, *p.first); - p = m.insert(val); - EXPECT_FALSE(p.second); -} - -TYPED_TEST_P(ModifiersTest, InsertHint) { - using T = hash_internal::GeneratedType<TypeParam>; - T val = hash_internal::Generator<T>()(); - TypeParam m; - auto it = m.insert(m.end(), val); - EXPECT_TRUE(it != m.end()); - EXPECT_EQ(val, *it); - it = m.insert(it, val); - EXPECT_TRUE(it != m.end()); - EXPECT_EQ(val, *it); -} - -TYPED_TEST_P(ModifiersTest, InsertRange) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m; - m.insert(values.begin(), values.end()); - ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); -} - -TYPED_TEST_P(ModifiersTest, InsertWithinCapacity) { - using T = hash_internal::GeneratedType<TypeParam>; - T val = hash_internal::Generator<T>()(); - TypeParam m; - m.reserve(10); - const size_t original_capacity = m.bucket_count(); - m.insert(val); - EXPECT_EQ(m.bucket_count(), original_capacity); - m.insert(val); - EXPECT_EQ(m.bucket_count(), original_capacity); -} - -TYPED_TEST_P(ModifiersTest, InsertRangeWithinCapacity) { -#if !defined(__GLIBCXX__) - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> base_values; - std::generate_n(std::back_inserter(base_values), 10, - hash_internal::Generator<T>()); - std::vector<T> values; - while (values.size() != 100) { - values.insert(values.end(), base_values.begin(), base_values.end()); - } - TypeParam m; - m.reserve(10); - const size_t original_capacity = m.bucket_count(); - m.insert(values.begin(), values.end()); - EXPECT_EQ(m.bucket_count(), original_capacity); -#endif -} - -TYPED_TEST_P(ModifiersTest, Emplace) { - using T = hash_internal::GeneratedType<TypeParam>; - T val = hash_internal::Generator<T>()(); - TypeParam m; - // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps - // with test traits/policy. - auto p = m.emplace(val); - EXPECT_TRUE(p.second); - EXPECT_EQ(val, *p.first); - p = m.emplace(val); - EXPECT_FALSE(p.second); - EXPECT_EQ(val, *p.first); -} - -TYPED_TEST_P(ModifiersTest, EmplaceHint) { - using T = hash_internal::GeneratedType<TypeParam>; - T val = hash_internal::Generator<T>()(); - TypeParam m; - // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps - // with test traits/policy. - auto it = m.emplace_hint(m.end(), val); - EXPECT_EQ(val, *it); - it = m.emplace_hint(it, val); - EXPECT_EQ(val, *it); -} - -template <class V> -using IfNotVoid = typename std::enable_if<!std::is_void<V>::value, V>::type; - -// In openmap we chose not to return the iterator from erase because that's -// more expensive. As such we adapt erase to return an iterator here. -struct EraseFirst { - template <class Map> - auto operator()(Map* m, int) const - -> IfNotVoid<decltype(m->erase(m->begin()))> { - return m->erase(m->begin()); - } - template <class Map> - typename Map::iterator operator()(Map* m, ...) const { - auto it = m->begin(); - m->erase(it++); - return it; - } -}; - -TYPED_TEST_P(ModifiersTest, Erase) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m(values.begin(), values.end()); - ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - std::vector<T> values2; - for (const auto& val : values) - if (val != *m.begin()) values2.push_back(val); - auto it = EraseFirst()(&m, 0); - ASSERT_TRUE(it != m.end()); - EXPECT_EQ(1, std::count(values2.begin(), values2.end(), *it)); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values2.begin(), - values2.end())); -} - -TYPED_TEST_P(ModifiersTest, EraseRange) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m(values.begin(), values.end()); - ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - auto it = m.erase(m.begin(), m.end()); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre()); - EXPECT_TRUE(it == m.end()); -} - -TYPED_TEST_P(ModifiersTest, EraseKey) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> values; - std::generate_n(std::back_inserter(values), 10, - hash_internal::Generator<T>()); - TypeParam m(values.begin(), values.end()); - ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values)); - EXPECT_EQ(1, m.erase(values[0])); - EXPECT_EQ(0, std::count(m.begin(), m.end(), values[0])); - EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values.begin() + 1, - values.end())); -} - -TYPED_TEST_P(ModifiersTest, Swap) { - using T = hash_internal::GeneratedType<TypeParam>; - std::vector<T> v1; - std::vector<T> v2; - std::generate_n(std::back_inserter(v1), 5, hash_internal::Generator<T>()); - std::generate_n(std::back_inserter(v2), 5, hash_internal::Generator<T>()); - TypeParam m1(v1.begin(), v1.end()); - TypeParam m2(v2.begin(), v2.end()); - EXPECT_THAT(keys(m1), ::testing::UnorderedElementsAreArray(v1)); - EXPECT_THAT(keys(m2), ::testing::UnorderedElementsAreArray(v2)); - m1.swap(m2); - EXPECT_THAT(keys(m1), ::testing::UnorderedElementsAreArray(v2)); - EXPECT_THAT(keys(m2), ::testing::UnorderedElementsAreArray(v1)); -} - -// TODO(alkis): Write tests for extract. -// TODO(alkis): Write tests for merge. - -REGISTER_TYPED_TEST_CASE_P(ModifiersTest, Clear, Insert, InsertHint, - InsertRange, InsertWithinCapacity, - InsertRangeWithinCapacity, Emplace, EmplaceHint, - Erase, EraseRange, EraseKey, Swap); - -} // namespace container_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MODIFIERS_TEST_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/node_hash_map.h b/contrib/restricted/abseil-cpp/absl/container/node_hash_map.h deleted file mode 100644 index 7a39f6284c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/node_hash_map.h +++ /dev/null @@ -1,597 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: node_hash_map.h -// ----------------------------------------------------------------------------- -// -// An `absl::node_hash_map<K, V>` is an unordered associative container of -// unique keys and associated values designed to be a more efficient replacement -// for `std::unordered_map`. Like `unordered_map`, search, insertion, and -// deletion of map elements can be done as an `O(1)` operation. However, -// `node_hash_map` (and other unordered associative containers known as the -// collection of Abseil "Swiss tables") contain other optimizations that result -// in both memory and computation advantages. -// -// In most cases, your default choice for a hash map should be a map of type -// `flat_hash_map`. However, if you need pointer stability and cannot store -// a `flat_hash_map` with `unique_ptr` elements, a `node_hash_map` may be a -// valid alternative. As well, if you are migrating your code from using -// `std::unordered_map`, a `node_hash_map` provides a more straightforward -// migration, because it guarantees pointer stability. Consider migrating to -// `node_hash_map` and perhaps converting to a more efficient `flat_hash_map` -// upon further review. - -#ifndef ABSL_CONTAINER_NODE_HASH_MAP_H_ -#define ABSL_CONTAINER_NODE_HASH_MAP_H_ - -#include <tuple> -#include <type_traits> -#include <utility> - -#include "absl/algorithm/container.h" -#include "absl/container/internal/container_memory.h" -#include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export -#include "absl/container/internal/node_hash_policy.h" -#include "absl/container/internal/raw_hash_map.h" // IWYU pragma: export -#include "absl/memory/memory.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { -template <class Key, class Value> -class NodeHashMapPolicy; -} // namespace container_internal - -// ----------------------------------------------------------------------------- -// absl::node_hash_map -// ----------------------------------------------------------------------------- -// -// An `absl::node_hash_map<K, V>` is an unordered associative container which -// has been optimized for both speed and memory footprint in most common use -// cases. Its interface is similar to that of `std::unordered_map<K, V>` with -// the following notable differences: -// -// * Supports heterogeneous lookup, through `find()`, `operator[]()` and -// `insert()`, provided that the map is provided a compatible heterogeneous -// hashing function and equality operator. -// * Contains a `capacity()` member function indicating the number of element -// slots (open, deleted, and empty) within the hash map. -// * Returns `void` from the `erase(iterator)` overload. -// -// By default, `node_hash_map` uses the `absl::Hash` hashing framework. -// All fundamental and Abseil types that support the `absl::Hash` framework have -// a compatible equality operator for comparing insertions into `node_hash_map`. -// If your type is not yet supported by the `absl::Hash` framework, see -// absl/hash/hash.h for information on extending Abseil hashing to user-defined -// types. -// -// Example: -// -// // Create a node hash map of three strings (that map to strings) -// absl::node_hash_map<std::string, std::string> ducks = -// {{"a", "huey"}, {"b", "dewey"}, {"c", "louie"}}; -// -// // Insert a new element into the node hash map -// ducks.insert({"d", "donald"}}; -// -// // Force a rehash of the node hash map -// ducks.rehash(0); -// -// // Find the element with the key "b" -// std::string search_key = "b"; -// auto result = ducks.find(search_key); -// if (result != ducks.end()) { -// std::cout << "Result: " << result->second << std::endl; -// } -template <class Key, class Value, - class Hash = absl::container_internal::hash_default_hash<Key>, - class Eq = absl::container_internal::hash_default_eq<Key>, - class Alloc = std::allocator<std::pair<const Key, Value>>> -class node_hash_map - : public absl::container_internal::raw_hash_map< - absl::container_internal::NodeHashMapPolicy<Key, Value>, Hash, Eq, - Alloc> { - using Base = typename node_hash_map::raw_hash_map; - - public: - // Constructors and Assignment Operators - // - // A node_hash_map supports the same overload set as `std::unordered_map` - // for construction and assignment: - // - // * Default constructor - // - // // No allocation for the table's elements is made. - // absl::node_hash_map<int, std::string> map1; - // - // * Initializer List constructor - // - // absl::node_hash_map<int, std::string> map2 = - // {{1, "huey"}, {2, "dewey"}, {3, "louie"},}; - // - // * Copy constructor - // - // absl::node_hash_map<int, std::string> map3(map2); - // - // * Copy assignment operator - // - // // Hash functor and Comparator are copied as well - // absl::node_hash_map<int, std::string> map4; - // map4 = map3; - // - // * Move constructor - // - // // Move is guaranteed efficient - // absl::node_hash_map<int, std::string> map5(std::move(map4)); - // - // * Move assignment operator - // - // // May be efficient if allocators are compatible - // absl::node_hash_map<int, std::string> map6; - // map6 = std::move(map5); - // - // * Range constructor - // - // std::vector<std::pair<int, std::string>> v = {{1, "a"}, {2, "b"}}; - // absl::node_hash_map<int, std::string> map7(v.begin(), v.end()); - node_hash_map() {} - using Base::Base; - - // node_hash_map::begin() - // - // Returns an iterator to the beginning of the `node_hash_map`. - using Base::begin; - - // node_hash_map::cbegin() - // - // Returns a const iterator to the beginning of the `node_hash_map`. - using Base::cbegin; - - // node_hash_map::cend() - // - // Returns a const iterator to the end of the `node_hash_map`. - using Base::cend; - - // node_hash_map::end() - // - // Returns an iterator to the end of the `node_hash_map`. - using Base::end; - - // node_hash_map::capacity() - // - // Returns the number of element slots (assigned, deleted, and empty) - // available within the `node_hash_map`. - // - // NOTE: this member function is particular to `absl::node_hash_map` and is - // not provided in the `std::unordered_map` API. - using Base::capacity; - - // node_hash_map::empty() - // - // Returns whether or not the `node_hash_map` is empty. - using Base::empty; - - // node_hash_map::max_size() - // - // Returns the largest theoretical possible number of elements within a - // `node_hash_map` under current memory constraints. This value can be thought - // of as the largest value of `std::distance(begin(), end())` for a - // `node_hash_map<K, V>`. - using Base::max_size; - - // node_hash_map::size() - // - // Returns the number of elements currently within the `node_hash_map`. - using Base::size; - - // node_hash_map::clear() - // - // Removes all elements from the `node_hash_map`. Invalidates any references, - // pointers, or iterators referring to contained elements. - // - // NOTE: this operation may shrink the underlying buffer. To avoid shrinking - // the underlying buffer call `erase(begin(), end())`. - using Base::clear; - - // node_hash_map::erase() - // - // Erases elements within the `node_hash_map`. Erasing does not trigger a - // rehash. Overloads are listed below. - // - // void erase(const_iterator pos): - // - // Erases the element at `position` of the `node_hash_map`, returning - // `void`. - // - // NOTE: this return behavior is different than that of STL containers in - // general and `std::unordered_map` in particular. - // - // iterator erase(const_iterator first, const_iterator last): - // - // Erases the elements in the open interval [`first`, `last`), returning an - // iterator pointing to `last`. - // - // size_type erase(const key_type& key): - // - // Erases the element with the matching key, if it exists, returning the - // number of elements erased (0 or 1). - using Base::erase; - - // node_hash_map::insert() - // - // Inserts an element of the specified value into the `node_hash_map`, - // returning an iterator pointing to the newly inserted element, provided that - // an element with the given key does not already exist. If rehashing occurs - // due to the insertion, all iterators are invalidated. Overloads are listed - // below. - // - // std::pair<iterator,bool> insert(const init_type& value): - // - // Inserts a value into the `node_hash_map`. Returns a pair consisting of an - // iterator to the inserted element (or to the element that prevented the - // insertion) and a `bool` denoting whether the insertion took place. - // - // std::pair<iterator,bool> insert(T&& value): - // std::pair<iterator,bool> insert(init_type&& value): - // - // Inserts a moveable value into the `node_hash_map`. Returns a `std::pair` - // consisting of an iterator to the inserted element (or to the element that - // prevented the insertion) and a `bool` denoting whether the insertion took - // place. - // - // iterator insert(const_iterator hint, const init_type& value): - // iterator insert(const_iterator hint, T&& value): - // iterator insert(const_iterator hint, init_type&& value); - // - // Inserts a value, using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. Returns an iterator to the - // inserted element, or to the existing element that prevented the - // insertion. - // - // void insert(InputIterator first, InputIterator last): - // - // Inserts a range of values [`first`, `last`). - // - // NOTE: Although the STL does not specify which element may be inserted if - // multiple keys compare equivalently, for `node_hash_map` we guarantee the - // first match is inserted. - // - // void insert(std::initializer_list<init_type> ilist): - // - // Inserts the elements within the initializer list `ilist`. - // - // NOTE: Although the STL does not specify which element may be inserted if - // multiple keys compare equivalently within the initializer list, for - // `node_hash_map` we guarantee the first match is inserted. - using Base::insert; - - // node_hash_map::insert_or_assign() - // - // Inserts an element of the specified value into the `node_hash_map` provided - // that a value with the given key does not already exist, or replaces it with - // the element value if a key for that value already exists, returning an - // iterator pointing to the newly inserted element. If rehashing occurs due to - // the insertion, all iterators are invalidated. Overloads are listed - // below. - // - // std::pair<iterator, bool> insert_or_assign(const init_type& k, T&& obj): - // std::pair<iterator, bool> insert_or_assign(init_type&& k, T&& obj): - // - // Inserts/Assigns (or moves) the element of the specified key into the - // `node_hash_map`. - // - // iterator insert_or_assign(const_iterator hint, - // const init_type& k, T&& obj): - // iterator insert_or_assign(const_iterator hint, init_type&& k, T&& obj): - // - // Inserts/Assigns (or moves) the element of the specified key into the - // `node_hash_map` using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. - using Base::insert_or_assign; - - // node_hash_map::emplace() - // - // Inserts an element of the specified value by constructing it in-place - // within the `node_hash_map`, provided that no element with the given key - // already exists. - // - // The element may be constructed even if there already is an element with the - // key in the container, in which case the newly constructed element will be - // destroyed immediately. Prefer `try_emplace()` unless your key is not - // copyable or moveable. - // - // If rehashing occurs due to the insertion, all iterators are invalidated. - using Base::emplace; - - // node_hash_map::emplace_hint() - // - // Inserts an element of the specified value by constructing it in-place - // within the `node_hash_map`, using the position of `hint` as a non-binding - // suggestion for where to begin the insertion search, and only inserts - // provided that no element with the given key already exists. - // - // The element may be constructed even if there already is an element with the - // key in the container, in which case the newly constructed element will be - // destroyed immediately. Prefer `try_emplace()` unless your key is not - // copyable or moveable. - // - // If rehashing occurs due to the insertion, all iterators are invalidated. - using Base::emplace_hint; - - // node_hash_map::try_emplace() - // - // Inserts an element of the specified value by constructing it in-place - // within the `node_hash_map`, provided that no element with the given key - // already exists. Unlike `emplace()`, if an element with the given key - // already exists, we guarantee that no element is constructed. - // - // If rehashing occurs due to the insertion, all iterators are invalidated. - // Overloads are listed below. - // - // std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args): - // std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args): - // - // Inserts (via copy or move) the element of the specified key into the - // `node_hash_map`. - // - // iterator try_emplace(const_iterator hint, - // const init_type& k, Args&&... args): - // iterator try_emplace(const_iterator hint, init_type&& k, Args&&... args): - // - // Inserts (via copy or move) the element of the specified key into the - // `node_hash_map` using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. - // - // All `try_emplace()` overloads make the same guarantees regarding rvalue - // arguments as `std::unordered_map::try_emplace()`, namely that these - // functions will not move from rvalue arguments if insertions do not happen. - using Base::try_emplace; - - // node_hash_map::extract() - // - // Extracts the indicated element, erasing it in the process, and returns it - // as a C++17-compatible node handle. Overloads are listed below. - // - // node_type extract(const_iterator position): - // - // Extracts the key,value pair of the element at the indicated position and - // returns a node handle owning that extracted data. - // - // node_type extract(const key_type& x): - // - // Extracts the key,value pair of the element with a key matching the passed - // key value and returns a node handle owning that extracted data. If the - // `node_hash_map` does not contain an element with a matching key, this - // function returns an empty node handle. - // - // NOTE: when compiled in an earlier version of C++ than C++17, - // `node_type::key()` returns a const reference to the key instead of a - // mutable reference. We cannot safely return a mutable reference without - // std::launder (which is not available before C++17). - using Base::extract; - - // node_hash_map::merge() - // - // Extracts elements from a given `source` node hash map into this - // `node_hash_map`. If the destination `node_hash_map` already contains an - // element with an equivalent key, that element is not extracted. - using Base::merge; - - // node_hash_map::swap(node_hash_map& other) - // - // Exchanges the contents of this `node_hash_map` with those of the `other` - // node hash map, avoiding invocation of any move, copy, or swap operations on - // individual elements. - // - // All iterators and references on the `node_hash_map` remain valid, excepting - // for the past-the-end iterator, which is invalidated. - // - // `swap()` requires that the node hash map's hashing and key equivalence - // functions be Swappable, and are exchaged using unqualified calls to - // non-member `swap()`. If the map's allocator has - // `std::allocator_traits<allocator_type>::propagate_on_container_swap::value` - // set to `true`, the allocators are also exchanged using an unqualified call - // to non-member `swap()`; otherwise, the allocators are not swapped. - using Base::swap; - - // node_hash_map::rehash(count) - // - // Rehashes the `node_hash_map`, setting the number of slots to be at least - // the passed value. If the new number of slots increases the load factor more - // than the current maximum load factor - // (`count` < `size()` / `max_load_factor()`), then the new number of slots - // will be at least `size()` / `max_load_factor()`. - // - // To force a rehash, pass rehash(0). - using Base::rehash; - - // node_hash_map::reserve(count) - // - // Sets the number of slots in the `node_hash_map` to the number needed to - // accommodate at least `count` total elements without exceeding the current - // maximum load factor, and may rehash the container if needed. - using Base::reserve; - - // node_hash_map::at() - // - // Returns a reference to the mapped value of the element with key equivalent - // to the passed key. - using Base::at; - - // node_hash_map::contains() - // - // Determines whether an element with a key comparing equal to the given `key` - // exists within the `node_hash_map`, returning `true` if so or `false` - // otherwise. - using Base::contains; - - // node_hash_map::count(const Key& key) const - // - // Returns the number of elements with a key comparing equal to the given - // `key` within the `node_hash_map`. note that this function will return - // either `1` or `0` since duplicate keys are not allowed within a - // `node_hash_map`. - using Base::count; - - // node_hash_map::equal_range() - // - // Returns a closed range [first, last], defined by a `std::pair` of two - // iterators, containing all elements with the passed key in the - // `node_hash_map`. - using Base::equal_range; - - // node_hash_map::find() - // - // Finds an element with the passed `key` within the `node_hash_map`. - using Base::find; - - // node_hash_map::operator[]() - // - // Returns a reference to the value mapped to the passed key within the - // `node_hash_map`, performing an `insert()` if the key does not already - // exist. If an insertion occurs and results in a rehashing of the container, - // all iterators are invalidated. Otherwise iterators are not affected and - // references are not invalidated. Overloads are listed below. - // - // T& operator[](const Key& key): - // - // Inserts an init_type object constructed in-place if the element with the - // given key does not exist. - // - // T& operator[](Key&& key): - // - // Inserts an init_type object constructed in-place provided that an element - // with the given key does not exist. - using Base::operator[]; - - // node_hash_map::bucket_count() - // - // Returns the number of "buckets" within the `node_hash_map`. - using Base::bucket_count; - - // node_hash_map::load_factor() - // - // Returns the current load factor of the `node_hash_map` (the average number - // of slots occupied with a value within the hash map). - using Base::load_factor; - - // node_hash_map::max_load_factor() - // - // Manages the maximum load factor of the `node_hash_map`. Overloads are - // listed below. - // - // float node_hash_map::max_load_factor() - // - // Returns the current maximum load factor of the `node_hash_map`. - // - // void node_hash_map::max_load_factor(float ml) - // - // Sets the maximum load factor of the `node_hash_map` to the passed value. - // - // NOTE: This overload is provided only for API compatibility with the STL; - // `node_hash_map` will ignore any set load factor and manage its rehashing - // internally as an implementation detail. - using Base::max_load_factor; - - // node_hash_map::get_allocator() - // - // Returns the allocator function associated with this `node_hash_map`. - using Base::get_allocator; - - // node_hash_map::hash_function() - // - // Returns the hashing function used to hash the keys within this - // `node_hash_map`. - using Base::hash_function; - - // node_hash_map::key_eq() - // - // Returns the function used for comparing keys equality. - using Base::key_eq; -}; - -// erase_if(node_hash_map<>, Pred) -// -// Erases all elements that satisfy the predicate `pred` from the container `c`. -template <typename K, typename V, typename H, typename E, typename A, - typename Predicate> -void erase_if(node_hash_map<K, V, H, E, A>& c, Predicate pred) { - container_internal::EraseIf(pred, &c); -} - -namespace container_internal { - -template <class Key, class Value> -class NodeHashMapPolicy - : public absl::container_internal::node_hash_policy< - std::pair<const Key, Value>&, NodeHashMapPolicy<Key, Value>> { - using value_type = std::pair<const Key, Value>; - - public: - using key_type = Key; - using mapped_type = Value; - using init_type = std::pair</*non const*/ key_type, mapped_type>; - - template <class Allocator, class... Args> - static value_type* new_element(Allocator* alloc, Args&&... args) { - using PairAlloc = typename absl::allocator_traits< - Allocator>::template rebind_alloc<value_type>; - PairAlloc pair_alloc(*alloc); - value_type* res = - absl::allocator_traits<PairAlloc>::allocate(pair_alloc, 1); - absl::allocator_traits<PairAlloc>::construct(pair_alloc, res, - std::forward<Args>(args)...); - return res; - } - - template <class Allocator> - static void delete_element(Allocator* alloc, value_type* pair) { - using PairAlloc = typename absl::allocator_traits< - Allocator>::template rebind_alloc<value_type>; - PairAlloc pair_alloc(*alloc); - absl::allocator_traits<PairAlloc>::destroy(pair_alloc, pair); - absl::allocator_traits<PairAlloc>::deallocate(pair_alloc, pair, 1); - } - - template <class F, class... Args> - static decltype(absl::container_internal::DecomposePair( - std::declval<F>(), std::declval<Args>()...)) - apply(F&& f, Args&&... args) { - return absl::container_internal::DecomposePair(std::forward<F>(f), - std::forward<Args>(args)...); - } - - static size_t element_space_used(const value_type*) { - return sizeof(value_type); - } - - static Value& value(value_type* elem) { return elem->second; } - static const Value& value(const value_type* elem) { return elem->second; } -}; -} // namespace container_internal - -namespace container_algorithm_internal { - -// Specialization of trait in absl/algorithm/container.h -template <class Key, class T, class Hash, class KeyEqual, class Allocator> -struct IsUnorderedContainer< - absl::node_hash_map<Key, T, Hash, KeyEqual, Allocator>> : std::true_type {}; - -} // namespace container_algorithm_internal - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_NODE_HASH_MAP_H_ diff --git a/contrib/restricted/abseil-cpp/absl/container/node_hash_set.h b/contrib/restricted/abseil-cpp/absl/container/node_hash_set.h deleted file mode 100644 index 93b15f4681..0000000000 --- a/contrib/restricted/abseil-cpp/absl/container/node_hash_set.h +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: node_hash_set.h -// ----------------------------------------------------------------------------- -// -// An `absl::node_hash_set<T>` is an unordered associative container designed to -// be a more efficient replacement for `std::unordered_set`. Like -// `unordered_set`, search, insertion, and deletion of set elements can be done -// as an `O(1)` operation. However, `node_hash_set` (and other unordered -// associative containers known as the collection of Abseil "Swiss tables") -// contain other optimizations that result in both memory and computation -// advantages. -// -// In most cases, your default choice for a hash table should be a map of type -// `flat_hash_map` or a set of type `flat_hash_set`. However, if you need -// pointer stability, a `node_hash_set` should be your preferred choice. As -// well, if you are migrating your code from using `std::unordered_set`, a -// `node_hash_set` should be an easy migration. Consider migrating to -// `node_hash_set` and perhaps converting to a more efficient `flat_hash_set` -// upon further review. - -#ifndef ABSL_CONTAINER_NODE_HASH_SET_H_ -#define ABSL_CONTAINER_NODE_HASH_SET_H_ - -#include <type_traits> - -#include "absl/algorithm/container.h" -#include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export -#include "absl/container/internal/node_hash_policy.h" -#include "absl/container/internal/raw_hash_set.h" // IWYU pragma: export -#include "absl/memory/memory.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace container_internal { -template <typename T> -struct NodeHashSetPolicy; -} // namespace container_internal - -// ----------------------------------------------------------------------------- -// absl::node_hash_set -// ----------------------------------------------------------------------------- -// -// An `absl::node_hash_set<T>` is an unordered associative container which -// has been optimized for both speed and memory footprint in most common use -// cases. Its interface is similar to that of `std::unordered_set<T>` with the -// following notable differences: -// -// * Supports heterogeneous lookup, through `find()`, `operator[]()` and -// `insert()`, provided that the set is provided a compatible heterogeneous -// hashing function and equality operator. -// * Contains a `capacity()` member function indicating the number of element -// slots (open, deleted, and empty) within the hash set. -// * Returns `void` from the `erase(iterator)` overload. -// -// By default, `node_hash_set` uses the `absl::Hash` hashing framework. -// All fundamental and Abseil types that support the `absl::Hash` framework have -// a compatible equality operator for comparing insertions into `node_hash_set`. -// If your type is not yet supported by the `absl::Hash` framework, see -// absl/hash/hash.h for information on extending Abseil hashing to user-defined -// types. -// -// Example: -// -// // Create a node hash set of three strings -// absl::node_hash_set<std::string> ducks = -// {"huey", "dewey", "louie"}; -// -// // Insert a new element into the node hash set -// ducks.insert("donald"); -// -// // Force a rehash of the node hash set -// ducks.rehash(0); -// -// // See if "dewey" is present -// if (ducks.contains("dewey")) { -// std::cout << "We found dewey!" << std::endl; -// } -template <class T, class Hash = absl::container_internal::hash_default_hash<T>, - class Eq = absl::container_internal::hash_default_eq<T>, - class Alloc = std::allocator<T>> -class node_hash_set - : public absl::container_internal::raw_hash_set< - absl::container_internal::NodeHashSetPolicy<T>, Hash, Eq, Alloc> { - using Base = typename node_hash_set::raw_hash_set; - - public: - // Constructors and Assignment Operators - // - // A node_hash_set supports the same overload set as `std::unordered_set` - // for construction and assignment: - // - // * Default constructor - // - // // No allocation for the table's elements is made. - // absl::node_hash_set<std::string> set1; - // - // * Initializer List constructor - // - // absl::node_hash_set<std::string> set2 = - // {{"huey"}, {"dewey"}, {"louie"}}; - // - // * Copy constructor - // - // absl::node_hash_set<std::string> set3(set2); - // - // * Copy assignment operator - // - // // Hash functor and Comparator are copied as well - // absl::node_hash_set<std::string> set4; - // set4 = set3; - // - // * Move constructor - // - // // Move is guaranteed efficient - // absl::node_hash_set<std::string> set5(std::move(set4)); - // - // * Move assignment operator - // - // // May be efficient if allocators are compatible - // absl::node_hash_set<std::string> set6; - // set6 = std::move(set5); - // - // * Range constructor - // - // std::vector<std::string> v = {"a", "b"}; - // absl::node_hash_set<std::string> set7(v.begin(), v.end()); - node_hash_set() {} - using Base::Base; - - // node_hash_set::begin() - // - // Returns an iterator to the beginning of the `node_hash_set`. - using Base::begin; - - // node_hash_set::cbegin() - // - // Returns a const iterator to the beginning of the `node_hash_set`. - using Base::cbegin; - - // node_hash_set::cend() - // - // Returns a const iterator to the end of the `node_hash_set`. - using Base::cend; - - // node_hash_set::end() - // - // Returns an iterator to the end of the `node_hash_set`. - using Base::end; - - // node_hash_set::capacity() - // - // Returns the number of element slots (assigned, deleted, and empty) - // available within the `node_hash_set`. - // - // NOTE: this member function is particular to `absl::node_hash_set` and is - // not provided in the `std::unordered_set` API. - using Base::capacity; - - // node_hash_set::empty() - // - // Returns whether or not the `node_hash_set` is empty. - using Base::empty; - - // node_hash_set::max_size() - // - // Returns the largest theoretical possible number of elements within a - // `node_hash_set` under current memory constraints. This value can be thought - // of the largest value of `std::distance(begin(), end())` for a - // `node_hash_set<T>`. - using Base::max_size; - - // node_hash_set::size() - // - // Returns the number of elements currently within the `node_hash_set`. - using Base::size; - - // node_hash_set::clear() - // - // Removes all elements from the `node_hash_set`. Invalidates any references, - // pointers, or iterators referring to contained elements. - // - // NOTE: this operation may shrink the underlying buffer. To avoid shrinking - // the underlying buffer call `erase(begin(), end())`. - using Base::clear; - - // node_hash_set::erase() - // - // Erases elements within the `node_hash_set`. Erasing does not trigger a - // rehash. Overloads are listed below. - // - // void erase(const_iterator pos): - // - // Erases the element at `position` of the `node_hash_set`, returning - // `void`. - // - // NOTE: this return behavior is different than that of STL containers in - // general and `std::unordered_set` in particular. - // - // iterator erase(const_iterator first, const_iterator last): - // - // Erases the elements in the open interval [`first`, `last`), returning an - // iterator pointing to `last`. - // - // size_type erase(const key_type& key): - // - // Erases the element with the matching key, if it exists, returning the - // number of elements erased (0 or 1). - using Base::erase; - - // node_hash_set::insert() - // - // Inserts an element of the specified value into the `node_hash_set`, - // returning an iterator pointing to the newly inserted element, provided that - // an element with the given key does not already exist. If rehashing occurs - // due to the insertion, all iterators are invalidated. Overloads are listed - // below. - // - // std::pair<iterator,bool> insert(const T& value): - // - // Inserts a value into the `node_hash_set`. Returns a pair consisting of an - // iterator to the inserted element (or to the element that prevented the - // insertion) and a bool denoting whether the insertion took place. - // - // std::pair<iterator,bool> insert(T&& value): - // - // Inserts a moveable value into the `node_hash_set`. Returns a pair - // consisting of an iterator to the inserted element (or to the element that - // prevented the insertion) and a bool denoting whether the insertion took - // place. - // - // iterator insert(const_iterator hint, const T& value): - // iterator insert(const_iterator hint, T&& value): - // - // Inserts a value, using the position of `hint` as a non-binding suggestion - // for where to begin the insertion search. Returns an iterator to the - // inserted element, or to the existing element that prevented the - // insertion. - // - // void insert(InputIterator first, InputIterator last): - // - // Inserts a range of values [`first`, `last`). - // - // NOTE: Although the STL does not specify which element may be inserted if - // multiple keys compare equivalently, for `node_hash_set` we guarantee the - // first match is inserted. - // - // void insert(std::initializer_list<T> ilist): - // - // Inserts the elements within the initializer list `ilist`. - // - // NOTE: Although the STL does not specify which element may be inserted if - // multiple keys compare equivalently within the initializer list, for - // `node_hash_set` we guarantee the first match is inserted. - using Base::insert; - - // node_hash_set::emplace() - // - // Inserts an element of the specified value by constructing it in-place - // within the `node_hash_set`, provided that no element with the given key - // already exists. - // - // The element may be constructed even if there already is an element with the - // key in the container, in which case the newly constructed element will be - // destroyed immediately. - // - // If rehashing occurs due to the insertion, all iterators are invalidated. - using Base::emplace; - - // node_hash_set::emplace_hint() - // - // Inserts an element of the specified value by constructing it in-place - // within the `node_hash_set`, using the position of `hint` as a non-binding - // suggestion for where to begin the insertion search, and only inserts - // provided that no element with the given key already exists. - // - // The element may be constructed even if there already is an element with the - // key in the container, in which case the newly constructed element will be - // destroyed immediately. - // - // If rehashing occurs due to the insertion, all iterators are invalidated. - using Base::emplace_hint; - - // node_hash_set::extract() - // - // Extracts the indicated element, erasing it in the process, and returns it - // as a C++17-compatible node handle. Overloads are listed below. - // - // node_type extract(const_iterator position): - // - // Extracts the element at the indicated position and returns a node handle - // owning that extracted data. - // - // node_type extract(const key_type& x): - // - // Extracts the element with the key matching the passed key value and - // returns a node handle owning that extracted data. If the `node_hash_set` - // does not contain an element with a matching key, this function returns an - // empty node handle. - using Base::extract; - - // node_hash_set::merge() - // - // Extracts elements from a given `source` node hash set into this - // `node_hash_set`. If the destination `node_hash_set` already contains an - // element with an equivalent key, that element is not extracted. - using Base::merge; - - // node_hash_set::swap(node_hash_set& other) - // - // Exchanges the contents of this `node_hash_set` with those of the `other` - // node hash set, avoiding invocation of any move, copy, or swap operations on - // individual elements. - // - // All iterators and references on the `node_hash_set` remain valid, excepting - // for the past-the-end iterator, which is invalidated. - // - // `swap()` requires that the node hash set's hashing and key equivalence - // functions be Swappable, and are exchaged using unqualified calls to - // non-member `swap()`. If the set's allocator has - // `std::allocator_traits<allocator_type>::propagate_on_container_swap::value` - // set to `true`, the allocators are also exchanged using an unqualified call - // to non-member `swap()`; otherwise, the allocators are not swapped. - using Base::swap; - - // node_hash_set::rehash(count) - // - // Rehashes the `node_hash_set`, setting the number of slots to be at least - // the passed value. If the new number of slots increases the load factor more - // than the current maximum load factor - // (`count` < `size()` / `max_load_factor()`), then the new number of slots - // will be at least `size()` / `max_load_factor()`. - // - // To force a rehash, pass rehash(0). - // - // NOTE: unlike behavior in `std::unordered_set`, references are also - // invalidated upon a `rehash()`. - using Base::rehash; - - // node_hash_set::reserve(count) - // - // Sets the number of slots in the `node_hash_set` to the number needed to - // accommodate at least `count` total elements without exceeding the current - // maximum load factor, and may rehash the container if needed. - using Base::reserve; - - // node_hash_set::contains() - // - // Determines whether an element comparing equal to the given `key` exists - // within the `node_hash_set`, returning `true` if so or `false` otherwise. - using Base::contains; - - // node_hash_set::count(const Key& key) const - // - // Returns the number of elements comparing equal to the given `key` within - // the `node_hash_set`. note that this function will return either `1` or `0` - // since duplicate elements are not allowed within a `node_hash_set`. - using Base::count; - - // node_hash_set::equal_range() - // - // Returns a closed range [first, last], defined by a `std::pair` of two - // iterators, containing all elements with the passed key in the - // `node_hash_set`. - using Base::equal_range; - - // node_hash_set::find() - // - // Finds an element with the passed `key` within the `node_hash_set`. - using Base::find; - - // node_hash_set::bucket_count() - // - // Returns the number of "buckets" within the `node_hash_set`. Note that - // because a node hash set contains all elements within its internal storage, - // this value simply equals the current capacity of the `node_hash_set`. - using Base::bucket_count; - - // node_hash_set::load_factor() - // - // Returns the current load factor of the `node_hash_set` (the average number - // of slots occupied with a value within the hash set). - using Base::load_factor; - - // node_hash_set::max_load_factor() - // - // Manages the maximum load factor of the `node_hash_set`. Overloads are - // listed below. - // - // float node_hash_set::max_load_factor() - // - // Returns the current maximum load factor of the `node_hash_set`. - // - // void node_hash_set::max_load_factor(float ml) - // - // Sets the maximum load factor of the `node_hash_set` to the passed value. - // - // NOTE: This overload is provided only for API compatibility with the STL; - // `node_hash_set` will ignore any set load factor and manage its rehashing - // internally as an implementation detail. - using Base::max_load_factor; - - // node_hash_set::get_allocator() - // - // Returns the allocator function associated with this `node_hash_set`. - using Base::get_allocator; - - // node_hash_set::hash_function() - // - // Returns the hashing function used to hash the keys within this - // `node_hash_set`. - using Base::hash_function; - - // node_hash_set::key_eq() - // - // Returns the function used for comparing keys equality. - using Base::key_eq; -}; - -// erase_if(node_hash_set<>, Pred) -// -// Erases all elements that satisfy the predicate `pred` from the container `c`. -template <typename T, typename H, typename E, typename A, typename Predicate> -void erase_if(node_hash_set<T, H, E, A>& c, Predicate pred) { - container_internal::EraseIf(pred, &c); -} - -namespace container_internal { - -template <class T> -struct NodeHashSetPolicy - : absl::container_internal::node_hash_policy<T&, NodeHashSetPolicy<T>> { - using key_type = T; - using init_type = T; - using constant_iterators = std::true_type; - - template <class Allocator, class... Args> - static T* new_element(Allocator* alloc, Args&&... args) { - using ValueAlloc = - typename absl::allocator_traits<Allocator>::template rebind_alloc<T>; - ValueAlloc value_alloc(*alloc); - T* res = absl::allocator_traits<ValueAlloc>::allocate(value_alloc, 1); - absl::allocator_traits<ValueAlloc>::construct(value_alloc, res, - std::forward<Args>(args)...); - return res; - } - - template <class Allocator> - static void delete_element(Allocator* alloc, T* elem) { - using ValueAlloc = - typename absl::allocator_traits<Allocator>::template rebind_alloc<T>; - ValueAlloc value_alloc(*alloc); - absl::allocator_traits<ValueAlloc>::destroy(value_alloc, elem); - absl::allocator_traits<ValueAlloc>::deallocate(value_alloc, elem, 1); - } - - template <class F, class... Args> - static decltype(absl::container_internal::DecomposeValue( - std::declval<F>(), std::declval<Args>()...)) - apply(F&& f, Args&&... args) { - return absl::container_internal::DecomposeValue( - std::forward<F>(f), std::forward<Args>(args)...); - } - - static size_t element_space_used(const T*) { return sizeof(T); } -}; -} // namespace container_internal - -namespace container_algorithm_internal { - -// Specialization of trait in absl/algorithm/container.h -template <class Key, class Hash, class KeyEqual, class Allocator> -struct IsUnorderedContainer<absl::node_hash_set<Key, Hash, KeyEqual, Allocator>> - : std::true_type {}; - -} // namespace container_algorithm_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_CONTAINER_NODE_HASH_SET_H_ diff --git a/contrib/restricted/abseil-cpp/absl/debugging/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/debugging/.yandex_meta/licenses.list.txt deleted file mode 100644 index 030c5b94cf..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,24 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2020 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/debugging/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/debugging/CMakeLists.linux.txt deleted file mode 100644 index a73ff5ab2f..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/CMakeLists.linux.txt +++ /dev/null @@ -1,27 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-debugging) -target_compile_options(abseil-cpp-absl-debugging PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-debugging PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-debugging PUBLIC - contrib-libs-cxxsupp - base-internal-raw_logging - absl-base-log_severity -) -target_sources(abseil-cpp-absl-debugging PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/address_is_readable.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/elf_mem_image.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/vdso_support.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/debugging/CMakeLists.txt index e8c98bfd99..a73ff5ab2f 100644 --- a/contrib/restricted/abseil-cpp/absl/debugging/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/debugging/CMakeLists.txt @@ -6,6 +6,22 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-debugging) +target_compile_options(abseil-cpp-absl-debugging PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-debugging PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-debugging PUBLIC + contrib-libs-cxxsupp + base-internal-raw_logging + absl-base-log_severity +) +target_sources(abseil-cpp-absl-debugging PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/address_is_readable.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/elf_mem_image.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/vdso_support.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler/CMakeLists.linux.txt deleted file mode 100644 index a851c795d4..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler/CMakeLists.linux.txt +++ /dev/null @@ -1,37 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-debugging-failure_signal_handler) -target_compile_options(absl-debugging-failure_signal_handler PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-debugging-failure_signal_handler PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-debugging-failure_signal_handler PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-internal - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal -) -target_sources(absl-debugging-failure_signal_handler PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler/CMakeLists.txt index e8c98bfd99..a851c795d4 100644 --- a/contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler/CMakeLists.txt @@ -6,6 +6,32 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-debugging-failure_signal_handler) +target_compile_options(absl-debugging-failure_signal_handler PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-debugging-failure_signal_handler PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-debugging-failure_signal_handler PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-internal + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal +) +target_sources(absl-debugging-failure_signal_handler PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/internal/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/debugging/internal/.yandex_meta/licenses.list.txt deleted file mode 100644 index aac6c71d05..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/internal/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,52 +0,0 @@ -====================Apache-2.0==================== - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - - -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2021 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/debugging/internal/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/debugging/internal/CMakeLists.linux.txt deleted file mode 100644 index 563da4a130..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/internal/CMakeLists.linux.txt +++ /dev/null @@ -1,36 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-debugging-internal) -target_compile_options(absl-debugging-internal PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-debugging-internal PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-debugging-internal PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal -) -target_sources(absl-debugging-internal PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/examine_stack.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/internal/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/debugging/internal/CMakeLists.txt index e8c98bfd99..563da4a130 100644 --- a/contrib/restricted/abseil-cpp/absl/debugging/internal/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/debugging/internal/CMakeLists.txt @@ -6,6 +6,31 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-debugging-internal) +target_compile_options(absl-debugging-internal PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-debugging-internal PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-debugging-internal PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal +) +target_sources(absl-debugging-internal PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/examine_stack.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/internal/stack_consumption.h b/contrib/restricted/abseil-cpp/absl/debugging/internal/stack_consumption.h deleted file mode 100644 index f41b64c39d..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/internal/stack_consumption.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Helper function for measuring stack consumption of signal handlers. - -#ifndef ABSL_DEBUGGING_INTERNAL_STACK_CONSUMPTION_H_ -#define ABSL_DEBUGGING_INTERNAL_STACK_CONSUMPTION_H_ - -#include "absl/base/config.h" - -// The code in this module is not portable. -// Use this feature test macro to detect its availability. -#ifdef ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION -#error ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION cannot be set directly -#elif !defined(__APPLE__) && !defined(_WIN32) && \ - (defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || \ - defined(__aarch64__) || defined(__riscv)) -#define ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION 1 - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace debugging_internal { - -// Returns the stack consumption in bytes for the code exercised by -// signal_handler. To measure stack consumption, signal_handler is registered -// as a signal handler, so the code that it exercises must be async-signal -// safe. The argument of signal_handler is an implementation detail of signal -// handlers and should ignored by the code for signal_handler. Use global -// variables to pass information between your test code and signal_handler. -int GetSignalHandlerStackConsumption(void (*signal_handler)(int)); - -} // namespace debugging_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION - -#endif // ABSL_DEBUGGING_INTERNAL_STACK_CONSUMPTION_H_ diff --git a/contrib/restricted/abseil-cpp/absl/debugging/leak_check/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/debugging/leak_check/CMakeLists.linux.txt deleted file mode 100644 index 21d1737fd6..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/leak_check/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-debugging-leak_check) -target_compile_options(absl-debugging-leak_check PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-debugging-leak_check PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-debugging-leak_check PUBLIC - contrib-libs-cxxsupp -) -target_sources(absl-debugging-leak_check PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/leak_check.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/leak_check/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/debugging/leak_check/CMakeLists.txt index e8c98bfd99..21d1737fd6 100644 --- a/contrib/restricted/abseil-cpp/absl/debugging/leak_check/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/debugging/leak_check/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-debugging-leak_check) +target_compile_options(absl-debugging-leak_check PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-debugging-leak_check PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-debugging-leak_check PUBLIC + contrib-libs-cxxsupp +) +target_sources(absl-debugging-leak_check PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/leak_check.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable/CMakeLists.linux.txt deleted file mode 100644 index e20918adcb..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-debugging-leak_check_disable) -target_compile_options(absl-debugging-leak_check_disable PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-debugging-leak_check_disable PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-debugging-leak_check_disable PUBLIC - contrib-libs-cxxsupp -) -target_sources(absl-debugging-leak_check_disable PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable/CMakeLists.txt index e8c98bfd99..e20918adcb 100644 --- a/contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-debugging-leak_check_disable) +target_compile_options(absl-debugging-leak_check_disable PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-debugging-leak_check_disable PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-debugging-leak_check_disable PUBLIC + contrib-libs-cxxsupp +) +target_sources(absl-debugging-leak_check_disable PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/stacktrace/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/debugging/stacktrace/CMakeLists.linux.txt deleted file mode 100644 index ed64e87295..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/stacktrace/CMakeLists.linux.txt +++ /dev/null @@ -1,26 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-debugging-stacktrace) -target_compile_options(absl-debugging-stacktrace PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-debugging-stacktrace PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-debugging-stacktrace PUBLIC - contrib-libs-cxxsupp - base-internal-raw_logging - absl-base-log_severity - abseil-cpp-absl-debugging -) -target_sources(absl-debugging-stacktrace PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/stacktrace.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/stacktrace/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/debugging/stacktrace/CMakeLists.txt index e8c98bfd99..ed64e87295 100644 --- a/contrib/restricted/abseil-cpp/absl/debugging/stacktrace/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/debugging/stacktrace/CMakeLists.txt @@ -6,6 +6,21 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-debugging-stacktrace) +target_compile_options(absl-debugging-stacktrace PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-debugging-stacktrace PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-debugging-stacktrace PUBLIC + contrib-libs-cxxsupp + base-internal-raw_logging + absl-base-log_severity + abseil-cpp-absl-debugging +) +target_sources(absl-debugging-stacktrace PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/stacktrace.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/symbolize/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/debugging/symbolize/CMakeLists.linux.txt deleted file mode 100644 index 981b10aef2..0000000000 --- a/contrib/restricted/abseil-cpp/absl/debugging/symbolize/CMakeLists.linux.txt +++ /dev/null @@ -1,34 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-debugging-symbolize) -target_compile_options(absl-debugging-symbolize PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-debugging-symbolize PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-debugging-symbolize PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal -) -target_sources(absl-debugging-symbolize PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/symbolize.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/debugging/symbolize/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/debugging/symbolize/CMakeLists.txt index e8c98bfd99..981b10aef2 100644 --- a/contrib/restricted/abseil-cpp/absl/debugging/symbolize/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/debugging/symbolize/CMakeLists.txt @@ -6,6 +6,29 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-debugging-symbolize) +target_compile_options(absl-debugging-symbolize PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-debugging-symbolize PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-debugging-symbolize PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal +) +target_sources(absl-debugging-symbolize PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/symbolize.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/demangle/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/demangle/CMakeLists.linux.txt deleted file mode 100644 index 93ec34fc35..0000000000 --- a/contrib/restricted/abseil-cpp/absl/demangle/CMakeLists.linux.txt +++ /dev/null @@ -1,27 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-demangle) -target_compile_options(abseil-cpp-absl-demangle PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-demangle PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-demangle PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - absl-base-log_severity -) -target_sources(abseil-cpp-absl-demangle PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/demangle/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/demangle/CMakeLists.txt index e8c98bfd99..93ec34fc35 100644 --- a/contrib/restricted/abseil-cpp/absl/demangle/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/demangle/CMakeLists.txt @@ -6,6 +6,22 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-demangle) +target_compile_options(abseil-cpp-absl-demangle PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-demangle PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-demangle PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + absl-base-log_severity +) +target_sources(abseil-cpp-absl-demangle PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/flags/.yandex_meta/licenses.list.txt deleted file mode 100644 index 690ae5993e..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,24 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2019 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2020 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2021 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/flags/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/CMakeLists.linux.txt deleted file mode 100644 index b0b286edbd..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/CMakeLists.linux.txt +++ /dev/null @@ -1,63 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-flags) -target_compile_options(abseil-cpp-absl-flags PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-flags PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-flags PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-city - container-internal-absl_hashtablez_sampler - container-internal-raw_hash_set - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - absl-flags-commandlineflag - flags-internal-commandlineflag - flags-internal-flag - flags-internal-private_handle_accessor - flags-internal-program_name - absl-flags-marshalling - absl-flags-reflection - absl-flags-usage_config - abseil-cpp-absl-hash - absl-hash-internal - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - absl-strings-cord - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - strings-internal-str_format - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - absl-types-bad_optional_access - absl-types-bad_variant_access -) -target_sources(abseil-cpp-absl-flags PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/flag.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/CMakeLists.txt index e8c98bfd99..b0b286edbd 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/CMakeLists.txt @@ -6,6 +6,58 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-flags) +target_compile_options(abseil-cpp-absl-flags PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-flags PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-flags PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-city + container-internal-absl_hashtablez_sampler + container-internal-raw_hash_set + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + absl-flags-commandlineflag + flags-internal-commandlineflag + flags-internal-flag + flags-internal-private_handle_accessor + flags-internal-program_name + absl-flags-marshalling + absl-flags-reflection + absl-flags-usage_config + abseil-cpp-absl-hash + absl-hash-internal + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + absl-strings-cord + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + strings-internal-str_format + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + absl-types-bad_optional_access + absl-types-bad_variant_access +) +target_sources(abseil-cpp-absl-flags PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/flag.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/CMakeLists.linux.txt deleted file mode 100644 index 7ad63de764..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/CMakeLists.linux.txt +++ /dev/null @@ -1,33 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-flags-commandlineflag) -target_compile_options(absl-flags-commandlineflag PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-flags-commandlineflag PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-flags-commandlineflag PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - flags-internal-commandlineflag - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - absl-types-bad_optional_access -) -target_sources(absl-flags-commandlineflag PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/commandlineflag.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/CMakeLists.txt index e8c98bfd99..7ad63de764 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/CMakeLists.txt @@ -6,6 +6,28 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-flags-commandlineflag) +target_compile_options(absl-flags-commandlineflag PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-flags-commandlineflag PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-flags-commandlineflag PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + flags-internal-commandlineflag + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + absl-types-bad_optional_access +) +target_sources(absl-flags-commandlineflag PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/commandlineflag.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/CMakeLists.linux.txt deleted file mode 100644 index 93e6f8e3f0..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(flags-internal-commandlineflag) -target_compile_options(flags-internal-commandlineflag PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(flags-internal-commandlineflag PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(flags-internal-commandlineflag PUBLIC - contrib-libs-cxxsupp -) -target_sources(flags-internal-commandlineflag PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/CMakeLists.txt index e8c98bfd99..93e6f8e3f0 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(flags-internal-commandlineflag) +target_compile_options(flags-internal-commandlineflag PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(flags-internal-commandlineflag PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(flags-internal-commandlineflag PUBLIC + contrib-libs-cxxsupp +) +target_sources(flags-internal-commandlineflag PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/flag/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/flag/CMakeLists.linux.txt deleted file mode 100644 index 12a17ab968..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/flag/CMakeLists.linux.txt +++ /dev/null @@ -1,48 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(flags-internal-flag) -target_compile_options(flags-internal-flag PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(flags-internal-flag PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(flags-internal-flag PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - absl-flags-commandlineflag - flags-internal-commandlineflag - flags-internal-program_name - absl-flags-marshalling - absl-flags-usage_config - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - strings-internal-str_format - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - absl-types-bad_optional_access -) -target_sources(flags-internal-flag PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/flag/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/flag/CMakeLists.txt index e8c98bfd99..12a17ab968 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/flag/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/internal/flag/CMakeLists.txt @@ -6,6 +6,43 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(flags-internal-flag) +target_compile_options(flags-internal-flag PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(flags-internal-flag PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(flags-internal-flag PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + absl-flags-commandlineflag + flags-internal-commandlineflag + flags-internal-program_name + absl-flags-marshalling + absl-flags-usage_config + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + strings-internal-str_format + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + absl-types-bad_optional_access +) +target_sources(flags-internal-flag PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/CMakeLists.linux.txt deleted file mode 100644 index 0db0b57ea2..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/CMakeLists.linux.txt +++ /dev/null @@ -1,34 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(flags-internal-private_handle_accessor) -target_compile_options(flags-internal-private_handle_accessor PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(flags-internal-private_handle_accessor PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(flags-internal-private_handle_accessor PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - absl-flags-commandlineflag - flags-internal-commandlineflag - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - absl-types-bad_optional_access -) -target_sources(flags-internal-private_handle_accessor PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/CMakeLists.txt index e8c98bfd99..0db0b57ea2 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/CMakeLists.txt @@ -6,6 +6,29 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(flags-internal-private_handle_accessor) +target_compile_options(flags-internal-private_handle_accessor PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(flags-internal-private_handle_accessor PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(flags-internal-private_handle_accessor PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + absl-flags-commandlineflag + flags-internal-commandlineflag + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + absl-types-bad_optional_access +) +target_sources(flags-internal-private_handle_accessor PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/CMakeLists.linux.txt deleted file mode 100644 index fbf88c4e9c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/CMakeLists.linux.txt +++ /dev/null @@ -1,41 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(flags-internal-program_name) -target_compile_options(flags-internal-program_name PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(flags-internal-program_name PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(flags-internal-program_name PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone -) -target_sources(flags-internal-program_name PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/CMakeLists.txt index e8c98bfd99..fbf88c4e9c 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/CMakeLists.txt @@ -6,6 +6,36 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(flags-internal-program_name) +target_compile_options(flags-internal-program_name PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(flags-internal-program_name PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(flags-internal-program_name PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone +) +target_sources(flags-internal-program_name PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/usage/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/usage/CMakeLists.linux.txt deleted file mode 100644 index cd7a9be042..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/usage/CMakeLists.linux.txt +++ /dev/null @@ -1,64 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(flags-internal-usage) -target_compile_options(flags-internal-usage PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(flags-internal-usage PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(flags-internal-usage PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-city - container-internal-absl_hashtablez_sampler - container-internal-raw_hash_set - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-flags - absl-flags-commandlineflag - flags-internal-commandlineflag - flags-internal-flag - flags-internal-private_handle_accessor - flags-internal-program_name - absl-flags-marshalling - absl-flags-reflection - absl-flags-usage_config - abseil-cpp-absl-hash - absl-hash-internal - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - absl-strings-cord - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - strings-internal-str_format - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - absl-types-bad_optional_access - absl-types-bad_variant_access -) -target_sources(flags-internal-usage PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/usage/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/internal/usage/CMakeLists.txt index e8c98bfd99..cd7a9be042 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/internal/usage/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/internal/usage/CMakeLists.txt @@ -6,6 +6,59 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(flags-internal-usage) +target_compile_options(flags-internal-usage PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(flags-internal-usage PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(flags-internal-usage PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-city + container-internal-absl_hashtablez_sampler + container-internal-raw_hash_set + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-flags + absl-flags-commandlineflag + flags-internal-commandlineflag + flags-internal-flag + flags-internal-private_handle_accessor + flags-internal-program_name + absl-flags-marshalling + absl-flags-reflection + absl-flags-usage_config + abseil-cpp-absl-hash + absl-hash-internal + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + absl-strings-cord + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + strings-internal-str_format + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + absl-types-bad_optional_access + absl-types-bad_variant_access +) +target_sources(flags-internal-usage PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/marshalling/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/marshalling/CMakeLists.linux.txt deleted file mode 100644 index 5b6476f8a9..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/marshalling/CMakeLists.linux.txt +++ /dev/null @@ -1,32 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-flags-marshalling) -target_compile_options(absl-flags-marshalling PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-flags-marshalling PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-flags-marshalling PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - strings-internal-str_format -) -target_sources(absl-flags-marshalling PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/marshalling.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/marshalling/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/marshalling/CMakeLists.txt index e8c98bfd99..5b6476f8a9 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/marshalling/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/marshalling/CMakeLists.txt @@ -6,6 +6,27 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-flags-marshalling) +target_compile_options(absl-flags-marshalling PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-flags-marshalling PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-flags-marshalling PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + strings-internal-str_format +) +target_sources(absl-flags-marshalling PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/marshalling.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/parse/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/parse/CMakeLists.linux.txt deleted file mode 100644 index c92b9e3b03..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/parse/CMakeLists.linux.txt +++ /dev/null @@ -1,66 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-flags-parse) -target_compile_options(absl-flags-parse PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-flags-parse PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-flags-parse PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-city - container-internal-absl_hashtablez_sampler - container-internal-raw_hash_set - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-flags - absl-flags-commandlineflag - flags-internal-commandlineflag - flags-internal-flag - flags-internal-private_handle_accessor - flags-internal-program_name - flags-internal-usage - absl-flags-marshalling - absl-flags-reflection - absl-flags-usage - absl-flags-usage_config - abseil-cpp-absl-hash - absl-hash-internal - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - absl-strings-cord - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - strings-internal-str_format - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - absl-types-bad_optional_access - absl-types-bad_variant_access -) -target_sources(absl-flags-parse PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/parse.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/parse/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/parse/CMakeLists.txt index e8c98bfd99..c92b9e3b03 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/parse/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/parse/CMakeLists.txt @@ -6,6 +6,61 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-flags-parse) +target_compile_options(absl-flags-parse PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-flags-parse PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-flags-parse PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-city + container-internal-absl_hashtablez_sampler + container-internal-raw_hash_set + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-flags + absl-flags-commandlineflag + flags-internal-commandlineflag + flags-internal-flag + flags-internal-private_handle_accessor + flags-internal-program_name + flags-internal-usage + absl-flags-marshalling + absl-flags-reflection + absl-flags-usage + absl-flags-usage_config + abseil-cpp-absl-hash + absl-hash-internal + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + absl-strings-cord + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + strings-internal-str_format + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + absl-types-bad_optional_access + absl-types-bad_variant_access +) +target_sources(absl-flags-parse PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/parse.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/reflection/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/reflection/CMakeLists.linux.txt deleted file mode 100644 index b8115d351a..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/reflection/CMakeLists.linux.txt +++ /dev/null @@ -1,59 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-flags-reflection) -target_compile_options(absl-flags-reflection PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-flags-reflection PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-flags-reflection PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-city - container-internal-absl_hashtablez_sampler - container-internal-raw_hash_set - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - absl-flags-commandlineflag - flags-internal-commandlineflag - flags-internal-private_handle_accessor - flags-internal-program_name - absl-flags-usage_config - abseil-cpp-absl-hash - absl-hash-internal - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - absl-strings-cord - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - absl-types-bad_optional_access - absl-types-bad_variant_access -) -target_sources(absl-flags-reflection PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/reflection.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/reflection/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/reflection/CMakeLists.txt index e8c98bfd99..b8115d351a 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/reflection/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/reflection/CMakeLists.txt @@ -6,6 +6,54 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-flags-reflection) +target_compile_options(absl-flags-reflection PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-flags-reflection PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-flags-reflection PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-city + container-internal-absl_hashtablez_sampler + container-internal-raw_hash_set + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + absl-flags-commandlineflag + flags-internal-commandlineflag + flags-internal-private_handle_accessor + flags-internal-program_name + absl-flags-usage_config + abseil-cpp-absl-hash + absl-hash-internal + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + absl-strings-cord + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + absl-types-bad_optional_access + absl-types-bad_variant_access +) +target_sources(absl-flags-reflection PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/reflection.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/usage/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/usage/CMakeLists.linux.txt deleted file mode 100644 index 70f9e6f523..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/usage/CMakeLists.linux.txt +++ /dev/null @@ -1,65 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-flags-usage) -target_compile_options(absl-flags-usage PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-flags-usage PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-flags-usage PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-city - container-internal-absl_hashtablez_sampler - container-internal-raw_hash_set - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-flags - absl-flags-commandlineflag - flags-internal-commandlineflag - flags-internal-flag - flags-internal-private_handle_accessor - flags-internal-program_name - flags-internal-usage - absl-flags-marshalling - absl-flags-reflection - absl-flags-usage_config - abseil-cpp-absl-hash - absl-hash-internal - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - absl-strings-cord - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - strings-internal-str_format - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - absl-types-bad_optional_access - absl-types-bad_variant_access -) -target_sources(absl-flags-usage PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/usage.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/usage/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/usage/CMakeLists.txt index e8c98bfd99..70f9e6f523 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/usage/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/usage/CMakeLists.txt @@ -6,6 +6,60 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-flags-usage) +target_compile_options(absl-flags-usage PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-flags-usage PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-flags-usage PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-city + container-internal-absl_hashtablez_sampler + container-internal-raw_hash_set + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-flags + absl-flags-commandlineflag + flags-internal-commandlineflag + flags-internal-flag + flags-internal-private_handle_accessor + flags-internal-program_name + flags-internal-usage + absl-flags-marshalling + absl-flags-reflection + absl-flags-usage_config + abseil-cpp-absl-hash + absl-hash-internal + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + absl-strings-cord + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + strings-internal-str_format + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + absl-types-bad_optional_access + absl-types-bad_variant_access +) +target_sources(absl-flags-usage PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/usage.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/flags/usage_config/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/flags/usage_config/CMakeLists.linux.txt deleted file mode 100644 index 657f28eb21..0000000000 --- a/contrib/restricted/abseil-cpp/absl/flags/usage_config/CMakeLists.linux.txt +++ /dev/null @@ -1,42 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-flags-usage_config) -target_compile_options(absl-flags-usage_config PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-flags-usage_config PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-flags-usage_config PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - flags-internal-program_name - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone -) -target_sources(absl-flags-usage_config PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/usage_config.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/flags/usage_config/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/flags/usage_config/CMakeLists.txt index e8c98bfd99..657f28eb21 100644 --- a/contrib/restricted/abseil-cpp/absl/flags/usage_config/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/flags/usage_config/CMakeLists.txt @@ -6,6 +6,37 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-flags-usage_config) +target_compile_options(absl-flags-usage_config PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-flags-usage_config PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-flags-usage_config PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + flags-internal-program_name + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone +) +target_sources(absl-flags-usage_config PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/flags/usage_config.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/functional/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/functional/.yandex_meta/licenses.list.txt deleted file mode 100644 index 7b6169efac..0000000000 --- a/contrib/restricted/abseil-cpp/absl/functional/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,20 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2019 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/functional/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/functional/CMakeLists.linux.txt deleted file mode 100644 index 31ea222c83..0000000000 --- a/contrib/restricted/abseil-cpp/absl/functional/CMakeLists.linux.txt +++ /dev/null @@ -1,10 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-functional INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/functional/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/functional/CMakeLists.txt index e8c98bfd99..31ea222c83 100644 --- a/contrib/restricted/abseil-cpp/absl/functional/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/functional/CMakeLists.txt @@ -6,6 +6,5 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-functional INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/functional/bind_front.h b/contrib/restricted/abseil-cpp/absl/functional/bind_front.h deleted file mode 100644 index 5b47970e35..0000000000 --- a/contrib/restricted/abseil-cpp/absl/functional/bind_front.h +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: bind_front.h -// ----------------------------------------------------------------------------- -// -// `absl::bind_front()` returns a functor by binding a number of arguments to -// the front of a provided (usually more generic) functor. Unlike `std::bind`, -// it does not require the use of argument placeholders. The simpler syntax of -// `absl::bind_front()` allows you to avoid known misuses with `std::bind()`. -// -// `absl::bind_front()` is meant as a drop-in replacement for C++20's upcoming -// `std::bind_front()`, which similarly resolves these issues with -// `std::bind()`. Both `bind_front()` alternatives, unlike `std::bind()`, allow -// partial function application. (See -// https://en.wikipedia.org/wiki/Partial_application). - -#ifndef ABSL_FUNCTIONAL_BIND_FRONT_H_ -#define ABSL_FUNCTIONAL_BIND_FRONT_H_ - -#include "absl/functional/internal/front_binder.h" -#include "absl/utility/utility.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// bind_front() -// -// Binds the first N arguments of an invocable object and stores them by value. -// -// Like `std::bind()`, `absl::bind_front()` is implicitly convertible to -// `std::function`. In particular, it may be used as a simpler replacement for -// `std::bind()` in most cases, as it does not require placeholders to be -// specified. More importantly, it provides more reliable correctness guarantees -// than `std::bind()`; while `std::bind()` will silently ignore passing more -// parameters than expected, for example, `absl::bind_front()` will report such -// mis-uses as errors. -// -// absl::bind_front(a...) can be seen as storing the results of -// std::make_tuple(a...). -// -// Example: Binding a free function. -// -// int Minus(int a, int b) { return a - b; } -// -// assert(absl::bind_front(Minus)(3, 2) == 3 - 2); -// assert(absl::bind_front(Minus, 3)(2) == 3 - 2); -// assert(absl::bind_front(Minus, 3, 2)() == 3 - 2); -// -// Example: Binding a member function. -// -// struct Math { -// int Double(int a) const { return 2 * a; } -// }; -// -// Math math; -// -// assert(absl::bind_front(&Math::Double)(&math, 3) == 2 * 3); -// // Stores a pointer to math inside the functor. -// assert(absl::bind_front(&Math::Double, &math)(3) == 2 * 3); -// // Stores a copy of math inside the functor. -// assert(absl::bind_front(&Math::Double, math)(3) == 2 * 3); -// // Stores std::unique_ptr<Math> inside the functor. -// assert(absl::bind_front(&Math::Double, -// std::unique_ptr<Math>(new Math))(3) == 2 * 3); -// -// Example: Using `absl::bind_front()`, instead of `std::bind()`, with -// `std::function`. -// -// class FileReader { -// public: -// void ReadFileAsync(const std::string& filename, std::string* content, -// const std::function<void()>& done) { -// // Calls Executor::Schedule(std::function<void()>). -// Executor::DefaultExecutor()->Schedule( -// absl::bind_front(&FileReader::BlockingRead, this, -// filename, content, done)); -// } -// -// private: -// void BlockingRead(const std::string& filename, std::string* content, -// const std::function<void()>& done) { -// CHECK_OK(file::GetContents(filename, content, {})); -// done(); -// } -// }; -// -// `absl::bind_front()` stores bound arguments explicitly using the type passed -// rather than implicitly based on the type accepted by its functor. -// -// Example: Binding arguments explicitly. -// -// void LogStringView(absl::string_view sv) { -// LOG(INFO) << sv; -// } -// -// Executor* e = Executor::DefaultExecutor(); -// std::string s = "hello"; -// absl::string_view sv = s; -// -// // absl::bind_front(LogStringView, arg) makes a copy of arg and stores it. -// e->Schedule(absl::bind_front(LogStringView, sv)); // ERROR: dangling -// // string_view. -// -// e->Schedule(absl::bind_front(LogStringView, s)); // OK: stores a copy of -// // s. -// -// To store some of the arguments passed to `absl::bind_front()` by reference, -// use std::ref()` and `std::cref()`. -// -// Example: Storing some of the bound arguments by reference. -// -// class Service { -// public: -// void Serve(const Request& req, std::function<void()>* done) { -// // The request protocol buffer won't be deleted until done is called. -// // It's safe to store a reference to it inside the functor. -// Executor::DefaultExecutor()->Schedule( -// absl::bind_front(&Service::BlockingServe, this, std::cref(req), -// done)); -// } -// -// private: -// void BlockingServe(const Request& req, std::function<void()>* done); -// }; -// -// Example: Storing bound arguments by reference. -// -// void Print(const std::string& a, const std::string& b) { -// std::cerr << a << b; -// } -// -// std::string hi = "Hello, "; -// std::vector<std::string> names = {"Chuk", "Gek"}; -// // Doesn't copy hi. -// for_each(names.begin(), names.end(), -// absl::bind_front(Print, std::ref(hi))); -// -// // DO NOT DO THIS: the functor may outlive "hi", resulting in -// // dangling references. -// foo->DoInFuture(absl::bind_front(Print, std::ref(hi), "Guest")); // BAD! -// auto f = absl::bind_front(Print, std::ref(hi), "Guest"); // BAD! -// -// Example: Storing reference-like types. -// -// void Print(absl::string_view a, const std::string& b) { -// std::cerr << a << b; -// } -// -// std::string hi = "Hello, "; -// // Copies "hi". -// absl::bind_front(Print, hi)("Chuk"); -// -// // Compile error: std::reference_wrapper<const string> is not implicitly -// // convertible to string_view. -// // absl::bind_front(Print, std::cref(hi))("Chuk"); -// -// // Doesn't copy "hi". -// absl::bind_front(Print, absl::string_view(hi))("Chuk"); -// -template <class F, class... BoundArgs> -constexpr functional_internal::bind_front_t<F, BoundArgs...> bind_front( - F&& func, BoundArgs&&... args) { - return functional_internal::bind_front_t<F, BoundArgs...>( - absl::in_place, absl::forward<F>(func), - absl::forward<BoundArgs>(args)...); -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_FUNCTIONAL_BIND_FRONT_H_ diff --git a/contrib/restricted/abseil-cpp/absl/functional/internal/front_binder.h b/contrib/restricted/abseil-cpp/absl/functional/internal/front_binder.h deleted file mode 100644 index 45f52de73d..0000000000 --- a/contrib/restricted/abseil-cpp/absl/functional/internal/front_binder.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Implementation details for `absl::bind_front()`. - -#ifndef ABSL_FUNCTIONAL_INTERNAL_FRONT_BINDER_H_ -#define ABSL_FUNCTIONAL_INTERNAL_FRONT_BINDER_H_ - -#include <cstddef> -#include <type_traits> -#include <utility> - -#include "absl/base/internal/invoke.h" -#include "absl/container/internal/compressed_tuple.h" -#include "absl/meta/type_traits.h" -#include "absl/utility/utility.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace functional_internal { - -// Invoke the method, expanding the tuple of bound arguments. -template <class R, class Tuple, size_t... Idx, class... Args> -R Apply(Tuple&& bound, absl::index_sequence<Idx...>, Args&&... free) { - return base_internal::invoke( - absl::forward<Tuple>(bound).template get<Idx>()..., - absl::forward<Args>(free)...); -} - -template <class F, class... BoundArgs> -class FrontBinder { - using BoundArgsT = absl::container_internal::CompressedTuple<F, BoundArgs...>; - using Idx = absl::make_index_sequence<sizeof...(BoundArgs) + 1>; - - BoundArgsT bound_args_; - - public: - template <class... Ts> - constexpr explicit FrontBinder(absl::in_place_t, Ts&&... ts) - : bound_args_(absl::forward<Ts>(ts)...) {} - - template <class... FreeArgs, class R = base_internal::invoke_result_t< - F&, BoundArgs&..., FreeArgs&&...>> - R operator()(FreeArgs&&... free_args) & { - return functional_internal::Apply<R>(bound_args_, Idx(), - absl::forward<FreeArgs>(free_args)...); - } - - template <class... FreeArgs, - class R = base_internal::invoke_result_t< - const F&, const BoundArgs&..., FreeArgs&&...>> - R operator()(FreeArgs&&... free_args) const& { - return functional_internal::Apply<R>(bound_args_, Idx(), - absl::forward<FreeArgs>(free_args)...); - } - - template <class... FreeArgs, class R = base_internal::invoke_result_t< - F&&, BoundArgs&&..., FreeArgs&&...>> - R operator()(FreeArgs&&... free_args) && { - // This overload is called when *this is an rvalue. If some of the bound - // arguments are stored by value or rvalue reference, we move them. - return functional_internal::Apply<R>(absl::move(bound_args_), Idx(), - absl::forward<FreeArgs>(free_args)...); - } - - template <class... FreeArgs, - class R = base_internal::invoke_result_t< - const F&&, const BoundArgs&&..., FreeArgs&&...>> - R operator()(FreeArgs&&... free_args) const&& { - // This overload is called when *this is an rvalue. If some of the bound - // arguments are stored by value or rvalue reference, we move them. - return functional_internal::Apply<R>(absl::move(bound_args_), Idx(), - absl::forward<FreeArgs>(free_args)...); - } -}; - -template <class F, class... BoundArgs> -using bind_front_t = FrontBinder<decay_t<F>, absl::decay_t<BoundArgs>...>; - -} // namespace functional_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_FUNCTIONAL_INTERNAL_FRONT_BINDER_H_ diff --git a/contrib/restricted/abseil-cpp/absl/hash/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/hash/.yandex_meta/licenses.list.txt deleted file mode 100644 index 6e98312194..0000000000 --- a/contrib/restricted/abseil-cpp/absl/hash/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,16 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/hash/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/hash/CMakeLists.linux.txt deleted file mode 100644 index 23d66a6f73..0000000000 --- a/contrib/restricted/abseil-cpp/absl/hash/CMakeLists.linux.txt +++ /dev/null @@ -1,37 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-hash) -target_compile_options(abseil-cpp-absl-hash PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-hash PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-hash PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-city - absl-hash-internal - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - abseil-cpp-absl-types - absl-types-bad_optional_access - absl-types-bad_variant_access - absl-types-internal -) -target_sources(abseil-cpp-absl-hash PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/hash/internal/hash.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/hash/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/hash/CMakeLists.txt index e8c98bfd99..23d66a6f73 100644 --- a/contrib/restricted/abseil-cpp/absl/hash/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/hash/CMakeLists.txt @@ -6,6 +6,32 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-hash) +target_compile_options(abseil-cpp-absl-hash PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-hash PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-hash PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-city + absl-hash-internal + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + abseil-cpp-absl-types + absl-types-bad_optional_access + absl-types-bad_variant_access + absl-types-internal +) +target_sources(abseil-cpp-absl-hash PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/hash/internal/hash.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/hash/hash_testing.h b/contrib/restricted/abseil-cpp/absl/hash/hash_testing.h deleted file mode 100644 index 1e1c574149..0000000000 --- a/contrib/restricted/abseil-cpp/absl/hash/hash_testing.h +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_HASH_HASH_TESTING_H_ -#define ABSL_HASH_HASH_TESTING_H_ - -#include <initializer_list> -#include <tuple> -#include <type_traits> -#include <vector> - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/hash/internal/spy_hash_state.h" -#include "absl/meta/type_traits.h" -#include "absl/strings/str_cat.h" -#include "absl/types/variant.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// Run the absl::Hash algorithm over all the elements passed in and verify that -// their hash expansion is congruent with their `==` operator. -// -// It is used in conjunction with EXPECT_TRUE. Failures will output information -// on what requirement failed and on which objects. -// -// Users should pass a collection of types as either an initializer list or a -// container of cases. -// -// EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly( -// {v1, v2, ..., vN})); -// -// std::vector<MyType> cases; -// // Fill cases... -// EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(cases)); -// -// Users can pass a variety of types for testing heterogeneous lookup with -// `std::make_tuple`: -// -// EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly( -// std::make_tuple(v1, v2, ..., vN))); -// -// -// Ideally, the values passed should provide enough coverage of the `==` -// operator and the AbslHashValue implementations. -// For dynamically sized types, the empty state should usually be included in -// the values. -// -// The function accepts an optional comparator function, in case that `==` is -// not enough for the values provided. -// -// Usage: -// -// EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly( -// std::make_tuple(v1, v2, ..., vN), MyCustomEq{})); -// -// It checks the following requirements: -// 1. The expansion for a value is deterministic. -// 2. For any two objects `a` and `b` in the sequence, if `a == b` evaluates -// to true, then their hash expansion must be equal. -// 3. If `a == b` evaluates to false their hash expansion must be unequal. -// 4. If `a == b` evaluates to false neither hash expansion can be a -// suffix of the other. -// 5. AbslHashValue overloads should not be called by the user. They are only -// meant to be called by the framework. Users should call H::combine() and -// H::combine_contiguous(). -// 6. No moved-from instance of the hash state is used in the implementation -// of AbslHashValue. -// -// The values do not have to have the same type. This can be useful for -// equivalent types that support heterogeneous lookup. -// -// A possible reason for breaking (2) is combining state in the hash expansion -// that was not used in `==`. -// For example: -// -// struct Bad2 { -// int a, b; -// template <typename H> -// friend H AbslHashValue(H state, Bad2 x) { -// // Uses a and b. -// return H::combine(std::move(state), x.a, x.b); -// } -// friend bool operator==(Bad2 x, Bad2 y) { -// // Only uses a. -// return x.a == y.a; -// } -// }; -// -// As for (3), breaking this usually means that there is state being passed to -// the `==` operator that is not used in the hash expansion. -// For example: -// -// struct Bad3 { -// int a, b; -// template <typename H> -// friend H AbslHashValue(H state, Bad3 x) { -// // Only uses a. -// return H::combine(std::move(state), x.a); -// } -// friend bool operator==(Bad3 x, Bad3 y) { -// // Uses a and b. -// return x.a == y.a && x.b == y.b; -// } -// }; -// -// Finally, a common way to break 4 is by combining dynamic ranges without -// combining the size of the range. -// For example: -// -// struct Bad4 { -// int *p, size; -// template <typename H> -// friend H AbslHashValue(H state, Bad4 x) { -// return H::combine_contiguous(std::move(state), x.p, x.p + x.size); -// } -// friend bool operator==(Bad4 x, Bad4 y) { -// // Compare two ranges for equality. C++14 code can instead use std::equal. -// return absl::equal(x.p, x.p + x.size, y.p, y.p + y.size); -// } -// }; -// -// An easy solution to this is to combine the size after combining the range, -// like so: -// template <typename H> -// friend H AbslHashValue(H state, Bad4 x) { -// return H::combine( -// H::combine_contiguous(std::move(state), x.p, x.p + x.size), x.size); -// } -// -template <int&... ExplicitBarrier, typename Container> -ABSL_MUST_USE_RESULT testing::AssertionResult -VerifyTypeImplementsAbslHashCorrectly(const Container& values); - -template <int&... ExplicitBarrier, typename Container, typename Eq> -ABSL_MUST_USE_RESULT testing::AssertionResult -VerifyTypeImplementsAbslHashCorrectly(const Container& values, Eq equals); - -template <int&..., typename T> -ABSL_MUST_USE_RESULT testing::AssertionResult -VerifyTypeImplementsAbslHashCorrectly(std::initializer_list<T> values); - -template <int&..., typename T, typename Eq> -ABSL_MUST_USE_RESULT testing::AssertionResult -VerifyTypeImplementsAbslHashCorrectly(std::initializer_list<T> values, - Eq equals); - -namespace hash_internal { - -struct PrintVisitor { - size_t index; - template <typename T> - std::string operator()(const T* value) const { - return absl::StrCat("#", index, "(", testing::PrintToString(*value), ")"); - } -}; - -template <typename Eq> -struct EqVisitor { - Eq eq; - template <typename T, typename U> - bool operator()(const T* t, const U* u) const { - return eq(*t, *u); - } -}; - -struct ExpandVisitor { - template <typename T> - SpyHashState operator()(const T* value) const { - return SpyHashState::combine(SpyHashState(), *value); - } -}; - -template <typename Container, typename Eq> -ABSL_MUST_USE_RESULT testing::AssertionResult -VerifyTypeImplementsAbslHashCorrectly(const Container& values, Eq equals) { - using V = typename Container::value_type; - - struct Info { - const V& value; - size_t index; - std::string ToString() const { - return absl::visit(PrintVisitor{index}, value); - } - SpyHashState expand() const { return absl::visit(ExpandVisitor{}, value); } - }; - - using EqClass = std::vector<Info>; - std::vector<EqClass> classes; - - // Gather the values in equivalence classes. - size_t i = 0; - for (const auto& value : values) { - EqClass* c = nullptr; - for (auto& eqclass : classes) { - if (absl::visit(EqVisitor<Eq>{equals}, value, eqclass[0].value)) { - c = &eqclass; - break; - } - } - if (c == nullptr) { - classes.emplace_back(); - c = &classes.back(); - } - c->push_back({value, i}); - ++i; - - // Verify potential errors captured by SpyHashState. - if (auto error = c->back().expand().error()) { - return testing::AssertionFailure() << *error; - } - } - - if (classes.size() < 2) { - return testing::AssertionFailure() - << "At least two equivalence classes are expected."; - } - - // We assume that equality is correctly implemented. - // Now we verify that AbslHashValue is also correctly implemented. - - for (const auto& c : classes) { - // All elements of the equivalence class must have the same hash - // expansion. - const SpyHashState expected = c[0].expand(); - for (const Info& v : c) { - if (v.expand() != v.expand()) { - return testing::AssertionFailure() - << "Hash expansion for " << v.ToString() - << " is non-deterministic."; - } - if (v.expand() != expected) { - return testing::AssertionFailure() - << "Values " << c[0].ToString() << " and " << v.ToString() - << " evaluate as equal but have an unequal hash expansion."; - } - } - - // Elements from other classes must have different hash expansion. - for (const auto& c2 : classes) { - if (&c == &c2) continue; - const SpyHashState c2_hash = c2[0].expand(); - switch (SpyHashState::Compare(expected, c2_hash)) { - case SpyHashState::CompareResult::kEqual: - return testing::AssertionFailure() - << "Values " << c[0].ToString() << " and " << c2[0].ToString() - << " evaluate as unequal but have an equal hash expansion."; - case SpyHashState::CompareResult::kBSuffixA: - return testing::AssertionFailure() - << "Hash expansion of " << c2[0].ToString() - << " is a suffix of the hash expansion of " << c[0].ToString() - << "."; - case SpyHashState::CompareResult::kASuffixB: - return testing::AssertionFailure() - << "Hash expansion of " << c[0].ToString() - << " is a suffix of the hash expansion of " << c2[0].ToString() - << "."; - case SpyHashState::CompareResult::kUnequal: - break; - } - } - } - return testing::AssertionSuccess(); -} - -template <typename... T> -struct TypeSet { - template <typename U, bool = disjunction<std::is_same<T, U>...>::value> - struct Insert { - using type = TypeSet<U, T...>; - }; - template <typename U> - struct Insert<U, true> { - using type = TypeSet; - }; - - template <template <typename...> class C> - using apply = C<T...>; -}; - -template <typename... T> -struct MakeTypeSet : TypeSet<> {}; -template <typename T, typename... Ts> -struct MakeTypeSet<T, Ts...> : MakeTypeSet<Ts...>::template Insert<T>::type {}; - -template <typename... T> -using VariantForTypes = typename MakeTypeSet< - const typename std::decay<T>::type*...>::template apply<absl::variant>; - -template <typename Container> -struct ContainerAsVector { - using V = absl::variant<const typename Container::value_type*>; - using Out = std::vector<V>; - - static Out Do(const Container& values) { - Out out; - for (const auto& v : values) out.push_back(&v); - return out; - } -}; - -template <typename... T> -struct ContainerAsVector<std::tuple<T...>> { - using V = VariantForTypes<T...>; - using Out = std::vector<V>; - - template <size_t... I> - static Out DoImpl(const std::tuple<T...>& tuple, absl::index_sequence<I...>) { - return Out{&std::get<I>(tuple)...}; - } - - static Out Do(const std::tuple<T...>& values) { - return DoImpl(values, absl::index_sequence_for<T...>()); - } -}; - -template <> -struct ContainerAsVector<std::tuple<>> { - static std::vector<VariantForTypes<int>> Do(std::tuple<>) { return {}; } -}; - -struct DefaultEquals { - template <typename T, typename U> - bool operator()(const T& t, const U& u) const { - return t == u; - } -}; - -} // namespace hash_internal - -template <int&..., typename Container> -ABSL_MUST_USE_RESULT testing::AssertionResult -VerifyTypeImplementsAbslHashCorrectly(const Container& values) { - return hash_internal::VerifyTypeImplementsAbslHashCorrectly( - hash_internal::ContainerAsVector<Container>::Do(values), - hash_internal::DefaultEquals{}); -} - -template <int&..., typename Container, typename Eq> -ABSL_MUST_USE_RESULT testing::AssertionResult -VerifyTypeImplementsAbslHashCorrectly(const Container& values, Eq equals) { - return hash_internal::VerifyTypeImplementsAbslHashCorrectly( - hash_internal::ContainerAsVector<Container>::Do(values), equals); -} - -template <int&..., typename T> -ABSL_MUST_USE_RESULT testing::AssertionResult -VerifyTypeImplementsAbslHashCorrectly(std::initializer_list<T> values) { - return hash_internal::VerifyTypeImplementsAbslHashCorrectly( - hash_internal::ContainerAsVector<std::initializer_list<T>>::Do(values), - hash_internal::DefaultEquals{}); -} - -template <int&..., typename T, typename Eq> -ABSL_MUST_USE_RESULT testing::AssertionResult -VerifyTypeImplementsAbslHashCorrectly(std::initializer_list<T> values, - Eq equals) { - return hash_internal::VerifyTypeImplementsAbslHashCorrectly( - hash_internal::ContainerAsVector<std::initializer_list<T>>::Do(values), - equals); -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_HASH_HASH_TESTING_H_ diff --git a/contrib/restricted/abseil-cpp/absl/hash/internal/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/hash/internal/.yandex_meta/licenses.list.txt deleted file mode 100644 index bbc98ff778..0000000000 --- a/contrib/restricted/abseil-cpp/absl/hash/internal/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,34 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2020 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/hash/internal/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/hash/internal/CMakeLists.linux.txt deleted file mode 100644 index 8329eca604..0000000000 --- a/contrib/restricted/abseil-cpp/absl/hash/internal/CMakeLists.linux.txt +++ /dev/null @@ -1,28 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-hash-internal) -target_compile_options(absl-hash-internal PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-hash-internal PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-hash-internal PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - absl-base-log_severity - abseil-cpp-absl-numeric -) -target_sources(absl-hash-internal PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/hash/internal/low_level_hash.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/hash/internal/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/hash/internal/CMakeLists.txt index e8c98bfd99..8329eca604 100644 --- a/contrib/restricted/abseil-cpp/absl/hash/internal/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/hash/internal/CMakeLists.txt @@ -6,6 +6,23 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-hash-internal) +target_compile_options(absl-hash-internal PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-hash-internal PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-hash-internal PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + absl-base-log_severity + abseil-cpp-absl-numeric +) +target_sources(absl-hash-internal PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/hash/internal/low_level_hash.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/hash/internal/spy_hash_state.h b/contrib/restricted/abseil-cpp/absl/hash/internal/spy_hash_state.h deleted file mode 100644 index c083120811..0000000000 --- a/contrib/restricted/abseil-cpp/absl/hash/internal/spy_hash_state.h +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_HASH_INTERNAL_SPY_HASH_STATE_H_ -#define ABSL_HASH_INTERNAL_SPY_HASH_STATE_H_ - -#include <ostream> -#include <string> -#include <vector> - -#include "absl/hash/hash.h" -#include "absl/strings/match.h" -#include "absl/strings/str_format.h" -#include "absl/strings/str_join.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace hash_internal { - -// SpyHashState is an implementation of the HashState API that simply -// accumulates all input bytes in an internal buffer. This makes it useful -// for testing AbslHashValue overloads (so long as they are templated on the -// HashState parameter), since it can report the exact hash representation -// that the AbslHashValue overload produces. -// -// Sample usage: -// EXPECT_EQ(SpyHashState::combine(SpyHashState(), foo), -// SpyHashState::combine(SpyHashState(), bar)); -template <typename T> -class SpyHashStateImpl : public HashStateBase<SpyHashStateImpl<T>> { - public: - SpyHashStateImpl() : error_(std::make_shared<absl::optional<std::string>>()) { - static_assert(std::is_void<T>::value, ""); - } - - // Move-only - SpyHashStateImpl(const SpyHashStateImpl&) = delete; - SpyHashStateImpl& operator=(const SpyHashStateImpl&) = delete; - - SpyHashStateImpl(SpyHashStateImpl&& other) noexcept { - *this = std::move(other); - } - - SpyHashStateImpl& operator=(SpyHashStateImpl&& other) noexcept { - hash_representation_ = std::move(other.hash_representation_); - error_ = other.error_; - moved_from_ = other.moved_from_; - other.moved_from_ = true; - return *this; - } - - template <typename U> - SpyHashStateImpl(SpyHashStateImpl<U>&& other) { // NOLINT - hash_representation_ = std::move(other.hash_representation_); - error_ = other.error_; - moved_from_ = other.moved_from_; - other.moved_from_ = true; - } - - template <typename A, typename... Args> - static SpyHashStateImpl combine(SpyHashStateImpl s, const A& a, - const Args&... args) { - // Pass an instance of SpyHashStateImpl<A> when trying to combine `A`. This - // allows us to test that the user only uses this instance for combine calls - // and does not call AbslHashValue directly. - // See AbslHashValue implementation at the bottom. - s = SpyHashStateImpl<A>::HashStateBase::combine(std::move(s), a); - return SpyHashStateImpl::combine(std::move(s), args...); - } - static SpyHashStateImpl combine(SpyHashStateImpl s) { - if (direct_absl_hash_value_error_) { - *s.error_ = "AbslHashValue should not be invoked directly."; - } else if (s.moved_from_) { - *s.error_ = "Used moved-from instance of the hash state object."; - } - return s; - } - - static void SetDirectAbslHashValueError() { - direct_absl_hash_value_error_ = true; - } - - // Two SpyHashStateImpl objects are equal if they hold equal hash - // representations. - friend bool operator==(const SpyHashStateImpl& lhs, - const SpyHashStateImpl& rhs) { - return lhs.hash_representation_ == rhs.hash_representation_; - } - - friend bool operator!=(const SpyHashStateImpl& lhs, - const SpyHashStateImpl& rhs) { - return !(lhs == rhs); - } - - enum class CompareResult { - kEqual, - kASuffixB, - kBSuffixA, - kUnequal, - }; - - static CompareResult Compare(const SpyHashStateImpl& a, - const SpyHashStateImpl& b) { - const std::string a_flat = absl::StrJoin(a.hash_representation_, ""); - const std::string b_flat = absl::StrJoin(b.hash_representation_, ""); - if (a_flat == b_flat) return CompareResult::kEqual; - if (absl::EndsWith(a_flat, b_flat)) return CompareResult::kBSuffixA; - if (absl::EndsWith(b_flat, a_flat)) return CompareResult::kASuffixB; - return CompareResult::kUnequal; - } - - // operator<< prints the hash representation as a hex and ASCII dump, to - // facilitate debugging. - friend std::ostream& operator<<(std::ostream& out, - const SpyHashStateImpl& hash_state) { - out << "[\n"; - for (auto& s : hash_state.hash_representation_) { - size_t offset = 0; - for (char c : s) { - if (offset % 16 == 0) { - out << absl::StreamFormat("\n0x%04x: ", offset); - } - if (offset % 2 == 0) { - out << " "; - } - out << absl::StreamFormat("%02x", c); - ++offset; - } - out << "\n"; - } - return out << "]"; - } - - // The base case of the combine recursion, which writes raw bytes into the - // internal buffer. - static SpyHashStateImpl combine_contiguous(SpyHashStateImpl hash_state, - const unsigned char* begin, - size_t size) { - const size_t large_chunk_stride = PiecewiseChunkSize(); - if (size > large_chunk_stride) { - // Combining a large contiguous buffer must have the same effect as - // doing it piecewise by the stride length, followed by the (possibly - // empty) remainder. - while (size >= large_chunk_stride) { - hash_state = SpyHashStateImpl::combine_contiguous( - std::move(hash_state), begin, large_chunk_stride); - begin += large_chunk_stride; - size -= large_chunk_stride; - } - } - - hash_state.hash_representation_.emplace_back( - reinterpret_cast<const char*>(begin), size); - return hash_state; - } - - using SpyHashStateImpl::HashStateBase::combine_contiguous; - - absl::optional<std::string> error() const { - if (moved_from_) { - return "Returned a moved-from instance of the hash state object."; - } - return *error_; - } - - private: - template <typename U> - friend class SpyHashStateImpl; - - // This is true if SpyHashStateImpl<T> has been passed to a call of - // AbslHashValue with the wrong type. This detects that the user called - // AbslHashValue directly (because the hash state type does not match). - static bool direct_absl_hash_value_error_; - - std::vector<std::string> hash_representation_; - // This is a shared_ptr because we want all instances of the particular - // SpyHashState run to share the field. This way we can set the error for - // use-after-move and all the copies will see it. - std::shared_ptr<absl::optional<std::string>> error_; - bool moved_from_ = false; -}; - -template <typename T> -bool SpyHashStateImpl<T>::direct_absl_hash_value_error_; - -template <bool& B> -struct OdrUse { - constexpr OdrUse() {} - bool& b = B; -}; - -template <void (*)()> -struct RunOnStartup { - static bool run; - static constexpr OdrUse<run> kOdrUse{}; -}; - -template <void (*f)()> -bool RunOnStartup<f>::run = (f(), true); - -template < - typename T, typename U, - // Only trigger for when (T != U), - typename = absl::enable_if_t<!std::is_same<T, U>::value>, - // This statement works in two ways: - // - First, it instantiates RunOnStartup and forces the initialization of - // `run`, which set the global variable. - // - Second, it triggers a SFINAE error disabling the overload to prevent - // compile time errors. If we didn't disable the overload we would get - // ambiguous overload errors, which we don't want. - int = RunOnStartup<SpyHashStateImpl<T>::SetDirectAbslHashValueError>::run> -void AbslHashValue(SpyHashStateImpl<T>, const U&); - -using SpyHashState = SpyHashStateImpl<void>; - -} // namespace hash_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_HASH_INTERNAL_SPY_HASH_STATE_H_ diff --git a/contrib/restricted/abseil-cpp/absl/memory/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/memory/.yandex_meta/licenses.list.txt deleted file mode 100644 index 7be6b42848..0000000000 --- a/contrib/restricted/abseil-cpp/absl/memory/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,16 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/memory/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/memory/CMakeLists.linux.txt deleted file mode 100644 index 81b3787c3c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/memory/CMakeLists.linux.txt +++ /dev/null @@ -1,13 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-memory INTERFACE) -target_link_libraries(abseil-cpp-absl-memory INTERFACE - abseil-cpp-absl-meta -) diff --git a/contrib/restricted/abseil-cpp/absl/memory/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/memory/CMakeLists.txt index e8c98bfd99..81b3787c3c 100644 --- a/contrib/restricted/abseil-cpp/absl/memory/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/memory/CMakeLists.txt @@ -6,6 +6,8 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-memory INTERFACE) +target_link_libraries(abseil-cpp-absl-memory INTERFACE + abseil-cpp-absl-meta +) diff --git a/contrib/restricted/abseil-cpp/absl/meta/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/meta/.yandex_meta/licenses.list.txt deleted file mode 100644 index 7be6b42848..0000000000 --- a/contrib/restricted/abseil-cpp/absl/meta/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,16 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/meta/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/meta/CMakeLists.linux.txt deleted file mode 100644 index d1eedebfd8..0000000000 --- a/contrib/restricted/abseil-cpp/absl/meta/CMakeLists.linux.txt +++ /dev/null @@ -1,13 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-meta INTERFACE) -target_link_libraries(abseil-cpp-absl-meta INTERFACE - abseil-cpp-absl-base -) diff --git a/contrib/restricted/abseil-cpp/absl/meta/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/meta/CMakeLists.txt index e8c98bfd99..d1eedebfd8 100644 --- a/contrib/restricted/abseil-cpp/absl/meta/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/meta/CMakeLists.txt @@ -6,6 +6,8 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-meta INTERFACE) +target_link_libraries(abseil-cpp-absl-meta INTERFACE + abseil-cpp-absl-base +) diff --git a/contrib/restricted/abseil-cpp/absl/numeric/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/numeric/.yandex_meta/licenses.list.txt deleted file mode 100644 index 3d70f7ab0e..0000000000 --- a/contrib/restricted/abseil-cpp/absl/numeric/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,38 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2020 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2021 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/numeric/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/numeric/CMakeLists.linux.txt deleted file mode 100644 index 541705a4af..0000000000 --- a/contrib/restricted/abseil-cpp/absl/numeric/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-numeric) -target_compile_options(abseil-cpp-absl-numeric PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-numeric PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-numeric PUBLIC - contrib-libs-cxxsupp -) -target_sources(abseil-cpp-absl-numeric PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/numeric/int128.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/numeric/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/numeric/CMakeLists.txt index e8c98bfd99..541705a4af 100644 --- a/contrib/restricted/abseil-cpp/absl/numeric/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/numeric/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-numeric) +target_compile_options(abseil-cpp-absl-numeric PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-numeric PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-numeric PUBLIC + contrib-libs-cxxsupp +) +target_sources(abseil-cpp-absl-numeric PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/numeric/int128.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased/CMakeLists.linux.txt deleted file mode 100644 index b019ac5f7e..0000000000 --- a/contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(profiling-internal-exponential_biased) -target_compile_options(profiling-internal-exponential_biased PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(profiling-internal-exponential_biased PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(profiling-internal-exponential_biased PUBLIC - contrib-libs-cxxsupp -) -target_sources(profiling-internal-exponential_biased PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased/CMakeLists.txt index e8c98bfd99..b019ac5f7e 100644 --- a/contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(profiling-internal-exponential_biased) +target_compile_options(profiling-internal-exponential_biased PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(profiling-internal-exponential_biased PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(profiling-internal-exponential_biased PUBLIC + contrib-libs-cxxsupp +) +target_sources(profiling-internal-exponential_biased PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler/CMakeLists.linux.txt deleted file mode 100644 index bf9a81825e..0000000000 --- a/contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler/CMakeLists.linux.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(profiling-internal-periodic_sampler) -target_compile_options(profiling-internal-periodic_sampler PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(profiling-internal-periodic_sampler PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(profiling-internal-periodic_sampler PUBLIC - contrib-libs-cxxsupp - profiling-internal-exponential_biased -) -target_sources(profiling-internal-periodic_sampler PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler/CMakeLists.txt index e8c98bfd99..bf9a81825e 100644 --- a/contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler/CMakeLists.txt @@ -6,6 +6,19 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(profiling-internal-periodic_sampler) +target_compile_options(profiling-internal-periodic_sampler PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(profiling-internal-periodic_sampler PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(profiling-internal-periodic_sampler PUBLIC + contrib-libs-cxxsupp + profiling-internal-exponential_biased +) +target_sources(profiling-internal-periodic_sampler PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/absl_random_distributions/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/absl_random_distributions/CMakeLists.linux.txt deleted file mode 100644 index 3784c4b449..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/absl_random_distributions/CMakeLists.linux.txt +++ /dev/null @@ -1,32 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-random-absl_random_distributions) -target_compile_options(absl-random-absl_random_distributions PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-random-absl_random_distributions PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-random-absl_random_distributions PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal -) -target_sources(absl-random-absl_random_distributions PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/discrete_distribution.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/gaussian_distribution.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/absl_random_distributions/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/absl_random_distributions/CMakeLists.txt index e8c98bfd99..3784c4b449 100644 --- a/contrib/restricted/abseil-cpp/absl/random/absl_random_distributions/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/absl_random_distributions/CMakeLists.txt @@ -6,6 +6,27 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-random-absl_random_distributions) +target_compile_options(absl-random-absl_random_distributions PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-random-absl_random_distributions PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-random-absl_random_distributions PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal +) +target_sources(absl-random-absl_random_distributions PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/discrete_distribution.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/gaussian_distribution.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/beta_distribution.h b/contrib/restricted/abseil-cpp/absl/random/beta_distribution.h deleted file mode 100644 index c154066fb8..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/beta_distribution.h +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_BETA_DISTRIBUTION_H_ -#define ABSL_RANDOM_BETA_DISTRIBUTION_H_ - -#include <cassert> -#include <cmath> -#include <istream> -#include <limits> -#include <ostream> -#include <type_traits> - -#include "absl/meta/type_traits.h" -#include "absl/random/internal/fast_uniform_bits.h" -#include "absl/random/internal/fastmath.h" -#include "absl/random/internal/generate_real.h" -#include "absl/random/internal/iostream_state_saver.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// absl::beta_distribution: -// Generate a floating-point variate conforming to a Beta distribution: -// pdf(x) \propto x^(alpha-1) * (1-x)^(beta-1), -// where the params alpha and beta are both strictly positive real values. -// -// The support is the open interval (0, 1), but the return value might be equal -// to 0 or 1, due to numerical errors when alpha and beta are very different. -// -// Usage note: One usage is that alpha and beta are counts of number of -// successes and failures. When the total number of trials are large, consider -// approximating a beta distribution with a Gaussian distribution with the same -// mean and variance. One could use the skewness, which depends only on the -// smaller of alpha and beta when the number of trials are sufficiently large, -// to quantify how far a beta distribution is from the normal distribution. -template <typename RealType = double> -class beta_distribution { - public: - using result_type = RealType; - - class param_type { - public: - using distribution_type = beta_distribution; - - explicit param_type(result_type alpha, result_type beta) - : alpha_(alpha), beta_(beta) { - assert(alpha >= 0); - assert(beta >= 0); - assert(alpha <= (std::numeric_limits<result_type>::max)()); - assert(beta <= (std::numeric_limits<result_type>::max)()); - if (alpha == 0 || beta == 0) { - method_ = DEGENERATE_SMALL; - x_ = (alpha >= beta) ? 1 : 0; - return; - } - // a_ = min(beta, alpha), b_ = max(beta, alpha). - if (beta < alpha) { - inverted_ = true; - a_ = beta; - b_ = alpha; - } else { - inverted_ = false; - a_ = alpha; - b_ = beta; - } - if (a_ <= 1 && b_ >= ThresholdForLargeA()) { - method_ = DEGENERATE_SMALL; - x_ = inverted_ ? result_type(1) : result_type(0); - return; - } - // For threshold values, see also: - // Evaluation of Beta Generation Algorithms, Ying-Chao Hung, et. al. - // February, 2009. - if ((b_ < 1.0 && a_ + b_ <= 1.2) || a_ <= ThresholdForSmallA()) { - // Choose Joehnk over Cheng when it's faster or when Cheng encounters - // numerical issues. - method_ = JOEHNK; - a_ = result_type(1) / alpha_; - b_ = result_type(1) / beta_; - if (std::isinf(a_) || std::isinf(b_)) { - method_ = DEGENERATE_SMALL; - x_ = inverted_ ? result_type(1) : result_type(0); - } - return; - } - if (a_ >= ThresholdForLargeA()) { - method_ = DEGENERATE_LARGE; - // Note: on PPC for long double, evaluating - // `std::numeric_limits::max() / ThresholdForLargeA` results in NaN. - result_type r = a_ / b_; - x_ = (inverted_ ? result_type(1) : r) / (1 + r); - return; - } - x_ = a_ + b_; - log_x_ = std::log(x_); - if (a_ <= 1) { - method_ = CHENG_BA; - y_ = result_type(1) / a_; - gamma_ = a_ + a_; - return; - } - method_ = CHENG_BB; - result_type r = (a_ - 1) / (b_ - 1); - y_ = std::sqrt((1 + r) / (b_ * r * 2 - r + 1)); - gamma_ = a_ + result_type(1) / y_; - } - - result_type alpha() const { return alpha_; } - result_type beta() const { return beta_; } - - friend bool operator==(const param_type& a, const param_type& b) { - return a.alpha_ == b.alpha_ && a.beta_ == b.beta_; - } - - friend bool operator!=(const param_type& a, const param_type& b) { - return !(a == b); - } - - private: - friend class beta_distribution; - -#ifdef _MSC_VER - // MSVC does not have constexpr implementations for std::log and std::exp - // so they are computed at runtime. -#define ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR -#else -#define ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR constexpr -#endif - - // The threshold for whether std::exp(1/a) is finite. - // Note that this value is quite large, and a smaller a_ is NOT abnormal. - static ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR result_type - ThresholdForSmallA() { - return result_type(1) / - std::log((std::numeric_limits<result_type>::max)()); - } - - // The threshold for whether a * std::log(a) is finite. - static ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR result_type - ThresholdForLargeA() { - return std::exp( - std::log((std::numeric_limits<result_type>::max)()) - - std::log(std::log((std::numeric_limits<result_type>::max)())) - - ThresholdPadding()); - } - -#undef ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR - - // Pad the threshold for large A for long double on PPC. This is done via a - // template specialization below. - static constexpr result_type ThresholdPadding() { return 0; } - - enum Method { - JOEHNK, // Uses algorithm Joehnk - CHENG_BA, // Uses algorithm BA in Cheng - CHENG_BB, // Uses algorithm BB in Cheng - - // Note: See also: - // Hung et al. Evaluation of beta generation algorithms. Communications - // in Statistics-Simulation and Computation 38.4 (2009): 750-770. - // especially: - // Zechner, Heinz, and Ernst Stadlober. Generating beta variates via - // patchwork rejection. Computing 50.1 (1993): 1-18. - - DEGENERATE_SMALL, // a_ is abnormally small. - DEGENERATE_LARGE, // a_ is abnormally large. - }; - - result_type alpha_; - result_type beta_; - - result_type a_; // the smaller of {alpha, beta}, or 1.0/alpha_ in JOEHNK - result_type b_; // the larger of {alpha, beta}, or 1.0/beta_ in JOEHNK - result_type x_; // alpha + beta, or the result in degenerate cases - result_type log_x_; // log(x_) - result_type y_; // "beta" in Cheng - result_type gamma_; // "gamma" in Cheng - - Method method_; - - // Placing this last for optimal alignment. - // Whether alpha_ != a_, i.e. true iff alpha_ > beta_. - bool inverted_; - - static_assert(std::is_floating_point<RealType>::value, - "Class-template absl::beta_distribution<> must be " - "parameterized using a floating-point type."); - }; - - beta_distribution() : beta_distribution(1) {} - - explicit beta_distribution(result_type alpha, result_type beta = 1) - : param_(alpha, beta) {} - - explicit beta_distribution(const param_type& p) : param_(p) {} - - void reset() {} - - // Generating functions - template <typename URBG> - result_type operator()(URBG& g) { // NOLINT(runtime/references) - return (*this)(g, param_); - } - - template <typename URBG> - result_type operator()(URBG& g, // NOLINT(runtime/references) - const param_type& p); - - param_type param() const { return param_; } - void param(const param_type& p) { param_ = p; } - - result_type(min)() const { return 0; } - result_type(max)() const { return 1; } - - result_type alpha() const { return param_.alpha(); } - result_type beta() const { return param_.beta(); } - - friend bool operator==(const beta_distribution& a, - const beta_distribution& b) { - return a.param_ == b.param_; - } - friend bool operator!=(const beta_distribution& a, - const beta_distribution& b) { - return a.param_ != b.param_; - } - - private: - template <typename URBG> - result_type AlgorithmJoehnk(URBG& g, // NOLINT(runtime/references) - const param_type& p); - - template <typename URBG> - result_type AlgorithmCheng(URBG& g, // NOLINT(runtime/references) - const param_type& p); - - template <typename URBG> - result_type DegenerateCase(URBG& g, // NOLINT(runtime/references) - const param_type& p) { - if (p.method_ == param_type::DEGENERATE_SMALL && p.alpha_ == p.beta_) { - // Returns 0 or 1 with equal probability. - random_internal::FastUniformBits<uint8_t> fast_u8; - return static_cast<result_type>((fast_u8(g) & 0x10) != - 0); // pick any single bit. - } - return p.x_; - } - - param_type param_; - random_internal::FastUniformBits<uint64_t> fast_u64_; -}; - -#if defined(__powerpc64__) || defined(__PPC64__) || defined(__powerpc__) || \ - defined(__ppc__) || defined(__PPC__) -// PPC needs a more stringent boundary for long double. -template <> -constexpr long double -beta_distribution<long double>::param_type::ThresholdPadding() { - return 10; -} -#endif - -template <typename RealType> -template <typename URBG> -typename beta_distribution<RealType>::result_type -beta_distribution<RealType>::AlgorithmJoehnk( - URBG& g, // NOLINT(runtime/references) - const param_type& p) { - using random_internal::GeneratePositiveTag; - using random_internal::GenerateRealFromBits; - using real_type = - absl::conditional_t<std::is_same<RealType, float>::value, float, double>; - - // Based on Joehnk, M. D. Erzeugung von betaverteilten und gammaverteilten - // Zufallszahlen. Metrika 8.1 (1964): 5-15. - // This method is described in Knuth, Vol 2 (Third Edition), pp 134. - - result_type u, v, x, y, z; - for (;;) { - u = GenerateRealFromBits<real_type, GeneratePositiveTag, false>( - fast_u64_(g)); - v = GenerateRealFromBits<real_type, GeneratePositiveTag, false>( - fast_u64_(g)); - - // Direct method. std::pow is slow for float, so rely on the optimizer to - // remove the std::pow() path for that case. - if (!std::is_same<float, result_type>::value) { - x = std::pow(u, p.a_); - y = std::pow(v, p.b_); - z = x + y; - if (z > 1) { - // Reject if and only if `x + y > 1.0` - continue; - } - if (z > 0) { - // When both alpha and beta are small, x and y are both close to 0, so - // divide by (x+y) directly may result in nan. - return x / z; - } - } - - // Log transform. - // x = log( pow(u, p.a_) ), y = log( pow(v, p.b_) ) - // since u, v <= 1.0, x, y < 0. - x = std::log(u) * p.a_; - y = std::log(v) * p.b_; - if (!std::isfinite(x) || !std::isfinite(y)) { - continue; - } - // z = log( pow(u, a) + pow(v, b) ) - z = x > y ? (x + std::log(1 + std::exp(y - x))) - : (y + std::log(1 + std::exp(x - y))); - // Reject iff log(x+y) > 0. - if (z > 0) { - continue; - } - return std::exp(x - z); - } -} - -template <typename RealType> -template <typename URBG> -typename beta_distribution<RealType>::result_type -beta_distribution<RealType>::AlgorithmCheng( - URBG& g, // NOLINT(runtime/references) - const param_type& p) { - using random_internal::GeneratePositiveTag; - using random_internal::GenerateRealFromBits; - using real_type = - absl::conditional_t<std::is_same<RealType, float>::value, float, double>; - - // Based on Cheng, Russell CH. Generating beta variates with nonintegral - // shape parameters. Communications of the ACM 21.4 (1978): 317-322. - // (https://dl.acm.org/citation.cfm?id=359482). - static constexpr result_type kLogFour = - result_type(1.3862943611198906188344642429163531361); // log(4) - static constexpr result_type kS = - result_type(2.6094379124341003746007593332261876); // 1+log(5) - - const bool use_algorithm_ba = (p.method_ == param_type::CHENG_BA); - result_type u1, u2, v, w, z, r, s, t, bw_inv, lhs; - for (;;) { - u1 = GenerateRealFromBits<real_type, GeneratePositiveTag, false>( - fast_u64_(g)); - u2 = GenerateRealFromBits<real_type, GeneratePositiveTag, false>( - fast_u64_(g)); - v = p.y_ * std::log(u1 / (1 - u1)); - w = p.a_ * std::exp(v); - bw_inv = result_type(1) / (p.b_ + w); - r = p.gamma_ * v - kLogFour; - s = p.a_ + r - w; - z = u1 * u1 * u2; - if (!use_algorithm_ba && s + kS >= 5 * z) { - break; - } - t = std::log(z); - if (!use_algorithm_ba && s >= t) { - break; - } - lhs = p.x_ * (p.log_x_ + std::log(bw_inv)) + r; - if (lhs >= t) { - break; - } - } - return p.inverted_ ? (1 - w * bw_inv) : w * bw_inv; -} - -template <typename RealType> -template <typename URBG> -typename beta_distribution<RealType>::result_type -beta_distribution<RealType>::operator()(URBG& g, // NOLINT(runtime/references) - const param_type& p) { - switch (p.method_) { - case param_type::JOEHNK: - return AlgorithmJoehnk(g, p); - case param_type::CHENG_BA: - ABSL_FALLTHROUGH_INTENDED; - case param_type::CHENG_BB: - return AlgorithmCheng(g, p); - default: - return DegenerateCase(g, p); - } -} - -template <typename CharT, typename Traits, typename RealType> -std::basic_ostream<CharT, Traits>& operator<<( - std::basic_ostream<CharT, Traits>& os, // NOLINT(runtime/references) - const beta_distribution<RealType>& x) { - auto saver = random_internal::make_ostream_state_saver(os); - os.precision(random_internal::stream_precision_helper<RealType>::kPrecision); - os << x.alpha() << os.fill() << x.beta(); - return os; -} - -template <typename CharT, typename Traits, typename RealType> -std::basic_istream<CharT, Traits>& operator>>( - std::basic_istream<CharT, Traits>& is, // NOLINT(runtime/references) - beta_distribution<RealType>& x) { // NOLINT(runtime/references) - using result_type = typename beta_distribution<RealType>::result_type; - using param_type = typename beta_distribution<RealType>::param_type; - result_type alpha, beta; - - auto saver = random_internal::make_istream_state_saver(is); - alpha = random_internal::read_floating_point<result_type>(is); - if (is.fail()) return is; - beta = random_internal::read_floating_point<result_type>(is); - if (!is.fail()) { - x.param(param_type(alpha, beta)); - } - return is; -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_BETA_DISTRIBUTION_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/bit_gen_ref.h b/contrib/restricted/abseil-cpp/absl/random/bit_gen_ref.h deleted file mode 100644 index 9555460fd4..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/bit_gen_ref.h +++ /dev/null @@ -1,181 +0,0 @@ -// -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: bit_gen_ref.h -// ----------------------------------------------------------------------------- -// -// This header defines a bit generator "reference" class, for use in interfaces -// that take both Abseil (e.g. `absl::BitGen`) and standard library (e.g. -// `std::mt19937`) bit generators. - -#ifndef ABSL_RANDOM_BIT_GEN_REF_H_ -#define ABSL_RANDOM_BIT_GEN_REF_H_ - -#include "absl/base/internal/fast_type_id.h" -#include "absl/base/macros.h" -#include "absl/meta/type_traits.h" -#include "absl/random/internal/distribution_caller.h" -#include "absl/random/internal/fast_uniform_bits.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal { - -template <typename URBG, typename = void, typename = void, typename = void> -struct is_urbg : std::false_type {}; - -template <typename URBG> -struct is_urbg< - URBG, - absl::enable_if_t<std::is_same< - typename URBG::result_type, - typename std::decay<decltype((URBG::min)())>::type>::value>, - absl::enable_if_t<std::is_same< - typename URBG::result_type, - typename std::decay<decltype((URBG::max)())>::type>::value>, - absl::enable_if_t<std::is_same< - typename URBG::result_type, - typename std::decay<decltype(std::declval<URBG>()())>::type>::value>> - : std::true_type {}; - -template <typename> -struct DistributionCaller; -class MockHelpers; - -} // namespace random_internal - -// ----------------------------------------------------------------------------- -// absl::BitGenRef -// ----------------------------------------------------------------------------- -// -// `absl::BitGenRef` is a type-erasing class that provides a generator-agnostic -// non-owning "reference" interface for use in place of any specific uniform -// random bit generator (URBG). This class may be used for both Abseil -// (e.g. `absl::BitGen`, `absl::InsecureBitGen`) and Standard library (e.g -// `std::mt19937`, `std::minstd_rand`) bit generators. -// -// Like other reference classes, `absl::BitGenRef` does not own the -// underlying bit generator, and the underlying instance must outlive the -// `absl::BitGenRef`. -// -// `absl::BitGenRef` is particularly useful when used with an -// `absl::MockingBitGen` to test specific paths in functions which use random -// values. -// -// Example: -// void TakesBitGenRef(absl::BitGenRef gen) { -// int x = absl::Uniform<int>(gen, 0, 1000); -// } -// -class BitGenRef { - // SFINAE to detect whether the URBG type includes a member matching - // bool InvokeMock(base_internal::FastTypeIdType, void*, void*). - // - // These live inside BitGenRef so that they have friend access - // to MockingBitGen. (see similar methods in DistributionCaller). - template <template <class...> class Trait, class AlwaysVoid, class... Args> - struct detector : std::false_type {}; - template <template <class...> class Trait, class... Args> - struct detector<Trait, absl::void_t<Trait<Args...>>, Args...> - : std::true_type {}; - - template <class T> - using invoke_mock_t = decltype(std::declval<T*>()->InvokeMock( - std::declval<base_internal::FastTypeIdType>(), std::declval<void*>(), - std::declval<void*>())); - - template <typename T> - using HasInvokeMock = typename detector<invoke_mock_t, void, T>::type; - - public: - BitGenRef(const BitGenRef&) = default; - BitGenRef(BitGenRef&&) = default; - BitGenRef& operator=(const BitGenRef&) = default; - BitGenRef& operator=(BitGenRef&&) = default; - - template <typename URBG, typename absl::enable_if_t< - (!std::is_same<URBG, BitGenRef>::value && - random_internal::is_urbg<URBG>::value && - !HasInvokeMock<URBG>::value)>* = nullptr> - BitGenRef(URBG& gen) // NOLINT - : t_erased_gen_ptr_(reinterpret_cast<uintptr_t>(&gen)), - mock_call_(NotAMock), - generate_impl_fn_(ImplFn<URBG>) {} - - template <typename URBG, - typename absl::enable_if_t<(!std::is_same<URBG, BitGenRef>::value && - random_internal::is_urbg<URBG>::value && - HasInvokeMock<URBG>::value)>* = nullptr> - BitGenRef(URBG& gen) // NOLINT - : t_erased_gen_ptr_(reinterpret_cast<uintptr_t>(&gen)), - mock_call_(&MockCall<URBG>), - generate_impl_fn_(ImplFn<URBG>) {} - - using result_type = uint64_t; - - static constexpr result_type(min)() { - return (std::numeric_limits<result_type>::min)(); - } - - static constexpr result_type(max)() { - return (std::numeric_limits<result_type>::max)(); - } - - result_type operator()() { return generate_impl_fn_(t_erased_gen_ptr_); } - - private: - using impl_fn = result_type (*)(uintptr_t); - using mock_call_fn = bool (*)(uintptr_t, base_internal::FastTypeIdType, void*, - void*); - - template <typename URBG> - static result_type ImplFn(uintptr_t ptr) { - // Ensure that the return values from operator() fill the entire - // range promised by result_type, min() and max(). - absl::random_internal::FastUniformBits<result_type> fast_uniform_bits; - return fast_uniform_bits(*reinterpret_cast<URBG*>(ptr)); - } - - // Get a type-erased InvokeMock pointer. - template <typename URBG> - static bool MockCall(uintptr_t gen_ptr, base_internal::FastTypeIdType type, - void* result, void* arg_tuple) { - return reinterpret_cast<URBG*>(gen_ptr)->InvokeMock(type, result, - arg_tuple); - } - static bool NotAMock(uintptr_t, base_internal::FastTypeIdType, void*, void*) { - return false; - } - - inline bool InvokeMock(base_internal::FastTypeIdType type, void* args_tuple, - void* result) { - if (mock_call_ == NotAMock) return false; // avoids an indirect call. - return mock_call_(t_erased_gen_ptr_, type, args_tuple, result); - } - - uintptr_t t_erased_gen_ptr_; - mock_call_fn mock_call_; - impl_fn generate_impl_fn_; - - template <typename> - friend struct ::absl::random_internal::DistributionCaller; // for InvokeMock - friend class ::absl::random_internal::MockHelpers; // for InvokeMock -}; - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_BIT_GEN_REF_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/distributions.h b/contrib/restricted/abseil-cpp/absl/random/distributions.h deleted file mode 100644 index 31c79694e5..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/distributions.h +++ /dev/null @@ -1,452 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: distributions.h -// ----------------------------------------------------------------------------- -// -// This header defines functions representing distributions, which you use in -// combination with an Abseil random bit generator to produce random values -// according to the rules of that distribution. -// -// The Abseil random library defines the following distributions within this -// file: -// -// * `absl::Uniform` for uniform (constant) distributions having constant -// probability -// * `absl::Bernoulli` for discrete distributions having exactly two outcomes -// * `absl::Beta` for continuous distributions parameterized through two -// free parameters -// * `absl::Exponential` for discrete distributions of events occurring -// continuously and independently at a constant average rate -// * `absl::Gaussian` (also known as "normal distributions") for continuous -// distributions using an associated quadratic function -// * `absl::LogUniform` for continuous uniform distributions where the log -// to the given base of all values is uniform -// * `absl::Poisson` for discrete probability distributions that express the -// probability of a given number of events occurring within a fixed interval -// * `absl::Zipf` for discrete probability distributions commonly used for -// modelling of rare events -// -// Prefer use of these distribution function classes over manual construction of -// your own distribution classes, as it allows library maintainers greater -// flexibility to change the underlying implementation in the future. - -#ifndef ABSL_RANDOM_DISTRIBUTIONS_H_ -#define ABSL_RANDOM_DISTRIBUTIONS_H_ - -#include <algorithm> -#include <cmath> -#include <limits> -#include <random> -#include <type_traits> - -#include "absl/base/internal/inline_variable.h" -#include "absl/random/bernoulli_distribution.h" -#include "absl/random/beta_distribution.h" -#include "absl/random/exponential_distribution.h" -#include "absl/random/gaussian_distribution.h" -#include "absl/random/internal/distribution_caller.h" // IWYU pragma: export -#include "absl/random/internal/uniform_helper.h" // IWYU pragma: export -#include "absl/random/log_uniform_int_distribution.h" -#include "absl/random/poisson_distribution.h" -#include "absl/random/uniform_int_distribution.h" -#include "absl/random/uniform_real_distribution.h" -#include "absl/random/zipf_distribution.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -ABSL_INTERNAL_INLINE_CONSTEXPR(IntervalClosedClosedTag, IntervalClosedClosed, - {}); -ABSL_INTERNAL_INLINE_CONSTEXPR(IntervalClosedClosedTag, IntervalClosed, {}); -ABSL_INTERNAL_INLINE_CONSTEXPR(IntervalClosedOpenTag, IntervalClosedOpen, {}); -ABSL_INTERNAL_INLINE_CONSTEXPR(IntervalOpenOpenTag, IntervalOpenOpen, {}); -ABSL_INTERNAL_INLINE_CONSTEXPR(IntervalOpenOpenTag, IntervalOpen, {}); -ABSL_INTERNAL_INLINE_CONSTEXPR(IntervalOpenClosedTag, IntervalOpenClosed, {}); - -// ----------------------------------------------------------------------------- -// absl::Uniform<T>(tag, bitgen, lo, hi) -// ----------------------------------------------------------------------------- -// -// `absl::Uniform()` produces random values of type `T` uniformly distributed in -// a defined interval {lo, hi}. The interval `tag` defines the type of interval -// which should be one of the following possible values: -// -// * `absl::IntervalOpenOpen` -// * `absl::IntervalOpenClosed` -// * `absl::IntervalClosedOpen` -// * `absl::IntervalClosedClosed` -// -// where "open" refers to an exclusive value (excluded) from the output, while -// "closed" refers to an inclusive value (included) from the output. -// -// In the absence of an explicit return type `T`, `absl::Uniform()` will deduce -// the return type based on the provided endpoint arguments {A lo, B hi}. -// Given these endpoints, one of {A, B} will be chosen as the return type, if -// a type can be implicitly converted into the other in a lossless way. The -// lack of any such implicit conversion between {A, B} will produce a -// compile-time error -// -// See https://en.wikipedia.org/wiki/Uniform_distribution_(continuous) -// -// Example: -// -// absl::BitGen bitgen; -// -// // Produce a random float value between 0.0 and 1.0, inclusive -// auto x = absl::Uniform(absl::IntervalClosedClosed, bitgen, 0.0f, 1.0f); -// -// // The most common interval of `absl::IntervalClosedOpen` is available by -// // default: -// -// auto x = absl::Uniform(bitgen, 0.0f, 1.0f); -// -// // Return-types are typically inferred from the arguments, however callers -// // can optionally provide an explicit return-type to the template. -// -// auto x = absl::Uniform<float>(bitgen, 0, 1); -// -template <typename R = void, typename TagType, typename URBG> -typename absl::enable_if_t<!std::is_same<R, void>::value, R> // -Uniform(TagType tag, - URBG&& urbg, // NOLINT(runtime/references) - R lo, R hi) { - using gen_t = absl::decay_t<URBG>; - using distribution_t = random_internal::UniformDistributionWrapper<R>; - - auto a = random_internal::uniform_lower_bound(tag, lo, hi); - auto b = random_internal::uniform_upper_bound(tag, lo, hi); - if (!random_internal::is_uniform_range_valid(a, b)) return lo; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, tag, lo, hi); -} - -// absl::Uniform<T>(bitgen, lo, hi) -// -// Overload of `Uniform()` using the default closed-open interval of [lo, hi), -// and returning values of type `T` -template <typename R = void, typename URBG> -typename absl::enable_if_t<!std::is_same<R, void>::value, R> // -Uniform(URBG&& urbg, // NOLINT(runtime/references) - R lo, R hi) { - using gen_t = absl::decay_t<URBG>; - using distribution_t = random_internal::UniformDistributionWrapper<R>; - constexpr auto tag = absl::IntervalClosedOpen; - - auto a = random_internal::uniform_lower_bound(tag, lo, hi); - auto b = random_internal::uniform_upper_bound(tag, lo, hi); - if (!random_internal::is_uniform_range_valid(a, b)) return lo; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, lo, hi); -} - -// absl::Uniform(tag, bitgen, lo, hi) -// -// Overload of `Uniform()` using different (but compatible) lo, hi types. Note -// that a compile-error will result if the return type cannot be deduced -// correctly from the passed types. -template <typename R = void, typename TagType, typename URBG, typename A, - typename B> -typename absl::enable_if_t<std::is_same<R, void>::value, - random_internal::uniform_inferred_return_t<A, B>> -Uniform(TagType tag, - URBG&& urbg, // NOLINT(runtime/references) - A lo, B hi) { - using gen_t = absl::decay_t<URBG>; - using return_t = typename random_internal::uniform_inferred_return_t<A, B>; - using distribution_t = random_internal::UniformDistributionWrapper<return_t>; - - auto a = random_internal::uniform_lower_bound<return_t>(tag, lo, hi); - auto b = random_internal::uniform_upper_bound<return_t>(tag, lo, hi); - if (!random_internal::is_uniform_range_valid(a, b)) return lo; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, tag, static_cast<return_t>(lo), - static_cast<return_t>(hi)); -} - -// absl::Uniform(bitgen, lo, hi) -// -// Overload of `Uniform()` using different (but compatible) lo, hi types and the -// default closed-open interval of [lo, hi). Note that a compile-error will -// result if the return type cannot be deduced correctly from the passed types. -template <typename R = void, typename URBG, typename A, typename B> -typename absl::enable_if_t<std::is_same<R, void>::value, - random_internal::uniform_inferred_return_t<A, B>> -Uniform(URBG&& urbg, // NOLINT(runtime/references) - A lo, B hi) { - using gen_t = absl::decay_t<URBG>; - using return_t = typename random_internal::uniform_inferred_return_t<A, B>; - using distribution_t = random_internal::UniformDistributionWrapper<return_t>; - - constexpr auto tag = absl::IntervalClosedOpen; - auto a = random_internal::uniform_lower_bound<return_t>(tag, lo, hi); - auto b = random_internal::uniform_upper_bound<return_t>(tag, lo, hi); - if (!random_internal::is_uniform_range_valid(a, b)) return lo; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, static_cast<return_t>(lo), - static_cast<return_t>(hi)); -} - -// absl::Uniform<unsigned T>(bitgen) -// -// Overload of Uniform() using the minimum and maximum values of a given type -// `T` (which must be unsigned), returning a value of type `unsigned T` -template <typename R, typename URBG> -typename absl::enable_if_t<!std::is_signed<R>::value, R> // -Uniform(URBG&& urbg) { // NOLINT(runtime/references) - using gen_t = absl::decay_t<URBG>; - using distribution_t = random_internal::UniformDistributionWrapper<R>; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg); -} - -// ----------------------------------------------------------------------------- -// absl::Bernoulli(bitgen, p) -// ----------------------------------------------------------------------------- -// -// `absl::Bernoulli` produces a random boolean value, with probability `p` -// (where 0.0 <= p <= 1.0) equaling `true`. -// -// Prefer `absl::Bernoulli` to produce boolean values over other alternatives -// such as comparing an `absl::Uniform()` value to a specific output. -// -// See https://en.wikipedia.org/wiki/Bernoulli_distribution -// -// Example: -// -// absl::BitGen bitgen; -// ... -// if (absl::Bernoulli(bitgen, 1.0/3721.0)) { -// std::cout << "Asteroid field navigation successful."; -// } -// -template <typename URBG> -bool Bernoulli(URBG&& urbg, // NOLINT(runtime/references) - double p) { - using gen_t = absl::decay_t<URBG>; - using distribution_t = absl::bernoulli_distribution; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, p); -} - -// ----------------------------------------------------------------------------- -// absl::Beta<T>(bitgen, alpha, beta) -// ----------------------------------------------------------------------------- -// -// `absl::Beta` produces a floating point number distributed in the closed -// interval [0,1] and parameterized by two values `alpha` and `beta` as per a -// Beta distribution. `T` must be a floating point type, but may be inferred -// from the types of `alpha` and `beta`. -// -// See https://en.wikipedia.org/wiki/Beta_distribution. -// -// Example: -// -// absl::BitGen bitgen; -// ... -// double sample = absl::Beta(bitgen, 3.0, 2.0); -// -template <typename RealType, typename URBG> -RealType Beta(URBG&& urbg, // NOLINT(runtime/references) - RealType alpha, RealType beta) { - static_assert( - std::is_floating_point<RealType>::value, - "Template-argument 'RealType' must be a floating-point type, in " - "absl::Beta<RealType, URBG>(...)"); - - using gen_t = absl::decay_t<URBG>; - using distribution_t = typename absl::beta_distribution<RealType>; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, alpha, beta); -} - -// ----------------------------------------------------------------------------- -// absl::Exponential<T>(bitgen, lambda = 1) -// ----------------------------------------------------------------------------- -// -// `absl::Exponential` produces a floating point number representing the -// distance (time) between two consecutive events in a point process of events -// occurring continuously and independently at a constant average rate. `T` must -// be a floating point type, but may be inferred from the type of `lambda`. -// -// See https://en.wikipedia.org/wiki/Exponential_distribution. -// -// Example: -// -// absl::BitGen bitgen; -// ... -// double call_length = absl::Exponential(bitgen, 7.0); -// -template <typename RealType, typename URBG> -RealType Exponential(URBG&& urbg, // NOLINT(runtime/references) - RealType lambda = 1) { - static_assert( - std::is_floating_point<RealType>::value, - "Template-argument 'RealType' must be a floating-point type, in " - "absl::Exponential<RealType, URBG>(...)"); - - using gen_t = absl::decay_t<URBG>; - using distribution_t = typename absl::exponential_distribution<RealType>; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, lambda); -} - -// ----------------------------------------------------------------------------- -// absl::Gaussian<T>(bitgen, mean = 0, stddev = 1) -// ----------------------------------------------------------------------------- -// -// `absl::Gaussian` produces a floating point number selected from the Gaussian -// (ie. "Normal") distribution. `T` must be a floating point type, but may be -// inferred from the types of `mean` and `stddev`. -// -// See https://en.wikipedia.org/wiki/Normal_distribution -// -// Example: -// -// absl::BitGen bitgen; -// ... -// double giraffe_height = absl::Gaussian(bitgen, 16.3, 3.3); -// -template <typename RealType, typename URBG> -RealType Gaussian(URBG&& urbg, // NOLINT(runtime/references) - RealType mean = 0, RealType stddev = 1) { - static_assert( - std::is_floating_point<RealType>::value, - "Template-argument 'RealType' must be a floating-point type, in " - "absl::Gaussian<RealType, URBG>(...)"); - - using gen_t = absl::decay_t<URBG>; - using distribution_t = typename absl::gaussian_distribution<RealType>; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, mean, stddev); -} - -// ----------------------------------------------------------------------------- -// absl::LogUniform<T>(bitgen, lo, hi, base = 2) -// ----------------------------------------------------------------------------- -// -// `absl::LogUniform` produces random values distributed where the log to a -// given base of all values is uniform in a closed interval [lo, hi]. `T` must -// be an integral type, but may be inferred from the types of `lo` and `hi`. -// -// I.e., `LogUniform(0, n, b)` is uniformly distributed across buckets -// [0], [1, b-1], [b, b^2-1] .. [b^(k-1), (b^k)-1] .. [b^floor(log(n, b)), n] -// and is uniformly distributed within each bucket. -// -// The resulting probability density is inversely related to bucket size, though -// values in the final bucket may be more likely than previous values. (In the -// extreme case where n = b^i the final value will be tied with zero as the most -// probable result. -// -// If `lo` is nonzero then this distribution is shifted to the desired interval, -// so LogUniform(lo, hi, b) is equivalent to LogUniform(0, hi-lo, b)+lo. -// -// See http://ecolego.facilia.se/ecolego/show/Log-Uniform%20Distribution -// -// Example: -// -// absl::BitGen bitgen; -// ... -// int v = absl::LogUniform(bitgen, 0, 1000); -// -template <typename IntType, typename URBG> -IntType LogUniform(URBG&& urbg, // NOLINT(runtime/references) - IntType lo, IntType hi, IntType base = 2) { - static_assert(std::is_integral<IntType>::value, - "Template-argument 'IntType' must be an integral type, in " - "absl::LogUniform<IntType, URBG>(...)"); - - using gen_t = absl::decay_t<URBG>; - using distribution_t = typename absl::log_uniform_int_distribution<IntType>; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, lo, hi, base); -} - -// ----------------------------------------------------------------------------- -// absl::Poisson<T>(bitgen, mean = 1) -// ----------------------------------------------------------------------------- -// -// `absl::Poisson` produces discrete probabilities for a given number of events -// occurring within a fixed interval within the closed interval [0, max]. `T` -// must be an integral type. -// -// See https://en.wikipedia.org/wiki/Poisson_distribution -// -// Example: -// -// absl::BitGen bitgen; -// ... -// int requests_per_minute = absl::Poisson<int>(bitgen, 3.2); -// -template <typename IntType, typename URBG> -IntType Poisson(URBG&& urbg, // NOLINT(runtime/references) - double mean = 1.0) { - static_assert(std::is_integral<IntType>::value, - "Template-argument 'IntType' must be an integral type, in " - "absl::Poisson<IntType, URBG>(...)"); - - using gen_t = absl::decay_t<URBG>; - using distribution_t = typename absl::poisson_distribution<IntType>; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, mean); -} - -// ----------------------------------------------------------------------------- -// absl::Zipf<T>(bitgen, hi = max, q = 2, v = 1) -// ----------------------------------------------------------------------------- -// -// `absl::Zipf` produces discrete probabilities commonly used for modelling of -// rare events over the closed interval [0, hi]. The parameters `v` and `q` -// determine the skew of the distribution. `T` must be an integral type, but -// may be inferred from the type of `hi`. -// -// See http://mathworld.wolfram.com/ZipfDistribution.html -// -// Example: -// -// absl::BitGen bitgen; -// ... -// int term_rank = absl::Zipf<int>(bitgen); -// -template <typename IntType, typename URBG> -IntType Zipf(URBG&& urbg, // NOLINT(runtime/references) - IntType hi = (std::numeric_limits<IntType>::max)(), double q = 2.0, - double v = 1.0) { - static_assert(std::is_integral<IntType>::value, - "Template-argument 'IntType' must be an integral type, in " - "absl::Zipf<IntType, URBG>(...)"); - - using gen_t = absl::decay_t<URBG>; - using distribution_t = typename absl::zipf_distribution<IntType>; - - return random_internal::DistributionCaller<gen_t>::template Call< - distribution_t>(&urbg, hi, q, v); -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_DISTRIBUTIONS_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/exponential_distribution.h b/contrib/restricted/abseil-cpp/absl/random/exponential_distribution.h deleted file mode 100644 index b5caf8a1e1..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/exponential_distribution.h +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_EXPONENTIAL_DISTRIBUTION_H_ -#define ABSL_RANDOM_EXPONENTIAL_DISTRIBUTION_H_ - -#include <cassert> -#include <cmath> -#include <istream> -#include <limits> -#include <type_traits> - -#include "absl/meta/type_traits.h" -#include "absl/random/internal/fast_uniform_bits.h" -#include "absl/random/internal/generate_real.h" -#include "absl/random/internal/iostream_state_saver.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// absl::exponential_distribution: -// Generates a number conforming to an exponential distribution and is -// equivalent to the standard [rand.dist.pois.exp] distribution. -template <typename RealType = double> -class exponential_distribution { - public: - using result_type = RealType; - - class param_type { - public: - using distribution_type = exponential_distribution; - - explicit param_type(result_type lambda = 1) : lambda_(lambda) { - assert(lambda > 0); - neg_inv_lambda_ = -result_type(1) / lambda_; - } - - result_type lambda() const { return lambda_; } - - friend bool operator==(const param_type& a, const param_type& b) { - return a.lambda_ == b.lambda_; - } - - friend bool operator!=(const param_type& a, const param_type& b) { - return !(a == b); - } - - private: - friend class exponential_distribution; - - result_type lambda_; - result_type neg_inv_lambda_; - - static_assert( - std::is_floating_point<RealType>::value, - "Class-template absl::exponential_distribution<> must be parameterized " - "using a floating-point type."); - }; - - exponential_distribution() : exponential_distribution(1) {} - - explicit exponential_distribution(result_type lambda) : param_(lambda) {} - - explicit exponential_distribution(const param_type& p) : param_(p) {} - - void reset() {} - - // Generating functions - template <typename URBG> - result_type operator()(URBG& g) { // NOLINT(runtime/references) - return (*this)(g, param_); - } - - template <typename URBG> - result_type operator()(URBG& g, // NOLINT(runtime/references) - const param_type& p); - - param_type param() const { return param_; } - void param(const param_type& p) { param_ = p; } - - result_type(min)() const { return 0; } - result_type(max)() const { - return std::numeric_limits<result_type>::infinity(); - } - - result_type lambda() const { return param_.lambda(); } - - friend bool operator==(const exponential_distribution& a, - const exponential_distribution& b) { - return a.param_ == b.param_; - } - friend bool operator!=(const exponential_distribution& a, - const exponential_distribution& b) { - return a.param_ != b.param_; - } - - private: - param_type param_; - random_internal::FastUniformBits<uint64_t> fast_u64_; -}; - -// -------------------------------------------------------------------------- -// Implementation details follow -// -------------------------------------------------------------------------- - -template <typename RealType> -template <typename URBG> -typename exponential_distribution<RealType>::result_type -exponential_distribution<RealType>::operator()( - URBG& g, // NOLINT(runtime/references) - const param_type& p) { - using random_internal::GenerateNegativeTag; - using random_internal::GenerateRealFromBits; - using real_type = - absl::conditional_t<std::is_same<RealType, float>::value, float, double>; - - const result_type u = GenerateRealFromBits<real_type, GenerateNegativeTag, - false>(fast_u64_(g)); // U(-1, 0) - - // log1p(-x) is mathematically equivalent to log(1 - x) but has more - // accuracy for x near zero. - return p.neg_inv_lambda_ * std::log1p(u); -} - -template <typename CharT, typename Traits, typename RealType> -std::basic_ostream<CharT, Traits>& operator<<( - std::basic_ostream<CharT, Traits>& os, // NOLINT(runtime/references) - const exponential_distribution<RealType>& x) { - auto saver = random_internal::make_ostream_state_saver(os); - os.precision(random_internal::stream_precision_helper<RealType>::kPrecision); - os << x.lambda(); - return os; -} - -template <typename CharT, typename Traits, typename RealType> -std::basic_istream<CharT, Traits>& operator>>( - std::basic_istream<CharT, Traits>& is, // NOLINT(runtime/references) - exponential_distribution<RealType>& x) { // NOLINT(runtime/references) - using result_type = typename exponential_distribution<RealType>::result_type; - using param_type = typename exponential_distribution<RealType>::param_type; - result_type lambda; - - auto saver = random_internal::make_istream_state_saver(is); - lambda = random_internal::read_floating_point<result_type>(is); - if (!is.fail()) { - x.param(param_type(lambda)); - } - return is; -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_EXPONENTIAL_DISTRIBUTION_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/absl_random_internal_distribution_test_util/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/internal/absl_random_internal_distribution_test_util/CMakeLists.linux.txt deleted file mode 100644 index c8b7625f08..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/absl_random_internal_distribution_test_util/CMakeLists.linux.txt +++ /dev/null @@ -1,33 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(random-internal-absl_random_internal_distribution_test_util) -target_compile_options(random-internal-absl_random_internal_distribution_test_util PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(random-internal-absl_random_internal_distribution_test_util PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(random-internal-absl_random_internal_distribution_test_util PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - strings-internal-str_format -) -target_sources(random-internal-absl_random_internal_distribution_test_util PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/chi_square.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/distribution_test_util.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/absl_random_internal_distribution_test_util/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/internal/absl_random_internal_distribution_test_util/CMakeLists.txt index e8c98bfd99..c8b7625f08 100644 --- a/contrib/restricted/abseil-cpp/absl/random/internal/absl_random_internal_distribution_test_util/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/internal/absl_random_internal_distribution_test_util/CMakeLists.txt @@ -6,6 +6,28 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(random-internal-absl_random_internal_distribution_test_util) +target_compile_options(random-internal-absl_random_internal_distribution_test_util PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(random-internal-absl_random_internal_distribution_test_util PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(random-internal-absl_random_internal_distribution_test_util PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + strings-internal-str_format +) +target_sources(random-internal-absl_random_internal_distribution_test_util PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/chi_square.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/distribution_test_util.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/distribution_caller.h b/contrib/restricted/abseil-cpp/absl/random/internal/distribution_caller.h deleted file mode 100644 index fc81b787eb..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/distribution_caller.h +++ /dev/null @@ -1,92 +0,0 @@ -// -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#ifndef ABSL_RANDOM_INTERNAL_DISTRIBUTION_CALLER_H_ -#define ABSL_RANDOM_INTERNAL_DISTRIBUTION_CALLER_H_ - -#include <utility> - -#include "absl/base/config.h" -#include "absl/base/internal/fast_type_id.h" -#include "absl/utility/utility.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal { - -// DistributionCaller provides an opportunity to overload the general -// mechanism for calling a distribution, allowing for mock-RNG classes -// to intercept such calls. -template <typename URBG> -struct DistributionCaller { - // SFINAE to detect whether the URBG type includes a member matching - // bool InvokeMock(base_internal::FastTypeIdType, void*, void*). - // - // These live inside BitGenRef so that they have friend access - // to MockingBitGen. (see similar methods in DistributionCaller). - template <template <class...> class Trait, class AlwaysVoid, class... Args> - struct detector : std::false_type {}; - template <template <class...> class Trait, class... Args> - struct detector<Trait, absl::void_t<Trait<Args...>>, Args...> - : std::true_type {}; - - template <class T> - using invoke_mock_t = decltype(std::declval<T*>()->InvokeMock( - std::declval<::absl::base_internal::FastTypeIdType>(), - std::declval<void*>(), std::declval<void*>())); - - using HasInvokeMock = typename detector<invoke_mock_t, void, URBG>::type; - - // Default implementation of distribution caller. - template <typename DistrT, typename... Args> - static typename DistrT::result_type Impl(std::false_type, URBG* urbg, - Args&&... args) { - DistrT dist(std::forward<Args>(args)...); - return dist(*urbg); - } - - // Mock implementation of distribution caller. - // The underlying KeyT must match the KeyT constructed by MockOverloadSet. - template <typename DistrT, typename... Args> - static typename DistrT::result_type Impl(std::true_type, URBG* urbg, - Args&&... args) { - using ResultT = typename DistrT::result_type; - using ArgTupleT = std::tuple<absl::decay_t<Args>...>; - using KeyT = ResultT(DistrT, ArgTupleT); - - ArgTupleT arg_tuple(std::forward<Args>(args)...); - ResultT result; - if (!urbg->InvokeMock(::absl::base_internal::FastTypeId<KeyT>(), &arg_tuple, - &result)) { - auto dist = absl::make_from_tuple<DistrT>(arg_tuple); - result = dist(*urbg); - } - return result; - } - - // Default implementation of distribution caller. - template <typename DistrT, typename... Args> - static typename DistrT::result_type Call(URBG* urbg, Args&&... args) { - return Impl<DistrT, Args...>(HasInvokeMock{}, urbg, - std::forward<Args>(args)...); - } -}; - -} // namespace random_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_INTERNAL_DISTRIBUTION_CALLER_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/explicit_seed_seq.h b/contrib/restricted/abseil-cpp/absl/random/internal/explicit_seed_seq.h deleted file mode 100644 index 25f791535f..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/explicit_seed_seq.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_INTERNAL_EXPLICIT_SEED_SEQ_H_ -#define ABSL_RANDOM_INTERNAL_EXPLICIT_SEED_SEQ_H_ - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <initializer_list> -#include <iterator> -#include <vector> - -#include "absl/base/config.h" -#include "absl/base/internal/endian.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal { - -// This class conforms to the C++ Standard "Seed Sequence" concept -// [rand.req.seedseq]. -// -// An "ExplicitSeedSeq" is meant to provide a conformant interface for -// forwarding pre-computed seed material to the constructor of a class -// conforming to the "Uniform Random Bit Generator" concept. This class makes no -// attempt to mutate the state provided by its constructor, and returns it -// directly via ExplicitSeedSeq::generate(). -// -// If this class is asked to generate more seed material than was provided to -// the constructor, then the remaining bytes will be filled with deterministic, -// nonrandom data. -class ExplicitSeedSeq { - public: - using result_type = uint32_t; - - ExplicitSeedSeq() : state_() {} - - // Copy and move both allowed. - ExplicitSeedSeq(const ExplicitSeedSeq& other) = default; - ExplicitSeedSeq& operator=(const ExplicitSeedSeq& other) = default; - ExplicitSeedSeq(ExplicitSeedSeq&& other) = default; - ExplicitSeedSeq& operator=(ExplicitSeedSeq&& other) = default; - - template <typename Iterator> - ExplicitSeedSeq(Iterator begin, Iterator end) { - for (auto it = begin; it != end; it++) { - state_.push_back(*it & 0xffffffff); - } - } - - template <typename T> - ExplicitSeedSeq(std::initializer_list<T> il) - : ExplicitSeedSeq(il.begin(), il.end()) {} - - size_t size() const { return state_.size(); } - - template <typename OutIterator> - void param(OutIterator out) const { - std::copy(std::begin(state_), std::end(state_), out); - } - - template <typename OutIterator> - void generate(OutIterator begin, OutIterator end) { - for (size_t index = 0; begin != end; begin++) { - *begin = state_.empty() ? 0 : state_[index++]; - if (index >= state_.size()) { - index = 0; - } - } - } - - protected: - std::vector<uint32_t> state_; -}; - -} // namespace random_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_INTERNAL_EXPLICIT_SEED_SEQ_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/mock_helpers.h b/contrib/restricted/abseil-cpp/absl/random/internal/mock_helpers.h deleted file mode 100644 index 9d6ab21ef5..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/mock_helpers.h +++ /dev/null @@ -1,134 +0,0 @@ -// -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_INTERNAL_MOCK_HELPERS_H_ -#define ABSL_RANDOM_INTERNAL_MOCK_HELPERS_H_ - -#include <tuple> -#include <type_traits> - -#include "absl/base/internal/fast_type_id.h" -#include "absl/types/optional.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal { - -// MockHelpers works in conjunction with MockOverloadSet, MockingBitGen, and -// BitGenRef to enable the mocking capability for absl distribution functions. -// -// MockingBitGen registers mocks based on the typeid of a mock signature, KeyT, -// which is used to generate a unique id. -// -// KeyT is a signature of the form: -// result_type(discriminator_type, std::tuple<args...>) -// The mocked function signature will be composed from KeyT as: -// result_type(args...) -// -class MockHelpers { - using IdType = ::absl::base_internal::FastTypeIdType; - - // Given a key signature type used to index the mock, extract the components. - // KeyT is expected to have the form: - // result_type(discriminator_type, arg_tuple_type) - template <typename KeyT> - struct KeySignature; - - template <typename ResultT, typename DiscriminatorT, typename ArgTupleT> - struct KeySignature<ResultT(DiscriminatorT, ArgTupleT)> { - using result_type = ResultT; - using discriminator_type = DiscriminatorT; - using arg_tuple_type = ArgTupleT; - }; - - // Detector for InvokeMock. - template <class T> - using invoke_mock_t = decltype(std::declval<T*>()->InvokeMock( - std::declval<IdType>(), std::declval<void*>(), std::declval<void*>())); - - // Empty implementation of InvokeMock. - template <typename KeyT, typename ReturnT, typename ArgTupleT, typename URBG, - typename... Args> - static absl::optional<ReturnT> InvokeMockImpl(char, URBG*, Args&&...) { - return absl::nullopt; - } - - // Non-empty implementation of InvokeMock. - template <typename KeyT, typename ReturnT, typename ArgTupleT, typename URBG, - typename = invoke_mock_t<URBG>, typename... Args> - static absl::optional<ReturnT> InvokeMockImpl(int, URBG* urbg, - Args&&... args) { - ArgTupleT arg_tuple(std::forward<Args>(args)...); - ReturnT result; - if (urbg->InvokeMock(::absl::base_internal::FastTypeId<KeyT>(), &arg_tuple, - &result)) { - return result; - } - return absl::nullopt; - } - - public: - // InvokeMock is private; this provides access for some specialized use cases. - template <typename URBG> - static inline bool PrivateInvokeMock(URBG* urbg, IdType type, - void* args_tuple, void* result) { - return urbg->InvokeMock(type, args_tuple, result); - } - - // Invoke a mock for the KeyT (may or may not be a signature). - // - // KeyT is used to generate a typeid-based lookup key for the mock. - // KeyT is a signature of the form: - // result_type(discriminator_type, std::tuple<args...>) - // The mocked function signature will be composed from KeyT as: - // result_type(args...) - // - // An instance of arg_tuple_type must be constructable from Args..., since - // the underlying mechanism requires a pointer to an argument tuple. - template <typename KeyT, typename URBG, typename... Args> - static auto MaybeInvokeMock(URBG* urbg, Args&&... args) - -> absl::optional<typename KeySignature<KeyT>::result_type> { - // Use function overloading to dispatch to the implemenation since - // more modern patterns (e.g. require + constexpr) are not supported in all - // compiler configurations. - return InvokeMockImpl<KeyT, typename KeySignature<KeyT>::result_type, - typename KeySignature<KeyT>::arg_tuple_type, URBG>( - 0, urbg, std::forward<Args>(args)...); - } - - // Acquire a mock for the KeyT (may or may not be a signature). - // - // KeyT is used to generate a typeid-based lookup for the mock. - // KeyT is a signature of the form: - // result_type(discriminator_type, std::tuple<args...>) - // The mocked function signature will be composed from KeyT as: - // result_type(args...) - template <typename KeyT, typename MockURBG> - static auto MockFor(MockURBG& m) - -> decltype(m.template RegisterMock< - typename KeySignature<KeyT>::result_type, - typename KeySignature<KeyT>::arg_tuple_type>( - m, std::declval<IdType>())) { - return m.template RegisterMock<typename KeySignature<KeyT>::result_type, - typename KeySignature<KeyT>::arg_tuple_type>( - m, ::absl::base_internal::FastTypeId<KeyT>()); - } -}; - -} // namespace random_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_INTERNAL_MOCK_HELPERS_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/mock_overload_set.h b/contrib/restricted/abseil-cpp/absl/random/internal/mock_overload_set.h deleted file mode 100644 index 0d9c6c120c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/mock_overload_set.h +++ /dev/null @@ -1,100 +0,0 @@ -// -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_INTERNAL_MOCK_OVERLOAD_SET_H_ -#define ABSL_RANDOM_INTERNAL_MOCK_OVERLOAD_SET_H_ - -#include <type_traits> - -#include "gmock/gmock.h" -#include "absl/random/internal/mock_helpers.h" -#include "absl/random/mocking_bit_gen.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal { - -template <typename DistrT, typename Fn> -struct MockSingleOverload; - -// MockSingleOverload -// -// MockSingleOverload hooks in to gMock's `ON_CALL` and `EXPECT_CALL` macros. -// EXPECT_CALL(mock_single_overload, Call(...))` will expand to a call to -// `mock_single_overload.gmock_Call(...)`. Because expectations are stored on -// the MockingBitGen (an argument passed inside `Call(...)`), this forwards to -// arguments to MockingBitGen::Register. -// -// The underlying KeyT must match the KeyT constructed by DistributionCaller. -template <typename DistrT, typename Ret, typename... Args> -struct MockSingleOverload<DistrT, Ret(MockingBitGen&, Args...)> { - static_assert(std::is_same<typename DistrT::result_type, Ret>::value, - "Overload signature must have return type matching the " - "distribution result_type."); - using KeyT = Ret(DistrT, std::tuple<Args...>); - - template <typename MockURBG> - auto gmock_Call(MockURBG& gen, const ::testing::Matcher<Args>&... matchers) - -> decltype(MockHelpers::MockFor<KeyT>(gen).gmock_Call(matchers...)) { - static_assert(std::is_base_of<MockingBitGen, MockURBG>::value, - "Mocking requires an absl::MockingBitGen"); - return MockHelpers::MockFor<KeyT>(gen).gmock_Call(matchers...); - } -}; - -template <typename DistrT, typename Ret, typename Arg, typename... Args> -struct MockSingleOverload<DistrT, Ret(Arg, MockingBitGen&, Args...)> { - static_assert(std::is_same<typename DistrT::result_type, Ret>::value, - "Overload signature must have return type matching the " - "distribution result_type."); - using KeyT = Ret(DistrT, std::tuple<Arg, Args...>); - - template <typename MockURBG> - auto gmock_Call(const ::testing::Matcher<Arg>& matcher, MockURBG& gen, - const ::testing::Matcher<Args>&... matchers) - -> decltype(MockHelpers::MockFor<KeyT>(gen).gmock_Call(matcher, - matchers...)) { - static_assert(std::is_base_of<MockingBitGen, MockURBG>::value, - "Mocking requires an absl::MockingBitGen"); - return MockHelpers::MockFor<KeyT>(gen).gmock_Call(matcher, matchers...); - } -}; - -// MockOverloadSet -// -// MockOverloadSet takes a distribution and a collection of signatures and -// performs overload resolution amongst all the overloads. This makes -// `EXPECT_CALL(mock_overload_set, Call(...))` expand and do overload resolution -// correctly. -template <typename DistrT, typename... Signatures> -struct MockOverloadSet; - -template <typename DistrT, typename Sig> -struct MockOverloadSet<DistrT, Sig> : public MockSingleOverload<DistrT, Sig> { - using MockSingleOverload<DistrT, Sig>::gmock_Call; -}; - -template <typename DistrT, typename FirstSig, typename... Rest> -struct MockOverloadSet<DistrT, FirstSig, Rest...> - : public MockSingleOverload<DistrT, FirstSig>, - public MockOverloadSet<DistrT, Rest...> { - using MockSingleOverload<DistrT, FirstSig>::gmock_Call; - using MockOverloadSet<DistrT, Rest...>::gmock_Call; -}; - -} // namespace random_internal -ABSL_NAMESPACE_END -} // namespace absl -#endif // ABSL_RANDOM_INTERNAL_MOCK_OVERLOAD_SET_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/nanobenchmark.h b/contrib/restricted/abseil-cpp/absl/random/internal/nanobenchmark.h deleted file mode 100644 index a5097ba27b..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/nanobenchmark.h +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2017 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_INTERNAL_NANOBENCHMARK_H_ -#define ABSL_RANDOM_INTERNAL_NANOBENCHMARK_H_ - -// Benchmarks functions of a single integer argument with realistic branch -// prediction hit rates. Uses a robust estimator to summarize the measurements. -// The precision is about 0.2%. -// -// Examples: see nanobenchmark_test.cc. -// -// Background: Microbenchmarks such as http://github.com/google/benchmark -// can measure elapsed times on the order of a microsecond. Shorter functions -// are typically measured by repeating them thousands of times and dividing -// the total elapsed time by this count. Unfortunately, repetition (especially -// with the same input parameter!) influences the runtime. In time-critical -// code, it is reasonable to expect warm instruction/data caches and TLBs, -// but a perfect record of which branches will be taken is unrealistic. -// Unless the application also repeatedly invokes the measured function with -// the same parameter, the benchmark is measuring something very different - -// a best-case result, almost as if the parameter were made a compile-time -// constant. This may lead to erroneous conclusions about branch-heavy -// algorithms outperforming branch-free alternatives. -// -// Our approach differs in three ways. Adding fences to the timer functions -// reduces variability due to instruction reordering, improving the timer -// resolution to about 40 CPU cycles. However, shorter functions must still -// be invoked repeatedly. For more realistic branch prediction performance, -// we vary the input parameter according to a user-specified distribution. -// Thus, instead of VaryInputs(Measure(Repeat(func))), we change the -// loop nesting to Measure(Repeat(VaryInputs(func))). We also estimate the -// central tendency of the measurement samples with the "half sample mode", -// which is more robust to outliers and skewed data than the mean or median. - -// NOTE: for compatibility with multiple translation units compiled with -// distinct flags, avoid #including headers that define functions. - -#include <stddef.h> -#include <stdint.h> - -#include "absl/base/config.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal_nanobenchmark { - -// Input influencing the function being measured (e.g. number of bytes to copy). -using FuncInput = size_t; - -// "Proof of work" returned by Func to ensure the compiler does not elide it. -using FuncOutput = uint64_t; - -// Function to measure: either 1) a captureless lambda or function with two -// arguments or 2) a lambda with capture, in which case the first argument -// is reserved for use by MeasureClosure. -using Func = FuncOutput (*)(const void*, FuncInput); - -// Internal parameters that determine precision/resolution/measuring time. -struct Params { - // For measuring timer overhead/resolution. Used in a nested loop => - // quadratic time, acceptable because we know timer overhead is "low". - // constexpr because this is used to define array bounds. - static constexpr size_t kTimerSamples = 256; - - // Best-case precision, expressed as a divisor of the timer resolution. - // Larger => more calls to Func and higher precision. - size_t precision_divisor = 1024; - - // Ratio between full and subset input distribution sizes. Cannot be less - // than 2; larger values increase measurement time but more faithfully - // model the given input distribution. - size_t subset_ratio = 2; - - // Together with the estimated Func duration, determines how many times to - // call Func before checking the sample variability. Larger values increase - // measurement time, memory/cache use and precision. - double seconds_per_eval = 4E-3; - - // The minimum number of samples before estimating the central tendency. - size_t min_samples_per_eval = 7; - - // The mode is better than median for estimating the central tendency of - // skewed/fat-tailed distributions, but it requires sufficient samples - // relative to the width of half-ranges. - size_t min_mode_samples = 64; - - // Maximum permissible variability (= median absolute deviation / center). - double target_rel_mad = 0.002; - - // Abort after this many evals without reaching target_rel_mad. This - // prevents infinite loops. - size_t max_evals = 9; - - // Retry the measure loop up to this many times. - size_t max_measure_retries = 2; - - // Whether to print additional statistics to stdout. - bool verbose = true; -}; - -// Measurement result for each unique input. -struct Result { - FuncInput input; - - // Robust estimate (mode or median) of duration. - float ticks; - - // Measure of variability (median absolute deviation relative to "ticks"). - float variability; -}; - -// Ensures the thread is running on the specified cpu, and no others. -// Reduces noise due to desynchronized socket RDTSC and context switches. -// If "cpu" is negative, pin to the currently running core. -void PinThreadToCPU(const int cpu = -1); - -// Returns tick rate, useful for converting measurements to seconds. Invariant -// means the tick counter frequency is independent of CPU throttling or sleep. -// This call may be expensive, callers should cache the result. -double InvariantTicksPerSecond(); - -// Precisely measures the number of ticks elapsed when calling "func" with the -// given inputs, shuffled to ensure realistic branch prediction hit rates. -// -// "func" returns a 'proof of work' to ensure its computations are not elided. -// "arg" is passed to Func, or reserved for internal use by MeasureClosure. -// "inputs" is an array of "num_inputs" (not necessarily unique) arguments to -// "func". The values should be chosen to maximize coverage of "func". This -// represents a distribution, so a value's frequency should reflect its -// probability in the real application. Order does not matter; for example, a -// uniform distribution over [0, 4) could be represented as {3,0,2,1}. -// Returns how many Result were written to "results": one per unique input, or -// zero if the measurement failed (an error message goes to stderr). -size_t Measure(const Func func, const void* arg, const FuncInput* inputs, - const size_t num_inputs, Result* results, - const Params& p = Params()); - -// Calls operator() of the given closure (lambda function). -template <class Closure> -static FuncOutput CallClosure(const void* f, const FuncInput input) { - return (*reinterpret_cast<const Closure*>(f))(input); -} - -// Same as Measure, except "closure" is typically a lambda function of -// FuncInput -> FuncOutput with a capture list. -template <class Closure> -static inline size_t MeasureClosure(const Closure& closure, - const FuncInput* inputs, - const size_t num_inputs, Result* results, - const Params& p = Params()) { - return Measure(reinterpret_cast<Func>(&CallClosure<Closure>), - reinterpret_cast<const void*>(&closure), inputs, num_inputs, - results, p); -} - -} // namespace random_internal_nanobenchmark -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_INTERNAL_NANOBENCHMARK_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/nonsecure_base.h b/contrib/restricted/abseil-cpp/absl/random/internal/nonsecure_base.h deleted file mode 100644 index 730fa2ea12..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/nonsecure_base.h +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_INTERNAL_NONSECURE_BASE_H_ -#define ABSL_RANDOM_INTERNAL_NONSECURE_BASE_H_ - -#include <algorithm> -#include <cstdint> -#include <iostream> -#include <iterator> -#include <random> -#include <string> -#include <type_traits> -#include <vector> - -#include "absl/base/macros.h" -#include "absl/meta/type_traits.h" -#include "absl/random/internal/pool_urbg.h" -#include "absl/random/internal/salted_seed_seq.h" -#include "absl/random/internal/seed_material.h" -#include "absl/types/optional.h" -#include "absl/types/span.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal { - -// Each instance of NonsecureURBGBase<URBG> will be seeded by variates produced -// by a thread-unique URBG-instance. -template <typename URBG> -class NonsecureURBGBase { - public: - using result_type = typename URBG::result_type; - - // Default constructor - NonsecureURBGBase() : urbg_(ConstructURBG()) {} - - // Copy disallowed, move allowed. - NonsecureURBGBase(const NonsecureURBGBase&) = delete; - NonsecureURBGBase& operator=(const NonsecureURBGBase&) = delete; - NonsecureURBGBase(NonsecureURBGBase&&) = default; - NonsecureURBGBase& operator=(NonsecureURBGBase&&) = default; - - // Constructor using a seed - template <class SSeq, typename = typename absl::enable_if_t< - !std::is_same<SSeq, NonsecureURBGBase>::value>> - explicit NonsecureURBGBase(SSeq&& seq) - : urbg_(ConstructURBG(std::forward<SSeq>(seq))) {} - - // Note: on MSVC, min() or max() can be interpreted as MIN() or MAX(), so we - // enclose min() or max() in parens as (min)() and (max)(). - // Additionally, clang-format requires no space before this construction. - - // NonsecureURBGBase::min() - static constexpr result_type(min)() { return (URBG::min)(); } - - // NonsecureURBGBase::max() - static constexpr result_type(max)() { return (URBG::max)(); } - - // NonsecureURBGBase::operator()() - result_type operator()() { return urbg_(); } - - // NonsecureURBGBase::discard() - void discard(unsigned long long values) { // NOLINT(runtime/int) - urbg_.discard(values); - } - - bool operator==(const NonsecureURBGBase& other) const { - return urbg_ == other.urbg_; - } - - bool operator!=(const NonsecureURBGBase& other) const { - return !(urbg_ == other.urbg_); - } - - private: - // Seeder is a custom seed sequence type where generate() fills the provided - // buffer via the RandenPool entropy source. - struct Seeder { - using result_type = uint32_t; - - size_t size() { return 0; } - - template <typename OutIterator> - void param(OutIterator) const {} - - template <typename RandomAccessIterator> - void generate(RandomAccessIterator begin, RandomAccessIterator end) { - if (begin != end) { - // begin, end must be random access iterators assignable from uint32_t. - generate_impl( - std::integral_constant<bool, sizeof(*begin) == sizeof(uint32_t)>{}, - begin, end); - } - } - - // Commonly, generate is invoked with a pointer to a buffer which - // can be cast to a uint32_t. - template <typename RandomAccessIterator> - void generate_impl(std::integral_constant<bool, true>, - RandomAccessIterator begin, RandomAccessIterator end) { - auto buffer = absl::MakeSpan(begin, end); - auto target = absl::MakeSpan(reinterpret_cast<uint32_t*>(buffer.data()), - buffer.size()); - RandenPool<uint32_t>::Fill(target); - } - - // The non-uint32_t case should be uncommon, and involves an extra copy, - // filling the uint32_t buffer and then mixing into the output. - template <typename RandomAccessIterator> - void generate_impl(std::integral_constant<bool, false>, - RandomAccessIterator begin, RandomAccessIterator end) { - const size_t n = std::distance(begin, end); - absl::InlinedVector<uint32_t, 8> data(n, 0); - RandenPool<uint32_t>::Fill(absl::MakeSpan(data.begin(), data.end())); - std::copy(std::begin(data), std::end(data), begin); - } - }; - - static URBG ConstructURBG() { - Seeder seeder; - return URBG(seeder); - } - - template <typename SSeq> - static URBG ConstructURBG(SSeq&& seq) { // NOLINT(runtime/references) - auto salted_seq = - random_internal::MakeSaltedSeedSeq(std::forward<SSeq>(seq)); - return URBG(salted_seq); - } - - URBG urbg_; -}; - -} // namespace random_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_INTERNAL_NONSECURE_BASE_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/pcg_engine.h b/contrib/restricted/abseil-cpp/absl/random/internal/pcg_engine.h deleted file mode 100644 index 8efaf2e09a..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/pcg_engine.h +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_INTERNAL_PCG_ENGINE_H_ -#define ABSL_RANDOM_INTERNAL_PCG_ENGINE_H_ - -#include <type_traits> - -#include "absl/base/config.h" -#include "absl/meta/type_traits.h" -#include "absl/numeric/bits.h" -#include "absl/numeric/int128.h" -#include "absl/random/internal/fastmath.h" -#include "absl/random/internal/iostream_state_saver.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal { - -// pcg_engine is a simplified implementation of Melissa O'Neil's PCG engine in -// C++. PCG combines a linear congruential generator (LCG) with output state -// mixing functions to generate each random variate. pcg_engine supports only a -// single sequence (oneseq), and does not support streams. -// -// pcg_engine is parameterized by two types: -// Params, which provides the multiplier and increment values; -// Mix, which mixes the state into the result. -// -template <typename Params, typename Mix> -class pcg_engine { - static_assert(std::is_same<typename Params::state_type, - typename Mix::state_type>::value, - "Class-template absl::pcg_engine must be parameterized by " - "Params and Mix with identical state_type"); - - static_assert(std::is_unsigned<typename Mix::result_type>::value, - "Class-template absl::pcg_engine must be parameterized by " - "an unsigned Mix::result_type"); - - using params_type = Params; - using mix_type = Mix; - using state_type = typename Mix::state_type; - - public: - // C++11 URBG interface: - using result_type = typename Mix::result_type; - - static constexpr result_type(min)() { - return (std::numeric_limits<result_type>::min)(); - } - - static constexpr result_type(max)() { - return (std::numeric_limits<result_type>::max)(); - } - - explicit pcg_engine(uint64_t seed_value = 0) { seed(seed_value); } - - template <class SeedSequence, - typename = typename absl::enable_if_t< - !std::is_same<SeedSequence, pcg_engine>::value>> - explicit pcg_engine(SeedSequence&& seq) { - seed(seq); - } - - pcg_engine(const pcg_engine&) = default; - pcg_engine& operator=(const pcg_engine&) = default; - pcg_engine(pcg_engine&&) = default; - pcg_engine& operator=(pcg_engine&&) = default; - - result_type operator()() { - // Advance the LCG state, always using the new value to generate the output. - state_ = lcg(state_); - return Mix{}(state_); - } - - void seed(uint64_t seed_value = 0) { - state_type tmp = seed_value; - state_ = lcg(tmp + Params::increment()); - } - - template <class SeedSequence> - typename absl::enable_if_t< - !std::is_convertible<SeedSequence, uint64_t>::value, void> - seed(SeedSequence&& seq) { - reseed(seq); - } - - void discard(uint64_t count) { state_ = advance(state_, count); } - - bool operator==(const pcg_engine& other) const { - return state_ == other.state_; - } - - bool operator!=(const pcg_engine& other) const { return !(*this == other); } - - template <class CharT, class Traits> - friend typename absl::enable_if_t<(sizeof(state_type) == 16), - std::basic_ostream<CharT, Traits>&> - operator<<( - std::basic_ostream<CharT, Traits>& os, // NOLINT(runtime/references) - const pcg_engine& engine) { - auto saver = random_internal::make_ostream_state_saver(os); - random_internal::stream_u128_helper<state_type> helper; - helper.write(pcg_engine::params_type::multiplier(), os); - os << os.fill(); - helper.write(pcg_engine::params_type::increment(), os); - os << os.fill(); - helper.write(engine.state_, os); - return os; - } - - template <class CharT, class Traits> - friend typename absl::enable_if_t<(sizeof(state_type) <= 8), - std::basic_ostream<CharT, Traits>&> - operator<<( - std::basic_ostream<CharT, Traits>& os, // NOLINT(runtime/references) - const pcg_engine& engine) { - auto saver = random_internal::make_ostream_state_saver(os); - os << pcg_engine::params_type::multiplier() << os.fill(); - os << pcg_engine::params_type::increment() << os.fill(); - os << engine.state_; - return os; - } - - template <class CharT, class Traits> - friend typename absl::enable_if_t<(sizeof(state_type) == 16), - std::basic_istream<CharT, Traits>&> - operator>>( - std::basic_istream<CharT, Traits>& is, // NOLINT(runtime/references) - pcg_engine& engine) { // NOLINT(runtime/references) - random_internal::stream_u128_helper<state_type> helper; - auto mult = helper.read(is); - auto inc = helper.read(is); - auto tmp = helper.read(is); - if (mult != pcg_engine::params_type::multiplier() || - inc != pcg_engine::params_type::increment()) { - // signal failure by setting the failbit. - is.setstate(is.rdstate() | std::ios_base::failbit); - } - if (!is.fail()) { - engine.state_ = tmp; - } - return is; - } - - template <class CharT, class Traits> - friend typename absl::enable_if_t<(sizeof(state_type) <= 8), - std::basic_istream<CharT, Traits>&> - operator>>( - std::basic_istream<CharT, Traits>& is, // NOLINT(runtime/references) - pcg_engine& engine) { // NOLINT(runtime/references) - state_type mult{}, inc{}, tmp{}; - is >> mult >> inc >> tmp; - if (mult != pcg_engine::params_type::multiplier() || - inc != pcg_engine::params_type::increment()) { - // signal failure by setting the failbit. - is.setstate(is.rdstate() | std::ios_base::failbit); - } - if (!is.fail()) { - engine.state_ = tmp; - } - return is; - } - - private: - state_type state_; - - // Returns the linear-congruential generator next state. - static inline constexpr state_type lcg(state_type s) { - return s * Params::multiplier() + Params::increment(); - } - - // Returns the linear-congruential arbitrary seek state. - inline state_type advance(state_type s, uint64_t n) const { - state_type mult = Params::multiplier(); - state_type inc = Params::increment(); - state_type m = 1; - state_type i = 0; - while (n > 0) { - if (n & 1) { - m *= mult; - i = i * mult + inc; - } - inc = (mult + 1) * inc; - mult *= mult; - n >>= 1; - } - return m * s + i; - } - - template <class SeedSequence> - void reseed(SeedSequence& seq) { - using sequence_result_type = typename SeedSequence::result_type; - constexpr size_t kBufferSize = - sizeof(state_type) / sizeof(sequence_result_type); - sequence_result_type buffer[kBufferSize]; - seq.generate(std::begin(buffer), std::end(buffer)); - // Convert the seed output to a single state value. - state_type tmp = buffer[0]; - for (size_t i = 1; i < kBufferSize; i++) { - tmp <<= (sizeof(sequence_result_type) * 8); - tmp |= buffer[i]; - } - state_ = lcg(tmp + params_type::increment()); - } -}; - -// Parameterized implementation of the PCG 128-bit oneseq state. -// This provides state_type, multiplier, and increment for pcg_engine. -template <uint64_t kMultA, uint64_t kMultB, uint64_t kIncA, uint64_t kIncB> -class pcg128_params { - public: -#if ABSL_HAVE_INTRINSIC_INT128 - using state_type = __uint128_t; - static inline constexpr state_type make_u128(uint64_t a, uint64_t b) { - return (static_cast<__uint128_t>(a) << 64) | b; - } -#else - using state_type = absl::uint128; - static inline constexpr state_type make_u128(uint64_t a, uint64_t b) { - return absl::MakeUint128(a, b); - } -#endif - - static inline constexpr state_type multiplier() { - return make_u128(kMultA, kMultB); - } - static inline constexpr state_type increment() { - return make_u128(kIncA, kIncB); - } -}; - -// Implementation of the PCG xsl_rr_128_64 128-bit mixing function, which -// accepts an input of state_type and mixes it into an output of result_type. -struct pcg_xsl_rr_128_64 { -#if ABSL_HAVE_INTRINSIC_INT128 - using state_type = __uint128_t; -#else - using state_type = absl::uint128; -#endif - using result_type = uint64_t; - - inline uint64_t operator()(state_type state) { - // This is equivalent to the xsl_rr_128_64 mixing function. -#if ABSL_HAVE_INTRINSIC_INT128 - uint64_t rotate = static_cast<uint64_t>(state >> 122u); - state ^= state >> 64; - uint64_t s = static_cast<uint64_t>(state); -#else - uint64_t h = Uint128High64(state); - uint64_t rotate = h >> 58u; - uint64_t s = Uint128Low64(state) ^ h; -#endif - return rotr(s, rotate); - } -}; - -// Parameterized implementation of the PCG 64-bit oneseq state. -// This provides state_type, multiplier, and increment for pcg_engine. -template <uint64_t kMult, uint64_t kInc> -class pcg64_params { - public: - using state_type = uint64_t; - static inline constexpr state_type multiplier() { return kMult; } - static inline constexpr state_type increment() { return kInc; } -}; - -// Implementation of the PCG xsh_rr_64_32 64-bit mixing function, which accepts -// an input of state_type and mixes it into an output of result_type. -struct pcg_xsh_rr_64_32 { - using state_type = uint64_t; - using result_type = uint32_t; - inline uint32_t operator()(uint64_t state) { - return rotr(static_cast<uint32_t>(((state >> 18) ^ state) >> 27), - state >> 59); - } -}; - -// Stable pcg_engine implementations: -// This is a 64-bit generator using 128-bits of state. -// The output sequence is equivalent to Melissa O'Neil's pcg64_oneseq. -using pcg64_2018_engine = pcg_engine< - random_internal::pcg128_params<0x2360ed051fc65da4ull, 0x4385df649fccf645ull, - 0x5851f42d4c957f2d, 0x14057b7ef767814f>, - random_internal::pcg_xsl_rr_128_64>; - -// This is a 32-bit generator using 64-bits of state. -// This is equivalent to Melissa O'Neil's pcg32_oneseq. -using pcg32_2018_engine = pcg_engine< - random_internal::pcg64_params<0x5851f42d4c957f2dull, 0x14057b7ef767814full>, - random_internal::pcg_xsh_rr_64_32>; - -} // namespace random_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_INTERNAL_PCG_ENGINE_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg/CMakeLists.linux.txt deleted file mode 100644 index cc6ed9ccbc..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg/CMakeLists.linux.txt +++ /dev/null @@ -1,39 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(random-internal-pool_urbg) -target_compile_options(random-internal-pool_urbg PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(random-internal-pool_urbg PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(random-internal-pool_urbg PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - random-internal-randen - random-internal-randen_detect - random-internal-randen_hwaes - random-internal-randen_round_keys - random-internal-randen_slow - random-internal-seed_material - absl-random-seed_gen_exception - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - absl-types-bad_optional_access -) -target_sources(random-internal-pool_urbg PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg/CMakeLists.txt index e8c98bfd99..cc6ed9ccbc 100644 --- a/contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg/CMakeLists.txt @@ -6,6 +6,34 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(random-internal-pool_urbg) +target_compile_options(random-internal-pool_urbg PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(random-internal-pool_urbg PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(random-internal-pool_urbg PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + random-internal-randen + random-internal-randen_detect + random-internal-randen_hwaes + random-internal-randen_round_keys + random-internal-randen_slow + random-internal-seed_material + absl-random-seed_gen_exception + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + absl-types-bad_optional_access +) +target_sources(random-internal-pool_urbg PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen/CMakeLists.linux.txt deleted file mode 100644 index 42b4c9ae9c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen/CMakeLists.linux.txt +++ /dev/null @@ -1,27 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(random-internal-randen) -target_compile_options(random-internal-randen PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(random-internal-randen PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(random-internal-randen PUBLIC - contrib-libs-cxxsupp - random-internal-randen_detect - random-internal-randen_hwaes - random-internal-randen_round_keys - random-internal-randen_slow -) -target_sources(random-internal-randen PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen/CMakeLists.txt index e8c98bfd99..42b4c9ae9c 100644 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/internal/randen/CMakeLists.txt @@ -6,6 +6,22 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(random-internal-randen) +target_compile_options(random-internal-randen PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(random-internal-randen PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(random-internal-randen PUBLIC + contrib-libs-cxxsupp + random-internal-randen_detect + random-internal-randen_hwaes + random-internal-randen_round_keys + random-internal-randen_slow +) +target_sources(random-internal-randen PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen_detect/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen_detect/CMakeLists.linux.txt deleted file mode 100644 index deb20e628f..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen_detect/CMakeLists.linux.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(random-internal-randen_detect) -target_compile_options(random-internal-randen_detect PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(random-internal-randen_detect PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(random-internal-randen_detect PUBLIC - contrib-libs-cxxsupp - random-internal-randen_hwaes - random-internal-randen_round_keys -) -target_sources(random-internal-randen_detect PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen_detect.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen_detect/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen_detect/CMakeLists.txt index e8c98bfd99..deb20e628f 100644 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen_detect/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/internal/randen_detect/CMakeLists.txt @@ -6,6 +6,20 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(random-internal-randen_detect) +target_compile_options(random-internal-randen_detect PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(random-internal-randen_detect PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(random-internal-randen_detect PUBLIC + contrib-libs-cxxsupp + random-internal-randen_hwaes + random-internal-randen_round_keys +) +target_sources(random-internal-randen_detect PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen_detect.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen_engine.h b/contrib/restricted/abseil-cpp/absl/random/internal/randen_engine.h deleted file mode 100644 index 372c3ac2bd..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen_engine.h +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_INTERNAL_RANDEN_ENGINE_H_ -#define ABSL_RANDOM_INTERNAL_RANDEN_ENGINE_H_ - -#include <algorithm> -#include <cinttypes> -#include <cstdlib> -#include <iostream> -#include <iterator> -#include <limits> -#include <type_traits> - -#include "absl/base/internal/endian.h" -#include "absl/meta/type_traits.h" -#include "absl/random/internal/iostream_state_saver.h" -#include "absl/random/internal/randen.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal { - -// Deterministic pseudorandom byte generator with backtracking resistance -// (leaking the state does not compromise prior outputs). Based on Reverie -// (see "A Robust and Sponge-Like PRNG with Improved Efficiency") instantiated -// with an improved Simpira-like permutation. -// Returns values of type "T" (must be a built-in unsigned integer type). -// -// RANDen = RANDom generator or beetroots in Swiss High German. -// 'Strong' (well-distributed, unpredictable, backtracking-resistant) random -// generator, faster in some benchmarks than std::mt19937_64 and pcg64_c32. -template <typename T> -class alignas(16) randen_engine { - public: - // C++11 URBG interface: - using result_type = T; - static_assert(std::is_unsigned<result_type>::value, - "randen_engine template argument must be a built-in unsigned " - "integer type"); - - static constexpr result_type(min)() { - return (std::numeric_limits<result_type>::min)(); - } - - static constexpr result_type(max)() { - return (std::numeric_limits<result_type>::max)(); - } - - explicit randen_engine(result_type seed_value = 0) { seed(seed_value); } - - template <class SeedSequence, - typename = typename absl::enable_if_t< - !std::is_same<SeedSequence, randen_engine>::value>> - explicit randen_engine(SeedSequence&& seq) { - seed(seq); - } - - randen_engine(const randen_engine&) = default; - - // Returns random bits from the buffer in units of result_type. - result_type operator()() { - // Refill the buffer if needed (unlikely). - if (next_ >= kStateSizeT) { - next_ = kCapacityT; - impl_.Generate(state_); - } - - return little_endian::ToHost(state_[next_++]); - } - - template <class SeedSequence> - typename absl::enable_if_t< - !std::is_convertible<SeedSequence, result_type>::value> - seed(SeedSequence&& seq) { - // Zeroes the state. - seed(); - reseed(seq); - } - - void seed(result_type seed_value = 0) { - next_ = kStateSizeT; - // Zeroes the inner state and fills the outer state with seed_value to - // mimics behaviour of reseed - std::fill(std::begin(state_), std::begin(state_) + kCapacityT, 0); - std::fill(std::begin(state_) + kCapacityT, std::end(state_), seed_value); - } - - // Inserts entropy into (part of) the state. Calling this periodically with - // sufficient entropy ensures prediction resistance (attackers cannot predict - // future outputs even if state is compromised). - template <class SeedSequence> - void reseed(SeedSequence& seq) { - using sequence_result_type = typename SeedSequence::result_type; - static_assert(sizeof(sequence_result_type) == 4, - "SeedSequence::result_type must be 32-bit"); - - constexpr size_t kBufferSize = - Randen::kSeedBytes / sizeof(sequence_result_type); - alignas(16) sequence_result_type buffer[kBufferSize]; - - // Randen::Absorb XORs the seed into state, which is then mixed by a call - // to Randen::Generate. Seeding with only the provided entropy is preferred - // to using an arbitrary generate() call, so use [rand.req.seed_seq] - // size as a proxy for the number of entropy units that can be generated - // without relying on seed sequence mixing... - const size_t entropy_size = seq.size(); - if (entropy_size < kBufferSize) { - // ... and only request that many values, or 256-bits, when unspecified. - const size_t requested_entropy = (entropy_size == 0) ? 8u : entropy_size; - std::fill(std::begin(buffer) + requested_entropy, std::end(buffer), 0); - seq.generate(std::begin(buffer), std::begin(buffer) + requested_entropy); -#ifdef ABSL_IS_BIG_ENDIAN - // Randen expects the seed buffer to be in Little Endian; reverse it on - // Big Endian platforms. - for (sequence_result_type& e : buffer) { - e = absl::little_endian::FromHost(e); - } -#endif - // The Randen paper suggests preferentially initializing even-numbered - // 128-bit vectors of the randen state (there are 16 such vectors). - // The seed data is merged into the state offset by 128-bits, which - // implies prefering seed bytes [16..31, ..., 208..223]. Since the - // buffer is 32-bit values, we swap the corresponding buffer positions in - // 128-bit chunks. - size_t dst = kBufferSize; - while (dst > 7) { - // leave the odd bucket as-is. - dst -= 4; - size_t src = dst >> 1; - // swap 128-bits into the even bucket - std::swap(buffer[--dst], buffer[--src]); - std::swap(buffer[--dst], buffer[--src]); - std::swap(buffer[--dst], buffer[--src]); - std::swap(buffer[--dst], buffer[--src]); - } - } else { - seq.generate(std::begin(buffer), std::end(buffer)); - } - impl_.Absorb(buffer, state_); - - // Generate will be called when operator() is called - next_ = kStateSizeT; - } - - void discard(uint64_t count) { - uint64_t step = std::min<uint64_t>(kStateSizeT - next_, count); - count -= step; - - constexpr uint64_t kRateT = kStateSizeT - kCapacityT; - while (count > 0) { - next_ = kCapacityT; - impl_.Generate(state_); - step = std::min<uint64_t>(kRateT, count); - count -= step; - } - next_ += step; - } - - bool operator==(const randen_engine& other) const { - return next_ == other.next_ && - std::equal(std::begin(state_), std::end(state_), - std::begin(other.state_)); - } - - bool operator!=(const randen_engine& other) const { - return !(*this == other); - } - - template <class CharT, class Traits> - friend std::basic_ostream<CharT, Traits>& operator<<( - std::basic_ostream<CharT, Traits>& os, // NOLINT(runtime/references) - const randen_engine<T>& engine) { // NOLINT(runtime/references) - using numeric_type = - typename random_internal::stream_format_type<result_type>::type; - auto saver = random_internal::make_ostream_state_saver(os); - for (const auto& elem : engine.state_) { - // In the case that `elem` is `uint8_t`, it must be cast to something - // larger so that it prints as an integer rather than a character. For - // simplicity, apply the cast all circumstances. - os << static_cast<numeric_type>(little_endian::FromHost(elem)) - << os.fill(); - } - os << engine.next_; - return os; - } - - template <class CharT, class Traits> - friend std::basic_istream<CharT, Traits>& operator>>( - std::basic_istream<CharT, Traits>& is, // NOLINT(runtime/references) - randen_engine<T>& engine) { // NOLINT(runtime/references) - using numeric_type = - typename random_internal::stream_format_type<result_type>::type; - result_type state[kStateSizeT]; - size_t next; - for (auto& elem : state) { - // It is not possible to read uint8_t from wide streams, so it is - // necessary to read a wider type and then cast it to uint8_t. - numeric_type value; - is >> value; - elem = little_endian::ToHost(static_cast<result_type>(value)); - } - is >> next; - if (is.fail()) { - return is; - } - std::memcpy(engine.state_, state, sizeof(engine.state_)); - engine.next_ = next; - return is; - } - - private: - static constexpr size_t kStateSizeT = - Randen::kStateBytes / sizeof(result_type); - static constexpr size_t kCapacityT = - Randen::kCapacityBytes / sizeof(result_type); - - // First kCapacityT are `inner', the others are accessible random bits. - alignas(16) result_type state_[kStateSizeT]; - size_t next_; // index within state_ - Randen impl_; -}; - -} // namespace random_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_INTERNAL_RANDEN_ENGINE_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes/CMakeLists.linux.txt deleted file mode 100644 index 4134cd7c3a..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes/CMakeLists.linux.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(random-internal-randen_hwaes) -target_compile_options(random-internal-randen_hwaes PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(random-internal-randen_hwaes PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(random-internal-randen_hwaes PUBLIC - contrib-libs-cxxsupp - random-internal-randen_round_keys -) -target_sources(random-internal-randen_hwaes PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes/CMakeLists.txt index e8c98bfd99..4134cd7c3a 100644 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes/CMakeLists.txt @@ -6,6 +6,19 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(random-internal-randen_hwaes) +target_compile_options(random-internal-randen_hwaes PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(random-internal-randen_hwaes PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(random-internal-randen_hwaes PUBLIC + contrib-libs-cxxsupp + random-internal-randen_round_keys +) +target_sources(random-internal-randen_hwaes PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys/CMakeLists.linux.txt deleted file mode 100644 index 230b3fac21..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(random-internal-randen_round_keys) -target_compile_options(random-internal-randen_round_keys PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(random-internal-randen_round_keys PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(random-internal-randen_round_keys PUBLIC - contrib-libs-cxxsupp -) -target_sources(random-internal-randen_round_keys PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys/CMakeLists.txt index e8c98bfd99..230b3fac21 100644 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(random-internal-randen_round_keys) +target_compile_options(random-internal-randen_round_keys PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(random-internal-randen_round_keys PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(random-internal-randen_round_keys PUBLIC + contrib-libs-cxxsupp +) +target_sources(random-internal-randen_round_keys PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen_slow/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen_slow/CMakeLists.linux.txt deleted file mode 100644 index 0250d97f8a..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen_slow/CMakeLists.linux.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(random-internal-randen_slow) -target_compile_options(random-internal-randen_slow PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(random-internal-randen_slow PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(random-internal-randen_slow PUBLIC - contrib-libs-cxxsupp - random-internal-randen_round_keys -) -target_sources(random-internal-randen_slow PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen_slow.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/randen_slow/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/internal/randen_slow/CMakeLists.txt index e8c98bfd99..0250d97f8a 100644 --- a/contrib/restricted/abseil-cpp/absl/random/internal/randen_slow/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/internal/randen_slow/CMakeLists.txt @@ -6,6 +6,19 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(random-internal-randen_slow) +target_compile_options(random-internal-randen_slow PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(random-internal-randen_slow PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(random-internal-randen_slow PUBLIC + contrib-libs-cxxsupp + random-internal-randen_round_keys +) +target_sources(random-internal-randen_slow PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/randen_slow.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/seed_material/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/internal/seed_material/CMakeLists.linux.txt deleted file mode 100644 index ab3eb55d6e..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/seed_material/CMakeLists.linux.txt +++ /dev/null @@ -1,32 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(random-internal-seed_material) -target_compile_options(random-internal-seed_material PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(random-internal-seed_material PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(random-internal-seed_material PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - absl-types-bad_optional_access -) -target_sources(random-internal-seed_material PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/seed_material.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/seed_material/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/internal/seed_material/CMakeLists.txt index e8c98bfd99..ab3eb55d6e 100644 --- a/contrib/restricted/abseil-cpp/absl/random/internal/seed_material/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/internal/seed_material/CMakeLists.txt @@ -6,6 +6,27 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(random-internal-seed_material) +target_compile_options(random-internal-seed_material PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(random-internal-seed_material PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(random-internal-seed_material PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + absl-types-bad_optional_access +) +target_sources(random-internal-seed_material PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/internal/seed_material.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/sequence_urbg.h b/contrib/restricted/abseil-cpp/absl/random/internal/sequence_urbg.h deleted file mode 100644 index bc96a12cd2..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/sequence_urbg.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_ -#define ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_ - -#include <cstdint> -#include <cstring> -#include <limits> -#include <type_traits> -#include <vector> - -#include "absl/base/config.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace random_internal { - -// `sequence_urbg` is a simple random number generator which meets the -// requirements of [rand.req.urbg], and is solely for testing absl -// distributions. -class sequence_urbg { - public: - using result_type = uint64_t; - - static constexpr result_type(min)() { - return (std::numeric_limits<result_type>::min)(); - } - static constexpr result_type(max)() { - return (std::numeric_limits<result_type>::max)(); - } - - sequence_urbg(std::initializer_list<result_type> data) : i_(0), data_(data) {} - void reset() { i_ = 0; } - - result_type operator()() { return data_[i_++ % data_.size()]; } - - size_t invocations() const { return i_; } - - private: - size_t i_; - std::vector<result_type> data_; -}; - -} // namespace random_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/internal/uniform_helper.h b/contrib/restricted/abseil-cpp/absl/random/internal/uniform_helper.h deleted file mode 100644 index 1243bc1c62..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/internal/uniform_helper.h +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#ifndef ABSL_RANDOM_INTERNAL_UNIFORM_HELPER_H_ -#define ABSL_RANDOM_INTERNAL_UNIFORM_HELPER_H_ - -#include <cmath> -#include <limits> -#include <type_traits> - -#include "absl/base/config.h" -#include "absl/meta/type_traits.h" -#include "absl/random/internal/traits.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -template <typename IntType> -class uniform_int_distribution; - -template <typename RealType> -class uniform_real_distribution; - -// Interval tag types which specify whether the interval is open or closed -// on either boundary. - -namespace random_internal { -template <typename T> -struct TagTypeCompare {}; - -template <typename T> -constexpr bool operator==(TagTypeCompare<T>, TagTypeCompare<T>) { - // Tags are mono-states. They always compare equal. - return true; -} -template <typename T> -constexpr bool operator!=(TagTypeCompare<T>, TagTypeCompare<T>) { - return false; -} - -} // namespace random_internal - -struct IntervalClosedClosedTag - : public random_internal::TagTypeCompare<IntervalClosedClosedTag> {}; -struct IntervalClosedOpenTag - : public random_internal::TagTypeCompare<IntervalClosedOpenTag> {}; -struct IntervalOpenClosedTag - : public random_internal::TagTypeCompare<IntervalOpenClosedTag> {}; -struct IntervalOpenOpenTag - : public random_internal::TagTypeCompare<IntervalOpenOpenTag> {}; - -namespace random_internal { - -// In the absence of an explicitly provided return-type, the template -// "uniform_inferred_return_t<A, B>" is used to derive a suitable type, based on -// the data-types of the endpoint-arguments {A lo, B hi}. -// -// Given endpoints {A lo, B hi}, one of {A, B} will be chosen as the -// return-type, if one type can be implicitly converted into the other, in a -// lossless way. The template "is_widening_convertible" implements the -// compile-time logic for deciding if such a conversion is possible. -// -// If no such conversion between {A, B} exists, then the overload for -// absl::Uniform() will be discarded, and the call will be ill-formed. -// Return-type for absl::Uniform() when the return-type is inferred. -template <typename A, typename B> -using uniform_inferred_return_t = - absl::enable_if_t<absl::disjunction<is_widening_convertible<A, B>, - is_widening_convertible<B, A>>::value, - typename std::conditional< - is_widening_convertible<A, B>::value, B, A>::type>; - -// The functions -// uniform_lower_bound(tag, a, b) -// and -// uniform_upper_bound(tag, a, b) -// are used as implementation-details for absl::Uniform(). -// -// Conceptually, -// [a, b] == [uniform_lower_bound(IntervalClosedClosed, a, b), -// uniform_upper_bound(IntervalClosedClosed, a, b)] -// (a, b) == [uniform_lower_bound(IntervalOpenOpen, a, b), -// uniform_upper_bound(IntervalOpenOpen, a, b)] -// [a, b) == [uniform_lower_bound(IntervalClosedOpen, a, b), -// uniform_upper_bound(IntervalClosedOpen, a, b)] -// (a, b] == [uniform_lower_bound(IntervalOpenClosed, a, b), -// uniform_upper_bound(IntervalOpenClosed, a, b)] -// -template <typename IntType, typename Tag> -typename absl::enable_if_t< - absl::conjunction< - std::is_integral<IntType>, - absl::disjunction<std::is_same<Tag, IntervalOpenClosedTag>, - std::is_same<Tag, IntervalOpenOpenTag>>>::value, - IntType> -uniform_lower_bound(Tag, IntType a, IntType) { - return a < (std::numeric_limits<IntType>::max)() ? (a + 1) : a; -} - -template <typename FloatType, typename Tag> -typename absl::enable_if_t< - absl::conjunction< - std::is_floating_point<FloatType>, - absl::disjunction<std::is_same<Tag, IntervalOpenClosedTag>, - std::is_same<Tag, IntervalOpenOpenTag>>>::value, - FloatType> -uniform_lower_bound(Tag, FloatType a, FloatType b) { - return std::nextafter(a, b); -} - -template <typename NumType, typename Tag> -typename absl::enable_if_t< - absl::disjunction<std::is_same<Tag, IntervalClosedClosedTag>, - std::is_same<Tag, IntervalClosedOpenTag>>::value, - NumType> -uniform_lower_bound(Tag, NumType a, NumType) { - return a; -} - -template <typename IntType, typename Tag> -typename absl::enable_if_t< - absl::conjunction< - std::is_integral<IntType>, - absl::disjunction<std::is_same<Tag, IntervalClosedOpenTag>, - std::is_same<Tag, IntervalOpenOpenTag>>>::value, - IntType> -uniform_upper_bound(Tag, IntType, IntType b) { - return b > (std::numeric_limits<IntType>::min)() ? (b - 1) : b; -} - -template <typename FloatType, typename Tag> -typename absl::enable_if_t< - absl::conjunction< - std::is_floating_point<FloatType>, - absl::disjunction<std::is_same<Tag, IntervalClosedOpenTag>, - std::is_same<Tag, IntervalOpenOpenTag>>>::value, - FloatType> -uniform_upper_bound(Tag, FloatType, FloatType b) { - return b; -} - -template <typename IntType, typename Tag> -typename absl::enable_if_t< - absl::conjunction< - std::is_integral<IntType>, - absl::disjunction<std::is_same<Tag, IntervalClosedClosedTag>, - std::is_same<Tag, IntervalOpenClosedTag>>>::value, - IntType> -uniform_upper_bound(Tag, IntType, IntType b) { - return b; -} - -template <typename FloatType, typename Tag> -typename absl::enable_if_t< - absl::conjunction< - std::is_floating_point<FloatType>, - absl::disjunction<std::is_same<Tag, IntervalClosedClosedTag>, - std::is_same<Tag, IntervalOpenClosedTag>>>::value, - FloatType> -uniform_upper_bound(Tag, FloatType, FloatType b) { - return std::nextafter(b, (std::numeric_limits<FloatType>::max)()); -} - -// Returns whether the bounds are valid for the underlying distribution. -// Inputs must have already been resolved via uniform_*_bound calls. -// -// The c++ standard constraints in [rand.dist.uni.int] are listed as: -// requires: lo <= hi. -// -// In the uniform_int_distrubtion, {lo, hi} are closed, closed. Thus: -// [0, 0] is legal. -// [0, 0) is not legal, but [0, 1) is, which translates to [0, 0]. -// (0, 1) is not legal, but (0, 2) is, which translates to [1, 1]. -// (0, 0] is not legal, but (0, 1] is, which translates to [1, 1]. -// -// The c++ standard constraints in [rand.dist.uni.real] are listed as: -// requires: lo <= hi. -// requires: (hi - lo) <= numeric_limits<T>::max() -// -// In the uniform_real_distribution, {lo, hi} are closed, open, Thus: -// [0, 0] is legal, which is [0, 0+epsilon). -// [0, 0) is legal. -// (0, 0) is not legal, but (0-epsilon, 0+epsilon) is. -// (0, 0] is not legal, but (0, 0+epsilon] is. -// -template <typename FloatType> -absl::enable_if_t<std::is_floating_point<FloatType>::value, bool> -is_uniform_range_valid(FloatType a, FloatType b) { - return a <= b && std::isfinite(b - a); -} - -template <typename IntType> -absl::enable_if_t<std::is_integral<IntType>::value, bool> -is_uniform_range_valid(IntType a, IntType b) { - return a <= b; -} - -// UniformDistribution selects either absl::uniform_int_distribution -// or absl::uniform_real_distribution depending on the NumType parameter. -template <typename NumType> -using UniformDistribution = - typename std::conditional<std::is_integral<NumType>::value, - absl::uniform_int_distribution<NumType>, - absl::uniform_real_distribution<NumType>>::type; - -// UniformDistributionWrapper is used as the underlying distribution type -// by the absl::Uniform template function. It selects the proper Abseil -// uniform distribution and provides constructor overloads that match the -// expected parameter order as well as adjusting distribtuion bounds based -// on the tag. -template <typename NumType> -struct UniformDistributionWrapper : public UniformDistribution<NumType> { - template <typename TagType> - explicit UniformDistributionWrapper(TagType, NumType lo, NumType hi) - : UniformDistribution<NumType>( - uniform_lower_bound<NumType>(TagType{}, lo, hi), - uniform_upper_bound<NumType>(TagType{}, lo, hi)) {} - - explicit UniformDistributionWrapper(NumType lo, NumType hi) - : UniformDistribution<NumType>( - uniform_lower_bound<NumType>(IntervalClosedOpenTag(), lo, hi), - uniform_upper_bound<NumType>(IntervalClosedOpenTag(), lo, hi)) {} - - explicit UniformDistributionWrapper() - : UniformDistribution<NumType>(std::numeric_limits<NumType>::lowest(), - (std::numeric_limits<NumType>::max)()) {} -}; - -} // namespace random_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_INTERNAL_UNIFORM_HELPER_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/log_uniform_int_distribution.h b/contrib/restricted/abseil-cpp/absl/random/log_uniform_int_distribution.h deleted file mode 100644 index 43e101169c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/log_uniform_int_distribution.h +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_LOG_UNIFORM_INT_DISTRIBUTION_H_ -#define ABSL_RANDOM_LOG_UNIFORM_INT_DISTRIBUTION_H_ - -#include <algorithm> -#include <cassert> -#include <cmath> -#include <istream> -#include <limits> -#include <ostream> -#include <type_traits> - -#include "absl/numeric/bits.h" -#include "absl/random/internal/fastmath.h" -#include "absl/random/internal/generate_real.h" -#include "absl/random/internal/iostream_state_saver.h" -#include "absl/random/internal/traits.h" -#include "absl/random/uniform_int_distribution.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// log_uniform_int_distribution: -// -// Returns a random variate R in range [min, max] such that -// floor(log(R-min, base)) is uniformly distributed. -// We ensure uniformity by discretization using the -// boundary sets [0, 1, base, base * base, ... min(base*n, max)] -// -template <typename IntType = int> -class log_uniform_int_distribution { - private: - using unsigned_type = - typename random_internal::make_unsigned_bits<IntType>::type; - - public: - using result_type = IntType; - - class param_type { - public: - using distribution_type = log_uniform_int_distribution; - - explicit param_type( - result_type min = 0, - result_type max = (std::numeric_limits<result_type>::max)(), - result_type base = 2) - : min_(min), - max_(max), - base_(base), - range_(static_cast<unsigned_type>(max_) - - static_cast<unsigned_type>(min_)), - log_range_(0) { - assert(max_ >= min_); - assert(base_ > 1); - - if (base_ == 2) { - // Determine where the first set bit is on range(), giving a log2(range) - // value which can be used to construct bounds. - log_range_ = - (std::min)(bit_width(range()), - static_cast<unsigned_type>( - std::numeric_limits<unsigned_type>::digits)); - } else { - // NOTE: Computing the logN(x) introduces error from 2 sources: - // 1. Conversion of int to double loses precision for values >= - // 2^53, which may cause some log() computations to operate on - // different values. - // 2. The error introduced by the division will cause the result - // to differ from the expected value. - // - // Thus a result which should equal K may equal K +/- epsilon, - // which can eliminate some values depending on where the bounds fall. - const double inv_log_base = 1.0 / std::log(base_); - const double log_range = std::log(static_cast<double>(range()) + 0.5); - log_range_ = static_cast<int>(std::ceil(inv_log_base * log_range)); - } - } - - result_type(min)() const { return min_; } - result_type(max)() const { return max_; } - result_type base() const { return base_; } - - friend bool operator==(const param_type& a, const param_type& b) { - return a.min_ == b.min_ && a.max_ == b.max_ && a.base_ == b.base_; - } - - friend bool operator!=(const param_type& a, const param_type& b) { - return !(a == b); - } - - private: - friend class log_uniform_int_distribution; - - int log_range() const { return log_range_; } - unsigned_type range() const { return range_; } - - result_type min_; - result_type max_; - result_type base_; - unsigned_type range_; // max - min - int log_range_; // ceil(logN(range_)) - - static_assert(std::is_integral<IntType>::value, - "Class-template absl::log_uniform_int_distribution<> must be " - "parameterized using an integral type."); - }; - - log_uniform_int_distribution() : log_uniform_int_distribution(0) {} - - explicit log_uniform_int_distribution( - result_type min, - result_type max = (std::numeric_limits<result_type>::max)(), - result_type base = 2) - : param_(min, max, base) {} - - explicit log_uniform_int_distribution(const param_type& p) : param_(p) {} - - void reset() {} - - // generating functions - template <typename URBG> - result_type operator()(URBG& g) { // NOLINT(runtime/references) - return (*this)(g, param_); - } - - template <typename URBG> - result_type operator()(URBG& g, // NOLINT(runtime/references) - const param_type& p) { - return (p.min)() + Generate(g, p); - } - - result_type(min)() const { return (param_.min)(); } - result_type(max)() const { return (param_.max)(); } - result_type base() const { return param_.base(); } - - param_type param() const { return param_; } - void param(const param_type& p) { param_ = p; } - - friend bool operator==(const log_uniform_int_distribution& a, - const log_uniform_int_distribution& b) { - return a.param_ == b.param_; - } - friend bool operator!=(const log_uniform_int_distribution& a, - const log_uniform_int_distribution& b) { - return a.param_ != b.param_; - } - - private: - // Returns a log-uniform variate in the range [0, p.range()]. The caller - // should add min() to shift the result to the correct range. - template <typename URNG> - unsigned_type Generate(URNG& g, // NOLINT(runtime/references) - const param_type& p); - - param_type param_; -}; - -template <typename IntType> -template <typename URBG> -typename log_uniform_int_distribution<IntType>::unsigned_type -log_uniform_int_distribution<IntType>::Generate( - URBG& g, // NOLINT(runtime/references) - const param_type& p) { - // sample e over [0, log_range]. Map the results of e to this: - // 0 => 0 - // 1 => [1, b-1] - // 2 => [b, (b^2)-1] - // n => [b^(n-1)..(b^n)-1] - const int e = absl::uniform_int_distribution<int>(0, p.log_range())(g); - if (e == 0) { - return 0; - } - const int d = e - 1; - - unsigned_type base_e, top_e; - if (p.base() == 2) { - base_e = static_cast<unsigned_type>(1) << d; - - top_e = (e >= std::numeric_limits<unsigned_type>::digits) - ? (std::numeric_limits<unsigned_type>::max)() - : (static_cast<unsigned_type>(1) << e) - 1; - } else { - const double r = std::pow(p.base(), d); - const double s = (r * p.base()) - 1.0; - - base_e = - (r > static_cast<double>((std::numeric_limits<unsigned_type>::max)())) - ? (std::numeric_limits<unsigned_type>::max)() - : static_cast<unsigned_type>(r); - - top_e = - (s > static_cast<double>((std::numeric_limits<unsigned_type>::max)())) - ? (std::numeric_limits<unsigned_type>::max)() - : static_cast<unsigned_type>(s); - } - - const unsigned_type lo = (base_e >= p.range()) ? p.range() : base_e; - const unsigned_type hi = (top_e >= p.range()) ? p.range() : top_e; - - // choose uniformly over [lo, hi] - return absl::uniform_int_distribution<result_type>(lo, hi)(g); -} - -template <typename CharT, typename Traits, typename IntType> -std::basic_ostream<CharT, Traits>& operator<<( - std::basic_ostream<CharT, Traits>& os, // NOLINT(runtime/references) - const log_uniform_int_distribution<IntType>& x) { - using stream_type = - typename random_internal::stream_format_type<IntType>::type; - auto saver = random_internal::make_ostream_state_saver(os); - os << static_cast<stream_type>((x.min)()) << os.fill() - << static_cast<stream_type>((x.max)()) << os.fill() - << static_cast<stream_type>(x.base()); - return os; -} - -template <typename CharT, typename Traits, typename IntType> -std::basic_istream<CharT, Traits>& operator>>( - std::basic_istream<CharT, Traits>& is, // NOLINT(runtime/references) - log_uniform_int_distribution<IntType>& x) { // NOLINT(runtime/references) - using param_type = typename log_uniform_int_distribution<IntType>::param_type; - using result_type = - typename log_uniform_int_distribution<IntType>::result_type; - using stream_type = - typename random_internal::stream_format_type<IntType>::type; - - stream_type min; - stream_type max; - stream_type base; - - auto saver = random_internal::make_istream_state_saver(is); - is >> min >> max >> base; - if (!is.fail()) { - x.param(param_type(static_cast<result_type>(min), - static_cast<result_type>(max), - static_cast<result_type>(base))); - } - return is; -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_LOG_UNIFORM_INT_DISTRIBUTION_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/mock_distributions.h b/contrib/restricted/abseil-cpp/absl/random/mock_distributions.h deleted file mode 100644 index 764ab370ab..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/mock_distributions.h +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: mock_distributions.h -// ----------------------------------------------------------------------------- -// -// This file contains mock distribution functions for use alongside an -// `absl::MockingBitGen` object within the Googletest testing framework. Such -// mocks are useful to provide deterministic values as return values within -// (otherwise random) Abseil distribution functions. -// -// The return type of each function is a mock expectation object which -// is used to set the match result. -// -// More information about the Googletest testing framework is available at -// https://github.com/google/googletest -// -// EXPECT_CALL and ON_CALL need to be made within the same DLL component as -// the call to absl::Uniform and related methods, otherwise mocking will fail -// since the underlying implementation creates a type-specific pointer which -// will be distinct across different DLL boundaries. -// -// Example: -// -// absl::MockingBitGen mock; -// EXPECT_CALL(absl::MockUniform<int>(), Call(mock, 1, 1000)) -// .WillRepeatedly(testing::ReturnRoundRobin({20, 40})); -// -// EXPECT_EQ(absl::Uniform<int>(gen, 1, 1000), 20); -// EXPECT_EQ(absl::Uniform<int>(gen, 1, 1000), 40); -// EXPECT_EQ(absl::Uniform<int>(gen, 1, 1000), 20); -// EXPECT_EQ(absl::Uniform<int>(gen, 1, 1000), 40); - -#ifndef ABSL_RANDOM_MOCK_DISTRIBUTIONS_H_ -#define ABSL_RANDOM_MOCK_DISTRIBUTIONS_H_ - -#include <limits> -#include <type_traits> -#include <utility> - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/meta/type_traits.h" -#include "absl/random/distributions.h" -#include "absl/random/internal/mock_overload_set.h" -#include "absl/random/mocking_bit_gen.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// ----------------------------------------------------------------------------- -// absl::MockUniform -// ----------------------------------------------------------------------------- -// -// Matches calls to absl::Uniform. -// -// `absl::MockUniform` is a class template used in conjunction with Googletest's -// `ON_CALL()` and `EXPECT_CALL()` macros. To use it, default-construct an -// instance of it inside `ON_CALL()` or `EXPECT_CALL()`, and use `Call(...)` the -// same way one would define mocks on a Googletest `MockFunction()`. -// -// Example: -// -// absl::MockingBitGen mock; -// EXPECT_CALL(absl::MockUniform<uint32_t>(), Call(mock)) -// .WillOnce(Return(123456)); -// auto x = absl::Uniform<uint32_t>(mock); -// assert(x == 123456) -// -template <typename R> -using MockUniform = random_internal::MockOverloadSet< - random_internal::UniformDistributionWrapper<R>, - R(IntervalClosedOpenTag, MockingBitGen&, R, R), - R(IntervalClosedClosedTag, MockingBitGen&, R, R), - R(IntervalOpenOpenTag, MockingBitGen&, R, R), - R(IntervalOpenClosedTag, MockingBitGen&, R, R), R(MockingBitGen&, R, R), - R(MockingBitGen&)>; - -// ----------------------------------------------------------------------------- -// absl::MockBernoulli -// ----------------------------------------------------------------------------- -// -// Matches calls to absl::Bernoulli. -// -// `absl::MockBernoulli` is a class used in conjunction with Googletest's -// `ON_CALL()` and `EXPECT_CALL()` macros. To use it, default-construct an -// instance of it inside `ON_CALL()` or `EXPECT_CALL()`, and use `Call(...)` the -// same way one would define mocks on a Googletest `MockFunction()`. -// -// Example: -// -// absl::MockingBitGen mock; -// EXPECT_CALL(absl::MockBernoulli(), Call(mock, testing::_)) -// .WillOnce(Return(false)); -// assert(absl::Bernoulli(mock, 0.5) == false); -// -using MockBernoulli = - random_internal::MockOverloadSet<absl::bernoulli_distribution, - bool(MockingBitGen&, double)>; - -// ----------------------------------------------------------------------------- -// absl::MockBeta -// ----------------------------------------------------------------------------- -// -// Matches calls to absl::Beta. -// -// `absl::MockBeta` is a class used in conjunction with Googletest's `ON_CALL()` -// and `EXPECT_CALL()` macros. To use it, default-construct an instance of it -// inside `ON_CALL()` or `EXPECT_CALL()`, and use `Call(...)` the same way one -// would define mocks on a Googletest `MockFunction()`. -// -// Example: -// -// absl::MockingBitGen mock; -// EXPECT_CALL(absl::MockBeta(), Call(mock, 3.0, 2.0)) -// .WillOnce(Return(0.567)); -// auto x = absl::Beta<double>(mock, 3.0, 2.0); -// assert(x == 0.567); -// -template <typename RealType> -using MockBeta = - random_internal::MockOverloadSet<absl::beta_distribution<RealType>, - RealType(MockingBitGen&, RealType, - RealType)>; - -// ----------------------------------------------------------------------------- -// absl::MockExponential -// ----------------------------------------------------------------------------- -// -// Matches calls to absl::Exponential. -// -// `absl::MockExponential` is a class template used in conjunction with -// Googletest's `ON_CALL()` and `EXPECT_CALL()` macros. To use it, -// default-construct an instance of it inside `ON_CALL()` or `EXPECT_CALL()`, -// and use `Call(...)` the same way one would define mocks on a -// Googletest `MockFunction()`. -// -// Example: -// -// absl::MockingBitGen mock; -// EXPECT_CALL(absl::MockExponential<double>(), Call(mock, 0.5)) -// .WillOnce(Return(12.3456789)); -// auto x = absl::Exponential<double>(mock, 0.5); -// assert(x == 12.3456789) -// -template <typename RealType> -using MockExponential = - random_internal::MockOverloadSet<absl::exponential_distribution<RealType>, - RealType(MockingBitGen&, RealType)>; - -// ----------------------------------------------------------------------------- -// absl::MockGaussian -// ----------------------------------------------------------------------------- -// -// Matches calls to absl::Gaussian. -// -// `absl::MockGaussian` is a class template used in conjunction with -// Googletest's `ON_CALL()` and `EXPECT_CALL()` macros. To use it, -// default-construct an instance of it inside `ON_CALL()` or `EXPECT_CALL()`, -// and use `Call(...)` the same way one would define mocks on a -// Googletest `MockFunction()`. -// -// Example: -// -// absl::MockingBitGen mock; -// EXPECT_CALL(absl::MockGaussian<double>(), Call(mock, 16.3, 3.3)) -// .WillOnce(Return(12.3456789)); -// auto x = absl::Gaussian<double>(mock, 16.3, 3.3); -// assert(x == 12.3456789) -// -template <typename RealType> -using MockGaussian = - random_internal::MockOverloadSet<absl::gaussian_distribution<RealType>, - RealType(MockingBitGen&, RealType, - RealType)>; - -// ----------------------------------------------------------------------------- -// absl::MockLogUniform -// ----------------------------------------------------------------------------- -// -// Matches calls to absl::LogUniform. -// -// `absl::MockLogUniform` is a class template used in conjunction with -// Googletest's `ON_CALL()` and `EXPECT_CALL()` macros. To use it, -// default-construct an instance of it inside `ON_CALL()` or `EXPECT_CALL()`, -// and use `Call(...)` the same way one would define mocks on a -// Googletest `MockFunction()`. -// -// Example: -// -// absl::MockingBitGen mock; -// EXPECT_CALL(absl::MockLogUniform<int>(), Call(mock, 10, 10000, 10)) -// .WillOnce(Return(1221)); -// auto x = absl::LogUniform<int>(mock, 10, 10000, 10); -// assert(x == 1221) -// -template <typename IntType> -using MockLogUniform = random_internal::MockOverloadSet< - absl::log_uniform_int_distribution<IntType>, - IntType(MockingBitGen&, IntType, IntType, IntType)>; - -// ----------------------------------------------------------------------------- -// absl::MockPoisson -// ----------------------------------------------------------------------------- -// -// Matches calls to absl::Poisson. -// -// `absl::MockPoisson` is a class template used in conjunction with Googletest's -// `ON_CALL()` and `EXPECT_CALL()` macros. To use it, default-construct an -// instance of it inside `ON_CALL()` or `EXPECT_CALL()`, and use `Call(...)` the -// same way one would define mocks on a Googletest `MockFunction()`. -// -// Example: -// -// absl::MockingBitGen mock; -// EXPECT_CALL(absl::MockPoisson<int>(), Call(mock, 2.0)) -// .WillOnce(Return(1221)); -// auto x = absl::Poisson<int>(mock, 2.0); -// assert(x == 1221) -// -template <typename IntType> -using MockPoisson = - random_internal::MockOverloadSet<absl::poisson_distribution<IntType>, - IntType(MockingBitGen&, double)>; - -// ----------------------------------------------------------------------------- -// absl::MockZipf -// ----------------------------------------------------------------------------- -// -// Matches calls to absl::Zipf. -// -// `absl::MockZipf` is a class template used in conjunction with Googletest's -// `ON_CALL()` and `EXPECT_CALL()` macros. To use it, default-construct an -// instance of it inside `ON_CALL()` or `EXPECT_CALL()`, and use `Call(...)` the -// same way one would define mocks on a Googletest `MockFunction()`. -// -// Example: -// -// absl::MockingBitGen mock; -// EXPECT_CALL(absl::MockZipf<int>(), Call(mock, 1000000, 2.0, 1.0)) -// .WillOnce(Return(1221)); -// auto x = absl::Zipf<int>(mock, 1000000, 2.0, 1.0); -// assert(x == 1221) -// -template <typename IntType> -using MockZipf = - random_internal::MockOverloadSet<absl::zipf_distribution<IntType>, - IntType(MockingBitGen&, IntType, double, - double)>; - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_MOCK_DISTRIBUTIONS_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/mocking_bit_gen.h b/contrib/restricted/abseil-cpp/absl/random/mocking_bit_gen.h deleted file mode 100644 index 7b2b80eb35..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/mocking_bit_gen.h +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// mocking_bit_gen.h -// ----------------------------------------------------------------------------- -// -// This file includes an `absl::MockingBitGen` class to use as a mock within the -// Googletest testing framework. Such a mock is useful to provide deterministic -// values as return values within (otherwise random) Abseil distribution -// functions. Such determinism within a mock is useful within testing frameworks -// to test otherwise indeterminate APIs. -// -// More information about the Googletest testing framework is available at -// https://github.com/google/googletest - -#ifndef ABSL_RANDOM_MOCKING_BIT_GEN_H_ -#define ABSL_RANDOM_MOCKING_BIT_GEN_H_ - -#include <iterator> -#include <limits> -#include <memory> -#include <tuple> -#include <type_traits> -#include <utility> - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/base/internal/fast_type_id.h" -#include "absl/container/flat_hash_map.h" -#include "absl/meta/type_traits.h" -#include "absl/random/distributions.h" -#include "absl/random/internal/distribution_caller.h" -#include "absl/random/random.h" -#include "absl/strings/str_cat.h" -#include "absl/strings/str_join.h" -#include "absl/types/span.h" -#include "absl/types/variant.h" -#include "absl/utility/utility.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -namespace random_internal { -template <typename> -struct DistributionCaller; -class MockHelpers; - -} // namespace random_internal -class BitGenRef; - -// MockingBitGen -// -// `absl::MockingBitGen` is a mock Uniform Random Bit Generator (URBG) class -// which can act in place of an `absl::BitGen` URBG within tests using the -// Googletest testing framework. -// -// Usage: -// -// Use an `absl::MockingBitGen` along with a mock distribution object (within -// mock_distributions.h) inside Googletest constructs such as ON_CALL(), -// EXPECT_TRUE(), etc. to produce deterministic results conforming to the -// distribution's API contract. -// -// Example: -// -// // Mock a call to an `absl::Bernoulli` distribution using Googletest -// absl::MockingBitGen bitgen; -// -// ON_CALL(absl::MockBernoulli(), Call(bitgen, 0.5)) -// .WillByDefault(testing::Return(true)); -// EXPECT_TRUE(absl::Bernoulli(bitgen, 0.5)); -// -// // Mock a call to an `absl::Uniform` distribution within Googletest -// absl::MockingBitGen bitgen; -// -// ON_CALL(absl::MockUniform<int>(), Call(bitgen, testing::_, testing::_)) -// .WillByDefault([] (int low, int high) { -// return (low + high) / 2; -// }); -// -// EXPECT_EQ(absl::Uniform<int>(gen, 0, 10), 5); -// EXPECT_EQ(absl::Uniform<int>(gen, 30, 40), 35); -// -// At this time, only mock distributions supplied within the Abseil random -// library are officially supported. -// -// EXPECT_CALL and ON_CALL need to be made within the same DLL component as -// the call to absl::Uniform and related methods, otherwise mocking will fail -// since the underlying implementation creates a type-specific pointer which -// will be distinct across different DLL boundaries. -// -class MockingBitGen { - public: - MockingBitGen() = default; - ~MockingBitGen() = default; - - // URBG interface - using result_type = absl::BitGen::result_type; - - static constexpr result_type(min)() { return (absl::BitGen::min)(); } - static constexpr result_type(max)() { return (absl::BitGen::max)(); } - result_type operator()() { return gen_(); } - - private: - // GetMockFnType returns the testing::MockFunction for a result and tuple. - // This method only exists for type deduction and is otherwise unimplemented. - template <typename ResultT, typename... Args> - static auto GetMockFnType(ResultT, std::tuple<Args...>) - -> ::testing::MockFunction<ResultT(Args...)>; - - // MockFnCaller is a helper method for use with absl::apply to - // apply an ArgTupleT to a compatible MockFunction. - // NOTE: MockFnCaller is essentially equivalent to the lambda: - // [fn](auto... args) { return fn->Call(std::move(args)...)} - // however that fails to build on some supported platforms. - template <typename MockFnType, typename ResultT, typename Tuple> - struct MockFnCaller; - - // specialization for std::tuple. - template <typename MockFnType, typename ResultT, typename... Args> - struct MockFnCaller<MockFnType, ResultT, std::tuple<Args...>> { - MockFnType* fn; - inline ResultT operator()(Args... args) { - return fn->Call(std::move(args)...); - } - }; - - // FunctionHolder owns a particular ::testing::MockFunction associated with - // a mocked type signature, and implement the type-erased Apply call, which - // applies type-erased arguments to the mock. - class FunctionHolder { - public: - virtual ~FunctionHolder() = default; - - // Call is a dispatch function which converts the - // generic type-erased parameters into a specific mock invocation call. - virtual void Apply(/*ArgTupleT*/ void* args_tuple, - /*ResultT*/ void* result) = 0; - }; - - template <typename MockFnType, typename ResultT, typename ArgTupleT> - class FunctionHolderImpl final : public FunctionHolder { - public: - void Apply(void* args_tuple, void* result) override { - // Requires tuple_args to point to a ArgTupleT, which is a - // std::tuple<Args...> used to invoke the mock function. Requires result - // to point to a ResultT, which is the result of the call. - *static_cast<ResultT*>(result) = - absl::apply(MockFnCaller<MockFnType, ResultT, ArgTupleT>{&mock_fn_}, - *static_cast<ArgTupleT*>(args_tuple)); - } - - MockFnType mock_fn_; - }; - - // MockingBitGen::RegisterMock - // - // RegisterMock<ResultT, ArgTupleT>(FastTypeIdType) is the main extension - // point for extending the MockingBitGen framework. It provides a mechanism to - // install a mock expectation for a function like ResultT(Args...) keyed by - // type_idex onto the MockingBitGen context. The key is that the type_index - // used to register must match the type index used to call the mock. - // - // The returned MockFunction<...> type can be used to setup additional - // distribution parameters of the expectation. - template <typename ResultT, typename ArgTupleT, typename SelfT> - auto RegisterMock(SelfT&, base_internal::FastTypeIdType type) - -> decltype(GetMockFnType(std::declval<ResultT>(), - std::declval<ArgTupleT>()))& { - using MockFnType = decltype(GetMockFnType(std::declval<ResultT>(), - std::declval<ArgTupleT>())); - - using WrappedFnType = absl::conditional_t< - std::is_same<SelfT, ::testing::NiceMock<absl::MockingBitGen>>::value, - ::testing::NiceMock<MockFnType>, - absl::conditional_t< - std::is_same<SelfT, - ::testing::NaggyMock<absl::MockingBitGen>>::value, - ::testing::NaggyMock<MockFnType>, - absl::conditional_t< - std::is_same<SelfT, - ::testing::StrictMock<absl::MockingBitGen>>::value, - ::testing::StrictMock<MockFnType>, MockFnType>>>; - - using ImplT = FunctionHolderImpl<WrappedFnType, ResultT, ArgTupleT>; - auto& mock = mocks_[type]; - if (!mock) { - mock = absl::make_unique<ImplT>(); - } - return static_cast<ImplT*>(mock.get())->mock_fn_; - } - - // MockingBitGen::InvokeMock - // - // InvokeMock(FastTypeIdType, args, result) is the entrypoint for invoking - // mocks registered on MockingBitGen. - // - // When no mocks are registered on the provided FastTypeIdType, returns false. - // Otherwise attempts to invoke the mock function ResultT(Args...) that - // was previously registered via the type_index. - // Requires tuple_args to point to a ArgTupleT, which is a std::tuple<Args...> - // used to invoke the mock function. - // Requires result to point to a ResultT, which is the result of the call. - inline bool InvokeMock(base_internal::FastTypeIdType type, void* args_tuple, - void* result) { - // Trigger a mock, if there exists one that matches `param`. - auto it = mocks_.find(type); - if (it == mocks_.end()) return false; - it->second->Apply(args_tuple, result); - return true; - } - - absl::flat_hash_map<base_internal::FastTypeIdType, - std::unique_ptr<FunctionHolder>> - mocks_; - absl::BitGen gen_; - - template <typename> - friend struct ::absl::random_internal::DistributionCaller; // for InvokeMock - friend class ::absl::BitGenRef; // for InvokeMock - friend class ::absl::random_internal::MockHelpers; // for RegisterMock, - // InvokeMock -}; - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_MOCKING_BIT_GEN_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/poisson_distribution.h b/contrib/restricted/abseil-cpp/absl/random/poisson_distribution.h deleted file mode 100644 index cb5f5d5d0f..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/poisson_distribution.h +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_POISSON_DISTRIBUTION_H_ -#define ABSL_RANDOM_POISSON_DISTRIBUTION_H_ - -#include <cassert> -#include <cmath> -#include <istream> -#include <limits> -#include <ostream> -#include <type_traits> - -#include "absl/random/internal/fast_uniform_bits.h" -#include "absl/random/internal/fastmath.h" -#include "absl/random/internal/generate_real.h" -#include "absl/random/internal/iostream_state_saver.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// absl::poisson_distribution: -// Generates discrete variates conforming to a Poisson distribution. -// p(n) = (mean^n / n!) exp(-mean) -// -// Depending on the parameter, the distribution selects one of the following -// algorithms: -// * The standard algorithm, attributed to Knuth, extended using a split method -// for larger values -// * The "Ratio of Uniforms as a convenient method for sampling from classical -// discrete distributions", Stadlober, 1989. -// http://www.sciencedirect.com/science/article/pii/0377042790903495 -// -// NOTE: param_type.mean() is a double, which permits values larger than -// poisson_distribution<IntType>::max(), however this should be avoided and -// the distribution results are limited to the max() value. -// -// The goals of this implementation are to provide good performance while still -// beig thread-safe: This limits the implementation to not using lgamma provided -// by <math.h>. -// -template <typename IntType = int> -class poisson_distribution { - public: - using result_type = IntType; - - class param_type { - public: - using distribution_type = poisson_distribution; - explicit param_type(double mean = 1.0); - - double mean() const { return mean_; } - - friend bool operator==(const param_type& a, const param_type& b) { - return a.mean_ == b.mean_; - } - - friend bool operator!=(const param_type& a, const param_type& b) { - return !(a == b); - } - - private: - friend class poisson_distribution; - - double mean_; - double emu_; // e ^ -mean_ - double lmu_; // ln(mean_) - double s_; - double log_k_; - int split_; - - static_assert(std::is_integral<IntType>::value, - "Class-template absl::poisson_distribution<> must be " - "parameterized using an integral type."); - }; - - poisson_distribution() : poisson_distribution(1.0) {} - - explicit poisson_distribution(double mean) : param_(mean) {} - - explicit poisson_distribution(const param_type& p) : param_(p) {} - - void reset() {} - - // generating functions - template <typename URBG> - result_type operator()(URBG& g) { // NOLINT(runtime/references) - return (*this)(g, param_); - } - - template <typename URBG> - result_type operator()(URBG& g, // NOLINT(runtime/references) - const param_type& p); - - param_type param() const { return param_; } - void param(const param_type& p) { param_ = p; } - - result_type(min)() const { return 0; } - result_type(max)() const { return (std::numeric_limits<result_type>::max)(); } - - double mean() const { return param_.mean(); } - - friend bool operator==(const poisson_distribution& a, - const poisson_distribution& b) { - return a.param_ == b.param_; - } - friend bool operator!=(const poisson_distribution& a, - const poisson_distribution& b) { - return a.param_ != b.param_; - } - - private: - param_type param_; - random_internal::FastUniformBits<uint64_t> fast_u64_; -}; - -// ----------------------------------------------------------------------------- -// Implementation details follow -// ----------------------------------------------------------------------------- - -template <typename IntType> -poisson_distribution<IntType>::param_type::param_type(double mean) - : mean_(mean), split_(0) { - assert(mean >= 0); - assert(mean <= (std::numeric_limits<result_type>::max)()); - // As a defensive measure, avoid large values of the mean. The rejection - // algorithm used does not support very large values well. It my be worth - // changing algorithms to better deal with these cases. - assert(mean <= 1e10); - if (mean_ < 10) { - // For small lambda, use the knuth method. - split_ = 1; - emu_ = std::exp(-mean_); - } else if (mean_ <= 50) { - // Use split-knuth method. - split_ = 1 + static_cast<int>(mean_ / 10.0); - emu_ = std::exp(-mean_ / static_cast<double>(split_)); - } else { - // Use ratio of uniforms method. - constexpr double k2E = 0.7357588823428846; - constexpr double kSA = 0.4494580810294493; - - lmu_ = std::log(mean_); - double a = mean_ + 0.5; - s_ = kSA + std::sqrt(k2E * a); - const double mode = std::ceil(mean_) - 1; - log_k_ = lmu_ * mode - absl::random_internal::StirlingLogFactorial(mode); - } -} - -template <typename IntType> -template <typename URBG> -typename poisson_distribution<IntType>::result_type -poisson_distribution<IntType>::operator()( - URBG& g, // NOLINT(runtime/references) - const param_type& p) { - using random_internal::GeneratePositiveTag; - using random_internal::GenerateRealFromBits; - using random_internal::GenerateSignedTag; - - if (p.split_ != 0) { - // Use Knuth's algorithm with range splitting to avoid floating-point - // errors. Knuth's algorithm is: Ui is a sequence of uniform variates on - // (0,1); return the number of variates required for product(Ui) < - // exp(-lambda). - // - // The expected number of variates required for Knuth's method can be - // computed as follows: - // The expected value of U is 0.5, so solving for 0.5^n < exp(-lambda) gives - // the expected number of uniform variates - // required for a given lambda, which is: - // lambda = [2, 5, 9, 10, 11, 12, 13, 14, 15, 16, 17] - // n = [3, 8, 13, 15, 16, 18, 19, 21, 22, 24, 25] - // - result_type n = 0; - for (int split = p.split_; split > 0; --split) { - double r = 1.0; - do { - r *= GenerateRealFromBits<double, GeneratePositiveTag, true>( - fast_u64_(g)); // U(-1, 0) - ++n; - } while (r > p.emu_); - --n; - } - return n; - } - - // Use ratio of uniforms method. - // - // Let u ~ Uniform(0, 1), v ~ Uniform(-1, 1), - // a = lambda + 1/2, - // s = 1.5 - sqrt(3/e) + sqrt(2(lambda + 1/2)/e), - // x = s * v/u + a. - // P(floor(x) = k | u^2 < f(floor(x))/k), where - // f(m) = lambda^m exp(-lambda)/ m!, for 0 <= m, and f(m) = 0 otherwise, - // and k = max(f). - const double a = p.mean_ + 0.5; - for (;;) { - const double u = GenerateRealFromBits<double, GeneratePositiveTag, false>( - fast_u64_(g)); // U(0, 1) - const double v = GenerateRealFromBits<double, GenerateSignedTag, false>( - fast_u64_(g)); // U(-1, 1) - - const double x = std::floor(p.s_ * v / u + a); - if (x < 0) continue; // f(negative) = 0 - const double rhs = x * p.lmu_; - // clang-format off - double s = (x <= 1.0) ? 0.0 - : (x == 2.0) ? 0.693147180559945 - : absl::random_internal::StirlingLogFactorial(x); - // clang-format on - const double lhs = 2.0 * std::log(u) + p.log_k_ + s; - if (lhs < rhs) { - return x > (max)() ? (max)() - : static_cast<result_type>(x); // f(x)/k >= u^2 - } - } -} - -template <typename CharT, typename Traits, typename IntType> -std::basic_ostream<CharT, Traits>& operator<<( - std::basic_ostream<CharT, Traits>& os, // NOLINT(runtime/references) - const poisson_distribution<IntType>& x) { - auto saver = random_internal::make_ostream_state_saver(os); - os.precision(random_internal::stream_precision_helper<double>::kPrecision); - os << x.mean(); - return os; -} - -template <typename CharT, typename Traits, typename IntType> -std::basic_istream<CharT, Traits>& operator>>( - std::basic_istream<CharT, Traits>& is, // NOLINT(runtime/references) - poisson_distribution<IntType>& x) { // NOLINT(runtime/references) - using param_type = typename poisson_distribution<IntType>::param_type; - - auto saver = random_internal::make_istream_state_saver(is); - double mean = random_internal::read_floating_point<double>(is); - if (!is.fail()) { - x.param(param_type(mean)); - } - return is; -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_POISSON_DISTRIBUTION_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/random.h b/contrib/restricted/abseil-cpp/absl/random/random.h deleted file mode 100644 index 71b6309288..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/random.h +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: random.h -// ----------------------------------------------------------------------------- -// -// This header defines the recommended Uniform Random Bit Generator (URBG) -// types for use within the Abseil Random library. These types are not -// suitable for security-related use-cases, but should suffice for most other -// uses of generating random values. -// -// The Abseil random library provides the following URBG types: -// -// * BitGen, a good general-purpose bit generator, optimized for generating -// random (but not cryptographically secure) values -// * InsecureBitGen, a slightly faster, though less random, bit generator, for -// cases where the existing BitGen is a drag on performance. - -#ifndef ABSL_RANDOM_RANDOM_H_ -#define ABSL_RANDOM_RANDOM_H_ - -#include <random> - -#include "absl/random/distributions.h" // IWYU pragma: export -#include "absl/random/internal/nonsecure_base.h" // IWYU pragma: export -#include "absl/random/internal/pcg_engine.h" // IWYU pragma: export -#include "absl/random/internal/pool_urbg.h" -#include "absl/random/internal/randen_engine.h" -#include "absl/random/seed_sequences.h" // IWYU pragma: export - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// ----------------------------------------------------------------------------- -// absl::BitGen -// ----------------------------------------------------------------------------- -// -// `absl::BitGen` is a general-purpose random bit generator for generating -// random values for use within the Abseil random library. Typically, you use a -// bit generator in combination with a distribution to provide random values. -// -// Example: -// -// // Create an absl::BitGen. There is no need to seed this bit generator. -// absl::BitGen gen; -// -// // Generate an integer value in the closed interval [1,6] -// int die_roll = absl::uniform_int_distribution<int>(1, 6)(gen); -// -// `absl::BitGen` is seeded by default with non-deterministic data to produce -// different sequences of random values across different instances, including -// different binary invocations. This behavior is different than the standard -// library bit generators, which use golden values as their seeds. Default -// construction intentionally provides no stability guarantees, to avoid -// accidental dependence on such a property. -// -// `absl::BitGen` may be constructed with an optional seed sequence type, -// conforming to [rand.req.seed_seq], which will be mixed with additional -// non-deterministic data. -// -// Example: -// -// // Create an absl::BitGen using an std::seed_seq seed sequence -// std::seed_seq seq{1,2,3}; -// absl::BitGen gen_with_seed(seq); -// -// // Generate an integer value in the closed interval [1,6] -// int die_roll2 = absl::uniform_int_distribution<int>(1, 6)(gen_with_seed); -// -// `absl::BitGen` meets the requirements of the Uniform Random Bit Generator -// (URBG) concept as per the C++17 standard [rand.req.urng] though differs -// slightly with [rand.req.eng]. Like its standard library equivalents (e.g. -// `std::mersenne_twister_engine`) `absl::BitGen` is not cryptographically -// secure. -// -// Constructing two `absl::BitGen`s with the same seed sequence in the same -// binary will produce the same sequence of variates within the same binary, but -// need not do so across multiple binary invocations. -// -// This type has been optimized to perform better than Mersenne Twister -// (https://en.wikipedia.org/wiki/Mersenne_Twister) and many other complex URBG -// types on modern x86, ARM, and PPC architectures. -// -// This type is thread-compatible, but not thread-safe. - -// --------------------------------------------------------------------------- -// absl::BitGen member functions -// --------------------------------------------------------------------------- - -// absl::BitGen::operator()() -// -// Calls the BitGen, returning a generated value. - -// absl::BitGen::min() -// -// Returns the smallest possible value from this bit generator. - -// absl::BitGen::max() -// -// Returns the largest possible value from this bit generator. - -// absl::BitGen::discard(num) -// -// Advances the internal state of this bit generator by `num` times, and -// discards the intermediate results. -// --------------------------------------------------------------------------- - -using BitGen = random_internal::NonsecureURBGBase< - random_internal::randen_engine<uint64_t>>; - -// ----------------------------------------------------------------------------- -// absl::InsecureBitGen -// ----------------------------------------------------------------------------- -// -// `absl::InsecureBitGen` is an efficient random bit generator for generating -// random values, recommended only for performance-sensitive use cases where -// `absl::BitGen` is not satisfactory when compute-bounded by bit generation -// costs. -// -// Example: -// -// // Create an absl::InsecureBitGen -// absl::InsecureBitGen gen; -// for (size_t i = 0; i < 1000000; i++) { -// -// // Generate a bunch of random values from some complex distribution -// auto my_rnd = some_distribution(gen, 1, 1000); -// } -// -// Like `absl::BitGen`, `absl::InsecureBitGen` is seeded by default with -// non-deterministic data to produce different sequences of random values across -// different instances, including different binary invocations. (This behavior -// is different than the standard library bit generators, which use golden -// values as their seeds.) -// -// `absl::InsecureBitGen` may be constructed with an optional seed sequence -// type, conforming to [rand.req.seed_seq], which will be mixed with additional -// non-deterministic data. (See std_seed_seq.h for more information.) -// -// `absl::InsecureBitGen` meets the requirements of the Uniform Random Bit -// Generator (URBG) concept as per the C++17 standard [rand.req.urng] though -// its implementation differs slightly with [rand.req.eng]. Like its standard -// library equivalents (e.g. `std::mersenne_twister_engine`) -// `absl::InsecureBitGen` is not cryptographically secure. -// -// Prefer `absl::BitGen` over `absl::InsecureBitGen` as the general type is -// often fast enough for the vast majority of applications. - -using InsecureBitGen = - random_internal::NonsecureURBGBase<random_internal::pcg64_2018_engine>; - -// --------------------------------------------------------------------------- -// absl::InsecureBitGen member functions -// --------------------------------------------------------------------------- - -// absl::InsecureBitGen::operator()() -// -// Calls the InsecureBitGen, returning a generated value. - -// absl::InsecureBitGen::min() -// -// Returns the smallest possible value from this bit generator. - -// absl::InsecureBitGen::max() -// -// Returns the largest possible value from this bit generator. - -// absl::InsecureBitGen::discard(num) -// -// Advances the internal state of this bit generator by `num` times, and -// discards the intermediate results. -// --------------------------------------------------------------------------- - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_RANDOM_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/seed_gen_exception/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/seed_gen_exception/CMakeLists.linux.txt deleted file mode 100644 index ef93465041..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/seed_gen_exception/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-random-seed_gen_exception) -target_compile_options(absl-random-seed_gen_exception PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-random-seed_gen_exception PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-random-seed_gen_exception PUBLIC - contrib-libs-cxxsupp -) -target_sources(absl-random-seed_gen_exception PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/seed_gen_exception.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/seed_gen_exception/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/seed_gen_exception/CMakeLists.txt index e8c98bfd99..ef93465041 100644 --- a/contrib/restricted/abseil-cpp/absl/random/seed_gen_exception/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/seed_gen_exception/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-random-seed_gen_exception) +target_compile_options(absl-random-seed_gen_exception PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-random-seed_gen_exception PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-random-seed_gen_exception PUBLIC + contrib-libs-cxxsupp +) +target_sources(absl-random-seed_gen_exception PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/seed_gen_exception.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/seed_sequences/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/random/seed_sequences/CMakeLists.linux.txt deleted file mode 100644 index 1e996f743f..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/seed_sequences/CMakeLists.linux.txt +++ /dev/null @@ -1,40 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-random-seed_sequences) -target_compile_options(absl-random-seed_sequences PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-random-seed_sequences PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-random-seed_sequences PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - random-internal-pool_urbg - random-internal-randen - random-internal-randen_detect - random-internal-randen_hwaes - random-internal-randen_round_keys - random-internal-randen_slow - random-internal-seed_material - absl-random-seed_gen_exception - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - absl-types-bad_optional_access -) -target_sources(absl-random-seed_sequences PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/seed_sequences.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/random/seed_sequences/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/random/seed_sequences/CMakeLists.txt index e8c98bfd99..1e996f743f 100644 --- a/contrib/restricted/abseil-cpp/absl/random/seed_sequences/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/random/seed_sequences/CMakeLists.txt @@ -6,6 +6,35 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-random-seed_sequences) +target_compile_options(absl-random-seed_sequences PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-random-seed_sequences PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-random-seed_sequences PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + random-internal-pool_urbg + random-internal-randen + random-internal-randen_detect + random-internal-randen_hwaes + random-internal-randen_round_keys + random-internal-randen_slow + random-internal-seed_material + absl-random-seed_gen_exception + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + absl-types-bad_optional_access +) +target_sources(absl-random-seed_sequences PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/random/seed_sequences.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/random/uniform_real_distribution.h b/contrib/restricted/abseil-cpp/absl/random/uniform_real_distribution.h deleted file mode 100644 index 5ba17b2341..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/uniform_real_distribution.h +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// File: uniform_real_distribution.h -// ----------------------------------------------------------------------------- -// -// This header defines a class for representing a uniform floating-point -// distribution over a half-open interval [a,b). You use this distribution in -// combination with an Abseil random bit generator to produce random values -// according to the rules of the distribution. -// -// `absl::uniform_real_distribution` is a drop-in replacement for the C++11 -// `std::uniform_real_distribution` [rand.dist.uni.real] but is considerably -// faster than the libstdc++ implementation. -// -// Note: the standard-library version may occasionally return `1.0` when -// default-initialized. See https://bugs.llvm.org//show_bug.cgi?id=18767 -// `absl::uniform_real_distribution` does not exhibit this behavior. - -#ifndef ABSL_RANDOM_UNIFORM_REAL_DISTRIBUTION_H_ -#define ABSL_RANDOM_UNIFORM_REAL_DISTRIBUTION_H_ - -#include <cassert> -#include <cmath> -#include <cstdint> -#include <istream> -#include <limits> -#include <type_traits> - -#include "absl/meta/type_traits.h" -#include "absl/random/internal/fast_uniform_bits.h" -#include "absl/random/internal/generate_real.h" -#include "absl/random/internal/iostream_state_saver.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// absl::uniform_real_distribution<T> -// -// This distribution produces random floating-point values uniformly distributed -// over the half-open interval [a, b). -// -// Example: -// -// absl::BitGen gen; -// -// // Use the distribution to produce a value between 0.0 (inclusive) -// // and 1.0 (exclusive). -// double value = absl::uniform_real_distribution<double>(0, 1)(gen); -// -template <typename RealType = double> -class uniform_real_distribution { - public: - using result_type = RealType; - - class param_type { - public: - using distribution_type = uniform_real_distribution; - - explicit param_type(result_type lo = 0, result_type hi = 1) - : lo_(lo), hi_(hi), range_(hi - lo) { - // [rand.dist.uni.real] preconditions 2 & 3 - assert(lo <= hi); - // NOTE: For integral types, we can promote the range to an unsigned type, - // which gives full width of the range. However for real (fp) types, this - // is not possible, so value generation cannot use the full range of the - // real type. - assert(range_ <= (std::numeric_limits<result_type>::max)()); - assert(std::isfinite(range_)); - } - - result_type a() const { return lo_; } - result_type b() const { return hi_; } - - friend bool operator==(const param_type& a, const param_type& b) { - return a.lo_ == b.lo_ && a.hi_ == b.hi_; - } - - friend bool operator!=(const param_type& a, const param_type& b) { - return !(a == b); - } - - private: - friend class uniform_real_distribution; - result_type lo_, hi_, range_; - - static_assert(std::is_floating_point<RealType>::value, - "Class-template absl::uniform_real_distribution<> must be " - "parameterized using a floating-point type."); - }; - - uniform_real_distribution() : uniform_real_distribution(0) {} - - explicit uniform_real_distribution(result_type lo, result_type hi = 1) - : param_(lo, hi) {} - - explicit uniform_real_distribution(const param_type& param) : param_(param) {} - - // uniform_real_distribution<T>::reset() - // - // Resets the uniform real distribution. Note that this function has no effect - // because the distribution already produces independent values. - void reset() {} - - template <typename URBG> - result_type operator()(URBG& gen) { // NOLINT(runtime/references) - return operator()(gen, param_); - } - - template <typename URBG> - result_type operator()(URBG& gen, // NOLINT(runtime/references) - const param_type& p); - - result_type a() const { return param_.a(); } - result_type b() const { return param_.b(); } - - param_type param() const { return param_; } - void param(const param_type& params) { param_ = params; } - - result_type(min)() const { return a(); } - result_type(max)() const { return b(); } - - friend bool operator==(const uniform_real_distribution& a, - const uniform_real_distribution& b) { - return a.param_ == b.param_; - } - friend bool operator!=(const uniform_real_distribution& a, - const uniform_real_distribution& b) { - return a.param_ != b.param_; - } - - private: - param_type param_; - random_internal::FastUniformBits<uint64_t> fast_u64_; -}; - -// ----------------------------------------------------------------------------- -// Implementation details follow -// ----------------------------------------------------------------------------- -template <typename RealType> -template <typename URBG> -typename uniform_real_distribution<RealType>::result_type -uniform_real_distribution<RealType>::operator()( - URBG& gen, const param_type& p) { // NOLINT(runtime/references) - using random_internal::GeneratePositiveTag; - using random_internal::GenerateRealFromBits; - using real_type = - absl::conditional_t<std::is_same<RealType, float>::value, float, double>; - - while (true) { - const result_type sample = - GenerateRealFromBits<real_type, GeneratePositiveTag, true>( - fast_u64_(gen)); - const result_type res = p.a() + (sample * p.range_); - if (res < p.b() || p.range_ <= 0 || !std::isfinite(p.range_)) { - return res; - } - // else sample rejected, try again. - } -} - -template <typename CharT, typename Traits, typename RealType> -std::basic_ostream<CharT, Traits>& operator<<( - std::basic_ostream<CharT, Traits>& os, // NOLINT(runtime/references) - const uniform_real_distribution<RealType>& x) { - auto saver = random_internal::make_ostream_state_saver(os); - os.precision(random_internal::stream_precision_helper<RealType>::kPrecision); - os << x.a() << os.fill() << x.b(); - return os; -} - -template <typename CharT, typename Traits, typename RealType> -std::basic_istream<CharT, Traits>& operator>>( - std::basic_istream<CharT, Traits>& is, // NOLINT(runtime/references) - uniform_real_distribution<RealType>& x) { // NOLINT(runtime/references) - using param_type = typename uniform_real_distribution<RealType>::param_type; - using result_type = typename uniform_real_distribution<RealType>::result_type; - auto saver = random_internal::make_istream_state_saver(is); - auto a = random_internal::read_floating_point<result_type>(is); - if (is.fail()) return is; - auto b = random_internal::read_floating_point<result_type>(is); - if (!is.fail()) { - x.param(param_type(a, b)); - } - return is; -} -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_UNIFORM_REAL_DISTRIBUTION_H_ diff --git a/contrib/restricted/abseil-cpp/absl/random/zipf_distribution.h b/contrib/restricted/abseil-cpp/absl/random/zipf_distribution.h deleted file mode 100644 index 22ebc756cf..0000000000 --- a/contrib/restricted/abseil-cpp/absl/random/zipf_distribution.h +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_RANDOM_ZIPF_DISTRIBUTION_H_ -#define ABSL_RANDOM_ZIPF_DISTRIBUTION_H_ - -#include <cassert> -#include <cmath> -#include <istream> -#include <limits> -#include <ostream> -#include <type_traits> - -#include "absl/random/internal/iostream_state_saver.h" -#include "absl/random/uniform_real_distribution.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// absl::zipf_distribution produces random integer-values in the range [0, k], -// distributed according to the discrete probability function: -// -// P(x) = (v + x) ^ -q -// -// The parameter `v` must be greater than 0 and the parameter `q` must be -// greater than 1. If either of these parameters take invalid values then the -// behavior is undefined. -// -// IntType is the result_type generated by the generator. It must be of integral -// type; a static_assert ensures this is the case. -// -// The implementation is based on W.Hormann, G.Derflinger: -// -// "Rejection-Inversion to Generate Variates from Monotone Discrete -// Distributions" -// -// http://eeyore.wu-wien.ac.at/papers/96-04-04.wh-der.ps.gz -// -template <typename IntType = int> -class zipf_distribution { - public: - using result_type = IntType; - - class param_type { - public: - using distribution_type = zipf_distribution; - - // Preconditions: k > 0, v > 0, q > 1 - // The precondidtions are validated when NDEBUG is not defined via - // a pair of assert() directives. - // If NDEBUG is defined and either or both of these parameters take invalid - // values, the behavior of the class is undefined. - explicit param_type(result_type k = (std::numeric_limits<IntType>::max)(), - double q = 2.0, double v = 1.0); - - result_type k() const { return k_; } - double q() const { return q_; } - double v() const { return v_; } - - friend bool operator==(const param_type& a, const param_type& b) { - return a.k_ == b.k_ && a.q_ == b.q_ && a.v_ == b.v_; - } - friend bool operator!=(const param_type& a, const param_type& b) { - return !(a == b); - } - - private: - friend class zipf_distribution; - inline double h(double x) const; - inline double hinv(double x) const; - inline double compute_s() const; - inline double pow_negative_q(double x) const; - - // Parameters here are exactly the same as the parameters of Algorithm ZRI - // in the paper. - IntType k_; - double q_; - double v_; - - double one_minus_q_; // 1-q - double s_; - double one_minus_q_inv_; // 1 / 1-q - double hxm_; // h(k + 0.5) - double hx0_minus_hxm_; // h(x0) - h(k + 0.5) - - static_assert(std::is_integral<IntType>::value, - "Class-template absl::zipf_distribution<> must be " - "parameterized using an integral type."); - }; - - zipf_distribution() - : zipf_distribution((std::numeric_limits<IntType>::max)()) {} - - explicit zipf_distribution(result_type k, double q = 2.0, double v = 1.0) - : param_(k, q, v) {} - - explicit zipf_distribution(const param_type& p) : param_(p) {} - - void reset() {} - - template <typename URBG> - result_type operator()(URBG& g) { // NOLINT(runtime/references) - return (*this)(g, param_); - } - - template <typename URBG> - result_type operator()(URBG& g, // NOLINT(runtime/references) - const param_type& p); - - result_type k() const { return param_.k(); } - double q() const { return param_.q(); } - double v() const { return param_.v(); } - - param_type param() const { return param_; } - void param(const param_type& p) { param_ = p; } - - result_type(min)() const { return 0; } - result_type(max)() const { return k(); } - - friend bool operator==(const zipf_distribution& a, - const zipf_distribution& b) { - return a.param_ == b.param_; - } - friend bool operator!=(const zipf_distribution& a, - const zipf_distribution& b) { - return a.param_ != b.param_; - } - - private: - param_type param_; -}; - -// -------------------------------------------------------------------------- -// Implementation details follow -// -------------------------------------------------------------------------- - -template <typename IntType> -zipf_distribution<IntType>::param_type::param_type( - typename zipf_distribution<IntType>::result_type k, double q, double v) - : k_(k), q_(q), v_(v), one_minus_q_(1 - q) { - assert(q > 1); - assert(v > 0); - assert(k > 0); - one_minus_q_inv_ = 1 / one_minus_q_; - - // Setup for the ZRI algorithm (pg 17 of the paper). - // Compute: h(i max) => h(k + 0.5) - constexpr double kMax = 18446744073709549568.0; - double kd = static_cast<double>(k); - // TODO(absl-team): Determine if this check is needed, and if so, add a test - // that fails for k > kMax - if (kd > kMax) { - // Ensure that our maximum value is capped to a value which will - // round-trip back through double. - kd = kMax; - } - hxm_ = h(kd + 0.5); - - // Compute: h(0) - const bool use_precomputed = (v == 1.0 && q == 2.0); - const double h0x5 = use_precomputed ? (-1.0 / 1.5) // exp(-log(1.5)) - : h(0.5); - const double elogv_q = (v_ == 1.0) ? 1 : pow_negative_q(v_); - - // h(0) = h(0.5) - exp(log(v) * -q) - hx0_minus_hxm_ = (h0x5 - elogv_q) - hxm_; - - // And s - s_ = use_precomputed ? 0.46153846153846123 : compute_s(); -} - -template <typename IntType> -double zipf_distribution<IntType>::param_type::h(double x) const { - // std::exp(one_minus_q_ * std::log(v_ + x)) * one_minus_q_inv_; - x += v_; - return (one_minus_q_ == -1.0) - ? (-1.0 / x) // -exp(-log(x)) - : (std::exp(std::log(x) * one_minus_q_) * one_minus_q_inv_); -} - -template <typename IntType> -double zipf_distribution<IntType>::param_type::hinv(double x) const { - // std::exp(one_minus_q_inv_ * std::log(one_minus_q_ * x)) - v_; - return -v_ + ((one_minus_q_ == -1.0) - ? (-1.0 / x) // exp(-log(-x)) - : std::exp(one_minus_q_inv_ * std::log(one_minus_q_ * x))); -} - -template <typename IntType> -double zipf_distribution<IntType>::param_type::compute_s() const { - // 1 - hinv(h(1.5) - std::exp(std::log(v_ + 1) * -q_)); - return 1.0 - hinv(h(1.5) - pow_negative_q(v_ + 1.0)); -} - -template <typename IntType> -double zipf_distribution<IntType>::param_type::pow_negative_q(double x) const { - // std::exp(std::log(x) * -q_); - return q_ == 2.0 ? (1.0 / (x * x)) : std::exp(std::log(x) * -q_); -} - -template <typename IntType> -template <typename URBG> -typename zipf_distribution<IntType>::result_type -zipf_distribution<IntType>::operator()( - URBG& g, const param_type& p) { // NOLINT(runtime/references) - absl::uniform_real_distribution<double> uniform_double; - double k; - for (;;) { - const double v = uniform_double(g); - const double u = p.hxm_ + v * p.hx0_minus_hxm_; - const double x = p.hinv(u); - k = rint(x); // std::floor(x + 0.5); - if (k > p.k()) continue; // reject k > max_k - if (k - x <= p.s_) break; - const double h = p.h(k + 0.5); - const double r = p.pow_negative_q(p.v_ + k); - if (u >= h - r) break; - } - IntType ki = static_cast<IntType>(k); - assert(ki <= p.k_); - return ki; -} - -template <typename CharT, typename Traits, typename IntType> -std::basic_ostream<CharT, Traits>& operator<<( - std::basic_ostream<CharT, Traits>& os, // NOLINT(runtime/references) - const zipf_distribution<IntType>& x) { - using stream_type = - typename random_internal::stream_format_type<IntType>::type; - auto saver = random_internal::make_ostream_state_saver(os); - os.precision(random_internal::stream_precision_helper<double>::kPrecision); - os << static_cast<stream_type>(x.k()) << os.fill() << x.q() << os.fill() - << x.v(); - return os; -} - -template <typename CharT, typename Traits, typename IntType> -std::basic_istream<CharT, Traits>& operator>>( - std::basic_istream<CharT, Traits>& is, // NOLINT(runtime/references) - zipf_distribution<IntType>& x) { // NOLINT(runtime/references) - using result_type = typename zipf_distribution<IntType>::result_type; - using param_type = typename zipf_distribution<IntType>::param_type; - using stream_type = - typename random_internal::stream_format_type<IntType>::type; - stream_type k; - double q; - double v; - - auto saver = random_internal::make_istream_state_saver(is); - is >> k >> q >> v; - if (!is.fail()) { - x.param(param_type(static_cast<result_type>(k), q, v)); - } - return is; -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_RANDOM_ZIPF_DISTRIBUTION_H_ diff --git a/contrib/restricted/abseil-cpp/absl/status/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/status/.yandex_meta/licenses.list.txt deleted file mode 100644 index 1c58023e4b..0000000000 --- a/contrib/restricted/abseil-cpp/absl/status/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,20 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2019 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2020 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/status/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/status/CMakeLists.linux.txt deleted file mode 100644 index 2323eb9d29..0000000000 --- a/contrib/restricted/abseil-cpp/absl/status/CMakeLists.linux.txt +++ /dev/null @@ -1,50 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-status) -target_compile_options(abseil-cpp-absl-status PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-status PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-status PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - absl-strings-cord - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - strings-internal-str_format - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - absl-types-bad_optional_access -) -target_sources(abseil-cpp-absl-status PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/status/status.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/status/status_payload_printer.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/status/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/status/CMakeLists.txt index e8c98bfd99..2323eb9d29 100644 --- a/contrib/restricted/abseil-cpp/absl/status/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/status/CMakeLists.txt @@ -6,6 +6,45 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-status) +target_compile_options(abseil-cpp-absl-status PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-status PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-status PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + absl-strings-cord + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + strings-internal-str_format + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + absl-types-bad_optional_access +) +target_sources(abseil-cpp-absl-status PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/status/status.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/status/status_payload_printer.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/status/statusor/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/status/statusor/CMakeLists.linux.txt deleted file mode 100644 index 911e0d5821..0000000000 --- a/contrib/restricted/abseil-cpp/absl/status/statusor/CMakeLists.linux.txt +++ /dev/null @@ -1,51 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-status-statusor) -target_compile_options(absl-status-statusor PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-status-statusor PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-status-statusor PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-status - abseil-cpp-absl-strings - absl-strings-cord - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - strings-internal-str_format - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - absl-types-bad_optional_access - absl-types-bad_variant_access -) -target_sources(absl-status-statusor PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/status/statusor.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/status/statusor/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/status/statusor/CMakeLists.txt index e8c98bfd99..911e0d5821 100644 --- a/contrib/restricted/abseil-cpp/absl/status/statusor/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/status/statusor/CMakeLists.txt @@ -6,6 +6,46 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-status-statusor) +target_compile_options(absl-status-statusor PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-status-statusor PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-status-statusor PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-status + abseil-cpp-absl-strings + absl-strings-cord + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + strings-internal-str_format + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + absl-types-bad_optional_access + absl-types-bad_variant_access +) +target_sources(absl-status-statusor PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/status/statusor.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/strings/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/strings/.yandex_meta/licenses.list.txt deleted file mode 100644 index 9d8552c68c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,46 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2019 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2020 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2021 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/strings/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/strings/CMakeLists.linux.txt deleted file mode 100644 index 1c450b7de5..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/CMakeLists.linux.txt +++ /dev/null @@ -1,42 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-strings) -target_compile_options(abseil-cpp-absl-strings PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-strings PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-strings PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - strings-internal-absl_strings_internal -) -target_sources(abseil-cpp-absl-strings PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/ascii.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/charconv.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/escaping.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/charconv_bigint.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/charconv_parse.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/memutil.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/match.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/numbers.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/str_cat.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/str_replace.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/str_split.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/string_view.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/substitute.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/strings/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/strings/CMakeLists.txt index e8c98bfd99..1c450b7de5 100644 --- a/contrib/restricted/abseil-cpp/absl/strings/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/strings/CMakeLists.txt @@ -6,6 +6,37 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-strings) +target_compile_options(abseil-cpp-absl-strings PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-strings PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-strings PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + strings-internal-absl_strings_internal +) +target_sources(abseil-cpp-absl-strings PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/ascii.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/charconv.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/escaping.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/charconv_bigint.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/charconv_parse.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/memutil.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/match.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/numbers.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/str_cat.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/str_replace.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/str_split.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/string_view.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/substitute.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/strings/cord/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/strings/cord/CMakeLists.linux.txt deleted file mode 100644 index 37171a4ccd..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/cord/CMakeLists.linux.txt +++ /dev/null @@ -1,52 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-strings-cord) -target_compile_options(absl-strings-cord PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-strings-cord PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-strings-cord PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-algorithm - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-container - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-functional - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone - abseil-cpp-absl-types - absl-types-bad_optional_access - abseil-cpp-absl-utility -) -target_sources(absl-strings-cord PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/cord.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/strings/cord/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/strings/cord/CMakeLists.txt index e8c98bfd99..37171a4ccd 100644 --- a/contrib/restricted/abseil-cpp/absl/strings/cord/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/strings/cord/CMakeLists.txt @@ -6,6 +6,47 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-strings-cord) +target_compile_options(absl-strings-cord PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-strings-cord PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-strings-cord PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-algorithm + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-container + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-functional + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone + abseil-cpp-absl-types + absl-types-bad_optional_access + abseil-cpp-absl-utility +) +target_sources(absl-strings-cord PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/cord.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/strings/cord_test_helpers.h b/contrib/restricted/abseil-cpp/absl/strings/cord_test_helpers.h deleted file mode 100644 index 31a1dc8980..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/cord_test_helpers.h +++ /dev/null @@ -1,122 +0,0 @@ -// -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#ifndef ABSL_STRINGS_CORD_TEST_HELPERS_H_ -#define ABSL_STRINGS_CORD_TEST_HELPERS_H_ - -#include <cstdint> -#include <iostream> -#include <string> - -#include "absl/base/config.h" -#include "absl/strings/cord.h" -#include "absl/strings/internal/cord_internal.h" -#include "absl/strings/string_view.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// Cord sizes relevant for testing -enum class TestCordSize { - // An empty value - kEmpty = 0, - - // An inlined string value - kInlined = cord_internal::kMaxInline / 2 + 1, - - // 'Well known' SSO lengths (excluding terminating zero). - // libstdcxx has a maximum SSO of 15, libc++ has a maximum SSO of 22. - kStringSso1 = 15, - kStringSso2 = 22, - - // A string value which is too large to fit in inlined data, but small enough - // such that Cord prefers copying the value if possible, i.e.: not stealing - // std::string inputs, or referencing existing CordReps on Append, etc. - kSmall = cord_internal::kMaxBytesToCopy / 2 + 1, - - // A string value large enough that Cord prefers to reference or steal from - // existing inputs rather than copying contents of the input. - kMedium = cord_internal::kMaxFlatLength / 2 + 1, - - // A string value large enough to cause it to be stored in mutliple flats. - kLarge = cord_internal::kMaxFlatLength * 4 -}; - -// To string helper -inline absl::string_view ToString(TestCordSize size) { - switch (size) { - case TestCordSize::kEmpty: - return "Empty"; - case TestCordSize::kInlined: - return "Inlined"; - case TestCordSize::kSmall: - return "Small"; - case TestCordSize::kStringSso1: - return "StringSso1"; - case TestCordSize::kStringSso2: - return "StringSso2"; - case TestCordSize::kMedium: - return "Medium"; - case TestCordSize::kLarge: - return "Large"; - } - return "???"; -} - -// Returns the length matching the specified size -inline size_t Length(TestCordSize size) { return static_cast<size_t>(size); } - -// Stream output helper -inline std::ostream& operator<<(std::ostream& stream, TestCordSize size) { - return stream << ToString(size); -} - -// Creates a multi-segment Cord from an iterable container of strings. The -// resulting Cord is guaranteed to have one segment for every string in the -// container. This allows code to be unit tested with multi-segment Cord -// inputs. -// -// Example: -// -// absl::Cord c = absl::MakeFragmentedCord({"A ", "fragmented ", "Cord"}); -// EXPECT_FALSE(c.GetFlat(&unused)); -// -// The mechanism by which this Cord is created is an implementation detail. Any -// implementation that produces a multi-segment Cord may produce a flat Cord in -// the future as new optimizations are added to the Cord class. -// MakeFragmentedCord will, however, always be updated to return a multi-segment -// Cord. -template <typename Container> -Cord MakeFragmentedCord(const Container& c) { - Cord result; - for (const auto& s : c) { - auto* external = new std::string(s); - Cord tmp = absl::MakeCordFromExternal( - *external, [external](absl::string_view) { delete external; }); - tmp.Prepend(result); - result = tmp; - } - return result; -} - -inline Cord MakeFragmentedCord(std::initializer_list<absl::string_view> list) { - return MakeFragmentedCord<std::initializer_list<absl::string_view>>(list); -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_STRINGS_CORD_TEST_HELPERS_H_ diff --git a/contrib/restricted/abseil-cpp/absl/strings/cordz_test_helpers.h b/contrib/restricted/abseil-cpp/absl/strings/cordz_test_helpers.h deleted file mode 100644 index e410eecf7f..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/cordz_test_helpers.h +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2021 The Abseil Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_STRINGS_CORDZ_TEST_HELPERS_H_ -#define ABSL_STRINGS_CORDZ_TEST_HELPERS_H_ - -#include <utility> - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "absl/base/config.h" -#include "absl/base/macros.h" -#include "absl/strings/cord.h" -#include "absl/strings/internal/cord_internal.h" -#include "absl/strings/internal/cordz_info.h" -#include "absl/strings/internal/cordz_sample_token.h" -#include "absl/strings/internal/cordz_statistics.h" -#include "absl/strings/internal/cordz_update_tracker.h" -#include "absl/strings/str_cat.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN - -// Returns the CordzInfo for the cord, or nullptr if the cord is not sampled. -inline const cord_internal::CordzInfo* GetCordzInfoForTesting( - const Cord& cord) { - if (!cord.contents_.is_tree()) return nullptr; - return cord.contents_.cordz_info(); -} - -// Returns true if the provided cordz_info is in the list of sampled cords. -inline bool CordzInfoIsListed(const cord_internal::CordzInfo* cordz_info, - cord_internal::CordzSampleToken token = {}) { - for (const cord_internal::CordzInfo& info : token) { - if (cordz_info == &info) return true; - } - return false; -} - -// Matcher on Cord that verifies all of: -// - the cord is sampled -// - the CordzInfo of the cord is listed / discoverable. -// - the reported CordzStatistics match the cord's actual properties -// - the cord has an (initial) UpdateTracker count of 1 for `method` -MATCHER_P(HasValidCordzInfoOf, method, "CordzInfo matches cord") { - const cord_internal::CordzInfo* cord_info = GetCordzInfoForTesting(arg); - if (cord_info == nullptr) { - *result_listener << "cord is not sampled"; - return false; - } - if (!CordzInfoIsListed(cord_info)) { - *result_listener << "cord is sampled, but not listed"; - return false; - } - cord_internal::CordzStatistics stat = cord_info->GetCordzStatistics(); - if (stat.size != arg.size()) { - *result_listener << "cordz size " << stat.size - << " does not match cord size " << arg.size(); - return false; - } - if (stat.update_tracker.Value(method) != 1) { - *result_listener << "Expected method count 1 for " << method << ", found " - << stat.update_tracker.Value(method); - return false; - } - return true; -} - -// Matcher on Cord that verifies that the cord is sampled and that the CordzInfo -// update tracker has 'method' with a call count of 'n' -MATCHER_P2(CordzMethodCountEq, method, n, - absl::StrCat("CordzInfo method count equals ", n)) { - const cord_internal::CordzInfo* cord_info = GetCordzInfoForTesting(arg); - if (cord_info == nullptr) { - *result_listener << "cord is not sampled"; - return false; - } - cord_internal::CordzStatistics stat = cord_info->GetCordzStatistics(); - if (stat.update_tracker.Value(method) != n) { - *result_listener << "Expected method count " << n << " for " << method - << ", found " << stat.update_tracker.Value(method); - return false; - } - return true; -} - -// Cordz will only update with a new rate once the previously scheduled event -// has fired. When we disable Cordz, a long delay takes place where we won't -// consider profiling new Cords. CordzSampleIntervalHelper will burn through -// that interval and allow for testing that assumes that the average sampling -// interval is a particular value. -class CordzSamplingIntervalHelper { - public: - explicit CordzSamplingIntervalHelper(int32_t interval) - : orig_mean_interval_(absl::cord_internal::get_cordz_mean_interval()) { - absl::cord_internal::set_cordz_mean_interval(interval); - absl::cord_internal::cordz_set_next_sample_for_testing(interval); - } - - ~CordzSamplingIntervalHelper() { - absl::cord_internal::set_cordz_mean_interval(orig_mean_interval_); - absl::cord_internal::cordz_set_next_sample_for_testing(orig_mean_interval_); - } - - private: - int32_t orig_mean_interval_; -}; - -// Wrapper struct managing a small CordRep `rep` -struct TestCordRep { - cord_internal::CordRepFlat* rep; - - TestCordRep() { - rep = cord_internal::CordRepFlat::New(100); - rep->length = 100; - memset(rep->Data(), 1, 100); - } - ~TestCordRep() { cord_internal::CordRep::Unref(rep); } -}; - -// Wrapper struct managing a small CordRep `rep`, and -// an InlineData `data` initialized with that CordRep. -struct TestCordData { - TestCordRep rep; - cord_internal::InlineData data{rep.rep}; -}; - -// Creates a Cord that is not sampled -template <typename... Args> -Cord UnsampledCord(Args... args) { - CordzSamplingIntervalHelper never(9999); - Cord cord(std::forward<Args>(args)...); - ABSL_ASSERT(GetCordzInfoForTesting(cord) == nullptr); - return cord; -} - -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_STRINGS_CORDZ_TEST_HELPERS_H_ diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/absl_cord_internal/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/absl_cord_internal/CMakeLists.linux.txt deleted file mode 100644 index b9a5a970d7..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/absl_cord_internal/CMakeLists.linux.txt +++ /dev/null @@ -1,36 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(strings-internal-absl_cord_internal) -target_compile_options(strings-internal-absl_cord_internal PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(strings-internal-absl_cord_internal PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(strings-internal-absl_cord_internal PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal -) -target_sources(strings-internal-absl_cord_internal PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_internal.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_btree.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_consume.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_ring.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/absl_cord_internal/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/absl_cord_internal/CMakeLists.txt index e8c98bfd99..b9a5a970d7 100644 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/absl_cord_internal/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/strings/internal/absl_cord_internal/CMakeLists.txt @@ -6,6 +6,31 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(strings-internal-absl_cord_internal) +target_compile_options(strings-internal-absl_cord_internal PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(strings-internal-absl_cord_internal PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(strings-internal-absl_cord_internal PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal +) +target_sources(strings-internal-absl_cord_internal PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_internal.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_btree.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_consume.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_ring.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal/CMakeLists.linux.txt deleted file mode 100644 index e17dd7a0b9..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal/CMakeLists.linux.txt +++ /dev/null @@ -1,29 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(strings-internal-absl_strings_internal) -target_compile_options(strings-internal-absl_strings_internal PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(strings-internal-absl_strings_internal PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(strings-internal-absl_strings_internal PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - absl-base-log_severity -) -target_sources(strings-internal-absl_strings_internal PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/escaping.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/ostringstream.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/utf8.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal/CMakeLists.txt index e8c98bfd99..e17dd7a0b9 100644 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal/CMakeLists.txt @@ -6,6 +6,24 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(strings-internal-absl_strings_internal) +target_compile_options(strings-internal-absl_strings_internal PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(strings-internal-absl_strings_internal PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(strings-internal-absl_strings_internal PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + absl-base-log_severity +) +target_sources(strings-internal-absl_strings_internal PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/escaping.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/ostringstream.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/utf8.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h b/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h deleted file mode 100644 index 7ceeaa000e..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2021 The Abseil Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_STRINGS_INTERNAL_CORD_REP_RING_READER_H_ -#define ABSL_STRINGS_INTERNAL_CORD_REP_RING_READER_H_ - -#include <cassert> -#include <cstddef> -#include <cstdint> - -#include "absl/strings/internal/cord_internal.h" -#include "absl/strings/internal/cord_rep_ring.h" -#include "absl/strings/string_view.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace cord_internal { - -// CordRepRingReader provides basic navigation over CordRepRing data. -class CordRepRingReader { - public: - // Returns true if this instance is not empty. - explicit operator bool() const { return ring_ != nullptr; } - - // Returns the ring buffer reference for this instance, or nullptr if empty. - CordRepRing* ring() const { return ring_; } - - // Returns the current node index inside the ring buffer for this instance. - // The returned value is undefined if this instance is empty. - CordRepRing::index_type index() const { return index_; } - - // Returns the current node inside the ring buffer for this instance. - // The returned value is undefined if this instance is empty. - CordRep* node() const { return ring_->entry_child(index_); } - - // Returns the length of the referenced ring buffer. - // Requires the current instance to be non empty. - size_t length() const { - assert(ring_); - return ring_->length; - } - - // Returns the end offset of the last navigated-to chunk, which represents the - // total bytes 'consumed' relative to the start of the ring. The returned - // value is never zero. For example, initializing a reader with a ring buffer - // with a first chunk of 19 bytes will return consumed() = 19. - // Requires the current instance to be non empty. - size_t consumed() const { - assert(ring_); - return ring_->entry_end_offset(index_); - } - - // Returns the number of bytes remaining beyond the last navigated-to chunk. - // Requires the current instance to be non empty. - size_t remaining() const { - assert(ring_); - return length() - consumed(); - } - - // Resets this instance to an empty value - void Reset() { ring_ = nullptr; } - - // Resets this instance to the start of `ring`. `ring` must not be null. - // Returns a reference into the first chunk of the provided ring. - absl::string_view Reset(CordRepRing* ring) { - assert(ring); - ring_ = ring; - index_ = ring_->head(); - return ring_->entry_data(index_); - } - - // Navigates to the next chunk inside the reference ring buffer. - // Returns a reference into the navigated-to chunk. - // Requires remaining() to be non zero. - absl::string_view Next() { - assert(remaining()); - index_ = ring_->advance(index_); - return ring_->entry_data(index_); - } - - // Navigates to the chunk at offset `offset`. - // Returns a reference into the navigated-to chunk, adjusted for the relative - // position of `offset` into that chunk. For example, calling Seek(13) on a - // ring buffer containing 2 chunks of 10 and 20 bytes respectively will return - // a string view into the second chunk starting at offset 3 with a size of 17. - // Requires `offset` to be less than `length()` - absl::string_view Seek(size_t offset) { - assert(offset < length()); - size_t current = ring_->entry_end_offset(index_); - CordRepRing::index_type hint = (offset >= current) ? index_ : ring_->head(); - const CordRepRing::Position head = ring_->Find(hint, offset); - index_ = head.index; - auto data = ring_->entry_data(head.index); - data.remove_prefix(head.offset); - return data; - } - - private: - CordRepRing* ring_ = nullptr; - CordRepRing::index_type index_; -}; - -} // namespace cord_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_STRINGS_INTERNAL_CORD_REP_RING_READER_H_ diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_test_util.h b/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_test_util.h deleted file mode 100644 index ad828af2a5..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cord_rep_test_util.h +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright 2021 The Abseil Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_STRINGS_INTERNAL_CORD_REP_TEST_UTIL_H_ -#define ABSL_STRINGS_INTERNAL_CORD_REP_TEST_UTIL_H_ - -#include <cassert> -#include <memory> -#include <random> -#include <string> -#include <vector> - -#include "absl/base/config.h" -#include "absl/base/internal/raw_logging.h" -#include "absl/strings/internal/cord_internal.h" -#include "absl/strings/internal/cord_rep_btree.h" -#include "absl/strings/internal/cord_rep_flat.h" -#include "absl/strings/string_view.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace cordrep_testing { - -inline cord_internal::CordRepSubstring* MakeSubstring( - size_t start, size_t len, cord_internal::CordRep* rep) { - auto* sub = new cord_internal::CordRepSubstring; - sub->tag = cord_internal::SUBSTRING; - sub->start = start; - sub->length = len <= 0 ? rep->length - start + len : len; - sub->child = rep; - return sub; -} - -inline cord_internal::CordRepConcat* MakeConcat(cord_internal::CordRep* left, - cord_internal::CordRep* right, - int depth = 0) { - auto* concat = new cord_internal::CordRepConcat; - concat->tag = cord_internal::CONCAT; - concat->length = left->length + right->length; - concat->left = left; - concat->right = right; - concat->set_depth(depth); - return concat; -} - -inline cord_internal::CordRepFlat* MakeFlat(absl::string_view value) { - assert(value.length() <= cord_internal::kMaxFlatLength); - auto* flat = cord_internal::CordRepFlat::New(value.length()); - flat->length = value.length(); - memcpy(flat->Data(), value.data(), value.length()); - return flat; -} - -// Creates an external node for testing -inline cord_internal::CordRepExternal* MakeExternal(absl::string_view s) { - struct Rep : public cord_internal::CordRepExternal { - std::string s; - explicit Rep(absl::string_view sv) : s(sv) { - this->tag = cord_internal::EXTERNAL; - this->base = s.data(); - this->length = s.length(); - this->releaser_invoker = [](cord_internal::CordRepExternal* self) { - delete static_cast<Rep*>(self); - }; - } - }; - return new Rep(s); -} - -inline std::string CreateRandomString(size_t n) { - absl::string_view data = - "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789~!@#$%^&*()_+=-<>?:\"{}[]|"; - std::minstd_rand rnd; - std::uniform_int_distribution<size_t> dist(0, data.size() - 1); - std::string s(n, ' '); - for (size_t i = 0; i < n; ++i) { - s[i] = data[dist(rnd)]; - } - return s; -} - -// Creates an array of flats from the provided string, chopping -// the provided string up into flats of size `chunk_size` characters -// resulting in roughly `data.size() / chunk_size` total flats. -inline std::vector<cord_internal::CordRep*> CreateFlatsFromString( - absl::string_view data, size_t chunk_size) { - assert(chunk_size > 0); - std::vector<cord_internal::CordRep*> flats; - for (absl::string_view s = data; !s.empty(); s.remove_prefix(chunk_size)) { - flats.push_back(MakeFlat(s.substr(0, chunk_size))); - } - return flats; -} - -inline cord_internal::CordRepBtree* CordRepBtreeFromFlats( - absl::Span<cord_internal::CordRep* const> flats) { - assert(!flats.empty()); - auto* node = cord_internal::CordRepBtree::Create(flats[0]); - for (size_t i = 1; i < flats.size(); ++i) { - node = cord_internal::CordRepBtree::Append(node, flats[i]); - } - return node; -} - -template <typename Fn> -inline void CordVisitReps(cord_internal::CordRep* rep, Fn&& fn) { - fn(rep); - while (rep->tag == cord_internal::SUBSTRING) { - rep = rep->substring()->child; - fn(rep); - } - if (rep->tag == cord_internal::BTREE) { - for (cord_internal::CordRep* edge : rep->btree()->Edges()) { - CordVisitReps(edge, fn); - } - } else if (rep->tag == cord_internal::CONCAT) { - CordVisitReps(rep->concat()->left, fn); - CordVisitReps(rep->concat()->right, fn); - } -} - -template <typename Predicate> -inline std::vector<cord_internal::CordRep*> CordCollectRepsIf( - Predicate&& predicate, cord_internal::CordRep* rep) { - std::vector<cord_internal::CordRep*> reps; - CordVisitReps(rep, [&reps, &predicate](cord_internal::CordRep* rep) { - if (predicate(rep)) reps.push_back(rep); - }); - return reps; -} - -inline std::vector<cord_internal::CordRep*> CordCollectReps( - cord_internal::CordRep* rep) { - std::vector<cord_internal::CordRep*> reps; - auto fn = [&reps](cord_internal::CordRep* rep) { reps.push_back(rep); }; - CordVisitReps(rep, fn); - return reps; -} - -inline void CordToString(cord_internal::CordRep* rep, std::string& s) { - size_t offset = 0; - size_t length = rep->length; - while (rep->tag == cord_internal::SUBSTRING) { - offset += rep->substring()->start; - rep = rep->substring()->child; - } - if (rep->tag == cord_internal::BTREE) { - for (cord_internal::CordRep* edge : rep->btree()->Edges()) { - CordToString(edge, s); - } - } else if (rep->tag >= cord_internal::FLAT) { - s.append(rep->flat()->Data() + offset, length); - } else if (rep->tag == cord_internal::EXTERNAL) { - s.append(rep->external()->base + offset, length); - } else { - ABSL_RAW_LOG(FATAL, "Unsupported tag %d", rep->tag); - } -} - -inline std::string CordToString(cord_internal::CordRep* rep) { - std::string s; - s.reserve(rep->length); - CordToString(rep, s); - return s; -} - -// RAII Helper class to automatically unref reps on destruction. -class AutoUnref { - public: - ~AutoUnref() { - for (CordRep* rep : unrefs_) CordRep::Unref(rep); - } - - // Adds `rep` to the list of reps to be unreffed at destruction. - template <typename CordRepType> - CordRepType* Add(CordRepType* rep) { - unrefs_.push_back(rep); - return rep; - } - - // Increments the reference count of `rep` by one, and adds it to - // the list of reps to be unreffed at destruction. - template <typename CordRepType> - CordRepType* Ref(CordRepType* rep) { - unrefs_.push_back(CordRep::Ref(rep)); - return rep; - } - - // Increments the reference count of `rep` by one if `condition` is true, - // and adds it to the list of reps to be unreffed at destruction. - template <typename CordRepType> - CordRepType* RefIf(bool condition, CordRepType* rep) { - if (condition) unrefs_.push_back(CordRep::Ref(rep)); - return rep; - } - - private: - using CordRep = absl::cord_internal::CordRep; - - std::vector<CordRep*> unrefs_; -}; - -} // namespace cordrep_testing -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_STRINGS_INTERNAL_CORD_REP_TEST_UTIL_H_ diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions/CMakeLists.linux.txt deleted file mode 100644 index ce7b6e4dad..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions/CMakeLists.linux.txt +++ /dev/null @@ -1,26 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(strings-internal-cordz_functions) -target_compile_options(strings-internal-cordz_functions PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(strings-internal-cordz_functions PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(strings-internal-cordz_functions PUBLIC - contrib-libs-cxxsupp - base-internal-raw_logging - absl-base-log_severity - profiling-internal-exponential_biased -) -target_sources(strings-internal-cordz_functions PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions/CMakeLists.txt index e8c98bfd99..ce7b6e4dad 100644 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions/CMakeLists.txt @@ -6,6 +6,21 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(strings-internal-cordz_functions) +target_compile_options(strings-internal-cordz_functions PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(strings-internal-cordz_functions PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(strings-internal-cordz_functions PUBLIC + contrib-libs-cxxsupp + base-internal-raw_logging + absl-base-log_severity + profiling-internal-exponential_biased +) +target_sources(strings-internal-cordz_functions PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle/CMakeLists.linux.txt deleted file mode 100644 index fabe90c63b..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle/CMakeLists.linux.txt +++ /dev/null @@ -1,41 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(strings-internal-cordz_handle) -target_compile_options(strings-internal-cordz_handle PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(strings-internal-cordz_handle PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(strings-internal-cordz_handle PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone -) -target_sources(strings-internal-cordz_handle PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle/CMakeLists.txt index e8c98bfd99..fabe90c63b 100644 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle/CMakeLists.txt @@ -6,6 +6,36 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(strings-internal-cordz_handle) +target_compile_options(strings-internal-cordz_handle PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(strings-internal-cordz_handle PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(strings-internal-cordz_handle PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone +) +target_sources(strings-internal-cordz_handle PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info/CMakeLists.linux.txt deleted file mode 100644 index 83c3cf3379..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info/CMakeLists.linux.txt +++ /dev/null @@ -1,45 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(strings-internal-cordz_info) -target_compile_options(strings-internal-cordz_info PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(strings-internal-cordz_info PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(strings-internal-cordz_info PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone -) -target_sources(strings-internal-cordz_info PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info/CMakeLists.txt index e8c98bfd99..83c3cf3379 100644 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info/CMakeLists.txt @@ -6,6 +6,40 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(strings-internal-cordz_info) +target_compile_options(strings-internal-cordz_info PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(strings-internal-cordz_info PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(strings-internal-cordz_info PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone +) +target_sources(strings-internal-cordz_info PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token/CMakeLists.linux.txt deleted file mode 100644 index c45e304001..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token/CMakeLists.linux.txt +++ /dev/null @@ -1,46 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(strings-internal-cordz_sample_token) -target_compile_options(strings-internal-cordz_sample_token PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(strings-internal-cordz_sample_token PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(strings-internal-cordz_sample_token PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - profiling-internal-exponential_biased - abseil-cpp-absl-strings - strings-internal-absl_cord_internal - strings-internal-absl_strings_internal - strings-internal-cordz_functions - strings-internal-cordz_handle - strings-internal-cordz_info - abseil-cpp-absl-synchronization - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone -) -target_sources(strings-internal-cordz_sample_token PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token/CMakeLists.txt index e8c98bfd99..c45e304001 100644 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token/CMakeLists.txt @@ -6,6 +6,41 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(strings-internal-cordz_sample_token) +target_compile_options(strings-internal-cordz_sample_token PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(strings-internal-cordz_sample_token PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(strings-internal-cordz_sample_token PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + profiling-internal-exponential_biased + abseil-cpp-absl-strings + strings-internal-absl_cord_internal + strings-internal-absl_strings_internal + strings-internal-cordz_functions + strings-internal-cordz_handle + strings-internal-cordz_info + abseil-cpp-absl-synchronization + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone +) +target_sources(strings-internal-cordz_sample_token PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/escaping_test_common.h b/contrib/restricted/abseil-cpp/absl/strings/internal/escaping_test_common.h deleted file mode 100644 index 7b18017a08..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/escaping_test_common.h +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// This test contains common things needed by both escaping_test.cc and -// escaping_benchmark.cc. - -#ifndef ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_ -#define ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_ - -#include <array> -#include "absl/strings/string_view.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace strings_internal { - -struct base64_testcase { - absl::string_view plaintext; - absl::string_view cyphertext; -}; - -inline const std::array<base64_testcase, 5>& base64_strings() { - static const std::array<base64_testcase, 5> testcase{{ - // Some google quotes - // Cyphertext created with "uuencode (GNU sharutils) 4.6.3" - // (Note that we're testing the websafe encoding, though, so if - // you add messages, be sure to run "tr -- '+/' '-_'" on the output) - { "I was always good at math and science, and I never realized " - "that was unusual or somehow undesirable. So one of the things " - "I care a lot about is helping to remove that stigma, " - "to show girls that you can be feminine, you can like the things " - "that girls like, but you can also be really good at technology. " - "You can be really good at building things." - " - Marissa Meyer, Newsweek, 2010-12-22" "\n", - - "SSB3YXMgYWx3YXlzIGdvb2QgYXQgbWF0aCBhbmQgc2NpZW5jZSwgYW5kIEkg" - "bmV2ZXIgcmVhbGl6ZWQgdGhhdCB3YXMgdW51c3VhbCBvciBzb21laG93IHVu" - "ZGVzaXJhYmxlLiBTbyBvbmUgb2YgdGhlIHRoaW5ncyBJIGNhcmUgYSBsb3Qg" - "YWJvdXQgaXMgaGVscGluZyB0byByZW1vdmUgdGhhdCBzdGlnbWEsIHRvIHNo" - "b3cgZ2lybHMgdGhhdCB5b3UgY2FuIGJlIGZlbWluaW5lLCB5b3UgY2FuIGxp" - "a2UgdGhlIHRoaW5ncyB0aGF0IGdpcmxzIGxpa2UsIGJ1dCB5b3UgY2FuIGFs" - "c28gYmUgcmVhbGx5IGdvb2QgYXQgdGVjaG5vbG9neS4gWW91IGNhbiBiZSBy" - "ZWFsbHkgZ29vZCBhdCBidWlsZGluZyB0aGluZ3MuIC0gTWFyaXNzYSBNZXll" - "ciwgTmV3c3dlZWssIDIwMTAtMTItMjIK" }, - - { "Typical first year for a new cluster: " - "~0.5 overheating " - "~1 PDU failure " - "~1 rack-move " - "~1 network rewiring " - "~20 rack failures " - "~5 racks go wonky " - "~8 network maintenances " - "~12 router reloads " - "~3 router failures " - "~dozens of minor 30-second blips for dns " - "~1000 individual machine failures " - "~thousands of hard drive failures " - "slow disks, bad memory, misconfigured machines, flaky machines, etc." - " - Jeff Dean, The Joys of Real Hardware" "\n", - - "VHlwaWNhbCBmaXJzdCB5ZWFyIGZvciBhIG5ldyBjbHVzdGVyOiB-MC41IG92" - "ZXJoZWF0aW5nIH4xIFBEVSBmYWlsdXJlIH4xIHJhY2stbW92ZSB-MSBuZXR3" - "b3JrIHJld2lyaW5nIH4yMCByYWNrIGZhaWx1cmVzIH41IHJhY2tzIGdvIHdv" - "bmt5IH44IG5ldHdvcmsgbWFpbnRlbmFuY2VzIH4xMiByb3V0ZXIgcmVsb2Fk" - "cyB-MyByb3V0ZXIgZmFpbHVyZXMgfmRvemVucyBvZiBtaW5vciAzMC1zZWNv" - "bmQgYmxpcHMgZm9yIGRucyB-MTAwMCBpbmRpdmlkdWFsIG1hY2hpbmUgZmFp" - "bHVyZXMgfnRob3VzYW5kcyBvZiBoYXJkIGRyaXZlIGZhaWx1cmVzIHNsb3cg" - "ZGlza3MsIGJhZCBtZW1vcnksIG1pc2NvbmZpZ3VyZWQgbWFjaGluZXMsIGZs" - "YWt5IG1hY2hpbmVzLCBldGMuIC0gSmVmZiBEZWFuLCBUaGUgSm95cyBvZiBS" - "ZWFsIEhhcmR3YXJlCg" }, - - { "I'm the head of the webspam team at Google. " - "That means that if you type your name into Google and get porn back, " - "it's my fault. Unless you're a porn star, in which case porn is a " - "completely reasonable response." - " - Matt Cutts, Google Plus" "\n", - - "SSdtIHRoZSBoZWFkIG9mIHRoZSB3ZWJzcGFtIHRlYW0gYXQgR29vZ2xlLiAg" - "VGhhdCBtZWFucyB0aGF0IGlmIHlvdSB0eXBlIHlvdXIgbmFtZSBpbnRvIEdv" - "b2dsZSBhbmQgZ2V0IHBvcm4gYmFjaywgaXQncyBteSBmYXVsdC4gVW5sZXNz" - "IHlvdSdyZSBhIHBvcm4gc3RhciwgaW4gd2hpY2ggY2FzZSBwb3JuIGlzIGEg" - "Y29tcGxldGVseSByZWFzb25hYmxlIHJlc3BvbnNlLiAtIE1hdHQgQ3V0dHMs" - "IEdvb2dsZSBQbHVzCg" }, - - { "It will still be a long time before machines approach human " - "intelligence. " - "But luckily, machines don't actually have to be intelligent; " - "they just have to fake it. Access to a wealth of information, " - "combined with a rudimentary decision-making capacity, " - "can often be almost as useful. Of course, the results are better yet " - "when coupled with intelligence. A reference librarian with access to " - "a good search engine is a formidable tool." - " - Craig Silverstein, Siemens Pictures of the Future, Spring 2004" - "\n", - - "SXQgd2lsbCBzdGlsbCBiZSBhIGxvbmcgdGltZSBiZWZvcmUgbWFjaGluZXMg" - "YXBwcm9hY2ggaHVtYW4gaW50ZWxsaWdlbmNlLiBCdXQgbHVja2lseSwgbWFj" - "aGluZXMgZG9uJ3QgYWN0dWFsbHkgaGF2ZSB0byBiZSBpbnRlbGxpZ2VudDsg" - "dGhleSBqdXN0IGhhdmUgdG8gZmFrZSBpdC4gQWNjZXNzIHRvIGEgd2VhbHRo" - "IG9mIGluZm9ybWF0aW9uLCBjb21iaW5lZCB3aXRoIGEgcnVkaW1lbnRhcnkg" - "ZGVjaXNpb24tbWFraW5nIGNhcGFjaXR5LCBjYW4gb2Z0ZW4gYmUgYWxtb3N0" - "IGFzIHVzZWZ1bC4gT2YgY291cnNlLCB0aGUgcmVzdWx0cyBhcmUgYmV0dGVy" - "IHlldCB3aGVuIGNvdXBsZWQgd2l0aCBpbnRlbGxpZ2VuY2UuIEEgcmVmZXJl" - "bmNlIGxpYnJhcmlhbiB3aXRoIGFjY2VzcyB0byBhIGdvb2Qgc2VhcmNoIGVu" - "Z2luZSBpcyBhIGZvcm1pZGFibGUgdG9vbC4gLSBDcmFpZyBTaWx2ZXJzdGVp" - "biwgU2llbWVucyBQaWN0dXJlcyBvZiB0aGUgRnV0dXJlLCBTcHJpbmcgMjAw" - "NAo" }, - - // Degenerate edge case - { "", - "" }, - }}; - - return testcase; -} - -} // namespace strings_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_ diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/numbers_test_common.h b/contrib/restricted/abseil-cpp/absl/strings/internal/numbers_test_common.h deleted file mode 100644 index eaa88a8897..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/numbers_test_common.h +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// This file contains common things needed by numbers_test.cc, -// numbers_legacy_test.cc and numbers_benchmark.cc. - -#ifndef ABSL_STRINGS_INTERNAL_NUMBERS_TEST_COMMON_H_ -#define ABSL_STRINGS_INTERNAL_NUMBERS_TEST_COMMON_H_ - -#include <array> -#include <cstdint> -#include <limits> -#include <string> - -#include "absl/base/config.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace strings_internal { - -template <typename IntType> -inline bool Itoa(IntType value, int base, std::string* destination) { - destination->clear(); - if (base <= 1 || base > 36) { - return false; - } - - if (value == 0) { - destination->push_back('0'); - return true; - } - - bool negative = value < 0; - while (value != 0) { - const IntType next_value = value / base; - // Can't use std::abs here because of problems when IntType is unsigned. - int remainder = - static_cast<int>(value > next_value * base ? value - next_value * base - : next_value * base - value); - char c = remainder < 10 ? '0' + remainder : 'A' + remainder - 10; - destination->insert(0, 1, c); - value = next_value; - } - - if (negative) { - destination->insert(0, 1, '-'); - } - return true; -} - -struct uint32_test_case { - const char* str; - bool expect_ok; - int base; // base to pass to the conversion function - uint32_t expected; -}; - -inline const std::array<uint32_test_case, 27>& strtouint32_test_cases() { - static const std::array<uint32_test_case, 27> test_cases{{ - {"0xffffffff", true, 16, (std::numeric_limits<uint32_t>::max)()}, - {"0x34234324", true, 16, 0x34234324}, - {"34234324", true, 16, 0x34234324}, - {"0", true, 16, 0}, - {" \t\n 0xffffffff", true, 16, (std::numeric_limits<uint32_t>::max)()}, - {" \f\v 46", true, 10, 46}, // must accept weird whitespace - {" \t\n 72717222", true, 8, 072717222}, - {" \t\n 072717222", true, 8, 072717222}, - {" \t\n 072717228", false, 8, 07271722}, - {"0", true, 0, 0}, - - // Base-10 version. - {"34234324", true, 0, 34234324}, - {"4294967295", true, 0, (std::numeric_limits<uint32_t>::max)()}, - {"34234324 \n\t", true, 10, 34234324}, - - // Unusual base - {"0", true, 3, 0}, - {"2", true, 3, 2}, - {"11", true, 3, 4}, - - // Invalid uints. - {"", false, 0, 0}, - {" ", false, 0, 0}, - {"abc", false, 0, 0}, // would be valid hex, but prefix is missing - {"34234324a", false, 0, 34234324}, - {"34234.3", false, 0, 34234}, - {"-1", false, 0, 0}, - {" -123", false, 0, 0}, - {" \t\n -123", false, 0, 0}, - - // Out of bounds. - {"4294967296", false, 0, (std::numeric_limits<uint32_t>::max)()}, - {"0x100000000", false, 0, (std::numeric_limits<uint32_t>::max)()}, - {nullptr, false, 0, 0}, - }}; - return test_cases; -} - -struct uint64_test_case { - const char* str; - bool expect_ok; - int base; - uint64_t expected; -}; - -inline const std::array<uint64_test_case, 34>& strtouint64_test_cases() { - static const std::array<uint64_test_case, 34> test_cases{{ - {"0x3423432448783446", true, 16, int64_t{0x3423432448783446}}, - {"3423432448783446", true, 16, int64_t{0x3423432448783446}}, - - {"0", true, 16, 0}, - {"000", true, 0, 0}, - {"0", true, 0, 0}, - {" \t\n 0xffffffffffffffff", true, 16, - (std::numeric_limits<uint64_t>::max)()}, - - {"012345670123456701234", true, 8, int64_t{012345670123456701234}}, - {"12345670123456701234", true, 8, int64_t{012345670123456701234}}, - - {"12845670123456701234", false, 8, 0}, - - // Base-10 version. - {"34234324487834466", true, 0, int64_t{34234324487834466}}, - - {" \t\n 18446744073709551615", true, 0, - (std::numeric_limits<uint64_t>::max)()}, - - {"34234324487834466 \n\t ", true, 0, int64_t{34234324487834466}}, - - {" \f\v 46", true, 10, 46}, // must accept weird whitespace - - // Unusual base - {"0", true, 3, 0}, - {"2", true, 3, 2}, - {"11", true, 3, 4}, - - {"0", true, 0, 0}, - - // Invalid uints. - {"", false, 0, 0}, - {" ", false, 0, 0}, - {"abc", false, 0, 0}, - {"34234324487834466a", false, 0, 0}, - {"34234487834466.3", false, 0, 0}, - {"-1", false, 0, 0}, - {" -123", false, 0, 0}, - {" \t\n -123", false, 0, 0}, - - // Out of bounds. - {"18446744073709551616", false, 10, 0}, - {"18446744073709551616", false, 0, 0}, - {"0x10000000000000000", false, 16, - (std::numeric_limits<uint64_t>::max)()}, - {"0X10000000000000000", false, 16, - (std::numeric_limits<uint64_t>::max)()}, // 0X versus 0x. - {"0x10000000000000000", false, 0, (std::numeric_limits<uint64_t>::max)()}, - {"0X10000000000000000", false, 0, - (std::numeric_limits<uint64_t>::max)()}, // 0X versus 0x. - - {"0x1234", true, 16, 0x1234}, - - // Base-10 string version. - {"1234", true, 0, 1234}, - {nullptr, false, 0, 0}, - }}; - return test_cases; -} - -} // namespace strings_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_STRINGS_INTERNAL_NUMBERS_TEST_COMMON_H_ diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/pow10_helper.h b/contrib/restricted/abseil-cpp/absl/strings/internal/pow10_helper.h deleted file mode 100644 index c37c2c3ffe..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/pow10_helper.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// This test helper library contains a table of powers of 10, to guarantee -// precise values are computed across the full range of doubles. We can't rely -// on the pow() function, because not all standard libraries ship a version -// that is precise. -#ifndef ABSL_STRINGS_INTERNAL_POW10_HELPER_H_ -#define ABSL_STRINGS_INTERNAL_POW10_HELPER_H_ - -#include <vector> - -#include "absl/base/config.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace strings_internal { - -// Computes the precise value of 10^exp. (I.e. the nearest representable -// double to the exact value, rounding to nearest-even in the (single) case of -// being exactly halfway between.) -double Pow10(int exp); - -} // namespace strings_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_STRINGS_INTERNAL_POW10_HELPER_H_ diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/.yandex_meta/licenses.list.txt deleted file mode 100644 index 33d60b3d2b..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,20 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2020 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/CMakeLists.linux.txt deleted file mode 100644 index b52e343b61..0000000000 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/CMakeLists.linux.txt +++ /dev/null @@ -1,36 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(strings-internal-str_format) -target_compile_options(strings-internal-str_format PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(strings-internal-str_format PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(strings-internal-str_format PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal -) -target_sources(strings-internal-str_format PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/arg.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/bind.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/extension.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/output.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/parser.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/CMakeLists.txt index e8c98bfd99..b52e343b61 100644 --- a/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/CMakeLists.txt @@ -6,6 +6,31 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(strings-internal-str_format) +target_compile_options(strings-internal-str_format PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(strings-internal-str_format PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(strings-internal-str_format PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal +) +target_sources(strings-internal-str_format PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/arg.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/bind.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/extension.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/output.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/strings/internal/str_format/parser.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/synchronization/.yandex_meta/licenses.list.txt deleted file mode 100644 index 7be6b42848..0000000000 --- a/contrib/restricted/abseil-cpp/absl/synchronization/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,16 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/synchronization/CMakeLists.linux.txt deleted file mode 100644 index e63479baed..0000000000 --- a/contrib/restricted/abseil-cpp/absl/synchronization/CMakeLists.linux.txt +++ /dev/null @@ -1,46 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-synchronization) -target_compile_options(abseil-cpp-absl-synchronization PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-synchronization PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-synchronization PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-debugging - absl-debugging-stacktrace - absl-debugging-symbolize - abseil-cpp-absl-demangle - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - absl-synchronization-internal - abseil-cpp-absl-time - absl-time-civil_time - absl-time-time_zone -) -target_sources(abseil-cpp-absl-synchronization PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/barrier.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/internal/waiter.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/mutex.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/notification.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/synchronization/CMakeLists.txt index e8c98bfd99..e63479baed 100644 --- a/contrib/restricted/abseil-cpp/absl/synchronization/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/synchronization/CMakeLists.txt @@ -6,6 +6,41 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-synchronization) +target_compile_options(abseil-cpp-absl-synchronization PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-synchronization PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-synchronization PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-debugging + absl-debugging-stacktrace + absl-debugging-symbolize + abseil-cpp-absl-demangle + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + absl-synchronization-internal + abseil-cpp-absl-time + absl-time-civil_time + absl-time-time_zone +) +target_sources(abseil-cpp-absl-synchronization PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/barrier.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/internal/waiter.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/mutex.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/notification.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/internal/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/synchronization/internal/.yandex_meta/licenses.list.txt deleted file mode 100644 index b94f79902f..0000000000 --- a/contrib/restricted/abseil-cpp/absl/synchronization/internal/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,34 +0,0 @@ -====================Apache-2.0==================== - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - - -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2020 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/internal/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/synchronization/internal/CMakeLists.linux.txt deleted file mode 100644 index dfc7f6f7c1..0000000000 --- a/contrib/restricted/abseil-cpp/absl/synchronization/internal/CMakeLists.linux.txt +++ /dev/null @@ -1,28 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-synchronization-internal) -target_compile_options(absl-synchronization-internal PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-synchronization-internal PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-synchronization-internal PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-low_level_alloc - base-internal-raw_logging - base-internal-spinlock_wait - absl-base-log_severity -) -target_sources(absl-synchronization-internal PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/internal/graphcycles.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/internal/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/synchronization/internal/CMakeLists.txt index e8c98bfd99..dfc7f6f7c1 100644 --- a/contrib/restricted/abseil-cpp/absl/synchronization/internal/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/synchronization/internal/CMakeLists.txt @@ -6,6 +6,23 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-synchronization-internal) +target_compile_options(absl-synchronization-internal PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-synchronization-internal PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-synchronization-internal PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-low_level_alloc + base-internal-raw_logging + base-internal-spinlock_wait + absl-base-log_severity +) +target_sources(absl-synchronization-internal PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/synchronization/internal/graphcycles.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/internal/thread_pool.h b/contrib/restricted/abseil-cpp/absl/synchronization/internal/thread_pool.h deleted file mode 100644 index 0cb96dacde..0000000000 --- a/contrib/restricted/abseil-cpp/absl/synchronization/internal/thread_pool.h +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_SYNCHRONIZATION_INTERNAL_THREAD_POOL_H_ -#define ABSL_SYNCHRONIZATION_INTERNAL_THREAD_POOL_H_ - -#include <cassert> -#include <cstddef> -#include <functional> -#include <queue> -#include <thread> // NOLINT(build/c++11) -#include <vector> - -#include "absl/base/thread_annotations.h" -#include "absl/synchronization/mutex.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace synchronization_internal { - -// A simple ThreadPool implementation for tests. -class ThreadPool { - public: - explicit ThreadPool(int num_threads) { - for (int i = 0; i < num_threads; ++i) { - threads_.push_back(std::thread(&ThreadPool::WorkLoop, this)); - } - } - - ThreadPool(const ThreadPool &) = delete; - ThreadPool &operator=(const ThreadPool &) = delete; - - ~ThreadPool() { - { - absl::MutexLock l(&mu_); - for (size_t i = 0; i < threads_.size(); i++) { - queue_.push(nullptr); // Shutdown signal. - } - } - for (auto &t : threads_) { - t.join(); - } - } - - // Schedule a function to be run on a ThreadPool thread immediately. - void Schedule(std::function<void()> func) { - assert(func != nullptr); - absl::MutexLock l(&mu_); - queue_.push(std::move(func)); - } - - private: - bool WorkAvailable() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_) { - return !queue_.empty(); - } - - void WorkLoop() { - while (true) { - std::function<void()> func; - { - absl::MutexLock l(&mu_); - mu_.Await(absl::Condition(this, &ThreadPool::WorkAvailable)); - func = std::move(queue_.front()); - queue_.pop(); - } - if (func == nullptr) { // Shutdown signal. - break; - } - func(); - } - } - - absl::Mutex mu_; - std::queue<std::function<void()>> queue_ ABSL_GUARDED_BY(mu_); - std::vector<std::thread> threads_; -}; - -} // namespace synchronization_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_SYNCHRONIZATION_INTERNAL_THREAD_POOL_H_ diff --git a/contrib/restricted/abseil-cpp/absl/time/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/time/.yandex_meta/licenses.list.txt deleted file mode 100644 index 7c1bf3b5ad..0000000000 --- a/contrib/restricted/abseil-cpp/absl/time/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,42 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2016 Google Inc. All Rights Reserved. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================Public-Domain==================== -** This file is in the public domain, so clarified as of diff --git a/contrib/restricted/abseil-cpp/absl/time/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/time/CMakeLists.linux.txt deleted file mode 100644 index a5919760af..0000000000 --- a/contrib/restricted/abseil-cpp/absl/time/CMakeLists.linux.txt +++ /dev/null @@ -1,37 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-time) -target_compile_options(abseil-cpp-absl-time PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(abseil-cpp-absl-time PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(abseil-cpp-absl-time PUBLIC - contrib-libs-cxxsupp - abseil-cpp-absl-base - base-internal-raw_logging - base-internal-spinlock_wait - base-internal-throw_delegate - absl-base-log_severity - abseil-cpp-absl-numeric - abseil-cpp-absl-strings - strings-internal-absl_strings_internal - absl-time-civil_time - absl-time-time_zone -) -target_sources(abseil-cpp-absl-time PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/civil_time.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/clock.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/duration.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/format.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/time.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/time/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/time/CMakeLists.txt index e8c98bfd99..a5919760af 100644 --- a/contrib/restricted/abseil-cpp/absl/time/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/time/CMakeLists.txt @@ -6,6 +6,32 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-time) +target_compile_options(abseil-cpp-absl-time PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(abseil-cpp-absl-time PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(abseil-cpp-absl-time PUBLIC + contrib-libs-cxxsupp + abseil-cpp-absl-base + base-internal-raw_logging + base-internal-spinlock_wait + base-internal-throw_delegate + absl-base-log_severity + abseil-cpp-absl-numeric + abseil-cpp-absl-strings + strings-internal-absl_strings_internal + absl-time-civil_time + absl-time-time_zone +) +target_sources(abseil-cpp-absl-time PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/civil_time.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/clock.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/duration.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/format.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/time.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/time/civil_time/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/time/civil_time/CMakeLists.linux.txt deleted file mode 100644 index 51df8fb131..0000000000 --- a/contrib/restricted/abseil-cpp/absl/time/civil_time/CMakeLists.linux.txt +++ /dev/null @@ -1,23 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-time-civil_time) -target_compile_options(absl-time-civil_time PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-time-civil_time PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-time-civil_time PUBLIC - contrib-libs-cxxsupp -) -target_sources(absl-time-civil_time PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/time/civil_time/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/time/civil_time/CMakeLists.txt index e8c98bfd99..51df8fb131 100644 --- a/contrib/restricted/abseil-cpp/absl/time/civil_time/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/time/civil_time/CMakeLists.txt @@ -6,6 +6,18 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-time-civil_time) +target_compile_options(absl-time-civil_time PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-time-civil_time PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-time-civil_time PUBLIC + contrib-libs-cxxsupp +) +target_sources(absl-time-civil_time PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/time/internal/test_util.h b/contrib/restricted/abseil-cpp/absl/time/internal/test_util.h deleted file mode 100644 index 5c4bf1f680..0000000000 --- a/contrib/restricted/abseil-cpp/absl/time/internal/test_util.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_TIME_INTERNAL_TEST_UTIL_H_ -#define ABSL_TIME_INTERNAL_TEST_UTIL_H_ - -#include <string> - -#include "absl/time/time.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace time_internal { - -// Loads the named timezone, but dies on any failure. -absl::TimeZone LoadTimeZone(const std::string& name); - -} // namespace time_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_TIME_INTERNAL_TEST_UTIL_H_ diff --git a/contrib/restricted/abseil-cpp/absl/time/internal/zoneinfo.inc b/contrib/restricted/abseil-cpp/absl/time/internal/zoneinfo.inc deleted file mode 100644 index bfed82990d..0000000000 --- a/contrib/restricted/abseil-cpp/absl/time/internal/zoneinfo.inc +++ /dev/null @@ -1,729 +0,0 @@ -unsigned char America_Los_Angeles[] = { - 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x80, 0x00, 0x00, 0x00, - 0x9e, 0xa6, 0x48, 0xa0, 0x9f, 0xbb, 0x15, 0x90, 0xa0, 0x86, 0x2a, 0xa0, - 0xa1, 0x9a, 0xf7, 0x90, 0xcb, 0x89, 0x1a, 0xa0, 0xd2, 0x23, 0xf4, 0x70, - 0xd2, 0x61, 0x26, 0x10, 0xd6, 0xfe, 0x74, 0x5c, 0xd8, 0x80, 0xad, 0x90, - 0xda, 0xfe, 0xc3, 0x90, 0xdb, 0xc0, 0x90, 0x10, 0xdc, 0xde, 0xa5, 0x90, - 0xdd, 0xa9, 0xac, 0x90, 0xde, 0xbe, 0x87, 0x90, 0xdf, 0x89, 0x8e, 0x90, - 0xe0, 0x9e, 0x69, 0x90, 0xe1, 0x69, 0x70, 0x90, 0xe2, 0x7e, 0x4b, 0x90, - 0xe3, 0x49, 0x52, 0x90, 0xe4, 0x5e, 0x2d, 0x90, 0xe5, 0x29, 0x34, 0x90, - 0xe6, 0x47, 0x4a, 0x10, 0xe7, 0x12, 0x51, 0x10, 0xe8, 0x27, 0x2c, 0x10, - 0xe8, 0xf2, 0x33, 0x10, 0xea, 0x07, 0x0e, 0x10, 0xea, 0xd2, 0x15, 0x10, - 0xeb, 0xe6, 0xf0, 0x10, 0xec, 0xb1, 0xf7, 0x10, 0xed, 0xc6, 0xd2, 0x10, - 0xee, 0x91, 0xd9, 0x10, 0xef, 0xaf, 0xee, 0x90, 0xf0, 0x71, 0xbb, 0x10, - 0xf1, 0x8f, 0xd0, 0x90, 0xf2, 0x7f, 0xc1, 0x90, 0xf3, 0x6f, 0xb2, 0x90, - 0xf4, 0x5f, 0xa3, 0x90, 0xf5, 0x4f, 0x94, 0x90, 0xf6, 0x3f, 0x85, 0x90, - 0xf7, 0x2f, 0x76, 0x90, 0xf8, 0x28, 0xa2, 0x10, 0xf9, 0x0f, 0x58, 0x90, - 0xfa, 0x08, 0x84, 0x10, 0xfa, 0xf8, 0x83, 0x20, 0xfb, 0xe8, 0x66, 0x10, - 0xfc, 0xd8, 0x65, 0x20, 0xfd, 0xc8, 0x48, 0x10, 0xfe, 0xb8, 0x47, 0x20, - 0xff, 0xa8, 0x2a, 0x10, 0x00, 0x98, 0x29, 0x20, 0x01, 0x88, 0x0c, 0x10, - 0x02, 0x78, 0x0b, 0x20, 0x03, 0x71, 0x28, 0x90, 0x04, 0x61, 0x27, 0xa0, - 0x05, 0x51, 0x0a, 0x90, 0x06, 0x41, 0x09, 0xa0, 0x07, 0x30, 0xec, 0x90, - 0x07, 0x8d, 0x43, 0xa0, 0x09, 0x10, 0xce, 0x90, 0x09, 0xad, 0xbf, 0x20, - 0x0a, 0xf0, 0xb0, 0x90, 0x0b, 0xe0, 0xaf, 0xa0, 0x0c, 0xd9, 0xcd, 0x10, - 0x0d, 0xc0, 0x91, 0xa0, 0x0e, 0xb9, 0xaf, 0x10, 0x0f, 0xa9, 0xae, 0x20, - 0x10, 0x99, 0x91, 0x10, 0x11, 0x89, 0x90, 0x20, 0x12, 0x79, 0x73, 0x10, - 0x13, 0x69, 0x72, 0x20, 0x14, 0x59, 0x55, 0x10, 0x15, 0x49, 0x54, 0x20, - 0x16, 0x39, 0x37, 0x10, 0x17, 0x29, 0x36, 0x20, 0x18, 0x22, 0x53, 0x90, - 0x19, 0x09, 0x18, 0x20, 0x1a, 0x02, 0x35, 0x90, 0x1a, 0xf2, 0x34, 0xa0, - 0x1b, 0xe2, 0x17, 0x90, 0x1c, 0xd2, 0x16, 0xa0, 0x1d, 0xc1, 0xf9, 0x90, - 0x1e, 0xb1, 0xf8, 0xa0, 0x1f, 0xa1, 0xdb, 0x90, 0x20, 0x76, 0x2b, 0x20, - 0x21, 0x81, 0xbd, 0x90, 0x22, 0x56, 0x0d, 0x20, 0x23, 0x6a, 0xda, 0x10, - 0x24, 0x35, 0xef, 0x20, 0x25, 0x4a, 0xbc, 0x10, 0x26, 0x15, 0xd1, 0x20, - 0x27, 0x2a, 0x9e, 0x10, 0x27, 0xfe, 0xed, 0xa0, 0x29, 0x0a, 0x80, 0x10, - 0x29, 0xde, 0xcf, 0xa0, 0x2a, 0xea, 0x62, 0x10, 0x2b, 0xbe, 0xb1, 0xa0, - 0x2c, 0xd3, 0x7e, 0x90, 0x2d, 0x9e, 0x93, 0xa0, 0x2e, 0xb3, 0x60, 0x90, - 0x2f, 0x7e, 0x75, 0xa0, 0x30, 0x93, 0x42, 0x90, 0x31, 0x67, 0x92, 0x20, - 0x32, 0x73, 0x24, 0x90, 0x33, 0x47, 0x74, 0x20, 0x34, 0x53, 0x06, 0x90, - 0x35, 0x27, 0x56, 0x20, 0x36, 0x32, 0xe8, 0x90, 0x37, 0x07, 0x38, 0x20, - 0x38, 0x1c, 0x05, 0x10, 0x38, 0xe7, 0x1a, 0x20, 0x39, 0xfb, 0xe7, 0x10, - 0x3a, 0xc6, 0xfc, 0x20, 0x3b, 0xdb, 0xc9, 0x10, 0x3c, 0xb0, 0x18, 0xa0, - 0x3d, 0xbb, 0xab, 0x10, 0x3e, 0x8f, 0xfa, 0xa0, 0x3f, 0x9b, 0x8d, 0x10, - 0x40, 0x6f, 0xdc, 0xa0, 0x41, 0x84, 0xa9, 0x90, 0x42, 0x4f, 0xbe, 0xa0, - 0x43, 0x64, 0x8b, 0x90, 0x44, 0x2f, 0xa0, 0xa0, 0x45, 0x44, 0x6d, 0x90, - 0x45, 0xf3, 0xd3, 0x20, 0x47, 0x2d, 0x8a, 0x10, 0x47, 0xd3, 0xb5, 0x20, - 0x49, 0x0d, 0x6c, 0x10, 0x49, 0xb3, 0x97, 0x20, 0x4a, 0xed, 0x4e, 0x10, - 0x4b, 0x9c, 0xb3, 0xa0, 0x4c, 0xd6, 0x6a, 0x90, 0x4d, 0x7c, 0x95, 0xa0, - 0x4e, 0xb6, 0x4c, 0x90, 0x4f, 0x5c, 0x77, 0xa0, 0x50, 0x96, 0x2e, 0x90, - 0x51, 0x3c, 0x59, 0xa0, 0x52, 0x76, 0x10, 0x90, 0x53, 0x1c, 0x3b, 0xa0, - 0x54, 0x55, 0xf2, 0x90, 0x54, 0xfc, 0x1d, 0xa0, 0x56, 0x35, 0xd4, 0x90, - 0x56, 0xe5, 0x3a, 0x20, 0x58, 0x1e, 0xf1, 0x10, 0x58, 0xc5, 0x1c, 0x20, - 0x59, 0xfe, 0xd3, 0x10, 0x5a, 0xa4, 0xfe, 0x20, 0x5b, 0xde, 0xb5, 0x10, - 0x5c, 0x84, 0xe0, 0x20, 0x5d, 0xbe, 0x97, 0x10, 0x5e, 0x64, 0xc2, 0x20, - 0x5f, 0x9e, 0x79, 0x10, 0x60, 0x4d, 0xde, 0xa0, 0x61, 0x87, 0x95, 0x90, - 0x62, 0x2d, 0xc0, 0xa0, 0x63, 0x67, 0x77, 0x90, 0x64, 0x0d, 0xa2, 0xa0, - 0x65, 0x47, 0x59, 0x90, 0x65, 0xed, 0x84, 0xa0, 0x67, 0x27, 0x3b, 0x90, - 0x67, 0xcd, 0x66, 0xa0, 0x69, 0x07, 0x1d, 0x90, 0x69, 0xad, 0x48, 0xa0, - 0x6a, 0xe6, 0xff, 0x90, 0x6b, 0x96, 0x65, 0x20, 0x6c, 0xd0, 0x1c, 0x10, - 0x6d, 0x76, 0x47, 0x20, 0x6e, 0xaf, 0xfe, 0x10, 0x6f, 0x56, 0x29, 0x20, - 0x70, 0x8f, 0xe0, 0x10, 0x71, 0x36, 0x0b, 0x20, 0x72, 0x6f, 0xc2, 0x10, - 0x73, 0x15, 0xed, 0x20, 0x74, 0x4f, 0xa4, 0x10, 0x74, 0xff, 0x09, 0xa0, - 0x76, 0x38, 0xc0, 0x90, 0x76, 0xde, 0xeb, 0xa0, 0x78, 0x18, 0xa2, 0x90, - 0x78, 0xbe, 0xcd, 0xa0, 0x79, 0xf8, 0x84, 0x90, 0x7a, 0x9e, 0xaf, 0xa0, - 0x7b, 0xd8, 0x66, 0x90, 0x7c, 0x7e, 0x91, 0xa0, 0x7d, 0xb8, 0x48, 0x90, - 0x7e, 0x5e, 0x73, 0xa0, 0x7f, 0x98, 0x2a, 0x90, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x03, 0x04, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0xff, 0xff, 0x91, 0x26, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x90, - 0x01, 0x04, 0xff, 0xff, 0x8f, 0x80, 0x00, 0x08, 0xff, 0xff, 0x9d, 0x90, - 0x01, 0x0c, 0xff, 0xff, 0x9d, 0x90, 0x01, 0x10, 0x4c, 0x4d, 0x54, 0x00, - 0x50, 0x44, 0x54, 0x00, 0x50, 0x53, 0x54, 0x00, 0x50, 0x57, 0x54, 0x00, - 0x50, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xbb, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0xf8, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x5e, 0x04, - 0x1a, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x9e, 0xa6, 0x48, 0xa0, 0xff, 0xff, - 0xff, 0xff, 0x9f, 0xbb, 0x15, 0x90, 0xff, 0xff, 0xff, 0xff, 0xa0, 0x86, - 0x2a, 0xa0, 0xff, 0xff, 0xff, 0xff, 0xa1, 0x9a, 0xf7, 0x90, 0xff, 0xff, - 0xff, 0xff, 0xcb, 0x89, 0x1a, 0xa0, 0xff, 0xff, 0xff, 0xff, 0xd2, 0x23, - 0xf4, 0x70, 0xff, 0xff, 0xff, 0xff, 0xd2, 0x61, 0x26, 0x10, 0xff, 0xff, - 0xff, 0xff, 0xd6, 0xfe, 0x74, 0x5c, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x80, - 0xad, 0x90, 0xff, 0xff, 0xff, 0xff, 0xda, 0xfe, 0xc3, 0x90, 0xff, 0xff, - 0xff, 0xff, 0xdb, 0xc0, 0x90, 0x10, 0xff, 0xff, 0xff, 0xff, 0xdc, 0xde, - 0xa5, 0x90, 0xff, 0xff, 0xff, 0xff, 0xdd, 0xa9, 0xac, 0x90, 0xff, 0xff, - 0xff, 0xff, 0xde, 0xbe, 0x87, 0x90, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x89, - 0x8e, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x9e, 0x69, 0x90, 0xff, 0xff, - 0xff, 0xff, 0xe1, 0x69, 0x70, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe2, 0x7e, - 0x4b, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x49, 0x52, 0x90, 0xff, 0xff, - 0xff, 0xff, 0xe4, 0x5e, 0x2d, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe5, 0x29, - 0x34, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe6, 0x47, 0x4a, 0x10, 0xff, 0xff, - 0xff, 0xff, 0xe7, 0x12, 0x51, 0x10, 0xff, 0xff, 0xff, 0xff, 0xe8, 0x27, - 0x2c, 0x10, 0xff, 0xff, 0xff, 0xff, 0xe8, 0xf2, 0x33, 0x10, 0xff, 0xff, - 0xff, 0xff, 0xea, 0x07, 0x0e, 0x10, 0xff, 0xff, 0xff, 0xff, 0xea, 0xd2, - 0x15, 0x10, 0xff, 0xff, 0xff, 0xff, 0xeb, 0xe6, 0xf0, 0x10, 0xff, 0xff, - 0xff, 0xff, 0xec, 0xb1, 0xf7, 0x10, 0xff, 0xff, 0xff, 0xff, 0xed, 0xc6, - 0xd2, 0x10, 0xff, 0xff, 0xff, 0xff, 0xee, 0x91, 0xd9, 0x10, 0xff, 0xff, - 0xff, 0xff, 0xef, 0xaf, 0xee, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x71, - 0xbb, 0x10, 0xff, 0xff, 0xff, 0xff, 0xf1, 0x8f, 0xd0, 0x90, 0xff, 0xff, - 0xff, 0xff, 0xf2, 0x7f, 0xc1, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x6f, - 0xb2, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf4, 0x5f, 0xa3, 0x90, 0xff, 0xff, - 0xff, 0xff, 0xf5, 0x4f, 0x94, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf6, 0x3f, - 0x85, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x2f, 0x76, 0x90, 0xff, 0xff, - 0xff, 0xff, 0xf8, 0x28, 0xa2, 0x10, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x0f, - 0x58, 0x90, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x08, 0x84, 0x10, 0xff, 0xff, - 0xff, 0xff, 0xfa, 0xf8, 0x83, 0x20, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xe8, - 0x66, 0x10, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xd8, 0x65, 0x20, 0xff, 0xff, - 0xff, 0xff, 0xfd, 0xc8, 0x48, 0x10, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xb8, - 0x47, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa8, 0x2a, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x98, 0x29, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x88, - 0x0c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x02, 0x78, 0x0b, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x03, 0x71, 0x28, 0x90, 0x00, 0x00, 0x00, 0x00, 0x04, 0x61, - 0x27, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x05, 0x51, 0x0a, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x41, 0x09, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x30, - 0xec, 0x90, 0x00, 0x00, 0x00, 0x00, 0x07, 0x8d, 0x43, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x09, 0x10, 0xce, 0x90, 0x00, 0x00, 0x00, 0x00, 0x09, 0xad, - 0xbf, 0x20, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf0, 0xb0, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x0b, 0xe0, 0xaf, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xd9, - 0xcd, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xc0, 0x91, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x0e, 0xb9, 0xaf, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xa9, - 0xae, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x99, 0x91, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x11, 0x89, 0x90, 0x20, 0x00, 0x00, 0x00, 0x00, 0x12, 0x79, - 0x73, 0x10, 0x00, 0x00, 0x00, 0x00, 0x13, 0x69, 0x72, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x14, 0x59, 0x55, 0x10, 0x00, 0x00, 0x00, 0x00, 0x15, 0x49, - 0x54, 0x20, 0x00, 0x00, 0x00, 0x00, 0x16, 0x39, 0x37, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x17, 0x29, 0x36, 0x20, 0x00, 0x00, 0x00, 0x00, 0x18, 0x22, - 0x53, 0x90, 0x00, 0x00, 0x00, 0x00, 0x19, 0x09, 0x18, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x1a, 0x02, 0x35, 0x90, 0x00, 0x00, 0x00, 0x00, 0x1a, 0xf2, - 0x34, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xe2, 0x17, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0xd2, 0x16, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xc1, - 0xf9, 0x90, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xb1, 0xf8, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x1f, 0xa1, 0xdb, 0x90, 0x00, 0x00, 0x00, 0x00, 0x20, 0x76, - 0x2b, 0x20, 0x00, 0x00, 0x00, 0x00, 0x21, 0x81, 0xbd, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x22, 0x56, 0x0d, 0x20, 0x00, 0x00, 0x00, 0x00, 0x23, 0x6a, - 0xda, 0x10, 0x00, 0x00, 0x00, 0x00, 0x24, 0x35, 0xef, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x25, 0x4a, 0xbc, 0x10, 0x00, 0x00, 0x00, 0x00, 0x26, 0x15, - 0xd1, 0x20, 0x00, 0x00, 0x00, 0x00, 0x27, 0x2a, 0x9e, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x27, 0xfe, 0xed, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x29, 0x0a, - 0x80, 0x10, 0x00, 0x00, 0x00, 0x00, 0x29, 0xde, 0xcf, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x2a, 0xea, 0x62, 0x10, 0x00, 0x00, 0x00, 0x00, 0x2b, 0xbe, - 0xb1, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x2c, 0xd3, 0x7e, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x2d, 0x9e, 0x93, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x2e, 0xb3, - 0x60, 0x90, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x7e, 0x75, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x93, 0x42, 0x90, 0x00, 0x00, 0x00, 0x00, 0x31, 0x67, - 0x92, 0x20, 0x00, 0x00, 0x00, 0x00, 0x32, 0x73, 0x24, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x33, 0x47, 0x74, 0x20, 0x00, 0x00, 0x00, 0x00, 0x34, 0x53, - 0x06, 0x90, 0x00, 0x00, 0x00, 0x00, 0x35, 0x27, 0x56, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x36, 0x32, 0xe8, 0x90, 0x00, 0x00, 0x00, 0x00, 0x37, 0x07, - 0x38, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1c, 0x05, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x38, 0xe7, 0x1a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x39, 0xfb, - 0xe7, 0x10, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xc6, 0xfc, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x3b, 0xdb, 0xc9, 0x10, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xb0, - 0x18, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x3d, 0xbb, 0xab, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x3e, 0x8f, 0xfa, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x9b, - 0x8d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x6f, 0xdc, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x41, 0x84, 0xa9, 0x90, 0x00, 0x00, 0x00, 0x00, 0x42, 0x4f, - 0xbe, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x43, 0x64, 0x8b, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x44, 0x2f, 0xa0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x45, 0x44, - 0x6d, 0x90, 0x00, 0x00, 0x00, 0x00, 0x45, 0xf3, 0xd3, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x47, 0x2d, 0x8a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x47, 0xd3, - 0xb5, 0x20, 0x00, 0x00, 0x00, 0x00, 0x49, 0x0d, 0x6c, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x49, 0xb3, 0x97, 0x20, 0x00, 0x00, 0x00, 0x00, 0x4a, 0xed, - 0x4e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x9c, 0xb3, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x4c, 0xd6, 0x6a, 0x90, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x7c, - 0x95, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x4e, 0xb6, 0x4c, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x4f, 0x5c, 0x77, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x50, 0x96, - 0x2e, 0x90, 0x00, 0x00, 0x00, 0x00, 0x51, 0x3c, 0x59, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x52, 0x76, 0x10, 0x90, 0x00, 0x00, 0x00, 0x00, 0x53, 0x1c, - 0x3b, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0xf2, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x54, 0xfc, 0x1d, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x56, 0x35, - 0xd4, 0x90, 0x00, 0x00, 0x00, 0x00, 0x56, 0xe5, 0x3a, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x58, 0x1e, 0xf1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x58, 0xc5, - 0x1c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x59, 0xfe, 0xd3, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x5a, 0xa4, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00, 0x5b, 0xde, - 0xb5, 0x10, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x84, 0xe0, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x5d, 0xbe, 0x97, 0x10, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x64, - 0xc2, 0x20, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x9e, 0x79, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x60, 0x4d, 0xde, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x61, 0x87, - 0x95, 0x90, 0x00, 0x00, 0x00, 0x00, 0x62, 0x2d, 0xc0, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x63, 0x67, 0x77, 0x90, 0x00, 0x00, 0x00, 0x00, 0x64, 0x0d, - 0xa2, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x65, 0x47, 0x59, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x65, 0xed, 0x84, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x67, 0x27, - 0x3b, 0x90, 0x00, 0x00, 0x00, 0x00, 0x67, 0xcd, 0x66, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x69, 0x07, 0x1d, 0x90, 0x00, 0x00, 0x00, 0x00, 0x69, 0xad, - 0x48, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x6a, 0xe6, 0xff, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x6b, 0x96, 0x65, 0x20, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xd0, - 0x1c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x76, 0x47, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x6e, 0xaf, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x56, - 0x29, 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0xe0, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x71, 0x36, 0x0b, 0x20, 0x00, 0x00, 0x00, 0x00, 0x72, 0x6f, - 0xc2, 0x10, 0x00, 0x00, 0x00, 0x00, 0x73, 0x15, 0xed, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x74, 0x4f, 0xa4, 0x10, 0x00, 0x00, 0x00, 0x00, 0x74, 0xff, - 0x09, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x76, 0x38, 0xc0, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x76, 0xde, 0xeb, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x78, 0x18, - 0xa2, 0x90, 0x00, 0x00, 0x00, 0x00, 0x78, 0xbe, 0xcd, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x79, 0xf8, 0x84, 0x90, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x9e, - 0xaf, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x7b, 0xd8, 0x66, 0x90, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0x7e, 0x91, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x7d, 0xb8, - 0x48, 0x90, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5e, 0x73, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x7f, 0x98, 0x2a, 0x90, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x03, 0x04, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0xff, 0xff, 0x91, 0x26, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x90, 0x01, - 0x04, 0xff, 0xff, 0x8f, 0x80, 0x00, 0x08, 0xff, 0xff, 0x9d, 0x90, 0x01, - 0x0c, 0xff, 0xff, 0x9d, 0x90, 0x01, 0x10, 0x4c, 0x4d, 0x54, 0x00, 0x50, - 0x44, 0x54, 0x00, 0x50, 0x53, 0x54, 0x00, 0x50, 0x57, 0x54, 0x00, 0x50, - 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x0a, 0x50, 0x53, 0x54, 0x38, 0x50, 0x44, 0x54, 0x2c, 0x4d, 0x33, - 0x2e, 0x32, 0x2e, 0x30, 0x2c, 0x4d, 0x31, 0x31, 0x2e, 0x31, 0x2e, 0x30, - 0x0a -}; -unsigned int America_Los_Angeles_len = 2845; -unsigned char America_New_York[] = { - 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x80, 0x00, 0x00, 0x00, - 0x9e, 0xa6, 0x1e, 0x70, 0x9f, 0xba, 0xeb, 0x60, 0xa0, 0x86, 0x00, 0x70, - 0xa1, 0x9a, 0xcd, 0x60, 0xa2, 0x65, 0xe2, 0x70, 0xa3, 0x83, 0xe9, 0xe0, - 0xa4, 0x6a, 0xae, 0x70, 0xa5, 0x35, 0xa7, 0x60, 0xa6, 0x53, 0xca, 0xf0, - 0xa7, 0x15, 0x89, 0x60, 0xa8, 0x33, 0xac, 0xf0, 0xa8, 0xfe, 0xa5, 0xe0, - 0xaa, 0x13, 0x8e, 0xf0, 0xaa, 0xde, 0x87, 0xe0, 0xab, 0xf3, 0x70, 0xf0, - 0xac, 0xbe, 0x69, 0xe0, 0xad, 0xd3, 0x52, 0xf0, 0xae, 0x9e, 0x4b, 0xe0, - 0xaf, 0xb3, 0x34, 0xf0, 0xb0, 0x7e, 0x2d, 0xe0, 0xb1, 0x9c, 0x51, 0x70, - 0xb2, 0x67, 0x4a, 0x60, 0xb3, 0x7c, 0x33, 0x70, 0xb4, 0x47, 0x2c, 0x60, - 0xb5, 0x5c, 0x15, 0x70, 0xb6, 0x27, 0x0e, 0x60, 0xb7, 0x3b, 0xf7, 0x70, - 0xb8, 0x06, 0xf0, 0x60, 0xb9, 0x1b, 0xd9, 0x70, 0xb9, 0xe6, 0xd2, 0x60, - 0xbb, 0x04, 0xf5, 0xf0, 0xbb, 0xc6, 0xb4, 0x60, 0xbc, 0xe4, 0xd7, 0xf0, - 0xbd, 0xaf, 0xd0, 0xe0, 0xbe, 0xc4, 0xb9, 0xf0, 0xbf, 0x8f, 0xb2, 0xe0, - 0xc0, 0xa4, 0x9b, 0xf0, 0xc1, 0x6f, 0x94, 0xe0, 0xc2, 0x84, 0x7d, 0xf0, - 0xc3, 0x4f, 0x76, 0xe0, 0xc4, 0x64, 0x5f, 0xf0, 0xc5, 0x2f, 0x58, 0xe0, - 0xc6, 0x4d, 0x7c, 0x70, 0xc7, 0x0f, 0x3a, 0xe0, 0xc8, 0x2d, 0x5e, 0x70, - 0xc8, 0xf8, 0x57, 0x60, 0xca, 0x0d, 0x40, 0x70, 0xca, 0xd8, 0x39, 0x60, - 0xcb, 0x88, 0xf0, 0x70, 0xd2, 0x23, 0xf4, 0x70, 0xd2, 0x60, 0xfb, 0xe0, - 0xd3, 0x75, 0xe4, 0xf0, 0xd4, 0x40, 0xdd, 0xe0, 0xd5, 0x55, 0xc6, 0xf0, - 0xd6, 0x20, 0xbf, 0xe0, 0xd7, 0x35, 0xa8, 0xf0, 0xd8, 0x00, 0xa1, 0xe0, - 0xd9, 0x15, 0x8a, 0xf0, 0xd9, 0xe0, 0x83, 0xe0, 0xda, 0xfe, 0xa7, 0x70, - 0xdb, 0xc0, 0x65, 0xe0, 0xdc, 0xde, 0x89, 0x70, 0xdd, 0xa9, 0x82, 0x60, - 0xde, 0xbe, 0x6b, 0x70, 0xdf, 0x89, 0x64, 0x60, 0xe0, 0x9e, 0x4d, 0x70, - 0xe1, 0x69, 0x46, 0x60, 0xe2, 0x7e, 0x2f, 0x70, 0xe3, 0x49, 0x28, 0x60, - 0xe4, 0x5e, 0x11, 0x70, 0xe5, 0x57, 0x2e, 0xe0, 0xe6, 0x47, 0x2d, 0xf0, - 0xe7, 0x37, 0x10, 0xe0, 0xe8, 0x27, 0x0f, 0xf0, 0xe9, 0x16, 0xf2, 0xe0, - 0xea, 0x06, 0xf1, 0xf0, 0xea, 0xf6, 0xd4, 0xe0, 0xeb, 0xe6, 0xd3, 0xf0, - 0xec, 0xd6, 0xb6, 0xe0, 0xed, 0xc6, 0xb5, 0xf0, 0xee, 0xbf, 0xd3, 0x60, - 0xef, 0xaf, 0xd2, 0x70, 0xf0, 0x9f, 0xb5, 0x60, 0xf1, 0x8f, 0xb4, 0x70, - 0xf2, 0x7f, 0x97, 0x60, 0xf3, 0x6f, 0x96, 0x70, 0xf4, 0x5f, 0x79, 0x60, - 0xf5, 0x4f, 0x78, 0x70, 0xf6, 0x3f, 0x5b, 0x60, 0xf7, 0x2f, 0x5a, 0x70, - 0xf8, 0x28, 0x77, 0xe0, 0xf9, 0x0f, 0x3c, 0x70, 0xfa, 0x08, 0x59, 0xe0, - 0xfa, 0xf8, 0x58, 0xf0, 0xfb, 0xe8, 0x3b, 0xe0, 0xfc, 0xd8, 0x3a, 0xf0, - 0xfd, 0xc8, 0x1d, 0xe0, 0xfe, 0xb8, 0x1c, 0xf0, 0xff, 0xa7, 0xff, 0xe0, - 0x00, 0x97, 0xfe, 0xf0, 0x01, 0x87, 0xe1, 0xe0, 0x02, 0x77, 0xe0, 0xf0, - 0x03, 0x70, 0xfe, 0x60, 0x04, 0x60, 0xfd, 0x70, 0x05, 0x50, 0xe0, 0x60, - 0x06, 0x40, 0xdf, 0x70, 0x07, 0x30, 0xc2, 0x60, 0x07, 0x8d, 0x19, 0x70, - 0x09, 0x10, 0xa4, 0x60, 0x09, 0xad, 0x94, 0xf0, 0x0a, 0xf0, 0x86, 0x60, - 0x0b, 0xe0, 0x85, 0x70, 0x0c, 0xd9, 0xa2, 0xe0, 0x0d, 0xc0, 0x67, 0x70, - 0x0e, 0xb9, 0x84, 0xe0, 0x0f, 0xa9, 0x83, 0xf0, 0x10, 0x99, 0x66, 0xe0, - 0x11, 0x89, 0x65, 0xf0, 0x12, 0x79, 0x48, 0xe0, 0x13, 0x69, 0x47, 0xf0, - 0x14, 0x59, 0x2a, 0xe0, 0x15, 0x49, 0x29, 0xf0, 0x16, 0x39, 0x0c, 0xe0, - 0x17, 0x29, 0x0b, 0xf0, 0x18, 0x22, 0x29, 0x60, 0x19, 0x08, 0xed, 0xf0, - 0x1a, 0x02, 0x0b, 0x60, 0x1a, 0xf2, 0x0a, 0x70, 0x1b, 0xe1, 0xed, 0x60, - 0x1c, 0xd1, 0xec, 0x70, 0x1d, 0xc1, 0xcf, 0x60, 0x1e, 0xb1, 0xce, 0x70, - 0x1f, 0xa1, 0xb1, 0x60, 0x20, 0x76, 0x00, 0xf0, 0x21, 0x81, 0x93, 0x60, - 0x22, 0x55, 0xe2, 0xf0, 0x23, 0x6a, 0xaf, 0xe0, 0x24, 0x35, 0xc4, 0xf0, - 0x25, 0x4a, 0x91, 0xe0, 0x26, 0x15, 0xa6, 0xf0, 0x27, 0x2a, 0x73, 0xe0, - 0x27, 0xfe, 0xc3, 0x70, 0x29, 0x0a, 0x55, 0xe0, 0x29, 0xde, 0xa5, 0x70, - 0x2a, 0xea, 0x37, 0xe0, 0x2b, 0xbe, 0x87, 0x70, 0x2c, 0xd3, 0x54, 0x60, - 0x2d, 0x9e, 0x69, 0x70, 0x2e, 0xb3, 0x36, 0x60, 0x2f, 0x7e, 0x4b, 0x70, - 0x30, 0x93, 0x18, 0x60, 0x31, 0x67, 0x67, 0xf0, 0x32, 0x72, 0xfa, 0x60, - 0x33, 0x47, 0x49, 0xf0, 0x34, 0x52, 0xdc, 0x60, 0x35, 0x27, 0x2b, 0xf0, - 0x36, 0x32, 0xbe, 0x60, 0x37, 0x07, 0x0d, 0xf0, 0x38, 0x1b, 0xda, 0xe0, - 0x38, 0xe6, 0xef, 0xf0, 0x39, 0xfb, 0xbc, 0xe0, 0x3a, 0xc6, 0xd1, 0xf0, - 0x3b, 0xdb, 0x9e, 0xe0, 0x3c, 0xaf, 0xee, 0x70, 0x3d, 0xbb, 0x80, 0xe0, - 0x3e, 0x8f, 0xd0, 0x70, 0x3f, 0x9b, 0x62, 0xe0, 0x40, 0x6f, 0xb2, 0x70, - 0x41, 0x84, 0x7f, 0x60, 0x42, 0x4f, 0x94, 0x70, 0x43, 0x64, 0x61, 0x60, - 0x44, 0x2f, 0x76, 0x70, 0x45, 0x44, 0x43, 0x60, 0x45, 0xf3, 0xa8, 0xf0, - 0x47, 0x2d, 0x5f, 0xe0, 0x47, 0xd3, 0x8a, 0xf0, 0x49, 0x0d, 0x41, 0xe0, - 0x49, 0xb3, 0x6c, 0xf0, 0x4a, 0xed, 0x23, 0xe0, 0x4b, 0x9c, 0x89, 0x70, - 0x4c, 0xd6, 0x40, 0x60, 0x4d, 0x7c, 0x6b, 0x70, 0x4e, 0xb6, 0x22, 0x60, - 0x4f, 0x5c, 0x4d, 0x70, 0x50, 0x96, 0x04, 0x60, 0x51, 0x3c, 0x2f, 0x70, - 0x52, 0x75, 0xe6, 0x60, 0x53, 0x1c, 0x11, 0x70, 0x54, 0x55, 0xc8, 0x60, - 0x54, 0xfb, 0xf3, 0x70, 0x56, 0x35, 0xaa, 0x60, 0x56, 0xe5, 0x0f, 0xf0, - 0x58, 0x1e, 0xc6, 0xe0, 0x58, 0xc4, 0xf1, 0xf0, 0x59, 0xfe, 0xa8, 0xe0, - 0x5a, 0xa4, 0xd3, 0xf0, 0x5b, 0xde, 0x8a, 0xe0, 0x5c, 0x84, 0xb5, 0xf0, - 0x5d, 0xbe, 0x6c, 0xe0, 0x5e, 0x64, 0x97, 0xf0, 0x5f, 0x9e, 0x4e, 0xe0, - 0x60, 0x4d, 0xb4, 0x70, 0x61, 0x87, 0x6b, 0x60, 0x62, 0x2d, 0x96, 0x70, - 0x63, 0x67, 0x4d, 0x60, 0x64, 0x0d, 0x78, 0x70, 0x65, 0x47, 0x2f, 0x60, - 0x65, 0xed, 0x5a, 0x70, 0x67, 0x27, 0x11, 0x60, 0x67, 0xcd, 0x3c, 0x70, - 0x69, 0x06, 0xf3, 0x60, 0x69, 0xad, 0x1e, 0x70, 0x6a, 0xe6, 0xd5, 0x60, - 0x6b, 0x96, 0x3a, 0xf0, 0x6c, 0xcf, 0xf1, 0xe0, 0x6d, 0x76, 0x1c, 0xf0, - 0x6e, 0xaf, 0xd3, 0xe0, 0x6f, 0x55, 0xfe, 0xf0, 0x70, 0x8f, 0xb5, 0xe0, - 0x71, 0x35, 0xe0, 0xf0, 0x72, 0x6f, 0x97, 0xe0, 0x73, 0x15, 0xc2, 0xf0, - 0x74, 0x4f, 0x79, 0xe0, 0x74, 0xfe, 0xdf, 0x70, 0x76, 0x38, 0x96, 0x60, - 0x76, 0xde, 0xc1, 0x70, 0x78, 0x18, 0x78, 0x60, 0x78, 0xbe, 0xa3, 0x70, - 0x79, 0xf8, 0x5a, 0x60, 0x7a, 0x9e, 0x85, 0x70, 0x7b, 0xd8, 0x3c, 0x60, - 0x7c, 0x7e, 0x67, 0x70, 0x7d, 0xb8, 0x1e, 0x60, 0x7e, 0x5e, 0x49, 0x70, - 0x7f, 0x98, 0x00, 0x60, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x04, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0xff, 0xff, 0xba, 0x9e, 0x00, 0x00, 0xff, 0xff, 0xc7, 0xc0, 0x01, 0x04, - 0xff, 0xff, 0xb9, 0xb0, 0x00, 0x08, 0xff, 0xff, 0xc7, 0xc0, 0x01, 0x0c, - 0xff, 0xff, 0xc7, 0xc0, 0x01, 0x10, 0x4c, 0x4d, 0x54, 0x00, 0x45, 0x44, - 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, 0x57, 0x54, 0x00, 0x45, 0x50, - 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xed, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0xf8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x5e, 0x03, 0xf0, 0x90, - 0xff, 0xff, 0xff, 0xff, 0x9e, 0xa6, 0x1e, 0x70, 0xff, 0xff, 0xff, 0xff, - 0x9f, 0xba, 0xeb, 0x60, 0xff, 0xff, 0xff, 0xff, 0xa0, 0x86, 0x00, 0x70, - 0xff, 0xff, 0xff, 0xff, 0xa1, 0x9a, 0xcd, 0x60, 0xff, 0xff, 0xff, 0xff, - 0xa2, 0x65, 0xe2, 0x70, 0xff, 0xff, 0xff, 0xff, 0xa3, 0x83, 0xe9, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xa4, 0x6a, 0xae, 0x70, 0xff, 0xff, 0xff, 0xff, - 0xa5, 0x35, 0xa7, 0x60, 0xff, 0xff, 0xff, 0xff, 0xa6, 0x53, 0xca, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xa7, 0x15, 0x89, 0x60, 0xff, 0xff, 0xff, 0xff, - 0xa8, 0x33, 0xac, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xa8, 0xfe, 0xa5, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xaa, 0x13, 0x8e, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xaa, 0xde, 0x87, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xab, 0xf3, 0x70, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xac, 0xbe, 0x69, 0xe0, 0xff, 0xff, 0xff, 0xff, - 0xad, 0xd3, 0x52, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xae, 0x9e, 0x4b, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xaf, 0xb3, 0x34, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xb0, 0x7e, 0x2d, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xb1, 0x9c, 0x51, 0x70, - 0xff, 0xff, 0xff, 0xff, 0xb2, 0x67, 0x4a, 0x60, 0xff, 0xff, 0xff, 0xff, - 0xb3, 0x7c, 0x33, 0x70, 0xff, 0xff, 0xff, 0xff, 0xb4, 0x47, 0x2c, 0x60, - 0xff, 0xff, 0xff, 0xff, 0xb5, 0x5c, 0x15, 0x70, 0xff, 0xff, 0xff, 0xff, - 0xb6, 0x27, 0x0e, 0x60, 0xff, 0xff, 0xff, 0xff, 0xb7, 0x3b, 0xf7, 0x70, - 0xff, 0xff, 0xff, 0xff, 0xb8, 0x06, 0xf0, 0x60, 0xff, 0xff, 0xff, 0xff, - 0xb9, 0x1b, 0xd9, 0x70, 0xff, 0xff, 0xff, 0xff, 0xb9, 0xe6, 0xd2, 0x60, - 0xff, 0xff, 0xff, 0xff, 0xbb, 0x04, 0xf5, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xbb, 0xc6, 0xb4, 0x60, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xe4, 0xd7, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xbd, 0xaf, 0xd0, 0xe0, 0xff, 0xff, 0xff, 0xff, - 0xbe, 0xc4, 0xb9, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xbf, 0x8f, 0xb2, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xc0, 0xa4, 0x9b, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xc1, 0x6f, 0x94, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xc2, 0x84, 0x7d, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xc3, 0x4f, 0x76, 0xe0, 0xff, 0xff, 0xff, 0xff, - 0xc4, 0x64, 0x5f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xc5, 0x2f, 0x58, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xc6, 0x4d, 0x7c, 0x70, 0xff, 0xff, 0xff, 0xff, - 0xc7, 0x0f, 0x3a, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xc8, 0x2d, 0x5e, 0x70, - 0xff, 0xff, 0xff, 0xff, 0xc8, 0xf8, 0x57, 0x60, 0xff, 0xff, 0xff, 0xff, - 0xca, 0x0d, 0x40, 0x70, 0xff, 0xff, 0xff, 0xff, 0xca, 0xd8, 0x39, 0x60, - 0xff, 0xff, 0xff, 0xff, 0xcb, 0x88, 0xf0, 0x70, 0xff, 0xff, 0xff, 0xff, - 0xd2, 0x23, 0xf4, 0x70, 0xff, 0xff, 0xff, 0xff, 0xd2, 0x60, 0xfb, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xd3, 0x75, 0xe4, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xd4, 0x40, 0xdd, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xd5, 0x55, 0xc6, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xd6, 0x20, 0xbf, 0xe0, 0xff, 0xff, 0xff, 0xff, - 0xd7, 0x35, 0xa8, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x00, 0xa1, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xd9, 0x15, 0x8a, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xd9, 0xe0, 0x83, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xda, 0xfe, 0xa7, 0x70, - 0xff, 0xff, 0xff, 0xff, 0xdb, 0xc0, 0x65, 0xe0, 0xff, 0xff, 0xff, 0xff, - 0xdc, 0xde, 0x89, 0x70, 0xff, 0xff, 0xff, 0xff, 0xdd, 0xa9, 0x82, 0x60, - 0xff, 0xff, 0xff, 0xff, 0xde, 0xbe, 0x6b, 0x70, 0xff, 0xff, 0xff, 0xff, - 0xdf, 0x89, 0x64, 0x60, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x9e, 0x4d, 0x70, - 0xff, 0xff, 0xff, 0xff, 0xe1, 0x69, 0x46, 0x60, 0xff, 0xff, 0xff, 0xff, - 0xe2, 0x7e, 0x2f, 0x70, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x49, 0x28, 0x60, - 0xff, 0xff, 0xff, 0xff, 0xe4, 0x5e, 0x11, 0x70, 0xff, 0xff, 0xff, 0xff, - 0xe5, 0x57, 0x2e, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xe6, 0x47, 0x2d, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xe7, 0x37, 0x10, 0xe0, 0xff, 0xff, 0xff, 0xff, - 0xe8, 0x27, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xe9, 0x16, 0xf2, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xea, 0x06, 0xf1, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xea, 0xf6, 0xd4, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xeb, 0xe6, 0xd3, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xec, 0xd6, 0xb6, 0xe0, 0xff, 0xff, 0xff, 0xff, - 0xed, 0xc6, 0xb5, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xee, 0xbf, 0xd3, 0x60, - 0xff, 0xff, 0xff, 0xff, 0xef, 0xaf, 0xd2, 0x70, 0xff, 0xff, 0xff, 0xff, - 0xf0, 0x9f, 0xb5, 0x60, 0xff, 0xff, 0xff, 0xff, 0xf1, 0x8f, 0xb4, 0x70, - 0xff, 0xff, 0xff, 0xff, 0xf2, 0x7f, 0x97, 0x60, 0xff, 0xff, 0xff, 0xff, - 0xf3, 0x6f, 0x96, 0x70, 0xff, 0xff, 0xff, 0xff, 0xf4, 0x5f, 0x79, 0x60, - 0xff, 0xff, 0xff, 0xff, 0xf5, 0x4f, 0x78, 0x70, 0xff, 0xff, 0xff, 0xff, - 0xf6, 0x3f, 0x5b, 0x60, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x2f, 0x5a, 0x70, - 0xff, 0xff, 0xff, 0xff, 0xf8, 0x28, 0x77, 0xe0, 0xff, 0xff, 0xff, 0xff, - 0xf9, 0x0f, 0x3c, 0x70, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x08, 0x59, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xfa, 0xf8, 0x58, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xfb, 0xe8, 0x3b, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xd8, 0x3a, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xfd, 0xc8, 0x1d, 0xe0, 0xff, 0xff, 0xff, 0xff, - 0xfe, 0xb8, 0x1c, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa7, 0xff, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0xfe, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x87, 0xe1, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x02, 0x77, 0xe0, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x70, 0xfe, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x60, 0xfd, 0x70, 0x00, 0x00, 0x00, 0x00, 0x05, 0x50, 0xe0, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x40, 0xdf, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x30, 0xc2, 0x60, 0x00, 0x00, 0x00, 0x00, 0x07, 0x8d, 0x19, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x10, 0xa4, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x09, 0xad, 0x94, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf0, 0x86, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x0b, 0xe0, 0x85, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0xd9, 0xa2, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xc0, 0x67, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0xb9, 0x84, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x0f, 0xa9, 0x83, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x99, 0x66, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x11, 0x89, 0x65, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x12, 0x79, 0x48, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x13, 0x69, 0x47, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x14, 0x59, 0x2a, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x15, 0x49, 0x29, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x16, 0x39, 0x0c, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x29, 0x0b, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x22, 0x29, 0x60, 0x00, 0x00, 0x00, 0x00, 0x19, 0x08, 0xed, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x1a, 0x02, 0x0b, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x1a, 0xf2, 0x0a, 0x70, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xe1, 0xed, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x1c, 0xd1, 0xec, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x1d, 0xc1, 0xcf, 0x60, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xb1, 0xce, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x1f, 0xa1, 0xb1, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x76, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x21, 0x81, 0x93, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x22, 0x55, 0xe2, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x23, 0x6a, 0xaf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x24, 0x35, 0xc4, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x25, 0x4a, 0x91, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x26, 0x15, 0xa6, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x27, 0x2a, 0x73, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x27, 0xfe, 0xc3, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x29, 0x0a, 0x55, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x29, 0xde, 0xa5, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x2a, 0xea, 0x37, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x2b, 0xbe, 0x87, 0x70, 0x00, 0x00, 0x00, 0x00, 0x2c, 0xd3, 0x54, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x2d, 0x9e, 0x69, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x2e, 0xb3, 0x36, 0x60, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x7e, 0x4b, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x30, 0x93, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x31, 0x67, 0x67, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x32, 0x72, 0xfa, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x33, 0x47, 0x49, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x34, 0x52, 0xdc, 0x60, 0x00, 0x00, 0x00, 0x00, 0x35, 0x27, 0x2b, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x36, 0x32, 0xbe, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x37, 0x07, 0x0d, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1b, 0xda, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x38, 0xe6, 0xef, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x39, 0xfb, 0xbc, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xc6, 0xd1, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x3b, 0xdb, 0x9e, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x3c, 0xaf, 0xee, 0x70, 0x00, 0x00, 0x00, 0x00, 0x3d, 0xbb, 0x80, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x3e, 0x8f, 0xd0, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x3f, 0x9b, 0x62, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x40, 0x6f, 0xb2, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x41, 0x84, 0x7f, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x42, 0x4f, 0x94, 0x70, 0x00, 0x00, 0x00, 0x00, 0x43, 0x64, 0x61, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x44, 0x2f, 0x76, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x45, 0x44, 0x43, 0x60, 0x00, 0x00, 0x00, 0x00, 0x45, 0xf3, 0xa8, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x2d, 0x5f, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x47, 0xd3, 0x8a, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x49, 0x0d, 0x41, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x49, 0xb3, 0x6c, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x4a, 0xed, 0x23, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x9c, 0x89, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x4c, 0xd6, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x4d, 0x7c, 0x6b, 0x70, 0x00, 0x00, 0x00, 0x00, 0x4e, 0xb6, 0x22, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x4f, 0x5c, 0x4d, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x50, 0x96, 0x04, 0x60, 0x00, 0x00, 0x00, 0x00, 0x51, 0x3c, 0x2f, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x52, 0x75, 0xe6, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x53, 0x1c, 0x11, 0x70, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0xc8, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x54, 0xfb, 0xf3, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x56, 0x35, 0xaa, 0x60, 0x00, 0x00, 0x00, 0x00, 0x56, 0xe5, 0x0f, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x58, 0x1e, 0xc6, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x58, 0xc4, 0xf1, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x59, 0xfe, 0xa8, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x5a, 0xa4, 0xd3, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x5b, 0xde, 0x8a, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x84, 0xb5, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x5d, 0xbe, 0x6c, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x5e, 0x64, 0x97, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x9e, 0x4e, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x60, 0x4d, 0xb4, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x61, 0x87, 0x6b, 0x60, 0x00, 0x00, 0x00, 0x00, 0x62, 0x2d, 0x96, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x63, 0x67, 0x4d, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x64, 0x0d, 0x78, 0x70, 0x00, 0x00, 0x00, 0x00, 0x65, 0x47, 0x2f, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x65, 0xed, 0x5a, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x67, 0x27, 0x11, 0x60, 0x00, 0x00, 0x00, 0x00, 0x67, 0xcd, 0x3c, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x69, 0x06, 0xf3, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x69, 0xad, 0x1e, 0x70, 0x00, 0x00, 0x00, 0x00, 0x6a, 0xe6, 0xd5, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x6b, 0x96, 0x3a, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x6c, 0xcf, 0xf1, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x76, 0x1c, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x6e, 0xaf, 0xd3, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x6f, 0x55, 0xfe, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0xb5, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x71, 0x35, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x72, 0x6f, 0x97, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x73, 0x15, 0xc2, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x74, 0x4f, 0x79, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x74, 0xfe, 0xdf, 0x70, 0x00, 0x00, 0x00, 0x00, 0x76, 0x38, 0x96, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x76, 0xde, 0xc1, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x78, 0x18, 0x78, 0x60, 0x00, 0x00, 0x00, 0x00, 0x78, 0xbe, 0xa3, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x79, 0xf8, 0x5a, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x7a, 0x9e, 0x85, 0x70, 0x00, 0x00, 0x00, 0x00, 0x7b, 0xd8, 0x3c, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7e, 0x67, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x7d, 0xb8, 0x1e, 0x60, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5e, 0x49, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x7f, 0x98, 0x00, 0x60, 0x00, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x04, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, - 0x02, 0x01, 0x02, 0x01, 0x02, 0xff, 0xff, 0xba, 0x9e, 0x00, 0x00, 0xff, - 0xff, 0xc7, 0xc0, 0x01, 0x04, 0xff, 0xff, 0xb9, 0xb0, 0x00, 0x08, 0xff, - 0xff, 0xc7, 0xc0, 0x01, 0x0c, 0xff, 0xff, 0xc7, 0xc0, 0x01, 0x10, 0x4c, - 0x4d, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, - 0x57, 0x54, 0x00, 0x45, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x45, 0x53, 0x54, 0x35, 0x45, 0x44, - 0x54, 0x2c, 0x4d, 0x33, 0x2e, 0x32, 0x2e, 0x30, 0x2c, 0x4d, 0x31, 0x31, - 0x2e, 0x31, 0x2e, 0x30, 0x0a -}; -unsigned int America_New_York_len = 3545; -unsigned char Australia_Sydney[] = { - 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0x00, - 0x9c, 0x4e, 0xa6, 0x9c, 0x9c, 0xbc, 0x20, 0xf0, 0xcb, 0x54, 0xb3, 0x00, - 0xcb, 0xc7, 0x57, 0x70, 0xcc, 0xb7, 0x56, 0x80, 0xcd, 0xa7, 0x39, 0x70, - 0xce, 0xa0, 0x73, 0x00, 0xcf, 0x87, 0x1b, 0x70, 0x03, 0x70, 0x39, 0x80, - 0x04, 0x0d, 0x1c, 0x00, 0x05, 0x50, 0x1b, 0x80, 0x05, 0xf6, 0x38, 0x80, - 0x07, 0x2f, 0xfd, 0x80, 0x07, 0xd6, 0x1a, 0x80, 0x09, 0x0f, 0xdf, 0x80, - 0x09, 0xb5, 0xfc, 0x80, 0x0a, 0xef, 0xc1, 0x80, 0x0b, 0x9f, 0x19, 0x00, - 0x0c, 0xd8, 0xde, 0x00, 0x0d, 0x7e, 0xfb, 0x00, 0x0e, 0xb8, 0xc0, 0x00, - 0x0f, 0x5e, 0xdd, 0x00, 0x10, 0x98, 0xa2, 0x00, 0x11, 0x3e, 0xbf, 0x00, - 0x12, 0x78, 0x84, 0x00, 0x13, 0x1e, 0xa1, 0x00, 0x14, 0x58, 0x66, 0x00, - 0x14, 0xfe, 0x83, 0x00, 0x16, 0x38, 0x48, 0x00, 0x17, 0x0c, 0x89, 0x80, - 0x18, 0x21, 0x64, 0x80, 0x18, 0xc7, 0x81, 0x80, 0x1a, 0x01, 0x46, 0x80, - 0x1a, 0xa7, 0x63, 0x80, 0x1b, 0xe1, 0x28, 0x80, 0x1c, 0x87, 0x45, 0x80, - 0x1d, 0xc1, 0x0a, 0x80, 0x1e, 0x79, 0x9c, 0x80, 0x1f, 0x97, 0xb2, 0x00, - 0x20, 0x59, 0x7e, 0x80, 0x21, 0x80, 0xce, 0x80, 0x22, 0x42, 0x9b, 0x00, - 0x23, 0x69, 0xeb, 0x00, 0x24, 0x22, 0x7d, 0x00, 0x25, 0x49, 0xcd, 0x00, - 0x25, 0xef, 0xea, 0x00, 0x27, 0x29, 0xaf, 0x00, 0x27, 0xcf, 0xcc, 0x00, - 0x29, 0x09, 0x91, 0x00, 0x29, 0xaf, 0xae, 0x00, 0x2a, 0xe9, 0x73, 0x00, - 0x2b, 0x98, 0xca, 0x80, 0x2c, 0xd2, 0x8f, 0x80, 0x2d, 0x78, 0xac, 0x80, - 0x2e, 0xb2, 0x71, 0x80, 0x2f, 0x58, 0x8e, 0x80, 0x30, 0x92, 0x53, 0x80, - 0x31, 0x5d, 0x5a, 0x80, 0x32, 0x72, 0x35, 0x80, 0x33, 0x3d, 0x3c, 0x80, - 0x34, 0x52, 0x17, 0x80, 0x35, 0x1d, 0x1e, 0x80, 0x36, 0x31, 0xf9, 0x80, - 0x36, 0xfd, 0x00, 0x80, 0x38, 0x1b, 0x16, 0x00, 0x38, 0xdc, 0xe2, 0x80, - 0x39, 0xa7, 0xe9, 0x80, 0x3a, 0xbc, 0xc4, 0x80, 0x3b, 0xda, 0xda, 0x00, - 0x3c, 0xa5, 0xe1, 0x00, 0x3d, 0xba, 0xbc, 0x00, 0x3e, 0x85, 0xc3, 0x00, - 0x3f, 0x9a, 0x9e, 0x00, 0x40, 0x65, 0xa5, 0x00, 0x41, 0x83, 0xba, 0x80, - 0x42, 0x45, 0x87, 0x00, 0x43, 0x63, 0x9c, 0x80, 0x44, 0x2e, 0xa3, 0x80, - 0x45, 0x43, 0x7e, 0x80, 0x46, 0x05, 0x4b, 0x00, 0x47, 0x23, 0x60, 0x80, - 0x47, 0xf7, 0xa2, 0x00, 0x48, 0xe7, 0x93, 0x00, 0x49, 0xd7, 0x84, 0x00, - 0x4a, 0xc7, 0x75, 0x00, 0x4b, 0xb7, 0x66, 0x00, 0x4c, 0xa7, 0x57, 0x00, - 0x4d, 0x97, 0x48, 0x00, 0x4e, 0x87, 0x39, 0x00, 0x4f, 0x77, 0x2a, 0x00, - 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80, - 0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0a, 0x80, - 0x56, 0x0f, 0xfb, 0x80, 0x56, 0xff, 0xec, 0x80, 0x57, 0xef, 0xdd, 0x80, - 0x58, 0xdf, 0xce, 0x80, 0x59, 0xcf, 0xbf, 0x80, 0x5a, 0xbf, 0xb0, 0x80, - 0x5b, 0xb8, 0xdc, 0x00, 0x5c, 0xa8, 0xcd, 0x00, 0x5d, 0x98, 0xbe, 0x00, - 0x5e, 0x88, 0xaf, 0x00, 0x5f, 0x78, 0xa0, 0x00, 0x60, 0x68, 0x91, 0x00, - 0x61, 0x58, 0x82, 0x00, 0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, - 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00, 0x66, 0x11, 0x71, 0x80, - 0x67, 0x01, 0x62, 0x80, 0x67, 0xf1, 0x53, 0x80, 0x68, 0xe1, 0x44, 0x80, - 0x69, 0xd1, 0x35, 0x80, 0x6a, 0xc1, 0x26, 0x80, 0x6b, 0xb1, 0x17, 0x80, - 0x6c, 0xa1, 0x08, 0x80, 0x6d, 0x90, 0xf9, 0x80, 0x6e, 0x80, 0xea, 0x80, - 0x6f, 0x70, 0xdb, 0x80, 0x70, 0x6a, 0x07, 0x00, 0x71, 0x59, 0xf8, 0x00, - 0x72, 0x49, 0xe9, 0x00, 0x73, 0x39, 0xda, 0x00, 0x74, 0x29, 0xcb, 0x00, - 0x75, 0x19, 0xbc, 0x00, 0x76, 0x09, 0xad, 0x00, 0x76, 0xf9, 0x9e, 0x00, - 0x77, 0xe9, 0x8f, 0x00, 0x78, 0xd9, 0x80, 0x00, 0x79, 0xc9, 0x71, 0x00, - 0x7a, 0xb9, 0x62, 0x00, 0x7b, 0xb2, 0x8d, 0x80, 0x7c, 0xa2, 0x7e, 0x80, - 0x7d, 0x92, 0x6f, 0x80, 0x7e, 0x82, 0x60, 0x80, 0x7f, 0x72, 0x51, 0x80, - 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, - 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x00, 0x00, - 0x8d, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x9a, 0xb0, 0x01, 0x04, 0x00, 0x00, - 0x8c, 0xa0, 0x00, 0x09, 0x00, 0x00, 0x9a, 0xb0, 0x01, 0x04, 0x00, 0x00, - 0x8c, 0xa0, 0x00, 0x09, 0x4c, 0x4d, 0x54, 0x00, 0x41, 0x45, 0x44, 0x54, - 0x00, 0x41, 0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, - 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x73, 0x16, 0x7f, 0x3c, 0xff, 0xff, 0xff, 0xff, 0x9c, 0x4e, 0xa6, 0x9c, - 0xff, 0xff, 0xff, 0xff, 0x9c, 0xbc, 0x20, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xcb, 0x54, 0xb3, 0x00, 0xff, 0xff, 0xff, 0xff, 0xcb, 0xc7, 0x57, 0x70, - 0xff, 0xff, 0xff, 0xff, 0xcc, 0xb7, 0x56, 0x80, 0xff, 0xff, 0xff, 0xff, - 0xcd, 0xa7, 0x39, 0x70, 0xff, 0xff, 0xff, 0xff, 0xce, 0xa0, 0x73, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xcf, 0x87, 0x1b, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x70, 0x39, 0x80, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0d, 0x1c, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x50, 0x1b, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x05, 0xf6, 0x38, 0x80, 0x00, 0x00, 0x00, 0x00, 0x07, 0x2f, 0xfd, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x07, 0xd6, 0x1a, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x0f, 0xdf, 0x80, 0x00, 0x00, 0x00, 0x00, 0x09, 0xb5, 0xfc, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x0a, 0xef, 0xc1, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x0b, 0x9f, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xd8, 0xde, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0d, 0x7e, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0xb8, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x5e, 0xdd, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x98, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x3e, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x78, 0x84, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x13, 0x1e, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x58, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xfe, 0x83, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x16, 0x38, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x17, 0x0c, 0x89, 0x80, 0x00, 0x00, 0x00, 0x00, 0x18, 0x21, 0x64, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x18, 0xc7, 0x81, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x1a, 0x01, 0x46, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1a, 0xa7, 0x63, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x1b, 0xe1, 0x28, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x1c, 0x87, 0x45, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xc1, 0x0a, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x1e, 0x79, 0x9c, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x1f, 0x97, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x59, 0x7e, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x21, 0x80, 0xce, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x22, 0x42, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x69, 0xeb, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x24, 0x22, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x25, 0x49, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0xef, 0xea, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x27, 0x29, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x27, 0xcf, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x09, 0x91, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x29, 0xaf, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x2a, 0xe9, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x98, 0xca, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x2c, 0xd2, 0x8f, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x2d, 0x78, 0xac, 0x80, 0x00, 0x00, 0x00, 0x00, 0x2e, 0xb2, 0x71, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x2f, 0x58, 0x8e, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x92, 0x53, 0x80, 0x00, 0x00, 0x00, 0x00, 0x31, 0x5d, 0x5a, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x32, 0x72, 0x35, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x3d, 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x34, 0x52, 0x17, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x35, 0x1d, 0x1e, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x36, 0x31, 0xf9, 0x80, 0x00, 0x00, 0x00, 0x00, 0x36, 0xfd, 0x00, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x38, 0x1b, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x38, 0xdc, 0xe2, 0x80, 0x00, 0x00, 0x00, 0x00, 0x39, 0xa7, 0xe9, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x3a, 0xbc, 0xc4, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x3b, 0xda, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xa5, 0xe1, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x3d, 0xba, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3e, 0x85, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x9a, 0x9e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x40, 0x65, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x41, 0x83, 0xba, 0x80, 0x00, 0x00, 0x00, 0x00, 0x42, 0x45, 0x87, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x43, 0x63, 0x9c, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x44, 0x2e, 0xa3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x45, 0x43, 0x7e, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x46, 0x05, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x23, 0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x47, 0xf7, 0xa2, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x48, 0xe7, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x49, 0xd7, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0xc7, 0x75, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x4b, 0xb7, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x4c, 0xa7, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x97, 0x48, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x4e, 0x87, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x4f, 0x77, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x70, 0x55, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x51, 0x60, 0x46, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x50, 0x37, 0x80, 0x00, 0x00, 0x00, 0x00, 0x53, 0x40, 0x28, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x54, 0x30, 0x19, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x55, 0x20, 0x0a, 0x80, 0x00, 0x00, 0x00, 0x00, 0x56, 0x0f, 0xfb, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x56, 0xff, 0xec, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x57, 0xef, 0xdd, 0x80, 0x00, 0x00, 0x00, 0x00, 0x58, 0xdf, 0xce, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x59, 0xcf, 0xbf, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x5a, 0xbf, 0xb0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x5b, 0xb8, 0xdc, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5c, 0xa8, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x5d, 0x98, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x88, 0xaf, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5f, 0x78, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x60, 0x68, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x58, 0x82, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x62, 0x48, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x63, 0x38, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x28, 0x55, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x65, 0x18, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x66, 0x11, 0x71, 0x80, 0x00, 0x00, 0x00, 0x00, 0x67, 0x01, 0x62, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x67, 0xf1, 0x53, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x68, 0xe1, 0x44, 0x80, 0x00, 0x00, 0x00, 0x00, 0x69, 0xd1, 0x35, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x6a, 0xc1, 0x26, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x6b, 0xb1, 0x17, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xa1, 0x08, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x6d, 0x90, 0xf9, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x6e, 0x80, 0xea, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x70, 0xdb, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x70, 0x6a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x71, 0x59, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x49, 0xe9, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x73, 0x39, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0x29, 0xcb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x19, 0xbc, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x76, 0x09, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x76, 0xf9, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xe9, 0x8f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x78, 0xd9, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x79, 0xc9, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0xb9, 0x62, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7b, 0xb2, 0x8d, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0xa2, 0x7e, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x92, 0x6f, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x7e, 0x82, 0x60, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x7f, 0x72, 0x51, 0x80, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, - 0x03, 0x04, 0x03, 0x00, 0x00, 0x8d, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x9a, - 0xb0, 0x01, 0x04, 0x00, 0x00, 0x8c, 0xa0, 0x00, 0x09, 0x00, 0x00, 0x9a, - 0xb0, 0x01, 0x04, 0x00, 0x00, 0x8c, 0xa0, 0x00, 0x09, 0x4c, 0x4d, 0x54, - 0x00, 0x41, 0x45, 0x44, 0x54, 0x00, 0x41, 0x45, 0x53, 0x54, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x41, 0x45, - 0x53, 0x54, 0x2d, 0x31, 0x30, 0x41, 0x45, 0x44, 0x54, 0x2c, 0x4d, 0x31, - 0x30, 0x2e, 0x31, 0x2e, 0x30, 0x2c, 0x4d, 0x34, 0x2e, 0x31, 0x2e, 0x30, - 0x2f, 0x33, 0x0a -}; -unsigned int Australia_Sydney_len = 2223; diff --git a/contrib/restricted/abseil-cpp/absl/time/time_zone/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/time/time_zone/CMakeLists.linux.txt deleted file mode 100644 index 0e86a30db3..0000000000 --- a/contrib/restricted/abseil-cpp/absl/time/time_zone/CMakeLists.linux.txt +++ /dev/null @@ -1,31 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-time-time_zone) -target_compile_options(absl-time-time_zone PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-time-time_zone PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-time-time_zone PUBLIC - contrib-libs-cxxsupp -) -target_sources(absl-time-time_zone PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/time/time_zone/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/time/time_zone/CMakeLists.txt index e8c98bfd99..0e86a30db3 100644 --- a/contrib/restricted/abseil-cpp/absl/time/time_zone/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/time/time_zone/CMakeLists.txt @@ -6,6 +6,26 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-time-time_zone) +target_compile_options(absl-time-time_zone PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-time-time_zone PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-time-time_zone PUBLIC + contrib-libs-cxxsupp +) +target_sources(absl-time-time_zone PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/types/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/types/.yandex_meta/licenses.list.txt deleted file mode 100644 index 2ff2fa2fd3..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,20 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/types/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/types/CMakeLists.linux.txt deleted file mode 100644 index d9ca280d08..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/CMakeLists.linux.txt +++ /dev/null @@ -1,10 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-types INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/types/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/types/CMakeLists.txt index e8c98bfd99..d9ca280d08 100644 --- a/contrib/restricted/abseil-cpp/absl/types/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/types/CMakeLists.txt @@ -6,6 +6,5 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-types INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/types/any.h b/contrib/restricted/abseil-cpp/absl/types/any.h deleted file mode 100644 index fc5a07469f..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/any.h +++ /dev/null @@ -1,528 +0,0 @@ -// -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// any.h -// ----------------------------------------------------------------------------- -// -// This header file define the `absl::any` type for holding a type-safe value -// of any type. The 'absl::any` type is useful for providing a way to hold -// something that is, as yet, unspecified. Such unspecified types -// traditionally are passed between API boundaries until they are later cast to -// their "destination" types. To cast to such a destination type, use -// `absl::any_cast()`. Note that when casting an `absl::any`, you must cast it -// to an explicit type; implicit conversions will throw. -// -// Example: -// -// auto a = absl::any(65); -// absl::any_cast<int>(a); // 65 -// absl::any_cast<char>(a); // throws absl::bad_any_cast -// absl::any_cast<std::string>(a); // throws absl::bad_any_cast -// -// `absl::any` is a C++11 compatible version of the C++17 `std::any` abstraction -// and is designed to be a drop-in replacement for code compliant with C++17. -// -// Traditionally, the behavior of casting to a temporary unspecified type has -// been accomplished with the `void *` paradigm, where the pointer was to some -// other unspecified type. `absl::any` provides an "owning" version of `void *` -// that avoids issues of pointer management. -// -// Note: just as in the case of `void *`, use of `absl::any` (and its C++17 -// version `std::any`) is a code smell indicating that your API might not be -// constructed correctly. We have seen that most uses of `any` are unwarranted, -// and `absl::any`, like `std::any`, is difficult to use properly. Before using -// this abstraction, make sure that you should not instead be rewriting your -// code to be more specific. -// -// Abseil has also released an `absl::variant` type (a C++11 compatible version -// of the C++17 `std::variant`), which is generally preferred for use over -// `absl::any`. -#ifndef ABSL_TYPES_ANY_H_ -#define ABSL_TYPES_ANY_H_ - -#include "absl/base/config.h" -#include "absl/utility/utility.h" - -#ifdef ABSL_USES_STD_ANY - -#include <any> // IWYU pragma: export - -namespace absl { -ABSL_NAMESPACE_BEGIN -using std::any; -using std::any_cast; -using std::bad_any_cast; -using std::make_any; -ABSL_NAMESPACE_END -} // namespace absl - -#else // ABSL_USES_STD_ANY - -#include <algorithm> -#include <cstddef> -#include <initializer_list> -#include <memory> -#include <stdexcept> -#include <type_traits> -#include <typeinfo> -#include <utility> - -#include "absl/base/internal/fast_type_id.h" -#include "absl/base/macros.h" -#include "absl/meta/type_traits.h" -#include "absl/types/bad_any_cast.h" - -// NOTE: This macro is an implementation detail that is undefined at the bottom -// of the file. It is not intended for expansion directly from user code. -#ifdef ABSL_ANY_DETAIL_HAS_RTTI -#error ABSL_ANY_DETAIL_HAS_RTTI cannot be directly set -#elif !defined(__GNUC__) || defined(__GXX_RTTI) -#define ABSL_ANY_DETAIL_HAS_RTTI 1 -#endif // !defined(__GNUC__) || defined(__GXX_RTTI) - -namespace absl { -ABSL_NAMESPACE_BEGIN - -class any; - -// swap() -// -// Swaps two `absl::any` values. Equivalent to `x.swap(y) where `x` and `y` are -// `absl::any` types. -void swap(any& x, any& y) noexcept; - -// make_any() -// -// Constructs an `absl::any` of type `T` with the given arguments. -template <typename T, typename... Args> -any make_any(Args&&... args); - -// Overload of `absl::make_any()` for constructing an `absl::any` type from an -// initializer list. -template <typename T, typename U, typename... Args> -any make_any(std::initializer_list<U> il, Args&&... args); - -// any_cast() -// -// Statically casts the value of a `const absl::any` type to the given type. -// This function will throw `absl::bad_any_cast` if the stored value type of the -// `absl::any` does not match the cast. -// -// `any_cast()` can also be used to get a reference to the internal storage iff -// a reference type is passed as its `ValueType`: -// -// Example: -// -// absl::any my_any = std::vector<int>(); -// absl::any_cast<std::vector<int>&>(my_any).push_back(42); -template <typename ValueType> -ValueType any_cast(const any& operand); - -// Overload of `any_cast()` to statically cast the value of a non-const -// `absl::any` type to the given type. This function will throw -// `absl::bad_any_cast` if the stored value type of the `absl::any` does not -// match the cast. -template <typename ValueType> -ValueType any_cast(any& operand); // NOLINT(runtime/references) - -// Overload of `any_cast()` to statically cast the rvalue of an `absl::any` -// type. This function will throw `absl::bad_any_cast` if the stored value type -// of the `absl::any` does not match the cast. -template <typename ValueType> -ValueType any_cast(any&& operand); - -// Overload of `any_cast()` to statically cast the value of a const pointer -// `absl::any` type to the given pointer type, or `nullptr` if the stored value -// type of the `absl::any` does not match the cast. -template <typename ValueType> -const ValueType* any_cast(const any* operand) noexcept; - -// Overload of `any_cast()` to statically cast the value of a pointer -// `absl::any` type to the given pointer type, or `nullptr` if the stored value -// type of the `absl::any` does not match the cast. -template <typename ValueType> -ValueType* any_cast(any* operand) noexcept; - -// ----------------------------------------------------------------------------- -// absl::any -// ----------------------------------------------------------------------------- -// -// An `absl::any` object provides the facility to either store an instance of a -// type, known as the "contained object", or no value. An `absl::any` is used to -// store values of types that are unknown at compile time. The `absl::any` -// object, when containing a value, must contain a value type; storing a -// reference type is neither desired nor supported. -// -// An `absl::any` can only store a type that is copy-constructible; move-only -// types are not allowed within an `any` object. -// -// Example: -// -// auto a = absl::any(65); // Literal, copyable -// auto b = absl::any(std::vector<int>()); // Default-initialized, copyable -// std::unique_ptr<Foo> my_foo; -// auto c = absl::any(std::move(my_foo)); // Error, not copy-constructible -// -// Note that `absl::any` makes use of decayed types (`absl::decay_t` in this -// context) to remove const-volatile qualifiers (known as "cv qualifiers"), -// decay functions to function pointers, etc. We essentially "decay" a given -// type into its essential type. -// -// `absl::any` makes use of decayed types when determining the basic type `T` of -// the value to store in the any's contained object. In the documentation below, -// we explicitly denote this by using the phrase "a decayed type of `T`". -// -// Example: -// -// const int a = 4; -// absl::any foo(a); // Decay ensures we store an "int", not a "const int&". -// -// void my_function() {} -// absl::any bar(my_function); // Decay ensures we store a function pointer. -// -// `absl::any` is a C++11 compatible version of the C++17 `std::any` abstraction -// and is designed to be a drop-in replacement for code compliant with C++17. -class any { - private: - template <typename T> - struct IsInPlaceType; - - public: - // Constructors - - // Constructs an empty `absl::any` object (`any::has_value()` will return - // `false`). - constexpr any() noexcept; - - // Copy constructs an `absl::any` object with a "contained object" of the - // passed type of `other` (or an empty `absl::any` if `other.has_value()` is - // `false`. - any(const any& other) - : obj_(other.has_value() ? other.obj_->Clone() - : std::unique_ptr<ObjInterface>()) {} - - // Move constructs an `absl::any` object with a "contained object" of the - // passed type of `other` (or an empty `absl::any` if `other.has_value()` is - // `false`). - any(any&& other) noexcept = default; - - // Constructs an `absl::any` object with a "contained object" of the decayed - // type of `T`, which is initialized via `std::forward<T>(value)`. - // - // This constructor will not participate in overload resolution if the - // decayed type of `T` is not copy-constructible. - template < - typename T, typename VT = absl::decay_t<T>, - absl::enable_if_t<!absl::disjunction< - std::is_same<any, VT>, IsInPlaceType<VT>, - absl::negation<std::is_copy_constructible<VT> > >::value>* = nullptr> - any(T&& value) : obj_(new Obj<VT>(in_place, std::forward<T>(value))) {} - - // Constructs an `absl::any` object with a "contained object" of the decayed - // type of `T`, which is initialized via `std::forward<T>(value)`. - template <typename T, typename... Args, typename VT = absl::decay_t<T>, - absl::enable_if_t<absl::conjunction< - std::is_copy_constructible<VT>, - std::is_constructible<VT, Args...>>::value>* = nullptr> - explicit any(in_place_type_t<T> /*tag*/, Args&&... args) - : obj_(new Obj<VT>(in_place, std::forward<Args>(args)...)) {} - - // Constructs an `absl::any` object with a "contained object" of the passed - // type `VT` as a decayed type of `T`. `VT` is initialized as if - // direct-non-list-initializing an object of type `VT` with the arguments - // `initializer_list, std::forward<Args>(args)...`. - template < - typename T, typename U, typename... Args, typename VT = absl::decay_t<T>, - absl::enable_if_t< - absl::conjunction<std::is_copy_constructible<VT>, - std::is_constructible<VT, std::initializer_list<U>&, - Args...>>::value>* = nullptr> - explicit any(in_place_type_t<T> /*tag*/, std::initializer_list<U> ilist, - Args&&... args) - : obj_(new Obj<VT>(in_place, ilist, std::forward<Args>(args)...)) {} - - // Assignment operators - - // Copy assigns an `absl::any` object with a "contained object" of the - // passed type. - any& operator=(const any& rhs) { - any(rhs).swap(*this); - return *this; - } - - // Move assigns an `absl::any` object with a "contained object" of the - // passed type. `rhs` is left in a valid but otherwise unspecified state. - any& operator=(any&& rhs) noexcept { - any(std::move(rhs)).swap(*this); - return *this; - } - - // Assigns an `absl::any` object with a "contained object" of the passed type. - template <typename T, typename VT = absl::decay_t<T>, - absl::enable_if_t<absl::conjunction< - absl::negation<std::is_same<VT, any>>, - std::is_copy_constructible<VT>>::value>* = nullptr> - any& operator=(T&& rhs) { - any tmp(in_place_type_t<VT>(), std::forward<T>(rhs)); - tmp.swap(*this); - return *this; - } - - // Modifiers - - // any::emplace() - // - // Emplaces a value within an `absl::any` object by calling `any::reset()`, - // initializing the contained value as if direct-non-list-initializing an - // object of type `VT` with the arguments `std::forward<Args>(args)...`, and - // returning a reference to the new contained value. - // - // Note: If an exception is thrown during the call to `VT`'s constructor, - // `*this` does not contain a value, and any previously contained value has - // been destroyed. - template < - typename T, typename... Args, typename VT = absl::decay_t<T>, - absl::enable_if_t<std::is_copy_constructible<VT>::value && - std::is_constructible<VT, Args...>::value>* = nullptr> - VT& emplace(Args&&... args) { - reset(); // NOTE: reset() is required here even in the world of exceptions. - Obj<VT>* const object_ptr = - new Obj<VT>(in_place, std::forward<Args>(args)...); - obj_ = std::unique_ptr<ObjInterface>(object_ptr); - return object_ptr->value; - } - - // Overload of `any::emplace()` to emplace a value within an `absl::any` - // object by calling `any::reset()`, initializing the contained value as if - // direct-non-list-initializing an object of type `VT` with the arguments - // `initializer_list, std::forward<Args>(args)...`, and returning a reference - // to the new contained value. - // - // Note: If an exception is thrown during the call to `VT`'s constructor, - // `*this` does not contain a value, and any previously contained value has - // been destroyed. The function shall not participate in overload resolution - // unless `is_copy_constructible_v<VT>` is `true` and - // `is_constructible_v<VT, initializer_list<U>&, Args...>` is `true`. - template < - typename T, typename U, typename... Args, typename VT = absl::decay_t<T>, - absl::enable_if_t<std::is_copy_constructible<VT>::value && - std::is_constructible<VT, std::initializer_list<U>&, - Args...>::value>* = nullptr> - VT& emplace(std::initializer_list<U> ilist, Args&&... args) { - reset(); // NOTE: reset() is required here even in the world of exceptions. - Obj<VT>* const object_ptr = - new Obj<VT>(in_place, ilist, std::forward<Args>(args)...); - obj_ = std::unique_ptr<ObjInterface>(object_ptr); - return object_ptr->value; - } - - // any::reset() - // - // Resets the state of the `absl::any` object, destroying the contained object - // if present. - void reset() noexcept { obj_ = nullptr; } - - // any::swap() - // - // Swaps the passed value and the value of this `absl::any` object. - void swap(any& other) noexcept { obj_.swap(other.obj_); } - - // Observers - - // any::has_value() - // - // Returns `true` if the `any` object has a contained value, otherwise - // returns `false`. - bool has_value() const noexcept { return obj_ != nullptr; } - -#if ABSL_ANY_DETAIL_HAS_RTTI - // Returns: typeid(T) if *this has a contained object of type T, otherwise - // typeid(void). - const std::type_info& type() const noexcept { - if (has_value()) { - return obj_->Type(); - } - - return typeid(void); - } -#endif // ABSL_ANY_DETAIL_HAS_RTTI - - private: - // Tagged type-erased abstraction for holding a cloneable object. - class ObjInterface { - public: - virtual ~ObjInterface() = default; - virtual std::unique_ptr<ObjInterface> Clone() const = 0; - virtual const void* ObjTypeId() const noexcept = 0; -#if ABSL_ANY_DETAIL_HAS_RTTI - virtual const std::type_info& Type() const noexcept = 0; -#endif // ABSL_ANY_DETAIL_HAS_RTTI - }; - - // Hold a value of some queryable type, with an ability to Clone it. - template <typename T> - class Obj : public ObjInterface { - public: - template <typename... Args> - explicit Obj(in_place_t /*tag*/, Args&&... args) - : value(std::forward<Args>(args)...) {} - - std::unique_ptr<ObjInterface> Clone() const final { - return std::unique_ptr<ObjInterface>(new Obj(in_place, value)); - } - - const void* ObjTypeId() const noexcept final { return IdForType<T>(); } - -#if ABSL_ANY_DETAIL_HAS_RTTI - const std::type_info& Type() const noexcept final { return typeid(T); } -#endif // ABSL_ANY_DETAIL_HAS_RTTI - - T value; - }; - - std::unique_ptr<ObjInterface> CloneObj() const { - if (!obj_) return nullptr; - return obj_->Clone(); - } - - template <typename T> - constexpr static const void* IdForType() { - // Note: This type dance is to make the behavior consistent with typeid. - using NormalizedType = - typename std::remove_cv<typename std::remove_reference<T>::type>::type; - - return base_internal::FastTypeId<NormalizedType>(); - } - - const void* GetObjTypeId() const { - return obj_ ? obj_->ObjTypeId() : base_internal::FastTypeId<void>(); - } - - // `absl::any` nonmember functions // - - // Description at the declaration site (top of file). - template <typename ValueType> - friend ValueType any_cast(const any& operand); - - // Description at the declaration site (top of file). - template <typename ValueType> - friend ValueType any_cast(any& operand); // NOLINT(runtime/references) - - // Description at the declaration site (top of file). - template <typename T> - friend const T* any_cast(const any* operand) noexcept; - - // Description at the declaration site (top of file). - template <typename T> - friend T* any_cast(any* operand) noexcept; - - std::unique_ptr<ObjInterface> obj_; -}; - -// ----------------------------------------------------------------------------- -// Implementation Details -// ----------------------------------------------------------------------------- - -constexpr any::any() noexcept = default; - -template <typename T> -struct any::IsInPlaceType : std::false_type {}; - -template <typename T> -struct any::IsInPlaceType<in_place_type_t<T>> : std::true_type {}; - -inline void swap(any& x, any& y) noexcept { x.swap(y); } - -// Description at the declaration site (top of file). -template <typename T, typename... Args> -any make_any(Args&&... args) { - return any(in_place_type_t<T>(), std::forward<Args>(args)...); -} - -// Description at the declaration site (top of file). -template <typename T, typename U, typename... Args> -any make_any(std::initializer_list<U> il, Args&&... args) { - return any(in_place_type_t<T>(), il, std::forward<Args>(args)...); -} - -// Description at the declaration site (top of file). -template <typename ValueType> -ValueType any_cast(const any& operand) { - using U = typename std::remove_cv< - typename std::remove_reference<ValueType>::type>::type; - static_assert(std::is_constructible<ValueType, const U&>::value, - "Invalid ValueType"); - auto* const result = (any_cast<U>)(&operand); - if (result == nullptr) { - any_internal::ThrowBadAnyCast(); - } - return static_cast<ValueType>(*result); -} - -// Description at the declaration site (top of file). -template <typename ValueType> -ValueType any_cast(any& operand) { // NOLINT(runtime/references) - using U = typename std::remove_cv< - typename std::remove_reference<ValueType>::type>::type; - static_assert(std::is_constructible<ValueType, U&>::value, - "Invalid ValueType"); - auto* result = (any_cast<U>)(&operand); - if (result == nullptr) { - any_internal::ThrowBadAnyCast(); - } - return static_cast<ValueType>(*result); -} - -// Description at the declaration site (top of file). -template <typename ValueType> -ValueType any_cast(any&& operand) { - using U = typename std::remove_cv< - typename std::remove_reference<ValueType>::type>::type; - static_assert(std::is_constructible<ValueType, U>::value, - "Invalid ValueType"); - return static_cast<ValueType>(std::move((any_cast<U&>)(operand))); -} - -// Description at the declaration site (top of file). -template <typename T> -const T* any_cast(const any* operand) noexcept { - using U = - typename std::remove_cv<typename std::remove_reference<T>::type>::type; - return operand && operand->GetObjTypeId() == any::IdForType<U>() - ? std::addressof( - static_cast<const any::Obj<U>*>(operand->obj_.get())->value) - : nullptr; -} - -// Description at the declaration site (top of file). -template <typename T> -T* any_cast(any* operand) noexcept { - using U = - typename std::remove_cv<typename std::remove_reference<T>::type>::type; - return operand && operand->GetObjTypeId() == any::IdForType<U>() - ? std::addressof( - static_cast<any::Obj<U>*>(operand->obj_.get())->value) - : nullptr; -} - -ABSL_NAMESPACE_END -} // namespace absl - -#undef ABSL_ANY_DETAIL_HAS_RTTI - -#endif // ABSL_USES_STD_ANY - -#endif // ABSL_TYPES_ANY_H_ diff --git a/contrib/restricted/abseil-cpp/absl/types/bad_any_cast/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/types/bad_any_cast/CMakeLists.linux.txt deleted file mode 100644 index 102fa3a9db..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/bad_any_cast/CMakeLists.linux.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-types-bad_any_cast) -target_compile_options(absl-types-bad_any_cast PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-types-bad_any_cast PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-types-bad_any_cast PUBLIC - contrib-libs-cxxsupp - base-internal-raw_logging - absl-base-log_severity -) -target_sources(absl-types-bad_any_cast PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/types/bad_any_cast.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/types/bad_any_cast/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/types/bad_any_cast/CMakeLists.txt index e8c98bfd99..102fa3a9db 100644 --- a/contrib/restricted/abseil-cpp/absl/types/bad_any_cast/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/types/bad_any_cast/CMakeLists.txt @@ -6,6 +6,20 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-types-bad_any_cast) +target_compile_options(absl-types-bad_any_cast PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-types-bad_any_cast PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-types-bad_any_cast PUBLIC + contrib-libs-cxxsupp + base-internal-raw_logging + absl-base-log_severity +) +target_sources(absl-types-bad_any_cast PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/types/bad_any_cast.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/types/bad_optional_access/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/types/bad_optional_access/CMakeLists.linux.txt deleted file mode 100644 index def45d766d..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/bad_optional_access/CMakeLists.linux.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-types-bad_optional_access) -target_compile_options(absl-types-bad_optional_access PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-types-bad_optional_access PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-types-bad_optional_access PUBLIC - contrib-libs-cxxsupp - base-internal-raw_logging - absl-base-log_severity -) -target_sources(absl-types-bad_optional_access PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/types/bad_optional_access.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/types/bad_optional_access/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/types/bad_optional_access/CMakeLists.txt index e8c98bfd99..def45d766d 100644 --- a/contrib/restricted/abseil-cpp/absl/types/bad_optional_access/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/types/bad_optional_access/CMakeLists.txt @@ -6,6 +6,20 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-types-bad_optional_access) +target_compile_options(absl-types-bad_optional_access PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-types-bad_optional_access PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-types-bad_optional_access PUBLIC + contrib-libs-cxxsupp + base-internal-raw_logging + absl-base-log_severity +) +target_sources(absl-types-bad_optional_access PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/types/bad_optional_access.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/types/bad_variant_access/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/types/bad_variant_access/CMakeLists.linux.txt deleted file mode 100644 index a42d862420..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/bad_variant_access/CMakeLists.linux.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-types-bad_variant_access) -target_compile_options(absl-types-bad_variant_access PRIVATE - -DNOMINMAX - -Wno-everything -) -target_include_directories(absl-types-bad_variant_access PUBLIC - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp -) -target_link_libraries(absl-types-bad_variant_access PUBLIC - contrib-libs-cxxsupp - base-internal-raw_logging - absl-base-log_severity -) -target_sources(absl-types-bad_variant_access PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/types/bad_variant_access.cc -) diff --git a/contrib/restricted/abseil-cpp/absl/types/bad_variant_access/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/types/bad_variant_access/CMakeLists.txt index e8c98bfd99..a42d862420 100644 --- a/contrib/restricted/abseil-cpp/absl/types/bad_variant_access/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/types/bad_variant_access/CMakeLists.txt @@ -6,6 +6,20 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-types-bad_variant_access) +target_compile_options(absl-types-bad_variant_access PRIVATE + -DNOMINMAX + -Wno-everything +) +target_include_directories(absl-types-bad_variant_access PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp +) +target_link_libraries(absl-types-bad_variant_access PUBLIC + contrib-libs-cxxsupp + base-internal-raw_logging + absl-base-log_severity +) +target_sources(absl-types-bad_variant_access PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/abseil-cpp/absl/types/bad_variant_access.cc +) diff --git a/contrib/restricted/abseil-cpp/absl/types/compare.h b/contrib/restricted/abseil-cpp/absl/types/compare.h deleted file mode 100644 index 19b076e7f1..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/compare.h +++ /dev/null @@ -1,600 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// compare.h -// ----------------------------------------------------------------------------- -// -// This header file defines the `absl::weak_equality`, `absl::strong_equality`, -// `absl::partial_ordering`, `absl::weak_ordering`, and `absl::strong_ordering` -// types for storing the results of three way comparisons. -// -// Example: -// absl::weak_ordering compare(const std::string& a, const std::string& b); -// -// These are C++11 compatible versions of the C++20 corresponding types -// (`std::weak_equality`, etc.) and are designed to be drop-in replacements -// for code compliant with C++20. - -#ifndef ABSL_TYPES_COMPARE_H_ -#define ABSL_TYPES_COMPARE_H_ - -#include <cstddef> -#include <cstdint> -#include <cstdlib> -#include <type_traits> - -#include "absl/base/attributes.h" -#include "absl/meta/type_traits.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace compare_internal { - -using value_type = int8_t; - -template <typename T> -struct Fail { - static_assert(sizeof(T) < 0, "Only literal `0` is allowed."); -}; - -// We need the NullPtrT template to avoid triggering the modernize-use-nullptr -// ClangTidy warning in user code. -template <typename NullPtrT = std::nullptr_t> -struct OnlyLiteralZero { - constexpr OnlyLiteralZero(NullPtrT) noexcept {} // NOLINT - - // Fails compilation when `nullptr` or integral type arguments other than - // `int` are passed. This constructor doesn't accept `int` because literal `0` - // has type `int`. Literal `0` arguments will be implicitly converted to - // `std::nullptr_t` and accepted by the above constructor, while other `int` - // arguments will fail to be converted and cause compilation failure. - template < - typename T, - typename = typename std::enable_if< - std::is_same<T, std::nullptr_t>::value || - (std::is_integral<T>::value && !std::is_same<T, int>::value)>::type, - typename = typename Fail<T>::type> - OnlyLiteralZero(T); // NOLINT -}; - -enum class eq : value_type { - equal = 0, - equivalent = equal, - nonequal = 1, - nonequivalent = nonequal, -}; - -enum class ord : value_type { less = -1, greater = 1 }; - -enum class ncmp : value_type { unordered = -127 }; - -// Define macros to allow for creation or emulation of C++17 inline variables -// based on whether the feature is supported. Note: we can't use -// ABSL_INTERNAL_INLINE_CONSTEXPR here because the variables here are of -// incomplete types so they need to be defined after the types are complete. -#ifdef __cpp_inline_variables - -// A no-op expansion that can be followed by a semicolon at class level. -#define ABSL_COMPARE_INLINE_BASECLASS_DECL(name) static_assert(true, "") - -#define ABSL_COMPARE_INLINE_SUBCLASS_DECL(type, name) \ - static const type name - -#define ABSL_COMPARE_INLINE_INIT(type, name, init) \ - inline constexpr type type::name(init) - -#else // __cpp_inline_variables - -#define ABSL_COMPARE_INLINE_BASECLASS_DECL(name) \ - ABSL_CONST_INIT static const T name - -// A no-op expansion that can be followed by a semicolon at class level. -#define ABSL_COMPARE_INLINE_SUBCLASS_DECL(type, name) static_assert(true, "") - -#define ABSL_COMPARE_INLINE_INIT(type, name, init) \ - template <typename T> \ - const T compare_internal::type##_base<T>::name(init) - -#endif // __cpp_inline_variables - -// These template base classes allow for defining the values of the constants -// in the header file (for performance) without using inline variables (which -// aren't available in C++11). -template <typename T> -struct weak_equality_base { - ABSL_COMPARE_INLINE_BASECLASS_DECL(equivalent); - ABSL_COMPARE_INLINE_BASECLASS_DECL(nonequivalent); -}; - -template <typename T> -struct strong_equality_base { - ABSL_COMPARE_INLINE_BASECLASS_DECL(equal); - ABSL_COMPARE_INLINE_BASECLASS_DECL(nonequal); - ABSL_COMPARE_INLINE_BASECLASS_DECL(equivalent); - ABSL_COMPARE_INLINE_BASECLASS_DECL(nonequivalent); -}; - -template <typename T> -struct partial_ordering_base { - ABSL_COMPARE_INLINE_BASECLASS_DECL(less); - ABSL_COMPARE_INLINE_BASECLASS_DECL(equivalent); - ABSL_COMPARE_INLINE_BASECLASS_DECL(greater); - ABSL_COMPARE_INLINE_BASECLASS_DECL(unordered); -}; - -template <typename T> -struct weak_ordering_base { - ABSL_COMPARE_INLINE_BASECLASS_DECL(less); - ABSL_COMPARE_INLINE_BASECLASS_DECL(equivalent); - ABSL_COMPARE_INLINE_BASECLASS_DECL(greater); -}; - -template <typename T> -struct strong_ordering_base { - ABSL_COMPARE_INLINE_BASECLASS_DECL(less); - ABSL_COMPARE_INLINE_BASECLASS_DECL(equal); - ABSL_COMPARE_INLINE_BASECLASS_DECL(equivalent); - ABSL_COMPARE_INLINE_BASECLASS_DECL(greater); -}; - -} // namespace compare_internal - -class weak_equality - : public compare_internal::weak_equality_base<weak_equality> { - explicit constexpr weak_equality(compare_internal::eq v) noexcept - : value_(static_cast<compare_internal::value_type>(v)) {} - friend struct compare_internal::weak_equality_base<weak_equality>; - - public: - ABSL_COMPARE_INLINE_SUBCLASS_DECL(weak_equality, equivalent); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(weak_equality, nonequivalent); - - // Comparisons - friend constexpr bool operator==( - weak_equality v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ == 0; - } - friend constexpr bool operator!=( - weak_equality v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ != 0; - } - friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>, - weak_equality v) noexcept { - return 0 == v.value_; - } - friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>, - weak_equality v) noexcept { - return 0 != v.value_; - } - friend constexpr bool operator==(weak_equality v1, - weak_equality v2) noexcept { - return v1.value_ == v2.value_; - } - friend constexpr bool operator!=(weak_equality v1, - weak_equality v2) noexcept { - return v1.value_ != v2.value_; - } - - private: - compare_internal::value_type value_; -}; -ABSL_COMPARE_INLINE_INIT(weak_equality, equivalent, - compare_internal::eq::equivalent); -ABSL_COMPARE_INLINE_INIT(weak_equality, nonequivalent, - compare_internal::eq::nonequivalent); - -class strong_equality - : public compare_internal::strong_equality_base<strong_equality> { - explicit constexpr strong_equality(compare_internal::eq v) noexcept - : value_(static_cast<compare_internal::value_type>(v)) {} - friend struct compare_internal::strong_equality_base<strong_equality>; - - public: - ABSL_COMPARE_INLINE_SUBCLASS_DECL(strong_equality, equal); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(strong_equality, nonequal); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(strong_equality, equivalent); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(strong_equality, nonequivalent); - - // Conversion - constexpr operator weak_equality() const noexcept { // NOLINT - return value_ == 0 ? weak_equality::equivalent - : weak_equality::nonequivalent; - } - // Comparisons - friend constexpr bool operator==( - strong_equality v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ == 0; - } - friend constexpr bool operator!=( - strong_equality v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ != 0; - } - friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>, - strong_equality v) noexcept { - return 0 == v.value_; - } - friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>, - strong_equality v) noexcept { - return 0 != v.value_; - } - friend constexpr bool operator==(strong_equality v1, - strong_equality v2) noexcept { - return v1.value_ == v2.value_; - } - friend constexpr bool operator!=(strong_equality v1, - strong_equality v2) noexcept { - return v1.value_ != v2.value_; - } - - private: - compare_internal::value_type value_; -}; -ABSL_COMPARE_INLINE_INIT(strong_equality, equal, compare_internal::eq::equal); -ABSL_COMPARE_INLINE_INIT(strong_equality, nonequal, - compare_internal::eq::nonequal); -ABSL_COMPARE_INLINE_INIT(strong_equality, equivalent, - compare_internal::eq::equivalent); -ABSL_COMPARE_INLINE_INIT(strong_equality, nonequivalent, - compare_internal::eq::nonequivalent); - -class partial_ordering - : public compare_internal::partial_ordering_base<partial_ordering> { - explicit constexpr partial_ordering(compare_internal::eq v) noexcept - : value_(static_cast<compare_internal::value_type>(v)) {} - explicit constexpr partial_ordering(compare_internal::ord v) noexcept - : value_(static_cast<compare_internal::value_type>(v)) {} - explicit constexpr partial_ordering(compare_internal::ncmp v) noexcept - : value_(static_cast<compare_internal::value_type>(v)) {} - friend struct compare_internal::partial_ordering_base<partial_ordering>; - - constexpr bool is_ordered() const noexcept { - return value_ != - compare_internal::value_type(compare_internal::ncmp::unordered); - } - - public: - ABSL_COMPARE_INLINE_SUBCLASS_DECL(partial_ordering, less); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(partial_ordering, equivalent); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(partial_ordering, greater); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(partial_ordering, unordered); - - // Conversion - constexpr operator weak_equality() const noexcept { // NOLINT - return value_ == 0 ? weak_equality::equivalent - : weak_equality::nonequivalent; - } - // Comparisons - friend constexpr bool operator==( - partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.is_ordered() && v.value_ == 0; - } - friend constexpr bool operator!=( - partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return !v.is_ordered() || v.value_ != 0; - } - friend constexpr bool operator<( - partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.is_ordered() && v.value_ < 0; - } - friend constexpr bool operator<=( - partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.is_ordered() && v.value_ <= 0; - } - friend constexpr bool operator>( - partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.is_ordered() && v.value_ > 0; - } - friend constexpr bool operator>=( - partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.is_ordered() && v.value_ >= 0; - } - friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>, - partial_ordering v) noexcept { - return v.is_ordered() && 0 == v.value_; - } - friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>, - partial_ordering v) noexcept { - return !v.is_ordered() || 0 != v.value_; - } - friend constexpr bool operator<(compare_internal::OnlyLiteralZero<>, - partial_ordering v) noexcept { - return v.is_ordered() && 0 < v.value_; - } - friend constexpr bool operator<=(compare_internal::OnlyLiteralZero<>, - partial_ordering v) noexcept { - return v.is_ordered() && 0 <= v.value_; - } - friend constexpr bool operator>(compare_internal::OnlyLiteralZero<>, - partial_ordering v) noexcept { - return v.is_ordered() && 0 > v.value_; - } - friend constexpr bool operator>=(compare_internal::OnlyLiteralZero<>, - partial_ordering v) noexcept { - return v.is_ordered() && 0 >= v.value_; - } - friend constexpr bool operator==(partial_ordering v1, - partial_ordering v2) noexcept { - return v1.value_ == v2.value_; - } - friend constexpr bool operator!=(partial_ordering v1, - partial_ordering v2) noexcept { - return v1.value_ != v2.value_; - } - - private: - compare_internal::value_type value_; -}; -ABSL_COMPARE_INLINE_INIT(partial_ordering, less, compare_internal::ord::less); -ABSL_COMPARE_INLINE_INIT(partial_ordering, equivalent, - compare_internal::eq::equivalent); -ABSL_COMPARE_INLINE_INIT(partial_ordering, greater, - compare_internal::ord::greater); -ABSL_COMPARE_INLINE_INIT(partial_ordering, unordered, - compare_internal::ncmp::unordered); - -class weak_ordering - : public compare_internal::weak_ordering_base<weak_ordering> { - explicit constexpr weak_ordering(compare_internal::eq v) noexcept - : value_(static_cast<compare_internal::value_type>(v)) {} - explicit constexpr weak_ordering(compare_internal::ord v) noexcept - : value_(static_cast<compare_internal::value_type>(v)) {} - friend struct compare_internal::weak_ordering_base<weak_ordering>; - - public: - ABSL_COMPARE_INLINE_SUBCLASS_DECL(weak_ordering, less); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(weak_ordering, equivalent); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(weak_ordering, greater); - - // Conversions - constexpr operator weak_equality() const noexcept { // NOLINT - return value_ == 0 ? weak_equality::equivalent - : weak_equality::nonequivalent; - } - constexpr operator partial_ordering() const noexcept { // NOLINT - return value_ == 0 ? partial_ordering::equivalent - : (value_ < 0 ? partial_ordering::less - : partial_ordering::greater); - } - // Comparisons - friend constexpr bool operator==( - weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ == 0; - } - friend constexpr bool operator!=( - weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ != 0; - } - friend constexpr bool operator<( - weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ < 0; - } - friend constexpr bool operator<=( - weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ <= 0; - } - friend constexpr bool operator>( - weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ > 0; - } - friend constexpr bool operator>=( - weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ >= 0; - } - friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>, - weak_ordering v) noexcept { - return 0 == v.value_; - } - friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>, - weak_ordering v) noexcept { - return 0 != v.value_; - } - friend constexpr bool operator<(compare_internal::OnlyLiteralZero<>, - weak_ordering v) noexcept { - return 0 < v.value_; - } - friend constexpr bool operator<=(compare_internal::OnlyLiteralZero<>, - weak_ordering v) noexcept { - return 0 <= v.value_; - } - friend constexpr bool operator>(compare_internal::OnlyLiteralZero<>, - weak_ordering v) noexcept { - return 0 > v.value_; - } - friend constexpr bool operator>=(compare_internal::OnlyLiteralZero<>, - weak_ordering v) noexcept { - return 0 >= v.value_; - } - friend constexpr bool operator==(weak_ordering v1, - weak_ordering v2) noexcept { - return v1.value_ == v2.value_; - } - friend constexpr bool operator!=(weak_ordering v1, - weak_ordering v2) noexcept { - return v1.value_ != v2.value_; - } - - private: - compare_internal::value_type value_; -}; -ABSL_COMPARE_INLINE_INIT(weak_ordering, less, compare_internal::ord::less); -ABSL_COMPARE_INLINE_INIT(weak_ordering, equivalent, - compare_internal::eq::equivalent); -ABSL_COMPARE_INLINE_INIT(weak_ordering, greater, - compare_internal::ord::greater); - -class strong_ordering - : public compare_internal::strong_ordering_base<strong_ordering> { - explicit constexpr strong_ordering(compare_internal::eq v) noexcept - : value_(static_cast<compare_internal::value_type>(v)) {} - explicit constexpr strong_ordering(compare_internal::ord v) noexcept - : value_(static_cast<compare_internal::value_type>(v)) {} - friend struct compare_internal::strong_ordering_base<strong_ordering>; - - public: - ABSL_COMPARE_INLINE_SUBCLASS_DECL(strong_ordering, less); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(strong_ordering, equal); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(strong_ordering, equivalent); - ABSL_COMPARE_INLINE_SUBCLASS_DECL(strong_ordering, greater); - - // Conversions - constexpr operator weak_equality() const noexcept { // NOLINT - return value_ == 0 ? weak_equality::equivalent - : weak_equality::nonequivalent; - } - constexpr operator strong_equality() const noexcept { // NOLINT - return value_ == 0 ? strong_equality::equal : strong_equality::nonequal; - } - constexpr operator partial_ordering() const noexcept { // NOLINT - return value_ == 0 ? partial_ordering::equivalent - : (value_ < 0 ? partial_ordering::less - : partial_ordering::greater); - } - constexpr operator weak_ordering() const noexcept { // NOLINT - return value_ == 0 - ? weak_ordering::equivalent - : (value_ < 0 ? weak_ordering::less : weak_ordering::greater); - } - // Comparisons - friend constexpr bool operator==( - strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ == 0; - } - friend constexpr bool operator!=( - strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ != 0; - } - friend constexpr bool operator<( - strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ < 0; - } - friend constexpr bool operator<=( - strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ <= 0; - } - friend constexpr bool operator>( - strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ > 0; - } - friend constexpr bool operator>=( - strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept { - return v.value_ >= 0; - } - friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>, - strong_ordering v) noexcept { - return 0 == v.value_; - } - friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>, - strong_ordering v) noexcept { - return 0 != v.value_; - } - friend constexpr bool operator<(compare_internal::OnlyLiteralZero<>, - strong_ordering v) noexcept { - return 0 < v.value_; - } - friend constexpr bool operator<=(compare_internal::OnlyLiteralZero<>, - strong_ordering v) noexcept { - return 0 <= v.value_; - } - friend constexpr bool operator>(compare_internal::OnlyLiteralZero<>, - strong_ordering v) noexcept { - return 0 > v.value_; - } - friend constexpr bool operator>=(compare_internal::OnlyLiteralZero<>, - strong_ordering v) noexcept { - return 0 >= v.value_; - } - friend constexpr bool operator==(strong_ordering v1, - strong_ordering v2) noexcept { - return v1.value_ == v2.value_; - } - friend constexpr bool operator!=(strong_ordering v1, - strong_ordering v2) noexcept { - return v1.value_ != v2.value_; - } - - private: - compare_internal::value_type value_; -}; -ABSL_COMPARE_INLINE_INIT(strong_ordering, less, compare_internal::ord::less); -ABSL_COMPARE_INLINE_INIT(strong_ordering, equal, compare_internal::eq::equal); -ABSL_COMPARE_INLINE_INIT(strong_ordering, equivalent, - compare_internal::eq::equivalent); -ABSL_COMPARE_INLINE_INIT(strong_ordering, greater, - compare_internal::ord::greater); - -#undef ABSL_COMPARE_INLINE_BASECLASS_DECL -#undef ABSL_COMPARE_INLINE_SUBCLASS_DECL -#undef ABSL_COMPARE_INLINE_INIT - -namespace compare_internal { -// We also provide these comparator adapter functions for internal absl use. - -// Helper functions to do a boolean comparison of two keys given a boolean -// or three-way comparator. -// SFINAE prevents implicit conversions to bool (such as from int). -template <typename Bool, - absl::enable_if_t<std::is_same<bool, Bool>::value, int> = 0> -constexpr bool compare_result_as_less_than(const Bool r) { return r; } -constexpr bool compare_result_as_less_than(const absl::weak_ordering r) { - return r < 0; -} - -template <typename Compare, typename K, typename LK> -constexpr bool do_less_than_comparison(const Compare &compare, const K &x, - const LK &y) { - return compare_result_as_less_than(compare(x, y)); -} - -// Helper functions to do a three-way comparison of two keys given a boolean or -// three-way comparator. -// SFINAE prevents implicit conversions to int (such as from bool). -template <typename Int, - absl::enable_if_t<std::is_same<int, Int>::value, int> = 0> -constexpr absl::weak_ordering compare_result_as_ordering(const Int c) { - return c < 0 ? absl::weak_ordering::less - : c == 0 ? absl::weak_ordering::equivalent - : absl::weak_ordering::greater; -} -constexpr absl::weak_ordering compare_result_as_ordering( - const absl::weak_ordering c) { - return c; -} - -template < - typename Compare, typename K, typename LK, - absl::enable_if_t<!std::is_same<bool, absl::result_of_t<Compare( - const K &, const LK &)>>::value, - int> = 0> -constexpr absl::weak_ordering do_three_way_comparison(const Compare &compare, - const K &x, const LK &y) { - return compare_result_as_ordering(compare(x, y)); -} -template < - typename Compare, typename K, typename LK, - absl::enable_if_t<std::is_same<bool, absl::result_of_t<Compare( - const K &, const LK &)>>::value, - int> = 0> -constexpr absl::weak_ordering do_three_way_comparison(const Compare &compare, - const K &x, const LK &y) { - return compare(x, y) ? absl::weak_ordering::less - : compare(y, x) ? absl::weak_ordering::greater - : absl::weak_ordering::equivalent; -} - -} // namespace compare_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_TYPES_COMPARE_H_ diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/types/internal/.yandex_meta/licenses.list.txt deleted file mode 100644 index f39e683596..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/internal/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,24 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2018 The Abseil Authors. - - -====================COPYRIGHT==================== -// Copyright 2019 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/types/internal/CMakeLists.linux.txt deleted file mode 100644 index 8af632db95..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/internal/CMakeLists.linux.txt +++ /dev/null @@ -1,10 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(absl-types-internal INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/types/internal/CMakeLists.txt index e8c98bfd99..8af632db95 100644 --- a/contrib/restricted/abseil-cpp/absl/types/internal/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/types/internal/CMakeLists.txt @@ -6,6 +6,5 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(absl-types-internal INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_aliases.h b/contrib/restricted/abseil-cpp/absl/types/internal/conformance_aliases.h deleted file mode 100644 index 0cc6884e30..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_aliases.h +++ /dev/null @@ -1,447 +0,0 @@ -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// regularity_aliases.h -// ----------------------------------------------------------------------------- -// -// This file contains type aliases of common ConformanceProfiles and Archetypes -// so that they can be directly used by name without creating them from scratch. - -#ifndef ABSL_TYPES_INTERNAL_CONFORMANCE_ALIASES_H_ -#define ABSL_TYPES_INTERNAL_CONFORMANCE_ALIASES_H_ - -#include "absl/types/internal/conformance_archetype.h" -#include "absl/types/internal/conformance_profile.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace types_internal { - -// Creates both a Profile and a corresponding Archetype with root name "name". -#define ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS(name, ...) \ - struct name##Profile : __VA_ARGS__ {}; \ - \ - using name##Archetype = ::absl::types_internal::Archetype<name##Profile>; \ - \ - template <class AbslInternalProfileTag> \ - using name##Archetype##_ = ::absl::types_internal::Archetype< \ - ::absl::types_internal::StrongProfileTypedef<name##Profile, \ - AbslInternalProfileTag>> - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasTrivialDefaultConstructor, - ConformanceProfile<default_constructible::trivial>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowDefaultConstructor, - ConformanceProfile<default_constructible::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasDefaultConstructor, ConformanceProfile<default_constructible::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasTrivialMoveConstructor, ConformanceProfile<default_constructible::maybe, - move_constructible::trivial>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowMoveConstructor, ConformanceProfile<default_constructible::maybe, - move_constructible::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasMoveConstructor, - ConformanceProfile<default_constructible::maybe, move_constructible::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasTrivialCopyConstructor, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::trivial>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowCopyConstructor, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasCopyConstructor, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasTrivialMoveAssign, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::trivial>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowMoveAssign, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasMoveAssign, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasTrivialCopyAssign, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::trivial>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowCopyAssign, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasCopyAssign, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasTrivialDestructor, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::trivial>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowDestructor, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasDestructor, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowEquality, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, - equality_comparable::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasEquality, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, - equality_comparable::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowInequality, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, - equality_comparable::maybe, - inequality_comparable::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasInequality, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, - equality_comparable::maybe, inequality_comparable::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowLessThan, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, - equality_comparable::maybe, inequality_comparable::maybe, - less_than_comparable::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasLessThan, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, - equality_comparable::maybe, inequality_comparable::maybe, - less_than_comparable::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowLessEqual, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, - equality_comparable::maybe, inequality_comparable::maybe, - less_than_comparable::maybe, - less_equal_comparable::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasLessEqual, - ConformanceProfile<default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, - equality_comparable::maybe, inequality_comparable::maybe, - less_than_comparable::maybe, - less_equal_comparable::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowGreaterEqual, - ConformanceProfile< - default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, - inequality_comparable::maybe, less_than_comparable::maybe, - less_equal_comparable::maybe, greater_equal_comparable::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasGreaterEqual, - ConformanceProfile< - default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, - inequality_comparable::maybe, less_than_comparable::maybe, - less_equal_comparable::maybe, greater_equal_comparable::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowGreaterThan, - ConformanceProfile< - default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, - inequality_comparable::maybe, less_than_comparable::maybe, - less_equal_comparable::maybe, greater_equal_comparable::maybe, - greater_than_comparable::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasGreaterThan, - ConformanceProfile< - default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, - inequality_comparable::maybe, less_than_comparable::maybe, - less_equal_comparable::maybe, greater_equal_comparable::maybe, - greater_than_comparable::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasNothrowSwap, - ConformanceProfile< - default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, - inequality_comparable::maybe, less_than_comparable::maybe, - less_equal_comparable::maybe, greater_equal_comparable::maybe, - greater_than_comparable::maybe, swappable::nothrow>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasSwap, - ConformanceProfile< - default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, - inequality_comparable::maybe, less_than_comparable::maybe, - less_equal_comparable::maybe, greater_equal_comparable::maybe, - greater_than_comparable::maybe, swappable::yes>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HasStdHashSpecialization, - ConformanceProfile< - default_constructible::maybe, move_constructible::maybe, - copy_constructible::maybe, move_assignable::maybe, - copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, - inequality_comparable::maybe, less_than_comparable::maybe, - less_equal_comparable::maybe, greater_equal_comparable::maybe, - greater_than_comparable::maybe, swappable::maybe, hashable::yes>); - -//////////////////////////////////////////////////////////////////////////////// -//// The remaining aliases are combinations of the previous aliases. //// -//////////////////////////////////////////////////////////////////////////////// - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - Equatable, CombineProfiles<HasEqualityProfile, HasInequalityProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - Comparable, - CombineProfiles<EquatableProfile, HasLessThanProfile, HasLessEqualProfile, - HasGreaterEqualProfile, HasGreaterThanProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - NothrowEquatable, - CombineProfiles<HasNothrowEqualityProfile, HasNothrowInequalityProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - NothrowComparable, - CombineProfiles<NothrowEquatableProfile, HasNothrowLessThanProfile, - HasNothrowLessEqualProfile, HasNothrowGreaterEqualProfile, - HasNothrowGreaterThanProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - Value, - CombineProfiles<HasNothrowMoveConstructorProfile, HasCopyConstructorProfile, - HasNothrowMoveAssignProfile, HasCopyAssignProfile, - HasNothrowDestructorProfile, HasNothrowSwapProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - EquatableValue, CombineProfiles<EquatableProfile, ValueProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - ComparableValue, CombineProfiles<ComparableProfile, ValueProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - DefaultConstructibleValue, - CombineProfiles<HasDefaultConstructorProfile, ValueProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - NothrowMoveConstructible, CombineProfiles<HasNothrowMoveConstructorProfile, - HasNothrowDestructorProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - EquatableNothrowMoveConstructible, - CombineProfiles<EquatableProfile, NothrowMoveConstructibleProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - ComparableNothrowMoveConstructible, - CombineProfiles<ComparableProfile, NothrowMoveConstructibleProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - DefaultConstructibleNothrowMoveConstructible, - CombineProfiles<HasDefaultConstructorProfile, - NothrowMoveConstructibleProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - CopyConstructible, - CombineProfiles<HasNothrowMoveConstructorProfile, HasCopyConstructorProfile, - HasNothrowDestructorProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - EquatableCopyConstructible, - CombineProfiles<EquatableProfile, CopyConstructibleProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - ComparableCopyConstructible, - CombineProfiles<ComparableProfile, CopyConstructibleProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - DefaultConstructibleCopyConstructible, - CombineProfiles<HasDefaultConstructorProfile, CopyConstructibleProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - NothrowMovable, - CombineProfiles<HasNothrowMoveConstructorProfile, - HasNothrowMoveAssignProfile, HasNothrowDestructorProfile, - HasNothrowSwapProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - EquatableNothrowMovable, - CombineProfiles<EquatableProfile, NothrowMovableProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - ComparableNothrowMovable, - CombineProfiles<ComparableProfile, NothrowMovableProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - DefaultConstructibleNothrowMovable, - CombineProfiles<HasDefaultConstructorProfile, NothrowMovableProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - TrivialSpecialMemberFunctions, - CombineProfiles<HasTrivialDefaultConstructorProfile, - HasTrivialMoveConstructorProfile, - HasTrivialCopyConstructorProfile, - HasTrivialMoveAssignProfile, HasTrivialCopyAssignProfile, - HasTrivialDestructorProfile, HasNothrowSwapProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - TriviallyComplete, - CombineProfiles<TrivialSpecialMemberFunctionsProfile, ComparableProfile, - HasStdHashSpecializationProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HashableNothrowMoveConstructible, - CombineProfiles<HasStdHashSpecializationProfile, - NothrowMoveConstructibleProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HashableCopyConstructible, - CombineProfiles<HasStdHashSpecializationProfile, CopyConstructibleProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HashableNothrowMovable, - CombineProfiles<HasStdHashSpecializationProfile, NothrowMovableProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - HashableValue, - CombineProfiles<HasStdHashSpecializationProfile, ValueProfile>); - -ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( - ComparableHashableValue, - CombineProfiles<HashableValueProfile, ComparableProfile>); - -// The "preferred" profiles that we support in Abseil. -template <template <class...> class Receiver> -using ExpandBasicProfiles = - Receiver<NothrowMoveConstructibleProfile, CopyConstructibleProfile, - NothrowMovableProfile, ValueProfile>; - -// The basic profiles except that they are also all Equatable. -template <template <class...> class Receiver> -using ExpandBasicEquatableProfiles = - Receiver<EquatableNothrowMoveConstructibleProfile, - EquatableCopyConstructibleProfile, EquatableNothrowMovableProfile, - EquatableValueProfile>; - -// The basic profiles except that they are also all Comparable. -template <template <class...> class Receiver> -using ExpandBasicComparableProfiles = - Receiver<ComparableNothrowMoveConstructibleProfile, - ComparableCopyConstructibleProfile, - ComparableNothrowMovableProfile, ComparableValueProfile>; - -// The basic profiles except that they are also all Hashable. -template <template <class...> class Receiver> -using ExpandBasicHashableProfiles = - Receiver<HashableNothrowMoveConstructibleProfile, - HashableCopyConstructibleProfile, HashableNothrowMovableProfile, - HashableValueProfile>; - -// The basic profiles except that they are also all DefaultConstructible. -template <template <class...> class Receiver> -using ExpandBasicDefaultConstructibleProfiles = - Receiver<DefaultConstructibleNothrowMoveConstructibleProfile, - DefaultConstructibleCopyConstructibleProfile, - DefaultConstructibleNothrowMovableProfile, - DefaultConstructibleValueProfile>; - -// The type profiles that we support in Abseil (all of the previous lists). -template <template <class...> class Receiver> -using ExpandSupportedProfiles = Receiver< - NothrowMoveConstructibleProfile, CopyConstructibleProfile, - NothrowMovableProfile, ValueProfile, - EquatableNothrowMoveConstructibleProfile, EquatableCopyConstructibleProfile, - EquatableNothrowMovableProfile, EquatableValueProfile, - ComparableNothrowMoveConstructibleProfile, - ComparableCopyConstructibleProfile, ComparableNothrowMovableProfile, - ComparableValueProfile, DefaultConstructibleNothrowMoveConstructibleProfile, - DefaultConstructibleCopyConstructibleProfile, - DefaultConstructibleNothrowMovableProfile, DefaultConstructibleValueProfile, - HashableNothrowMoveConstructibleProfile, HashableCopyConstructibleProfile, - HashableNothrowMovableProfile, HashableValueProfile>; - -// TODO(calabrese) Include types that have throwing move constructors, since in -// practice we still need to support them because of standard library types with -// (potentially) non-noexcept moves. - -} // namespace types_internal -ABSL_NAMESPACE_END -} // namespace absl - -#undef ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS - -#endif // ABSL_TYPES_INTERNAL_CONFORMANCE_ALIASES_H_ diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_archetype.h b/contrib/restricted/abseil-cpp/absl/types/internal/conformance_archetype.h deleted file mode 100644 index 2349e0f726..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_archetype.h +++ /dev/null @@ -1,978 +0,0 @@ -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// conformance_archetype.h -// ----------------------------------------------------------------------------- -// -// This file contains a facility for generating "archetypes" of out of -// "Conformance Profiles" (see "conformance_profiles.h" for more information -// about Conformance Profiles). An archetype is a type that aims to support the -// bare minimum requirements of a given Conformance Profile. For instance, an -// archetype that corresponds to an ImmutableProfile has exactly a nothrow -// move-constructor, a potentially-throwing copy constructor, a nothrow -// destructor, with all other special-member-functions deleted. These archetypes -// are useful for testing to make sure that templates are able to work with the -// kinds of types that they claim to support (i.e. that they do not accidentally -// under-constrain), -// -// The main type template in this file is the Archetype template, which takes -// a Conformance Profile as a template argument and its instantiations are a -// minimum-conforming model of that profile. - -#ifndef ABSL_TYPES_INTERNAL_CONFORMANCE_ARCHETYPE_H_ -#define ABSL_TYPES_INTERNAL_CONFORMANCE_ARCHETYPE_H_ - -#include <cstddef> -#include <functional> -#include <type_traits> -#include <utility> - -#include "absl/meta/type_traits.h" -#include "absl/types/internal/conformance_profile.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace types_internal { - -// A minimum-conforming implementation of a type with properties specified in -// `Prof`, where `Prof` is a valid Conformance Profile. -template <class Prof, class /*Enabler*/ = void> -class Archetype; - -// Given an Archetype, obtain the properties of the profile associated with that -// archetype. -template <class Archetype> -struct PropertiesOfArchetype; - -template <class Prof> -struct PropertiesOfArchetype<Archetype<Prof>> { - using type = PropertiesOfT<Prof>; -}; - -template <class Archetype> -using PropertiesOfArchetypeT = typename PropertiesOfArchetype<Archetype>::type; - -// A metafunction to determine if a type is an `Archetype`. -template <class T> -struct IsArchetype : std::false_type {}; - -template <class Prof> -struct IsArchetype<Archetype<Prof>> : std::true_type {}; - -// A constructor tag type used when creating an Archetype with internal state. -struct MakeArchetypeState {}; - -// Data stored within an archetype that is copied/compared/hashed when the -// corresponding operations are used. -using ArchetypeState = std::size_t; - -//////////////////////////////////////////////////////////////////////////////// -// This section of the file defines a chain of base classes for Archetype, // -// where each base defines a specific special member function with the // -// appropriate properties (deleted, noexcept(false), noexcept, or trivial). // -//////////////////////////////////////////////////////////////////////////////// - -// The bottom-most base, which contains the state and the default constructor. -template <default_constructible DefaultConstructibleValue> -struct ArchetypeStateBase { - static_assert(DefaultConstructibleValue == default_constructible::yes || - DefaultConstructibleValue == default_constructible::nothrow, - ""); - - ArchetypeStateBase() noexcept( - DefaultConstructibleValue == - default_constructible:: - nothrow) /*Vacuous archetype_state initialization*/ {} - explicit ArchetypeStateBase(MakeArchetypeState, ArchetypeState state) noexcept - : archetype_state(state) {} - - ArchetypeState archetype_state; -}; - -template <> -struct ArchetypeStateBase<default_constructible::maybe> { - explicit ArchetypeStateBase() = delete; - explicit ArchetypeStateBase(MakeArchetypeState, ArchetypeState state) noexcept - : archetype_state(state) {} - - ArchetypeState archetype_state; -}; - -template <> -struct ArchetypeStateBase<default_constructible::trivial> { - ArchetypeStateBase() = default; - explicit ArchetypeStateBase(MakeArchetypeState, ArchetypeState state) noexcept - : archetype_state(state) {} - - ArchetypeState archetype_state; -}; - -// The move-constructor base -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue> -struct ArchetypeMoveConstructor - : ArchetypeStateBase<DefaultConstructibleValue> { - static_assert(MoveConstructibleValue == move_constructible::yes || - MoveConstructibleValue == move_constructible::nothrow, - ""); - - explicit ArchetypeMoveConstructor(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeStateBase<DefaultConstructibleValue>(MakeArchetypeState(), - state) {} - - ArchetypeMoveConstructor() = default; - ArchetypeMoveConstructor(ArchetypeMoveConstructor&& other) noexcept( - MoveConstructibleValue == move_constructible::nothrow) - : ArchetypeStateBase<DefaultConstructibleValue>(MakeArchetypeState(), - other.archetype_state) {} - ArchetypeMoveConstructor(const ArchetypeMoveConstructor&) = default; - ArchetypeMoveConstructor& operator=(ArchetypeMoveConstructor&&) = default; - ArchetypeMoveConstructor& operator=(const ArchetypeMoveConstructor&) = - default; -}; - -template <default_constructible DefaultConstructibleValue> -struct ArchetypeMoveConstructor<DefaultConstructibleValue, - move_constructible::trivial> - : ArchetypeStateBase<DefaultConstructibleValue> { - explicit ArchetypeMoveConstructor(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeStateBase<DefaultConstructibleValue>(MakeArchetypeState(), - state) {} - - ArchetypeMoveConstructor() = default; -}; - -// The copy-constructor base -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue, - copy_constructible CopyConstructibleValue> -struct ArchetypeCopyConstructor - : ArchetypeMoveConstructor<DefaultConstructibleValue, - MoveConstructibleValue> { - static_assert(CopyConstructibleValue == copy_constructible::yes || - CopyConstructibleValue == copy_constructible::nothrow, - ""); - explicit ArchetypeCopyConstructor(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeMoveConstructor<DefaultConstructibleValue, - MoveConstructibleValue>(MakeArchetypeState(), - state) {} - - ArchetypeCopyConstructor() = default; - ArchetypeCopyConstructor(ArchetypeCopyConstructor&&) = default; - ArchetypeCopyConstructor(const ArchetypeCopyConstructor& other) noexcept( - CopyConstructibleValue == copy_constructible::nothrow) - : ArchetypeMoveConstructor<DefaultConstructibleValue, - MoveConstructibleValue>( - MakeArchetypeState(), other.archetype_state) {} - ArchetypeCopyConstructor& operator=(ArchetypeCopyConstructor&&) = default; - ArchetypeCopyConstructor& operator=(const ArchetypeCopyConstructor&) = - default; -}; - -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue> -struct ArchetypeCopyConstructor<DefaultConstructibleValue, - MoveConstructibleValue, - copy_constructible::maybe> - : ArchetypeMoveConstructor<DefaultConstructibleValue, - MoveConstructibleValue> { - explicit ArchetypeCopyConstructor(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeMoveConstructor<DefaultConstructibleValue, - MoveConstructibleValue>(MakeArchetypeState(), - state) {} - - ArchetypeCopyConstructor() = default; - ArchetypeCopyConstructor(ArchetypeCopyConstructor&&) = default; - ArchetypeCopyConstructor(const ArchetypeCopyConstructor&) = delete; - ArchetypeCopyConstructor& operator=(ArchetypeCopyConstructor&&) = default; - ArchetypeCopyConstructor& operator=(const ArchetypeCopyConstructor&) = - default; -}; - -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue> -struct ArchetypeCopyConstructor<DefaultConstructibleValue, - MoveConstructibleValue, - copy_constructible::trivial> - : ArchetypeMoveConstructor<DefaultConstructibleValue, - MoveConstructibleValue> { - explicit ArchetypeCopyConstructor(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeMoveConstructor<DefaultConstructibleValue, - MoveConstructibleValue>(MakeArchetypeState(), - state) {} - - ArchetypeCopyConstructor() = default; -}; - -// The move-assign base -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue, - copy_constructible CopyConstructibleValue, - move_assignable MoveAssignableValue> -struct ArchetypeMoveAssign - : ArchetypeCopyConstructor<DefaultConstructibleValue, - MoveConstructibleValue, CopyConstructibleValue> { - static_assert(MoveAssignableValue == move_assignable::yes || - MoveAssignableValue == move_assignable::nothrow, - ""); - explicit ArchetypeMoveAssign(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeCopyConstructor<DefaultConstructibleValue, - MoveConstructibleValue, - CopyConstructibleValue>(MakeArchetypeState(), - state) {} - - ArchetypeMoveAssign() = default; - ArchetypeMoveAssign(ArchetypeMoveAssign&&) = default; - ArchetypeMoveAssign(const ArchetypeMoveAssign&) = default; - ArchetypeMoveAssign& operator=(ArchetypeMoveAssign&& other) noexcept( - MoveAssignableValue == move_assignable::nothrow) { - this->archetype_state = other.archetype_state; - return *this; - } - - ArchetypeMoveAssign& operator=(const ArchetypeMoveAssign&) = default; -}; - -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue, - copy_constructible CopyConstructibleValue> -struct ArchetypeMoveAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, move_assignable::trivial> - : ArchetypeCopyConstructor<DefaultConstructibleValue, - MoveConstructibleValue, CopyConstructibleValue> { - explicit ArchetypeMoveAssign(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeCopyConstructor<DefaultConstructibleValue, - MoveConstructibleValue, - CopyConstructibleValue>(MakeArchetypeState(), - state) {} - - ArchetypeMoveAssign() = default; -}; - -// The copy-assign base -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue, - copy_constructible CopyConstructibleValue, - move_assignable MoveAssignableValue, - copy_assignable CopyAssignableValue> -struct ArchetypeCopyAssign - : ArchetypeMoveAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue> { - static_assert(CopyAssignableValue == copy_assignable::yes || - CopyAssignableValue == copy_assignable::nothrow, - ""); - explicit ArchetypeCopyAssign(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeMoveAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue>( - MakeArchetypeState(), state) {} - - ArchetypeCopyAssign() = default; - ArchetypeCopyAssign(ArchetypeCopyAssign&&) = default; - ArchetypeCopyAssign(const ArchetypeCopyAssign&) = default; - ArchetypeCopyAssign& operator=(ArchetypeCopyAssign&&) = default; - - ArchetypeCopyAssign& operator=(const ArchetypeCopyAssign& other) noexcept( - CopyAssignableValue == copy_assignable::nothrow) { - this->archetype_state = other.archetype_state; - return *this; - } -}; - -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue, - copy_constructible CopyConstructibleValue, - move_assignable MoveAssignableValue> -struct ArchetypeCopyAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue, - copy_assignable::maybe> - : ArchetypeMoveAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue> { - explicit ArchetypeCopyAssign(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeMoveAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue>( - MakeArchetypeState(), state) {} - - ArchetypeCopyAssign() = default; - ArchetypeCopyAssign(ArchetypeCopyAssign&&) = default; - ArchetypeCopyAssign(const ArchetypeCopyAssign&) = default; - ArchetypeCopyAssign& operator=(ArchetypeCopyAssign&&) = default; - ArchetypeCopyAssign& operator=(const ArchetypeCopyAssign&) = delete; -}; - -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue, - copy_constructible CopyConstructibleValue, - move_assignable MoveAssignableValue> -struct ArchetypeCopyAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue, - copy_assignable::trivial> - : ArchetypeMoveAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue> { - explicit ArchetypeCopyAssign(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeMoveAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue>( - MakeArchetypeState(), state) {} - - ArchetypeCopyAssign() = default; -}; - -// The destructor base -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue, - copy_constructible CopyConstructibleValue, - move_assignable MoveAssignableValue, - copy_assignable CopyAssignableValue, destructible DestructibleValue> -struct ArchetypeDestructor - : ArchetypeCopyAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue, - CopyAssignableValue> { - static_assert(DestructibleValue == destructible::yes || - DestructibleValue == destructible::nothrow, - ""); - - explicit ArchetypeDestructor(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeCopyAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue, - CopyAssignableValue>(MakeArchetypeState(), state) {} - - ArchetypeDestructor() = default; - ArchetypeDestructor(ArchetypeDestructor&&) = default; - ArchetypeDestructor(const ArchetypeDestructor&) = default; - ArchetypeDestructor& operator=(ArchetypeDestructor&&) = default; - ArchetypeDestructor& operator=(const ArchetypeDestructor&) = default; - ~ArchetypeDestructor() noexcept(DestructibleValue == destructible::nothrow) {} -}; - -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue, - copy_constructible CopyConstructibleValue, - move_assignable MoveAssignableValue, - copy_assignable CopyAssignableValue> -struct ArchetypeDestructor<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue, - CopyAssignableValue, destructible::trivial> - : ArchetypeCopyAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue, - CopyAssignableValue> { - explicit ArchetypeDestructor(MakeArchetypeState, - ArchetypeState state) noexcept - : ArchetypeCopyAssign<DefaultConstructibleValue, MoveConstructibleValue, - CopyConstructibleValue, MoveAssignableValue, - CopyAssignableValue>(MakeArchetypeState(), state) {} - - ArchetypeDestructor() = default; -}; - -// An alias to the top of the chain of bases for special-member functions. -// NOTE: move_constructible::maybe, move_assignable::maybe, and -// destructible::maybe are handled in the top-level type by way of SFINAE. -// Because of this, we never instantiate the base classes with -// move_constructible::maybe, move_assignable::maybe, or destructible::maybe so -// that we minimize the number of different possible type-template -// instantiations. -template <default_constructible DefaultConstructibleValue, - move_constructible MoveConstructibleValue, - copy_constructible CopyConstructibleValue, - move_assignable MoveAssignableValue, - copy_assignable CopyAssignableValue, destructible DestructibleValue> -using ArchetypeSpecialMembersBase = ArchetypeDestructor< - DefaultConstructibleValue, - MoveConstructibleValue != move_constructible::maybe - ? MoveConstructibleValue - : move_constructible::nothrow, - CopyConstructibleValue, - MoveAssignableValue != move_assignable::maybe ? MoveAssignableValue - : move_assignable::nothrow, - CopyAssignableValue, - DestructibleValue != destructible::maybe ? DestructibleValue - : destructible::nothrow>; - -// A function that is used to create an archetype with some associated state. -template <class Arch> -Arch MakeArchetype(ArchetypeState state) noexcept { - static_assert(IsArchetype<Arch>::value, - "The explicit template argument to MakeArchetype is required " - "to be an Archetype."); - return Arch(MakeArchetypeState(), state); -} - -// This is used to conditionally delete "copy" and "move" constructors in a way -// that is consistent with what the ConformanceProfile requires and that also -// strictly enforces the arguments to the copy/move to not come from implicit -// conversions when dealing with the Archetype. -template <class Prof, class T> -constexpr bool ShouldDeleteConstructor() { - return !((PropertiesOfT<Prof>::move_constructible_support != - move_constructible::maybe && - std::is_same<T, Archetype<Prof>>::value) || - (PropertiesOfT<Prof>::copy_constructible_support != - copy_constructible::maybe && - (std::is_same<T, const Archetype<Prof>&>::value || - std::is_same<T, Archetype<Prof>&>::value || - std::is_same<T, const Archetype<Prof>>::value))); -} - -// This is used to conditionally delete "copy" and "move" assigns in a way -// that is consistent with what the ConformanceProfile requires and that also -// strictly enforces the arguments to the copy/move to not come from implicit -// conversions when dealing with the Archetype. -template <class Prof, class T> -constexpr bool ShouldDeleteAssign() { - return !( - (PropertiesOfT<Prof>::move_assignable_support != move_assignable::maybe && - std::is_same<T, Archetype<Prof>>::value) || - (PropertiesOfT<Prof>::copy_assignable_support != copy_assignable::maybe && - (std::is_same<T, const Archetype<Prof>&>::value || - std::is_same<T, Archetype<Prof>&>::value || - std::is_same<T, const Archetype<Prof>>::value))); -} - -// TODO(calabrese) Inherit from a chain of secondary bases to pull in the -// associated functions of other concepts. -template <class Prof, class Enabler> -class Archetype : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support> { - static_assert(std::is_same<Enabler, void>::value, - "An explicit type must not be passed as the second template " - "argument to 'Archetype`."); - - // The cases mentioned in these static_asserts are expected to be handled in - // the partial template specializations of Archetype that follow this - // definition. - static_assert(PropertiesOfT<Prof>::destructible_support != - destructible::maybe, - ""); - static_assert(PropertiesOfT<Prof>::move_constructible_support != - move_constructible::maybe || - PropertiesOfT<Prof>::copy_constructible_support == - copy_constructible::maybe, - ""); - static_assert(PropertiesOfT<Prof>::move_assignable_support != - move_assignable::maybe || - PropertiesOfT<Prof>::copy_assignable_support == - copy_assignable::maybe, - ""); - - public: - Archetype() = default; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteConstructor<Prof, T>()>::type* = nullptr> - Archetype(T&&) = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteAssign<Prof, T>()>::type* = nullptr> - Archetype& operator=(T&&) = delete; - - using ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>::archetype_state; - - private: - explicit Archetype(MakeArchetypeState, ArchetypeState state) noexcept - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>(MakeArchetypeState(), - state) {} - - friend Archetype MakeArchetype<Archetype>(ArchetypeState) noexcept; -}; - -template <class Prof> -class Archetype<Prof, typename std::enable_if< - PropertiesOfT<Prof>::move_constructible_support != - move_constructible::maybe && - PropertiesOfT<Prof>::move_assignable_support == - move_assignable::maybe && - PropertiesOfT<Prof>::destructible_support != - destructible::maybe>::type> - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support> { - public: - Archetype() = default; - Archetype(Archetype&&) = default; - Archetype(const Archetype&) = default; - Archetype& operator=(Archetype&&) = delete; - Archetype& operator=(const Archetype&) = default; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteConstructor<Prof, T>()>::type* = nullptr> - Archetype(T&&) = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteAssign<Prof, T>()>::type* = nullptr> - Archetype& operator=(T&&) = delete; - - using ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>::archetype_state; - - private: - explicit Archetype(MakeArchetypeState, ArchetypeState state) noexcept - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>(MakeArchetypeState(), - state) {} - - friend Archetype MakeArchetype<Archetype>(ArchetypeState) noexcept; -}; - -template <class Prof> -class Archetype<Prof, typename std::enable_if< - PropertiesOfT<Prof>::move_constructible_support == - move_constructible::maybe && - PropertiesOfT<Prof>::move_assignable_support == - move_assignable::maybe && - PropertiesOfT<Prof>::destructible_support != - destructible::maybe>::type> - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support> { - public: - Archetype() = default; - Archetype(Archetype&&) = delete; - Archetype(const Archetype&) = default; - Archetype& operator=(Archetype&&) = delete; - Archetype& operator=(const Archetype&) = default; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteConstructor<Prof, T>()>::type* = nullptr> - Archetype(T&&) = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteAssign<Prof, T>()>::type* = nullptr> - Archetype& operator=(T&&) = delete; - - using ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>::archetype_state; - - private: - explicit Archetype(MakeArchetypeState, ArchetypeState state) noexcept - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>(MakeArchetypeState(), - state) {} - - friend Archetype MakeArchetype<Archetype>(ArchetypeState) noexcept; -}; - -template <class Prof> -class Archetype<Prof, typename std::enable_if< - PropertiesOfT<Prof>::move_constructible_support == - move_constructible::maybe && - PropertiesOfT<Prof>::move_assignable_support != - move_assignable::maybe && - PropertiesOfT<Prof>::destructible_support != - destructible::maybe>::type> - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support> { - public: - Archetype() = default; - Archetype(Archetype&&) = delete; - Archetype(const Archetype&) = default; - Archetype& operator=(Archetype&&) = default; - Archetype& operator=(const Archetype&) = default; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteConstructor<Prof, T>()>::type* = nullptr> - Archetype(T&&) = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteAssign<Prof, T>()>::type* = nullptr> - Archetype& operator=(T&&) = delete; - - using ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>::archetype_state; - - private: - explicit Archetype(MakeArchetypeState, ArchetypeState state) noexcept - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>(MakeArchetypeState(), - state) {} - - friend Archetype MakeArchetype<Archetype>(ArchetypeState) noexcept; -}; - -template <class Prof> -class Archetype<Prof, typename std::enable_if< - PropertiesOfT<Prof>::move_constructible_support != - move_constructible::maybe && - PropertiesOfT<Prof>::move_assignable_support == - move_assignable::maybe && - PropertiesOfT<Prof>::destructible_support == - destructible::maybe>::type> - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support> { - public: - Archetype() = default; - Archetype(Archetype&&) = default; - Archetype(const Archetype&) = default; - Archetype& operator=(Archetype&&) = delete; - Archetype& operator=(const Archetype&) = default; - ~Archetype() = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteConstructor<Prof, T>()>::type* = nullptr> - Archetype(T&&) = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteAssign<Prof, T>()>::type* = nullptr> - Archetype& operator=(T&&) = delete; - - using ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>::archetype_state; - - private: - explicit Archetype(MakeArchetypeState, ArchetypeState state) noexcept - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>(MakeArchetypeState(), - state) {} - - friend Archetype MakeArchetype<Archetype>(ArchetypeState) noexcept; -}; - -template <class Prof> -class Archetype<Prof, typename std::enable_if< - PropertiesOfT<Prof>::move_constructible_support == - move_constructible::maybe && - PropertiesOfT<Prof>::move_assignable_support == - move_assignable::maybe && - PropertiesOfT<Prof>::destructible_support == - destructible::maybe>::type> - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support> { - public: - Archetype() = default; - Archetype(Archetype&&) = delete; - Archetype(const Archetype&) = default; - Archetype& operator=(Archetype&&) = delete; - Archetype& operator=(const Archetype&) = default; - ~Archetype() = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteConstructor<Prof, T>()>::type* = nullptr> - Archetype(T&&) = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteAssign<Prof, T>()>::type* = nullptr> - Archetype& operator=(T&&) = delete; - - using ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>::archetype_state; - - private: - explicit Archetype(MakeArchetypeState, ArchetypeState state) noexcept - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>(MakeArchetypeState(), - state) {} - - friend Archetype MakeArchetype<Archetype>(ArchetypeState) noexcept; -}; - -template <class Prof> -class Archetype<Prof, typename std::enable_if< - PropertiesOfT<Prof>::move_constructible_support == - move_constructible::maybe && - PropertiesOfT<Prof>::move_assignable_support != - move_assignable::maybe && - PropertiesOfT<Prof>::destructible_support == - destructible::maybe>::type> - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support> { - public: - Archetype() = default; - Archetype(Archetype&&) = delete; - Archetype(const Archetype&) = default; - Archetype& operator=(Archetype&&) = default; - Archetype& operator=(const Archetype&) = default; - ~Archetype() = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteConstructor<Prof, T>()>::type* = nullptr> - Archetype(T&&) = delete; - - // Disallow moves when requested, and disallow implicit conversions. - template <class T, typename std::enable_if< - ShouldDeleteAssign<Prof, T>()>::type* = nullptr> - Archetype& operator=(T&&) = delete; - - using ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>::archetype_state; - - private: - explicit Archetype(MakeArchetypeState, ArchetypeState state) noexcept - : ArchetypeSpecialMembersBase< - PropertiesOfT<Prof>::default_constructible_support, - PropertiesOfT<Prof>::move_constructible_support, - PropertiesOfT<Prof>::copy_constructible_support, - PropertiesOfT<Prof>::move_assignable_support, - PropertiesOfT<Prof>::copy_assignable_support, - PropertiesOfT<Prof>::destructible_support>(MakeArchetypeState(), - state) {} - - friend Archetype MakeArchetype<Archetype>(ArchetypeState) noexcept; -}; - -// Explicitly deleted swap for Archetype if the profile does not require swap. -// It is important to delete it rather than simply leave it out so that the -// "using std::swap;" idiom will result in this deleted overload being picked. -template <class Prof, - absl::enable_if_t<!PropertiesOfT<Prof>::is_swappable, int> = 0> -void swap(Archetype<Prof>&, Archetype<Prof>&) = delete; // NOLINT - -// A conditionally-noexcept swap implementation for Archetype when the profile -// supports swap. -template <class Prof, - absl::enable_if_t<PropertiesOfT<Prof>::is_swappable, int> = 0> -void swap(Archetype<Prof>& lhs, Archetype<Prof>& rhs) // NOLINT - noexcept(PropertiesOfT<Prof>::swappable_support != swappable::yes) { - std::swap(lhs.archetype_state, rhs.archetype_state); -} - -// A convertible-to-bool type that is used as the return type of comparison -// operators since the standard doesn't always require exactly bool. -struct NothrowBool { - explicit NothrowBool() = delete; - ~NothrowBool() = default; - - // TODO(calabrese) Delete the copy constructor in C++17 mode since guaranteed - // elision makes it not required when returning from a function. - // NothrowBool(NothrowBool const&) = delete; - - NothrowBool& operator=(NothrowBool const&) = delete; - - explicit operator bool() const noexcept { return value; } - - static NothrowBool make(bool const value) noexcept { - return NothrowBool(value); - } - - private: - explicit NothrowBool(bool const value) noexcept : value(value) {} - - bool value; -}; - -// A convertible-to-bool type that is used as the return type of comparison -// operators since the standard doesn't always require exactly bool. -// Note: ExceptionalBool has a conversion operator that is not noexcept, so -// that even when a comparison operator is noexcept, that operation may still -// potentially throw when converted to bool. -struct ExceptionalBool { - explicit ExceptionalBool() = delete; - ~ExceptionalBool() = default; - - // TODO(calabrese) Delete the copy constructor in C++17 mode since guaranteed - // elision makes it not required when returning from a function. - // ExceptionalBool(ExceptionalBool const&) = delete; - - ExceptionalBool& operator=(ExceptionalBool const&) = delete; - - explicit operator bool() const { return value; } // NOLINT - - static ExceptionalBool make(bool const value) noexcept { - return ExceptionalBool(value); - } - - private: - explicit ExceptionalBool(bool const value) noexcept : value(value) {} - - bool value; -}; - -// The following macro is only used as a helper in this file to stamp out -// comparison operator definitions. It is undefined after usage. -// -// NOTE: Non-nothrow operators throw via their result's conversion to bool even -// though the operation itself is noexcept. -#define ABSL_TYPES_INTERNAL_OP(enum_name, op) \ - template <class Prof> \ - absl::enable_if_t<!PropertiesOfT<Prof>::is_##enum_name, bool> operator op( \ - const Archetype<Prof>&, const Archetype<Prof>&) = delete; \ - \ - template <class Prof> \ - typename absl::enable_if_t< \ - PropertiesOfT<Prof>::is_##enum_name, \ - std::conditional<PropertiesOfT<Prof>::enum_name##_support == \ - enum_name::nothrow, \ - NothrowBool, ExceptionalBool>>::type \ - operator op(const Archetype<Prof>& lhs, \ - const Archetype<Prof>& rhs) noexcept { \ - return absl::conditional_t< \ - PropertiesOfT<Prof>::enum_name##_support == enum_name::nothrow, \ - NothrowBool, ExceptionalBool>::make(lhs.archetype_state op \ - rhs.archetype_state); \ - } - -ABSL_TYPES_INTERNAL_OP(equality_comparable, ==); -ABSL_TYPES_INTERNAL_OP(inequality_comparable, !=); -ABSL_TYPES_INTERNAL_OP(less_than_comparable, <); -ABSL_TYPES_INTERNAL_OP(less_equal_comparable, <=); -ABSL_TYPES_INTERNAL_OP(greater_equal_comparable, >=); -ABSL_TYPES_INTERNAL_OP(greater_than_comparable, >); - -#undef ABSL_TYPES_INTERNAL_OP - -// Base class for std::hash specializations when an Archetype doesn't support -// hashing. -struct PoisonedHash { - PoisonedHash() = delete; - PoisonedHash(const PoisonedHash&) = delete; - PoisonedHash& operator=(const PoisonedHash&) = delete; -}; - -// Base class for std::hash specializations when an Archetype supports hashing. -template <class Prof> -struct EnabledHash { - using argument_type = Archetype<Prof>; - using result_type = std::size_t; - result_type operator()(const argument_type& arg) const { - return std::hash<ArchetypeState>()(arg.archetype_state); - } -}; - -} // namespace types_internal -ABSL_NAMESPACE_END -} // namespace absl - -namespace std { - -template <class Prof> // NOLINT -struct hash<::absl::types_internal::Archetype<Prof>> - : conditional<::absl::types_internal::PropertiesOfT<Prof>::is_hashable, - ::absl::types_internal::EnabledHash<Prof>, - ::absl::types_internal::PoisonedHash>::type {}; - -} // namespace std - -#endif // ABSL_TYPES_INTERNAL_CONFORMANCE_ARCHETYPE_H_ diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_profile.h b/contrib/restricted/abseil-cpp/absl/types/internal/conformance_profile.h deleted file mode 100644 index cf64ff4fcd..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_profile.h +++ /dev/null @@ -1,931 +0,0 @@ -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// conformance_profiles.h -// ----------------------------------------------------------------------------- -// -// This file contains templates for representing "Regularity Profiles" and -// concisely-named versions of commonly used Regularity Profiles. -// -// A Regularity Profile is a compile-time description of the types of operations -// that a given type supports, along with properties of those operations when -// they do exist. For instance, a Regularity Profile may describe a type that -// has a move-constructor that is noexcept and a copy constructor that is not -// noexcept. This description can then be examined and passed around to other -// templates for the purposes of asserting expectations on user-defined types -// via a series trait checks, or for determining what kinds of run-time tests -// are able to be performed. -// -// Regularity Profiles are also used when creating "archetypes," which are -// minimum-conforming types that meet all of the requirements of a given -// Regularity Profile. For more information regarding archetypes, see -// "conformance_archetypes.h". - -#ifndef ABSL_TYPES_INTERNAL_CONFORMANCE_PROFILE_H_ -#define ABSL_TYPES_INTERNAL_CONFORMANCE_PROFILE_H_ - -#include <set> -#include <type_traits> -#include <utility> -#include <vector> - -#include "gtest/gtest.h" -#include "absl/algorithm/container.h" -#include "absl/meta/type_traits.h" -#include "absl/strings/ascii.h" -#include "absl/strings/str_cat.h" -#include "absl/strings/string_view.h" -#include "absl/types/internal/conformance_testing_helpers.h" -#include "absl/utility/utility.h" - -// TODO(calabrese) Add support for extending profiles. - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace types_internal { - -// Converts an enum to its underlying integral value. -template <typename Enum> -constexpr absl::underlying_type_t<Enum> UnderlyingValue(Enum value) { - return static_cast<absl::underlying_type_t<Enum>>(value); -} - -// A tag type used in place of a matcher when checking that an assertion result -// does not actually contain any errors. -struct NoError {}; - -// ----------------------------------------------------------------------------- -// ConformanceErrors -// ----------------------------------------------------------------------------- -class ConformanceErrors { - public: - // Setup the error reporting mechanism by seeding it with the name of the type - // that is being tested. - explicit ConformanceErrors(std::string type_name) - : assertion_result_(false), type_name_(std::move(type_name)) { - assertion_result_ << "\n\n" - "Assuming the following type alias:\n" - "\n" - " using _T = " - << type_name_ << ";\n\n"; - outputDivider(); - } - - // Adds the test name to the list of successfully run tests iff it was not - // previously reported as failing. This behavior is useful for tests that - // have multiple parts, where failures and successes are reported individually - // with the same test name. - void addTestSuccess(absl::string_view test_name) { - auto normalized_test_name = absl::AsciiStrToLower(test_name); - - // If the test is already reported as failing, do not add it to the list of - // successes. - if (test_failures_.find(normalized_test_name) == test_failures_.end()) { - test_successes_.insert(std::move(normalized_test_name)); - } - } - - // Streams a single error description into the internal buffer (a visual - // divider is automatically inserted after the error so that multiple errors - // are visibly distinct). - // - // This function increases the error count by 1. - // - // TODO(calabrese) Determine desired behavior when if this function throws. - template <class... P> - void addTestFailure(absl::string_view test_name, const P&... args) { - // Output a message related to the test failure. - assertion_result_ << "\n\n" - "Failed test: " - << test_name << "\n\n"; - addTestFailureImpl(args...); - assertion_result_ << "\n\n"; - outputDivider(); - - auto normalized_test_name = absl::AsciiStrToLower(test_name); - - // If previous parts of this test succeeded, remove it from that set. - test_successes_.erase(normalized_test_name); - - // Add the test name to the list of failed tests. - test_failures_.insert(std::move(normalized_test_name)); - - has_error_ = true; - } - - // Convert this object into a testing::AssertionResult instance such that it - // can be used with gtest. - ::testing::AssertionResult assertionResult() const { - return has_error_ ? assertion_result_ : ::testing::AssertionSuccess(); - } - - // Convert this object into a testing::AssertionResult instance such that it - // can be used with gtest. This overload expects errors, using the specified - // matcher. - ::testing::AssertionResult expectFailedTests( - const std::set<std::string>& test_names) const { - // Since we are expecting nonconformance, output an error message when the - // type actually conformed to the specified profile. - if (!has_error_) { - return ::testing::AssertionFailure() - << "Unexpected conformance of type:\n" - " " - << type_name_ << "\n\n"; - } - - // Get a list of all expected failures that did not actually fail - // (or that were not run). - std::vector<std::string> nonfailing_tests; - absl::c_set_difference(test_names, test_failures_, - std::back_inserter(nonfailing_tests)); - - // Get a list of all "expected failures" that were never actually run. - std::vector<std::string> unrun_tests; - absl::c_set_difference(nonfailing_tests, test_successes_, - std::back_inserter(unrun_tests)); - - // Report when the user specified tests that were not run. - if (!unrun_tests.empty()) { - const bool tests_were_run = - !(test_failures_.empty() && test_successes_.empty()); - - // Prepare an assertion result used in the case that tests pass that were - // expected to fail. - ::testing::AssertionResult result = ::testing::AssertionFailure(); - result << "When testing type:\n " << type_name_ - << "\n\nThe following tests were expected to fail but were not " - "run"; - - if (tests_were_run) result << " (was the test name spelled correctly?)"; - - result << ":\n\n"; - - // List all of the tests that unexpectedly passed. - for (const auto& test_name : unrun_tests) { - result << " " << test_name << "\n"; - } - - if (!tests_were_run) result << "\nNo tests were run."; - - if (!test_failures_.empty()) { - // List test failures - result << "\nThe tests that were run and failed are:\n\n"; - for (const auto& test_name : test_failures_) { - result << " " << test_name << "\n"; - } - } - - if (!test_successes_.empty()) { - // List test successes - result << "\nThe tests that were run and succeeded are:\n\n"; - for (const auto& test_name : test_successes_) { - result << " " << test_name << "\n"; - } - } - - return result; - } - - // If some tests passed when they were expected to fail, alert the caller. - if (nonfailing_tests.empty()) return ::testing::AssertionSuccess(); - - // Prepare an assertion result used in the case that tests pass that were - // expected to fail. - ::testing::AssertionResult unexpected_successes = - ::testing::AssertionFailure(); - unexpected_successes << "When testing type:\n " << type_name_ - << "\n\nThe following tests passed when they were " - "expected to fail:\n\n"; - - // List all of the tests that unexpectedly passed. - for (const auto& test_name : nonfailing_tests) { - unexpected_successes << " " << test_name << "\n"; - } - - return unexpected_successes; - } - - private: - void outputDivider() { - assertion_result_ << "========================================"; - } - - void addTestFailureImpl() {} - - template <class H, class... T> - void addTestFailureImpl(const H& head, const T&... tail) { - assertion_result_ << head; - addTestFailureImpl(tail...); - } - - ::testing::AssertionResult assertion_result_; - std::set<std::string> test_failures_; - std::set<std::string> test_successes_; - std::string type_name_; - bool has_error_ = false; -}; - -template <class T, class /*Enabler*/ = void> -struct PropertiesOfImpl {}; - -template <class T> -struct PropertiesOfImpl<T, absl::void_t<typename T::properties>> { - using type = typename T::properties; -}; - -template <class T> -struct PropertiesOfImpl<T, absl::void_t<typename T::profile_alias_of>> { - using type = typename PropertiesOfImpl<typename T::profile_alias_of>::type; -}; - -template <class T> -struct PropertiesOf : PropertiesOfImpl<T> {}; - -template <class T> -using PropertiesOfT = typename PropertiesOf<T>::type; - -// NOTE: These enums use this naming convention to be consistent with the -// standard trait names, which is useful since it allows us to match up each -// enum name with a corresponding trait name in macro definitions. - -// An enum that describes the various expectations on an operations existence. -enum class function_support { maybe, yes, nothrow, trivial }; - -constexpr const char* PessimisticPropertyDescription(function_support v) { - return v == function_support::maybe - ? "no" - : v == function_support::yes - ? "yes, potentially throwing" - : v == function_support::nothrow ? "yes, nothrow" - : "yes, trivial"; -} - -// Return a string that describes the kind of property support that was -// expected. -inline std::string ExpectedFunctionKindList(function_support min, - function_support max) { - if (min == max) { - std::string result = - absl::StrCat("Expected:\n ", - PessimisticPropertyDescription( - static_cast<function_support>(UnderlyingValue(min))), - "\n"); - return result; - } - - std::string result = "Expected one of:\n"; - for (auto curr_support = UnderlyingValue(min); - curr_support <= UnderlyingValue(max); ++curr_support) { - absl::StrAppend(&result, " ", - PessimisticPropertyDescription( - static_cast<function_support>(curr_support)), - "\n"); - } - - return result; -} - -template <class Enum> -void ExpectModelOfImpl(ConformanceErrors* errors, Enum min_support, - Enum max_support, Enum kind) { - const auto kind_value = UnderlyingValue(kind); - const auto min_support_value = UnderlyingValue(min_support); - const auto max_support_value = UnderlyingValue(max_support); - - if (!(kind_value >= min_support_value && kind_value <= max_support_value)) { - errors->addTestFailure( - PropertyName(kind), "**Failed property expectation**\n\n", - ExpectedFunctionKindList( - static_cast<function_support>(min_support_value), - static_cast<function_support>(max_support_value)), - '\n', "Actual:\n ", - PessimisticPropertyDescription( - static_cast<function_support>(kind_value))); - } else { - errors->addTestSuccess(PropertyName(kind)); - } -} - -#define ABSL_INTERNAL_SPECIAL_MEMBER_FUNCTION_ENUM(description, name) \ - enum class name { maybe, yes, nothrow, trivial }; \ - \ - constexpr const char* PropertyName(name v) { return description; } \ - static_assert(true, "") // Force a semicolon when using this macro. - -ABSL_INTERNAL_SPECIAL_MEMBER_FUNCTION_ENUM("support for default construction", - default_constructible); -ABSL_INTERNAL_SPECIAL_MEMBER_FUNCTION_ENUM("support for move construction", - move_constructible); -ABSL_INTERNAL_SPECIAL_MEMBER_FUNCTION_ENUM("support for copy construction", - copy_constructible); -ABSL_INTERNAL_SPECIAL_MEMBER_FUNCTION_ENUM("support for move assignment", - move_assignable); -ABSL_INTERNAL_SPECIAL_MEMBER_FUNCTION_ENUM("support for copy assignment", - copy_assignable); -ABSL_INTERNAL_SPECIAL_MEMBER_FUNCTION_ENUM("support for destruction", - destructible); - -#undef ABSL_INTERNAL_SPECIAL_MEMBER_FUNCTION_ENUM - -#define ABSL_INTERNAL_INTRINSIC_FUNCTION_ENUM(description, name) \ - enum class name { maybe, yes, nothrow }; \ - \ - constexpr const char* PropertyName(name v) { return description; } \ - static_assert(true, "") // Force a semicolon when using this macro. - -ABSL_INTERNAL_INTRINSIC_FUNCTION_ENUM("support for ==", equality_comparable); -ABSL_INTERNAL_INTRINSIC_FUNCTION_ENUM("support for !=", inequality_comparable); -ABSL_INTERNAL_INTRINSIC_FUNCTION_ENUM("support for <", less_than_comparable); -ABSL_INTERNAL_INTRINSIC_FUNCTION_ENUM("support for <=", less_equal_comparable); -ABSL_INTERNAL_INTRINSIC_FUNCTION_ENUM("support for >=", - greater_equal_comparable); -ABSL_INTERNAL_INTRINSIC_FUNCTION_ENUM("support for >", greater_than_comparable); - -ABSL_INTERNAL_INTRINSIC_FUNCTION_ENUM("support for swap", swappable); - -#undef ABSL_INTERNAL_INTRINSIC_FUNCTION_ENUM - -enum class hashable { maybe, yes }; - -constexpr const char* PropertyName(hashable v) { - return "support for std::hash"; -} - -template <class T> -using AlwaysFalse = std::false_type; - -#define ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_SPECIAL_MEMBER(name, property) \ - template <class T> \ - constexpr property property##_support_of() { \ - return std::is_##property<T>::value \ - ? std::is_nothrow_##property<T>::value \ - ? absl::is_trivially_##property<T>::value \ - ? property::trivial \ - : property::nothrow \ - : property::yes \ - : property::maybe; \ - } \ - \ - template <class T, class MinProf, class MaxProf> \ - void ExpectModelOf##name(ConformanceErrors* errors) { \ - (ExpectModelOfImpl)(errors, PropertiesOfT<MinProf>::property##_support, \ - PropertiesOfT<MaxProf>::property##_support, \ - property##_support_of<T>()); \ - } - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_SPECIAL_MEMBER(DefaultConstructible, - default_constructible); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_SPECIAL_MEMBER(MoveConstructible, - move_constructible); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_SPECIAL_MEMBER(CopyConstructible, - copy_constructible); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_SPECIAL_MEMBER(MoveAssignable, - move_assignable); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_SPECIAL_MEMBER(CopyAssignable, - copy_assignable); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_SPECIAL_MEMBER(Destructible, destructible); - -#undef ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_SPECIAL_MEMBER - -void BoolFunction(bool) noexcept; - -//////////////////////////////////////////////////////////////////////////////// -// -// A metafunction for checking if an operation exists through SFINAE. -// -// `T` is the type to test and Op is an alias containing the expression to test. -template <class T, template <class...> class Op, class = void> -struct IsOpableImpl : std::false_type {}; - -template <class T, template <class...> class Op> -struct IsOpableImpl<T, Op, absl::void_t<Op<T>>> : std::true_type {}; - -template <template <class...> class Op> -struct IsOpable { - template <class T> - using apply = typename IsOpableImpl<T, Op>::type; -}; -// -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// -// A metafunction for checking if an operation exists and is also noexcept -// through SFINAE and the noexcept operator. -/// -// `T` is the type to test and Op is an alias containing the expression to test. -template <class T, template <class...> class Op, class = void> -struct IsNothrowOpableImpl : std::false_type {}; - -template <class T, template <class...> class Op> -struct IsNothrowOpableImpl<T, Op, absl::enable_if_t<Op<T>::value>> - : std::true_type {}; - -template <template <class...> class Op> -struct IsNothrowOpable { - template <class T> - using apply = typename IsNothrowOpableImpl<T, Op>::type; -}; -// -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// -// A macro that produces the necessary function for reporting what kind of -// support a specific comparison operation has and a function for reporting an -// error if a given type's support for that operation does not meet the expected -// requirements. -#define ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_COMPARISON(name, property, op) \ - template <class T, \ - class Result = std::integral_constant< \ - bool, noexcept((BoolFunction)(std::declval<const T&>() op \ - std::declval<const T&>()))>> \ - using name = Result; \ - \ - template <class T> \ - constexpr property property##_support_of() { \ - return IsOpable<name>::apply<T>::value \ - ? IsNothrowOpable<name>::apply<T>::value ? property::nothrow \ - : property::yes \ - : property::maybe; \ - } \ - \ - template <class T, class MinProf, class MaxProf> \ - void ExpectModelOf##name(ConformanceErrors* errors) { \ - (ExpectModelOfImpl)(errors, PropertiesOfT<MinProf>::property##_support, \ - PropertiesOfT<MaxProf>::property##_support, \ - property##_support_of<T>()); \ - } -// -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// -// Generate the necessary support-checking and error reporting functions for -// each of the comparison operators. -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_COMPARISON(EqualityComparable, - equality_comparable, ==); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_COMPARISON(InequalityComparable, - inequality_comparable, !=); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_COMPARISON(LessThanComparable, - less_than_comparable, <); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_COMPARISON(LessEqualComparable, - less_equal_comparable, <=); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_COMPARISON(GreaterEqualComparable, - greater_equal_comparable, >=); - -ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_COMPARISON(GreaterThanComparable, - greater_than_comparable, >); - -#undef ABSL_INTERNAL_PESSIMISTIC_MODEL_OF_COMPARISON -// -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// -// The necessary support-checking and error-reporting functions for swap. -template <class T> -constexpr swappable swappable_support_of() { - return type_traits_internal::IsSwappable<T>::value - ? type_traits_internal::IsNothrowSwappable<T>::value - ? swappable::nothrow - : swappable::yes - : swappable::maybe; -} - -template <class T, class MinProf, class MaxProf> -void ExpectModelOfSwappable(ConformanceErrors* errors) { - (ExpectModelOfImpl)(errors, PropertiesOfT<MinProf>::swappable_support, - PropertiesOfT<MaxProf>::swappable_support, - swappable_support_of<T>()); -} -// -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// -// The necessary support-checking and error-reporting functions for std::hash. -template <class T> -constexpr hashable hashable_support_of() { - return type_traits_internal::IsHashable<T>::value ? hashable::yes - : hashable::maybe; -} - -template <class T, class MinProf, class MaxProf> -void ExpectModelOfHashable(ConformanceErrors* errors) { - (ExpectModelOfImpl)(errors, PropertiesOfT<MinProf>::hashable_support, - PropertiesOfT<MaxProf>::hashable_support, - hashable_support_of<T>()); -} -// -//////////////////////////////////////////////////////////////////////////////// - -template < - default_constructible DefaultConstructibleValue = - default_constructible::maybe, - move_constructible MoveConstructibleValue = move_constructible::maybe, - copy_constructible CopyConstructibleValue = copy_constructible::maybe, - move_assignable MoveAssignableValue = move_assignable::maybe, - copy_assignable CopyAssignableValue = copy_assignable::maybe, - destructible DestructibleValue = destructible::maybe, - equality_comparable EqualityComparableValue = equality_comparable::maybe, - inequality_comparable InequalityComparableValue = - inequality_comparable::maybe, - less_than_comparable LessThanComparableValue = less_than_comparable::maybe, - less_equal_comparable LessEqualComparableValue = - less_equal_comparable::maybe, - greater_equal_comparable GreaterEqualComparableValue = - greater_equal_comparable::maybe, - greater_than_comparable GreaterThanComparableValue = - greater_than_comparable::maybe, - swappable SwappableValue = swappable::maybe, - hashable HashableValue = hashable::maybe> -struct ConformanceProfile { - using properties = ConformanceProfile; - - static constexpr default_constructible - default_constructible_support = // NOLINT - DefaultConstructibleValue; - - static constexpr move_constructible move_constructible_support = // NOLINT - MoveConstructibleValue; - - static constexpr copy_constructible copy_constructible_support = // NOLINT - CopyConstructibleValue; - - static constexpr move_assignable move_assignable_support = // NOLINT - MoveAssignableValue; - - static constexpr copy_assignable copy_assignable_support = // NOLINT - CopyAssignableValue; - - static constexpr destructible destructible_support = // NOLINT - DestructibleValue; - - static constexpr equality_comparable equality_comparable_support = // NOLINT - EqualityComparableValue; - - static constexpr inequality_comparable - inequality_comparable_support = // NOLINT - InequalityComparableValue; - - static constexpr less_than_comparable - less_than_comparable_support = // NOLINT - LessThanComparableValue; - - static constexpr less_equal_comparable - less_equal_comparable_support = // NOLINT - LessEqualComparableValue; - - static constexpr greater_equal_comparable - greater_equal_comparable_support = // NOLINT - GreaterEqualComparableValue; - - static constexpr greater_than_comparable - greater_than_comparable_support = // NOLINT - GreaterThanComparableValue; - - static constexpr swappable swappable_support = SwappableValue; // NOLINT - - static constexpr hashable hashable_support = HashableValue; // NOLINT - - static constexpr bool is_default_constructible = // NOLINT - DefaultConstructibleValue != default_constructible::maybe; - - static constexpr bool is_move_constructible = // NOLINT - MoveConstructibleValue != move_constructible::maybe; - - static constexpr bool is_copy_constructible = // NOLINT - CopyConstructibleValue != copy_constructible::maybe; - - static constexpr bool is_move_assignable = // NOLINT - MoveAssignableValue != move_assignable::maybe; - - static constexpr bool is_copy_assignable = // NOLINT - CopyAssignableValue != copy_assignable::maybe; - - static constexpr bool is_destructible = // NOLINT - DestructibleValue != destructible::maybe; - - static constexpr bool is_equality_comparable = // NOLINT - EqualityComparableValue != equality_comparable::maybe; - - static constexpr bool is_inequality_comparable = // NOLINT - InequalityComparableValue != inequality_comparable::maybe; - - static constexpr bool is_less_than_comparable = // NOLINT - LessThanComparableValue != less_than_comparable::maybe; - - static constexpr bool is_less_equal_comparable = // NOLINT - LessEqualComparableValue != less_equal_comparable::maybe; - - static constexpr bool is_greater_equal_comparable = // NOLINT - GreaterEqualComparableValue != greater_equal_comparable::maybe; - - static constexpr bool is_greater_than_comparable = // NOLINT - GreaterThanComparableValue != greater_than_comparable::maybe; - - static constexpr bool is_swappable = // NOLINT - SwappableValue != swappable::maybe; - - static constexpr bool is_hashable = // NOLINT - HashableValue != hashable::maybe; -}; - -//////////////////////////////////////////////////////////////////////////////// -// -// Compliant SFINAE-friendliness is not always present on the standard library -// implementations that we support. This helper-struct (and associated enum) is -// used as a means to conditionally check the hashability support of a type. -enum class CheckHashability { no, yes }; - -template <class T, CheckHashability ShouldCheckHashability> -struct conservative_hashable_support_of; - -template <class T> -struct conservative_hashable_support_of<T, CheckHashability::no> { - static constexpr hashable Invoke() { return hashable::maybe; } -}; - -template <class T> -struct conservative_hashable_support_of<T, CheckHashability::yes> { - static constexpr hashable Invoke() { return hashable_support_of<T>(); } -}; -// -//////////////////////////////////////////////////////////////////////////////// - -// The ConformanceProfile that is expected based on introspection into the type -// by way of trait checks. -template <class T, CheckHashability ShouldCheckHashability> -struct SyntacticConformanceProfileOf { - using properties = ConformanceProfile< - default_constructible_support_of<T>(), move_constructible_support_of<T>(), - copy_constructible_support_of<T>(), move_assignable_support_of<T>(), - copy_assignable_support_of<T>(), destructible_support_of<T>(), - equality_comparable_support_of<T>(), - inequality_comparable_support_of<T>(), - less_than_comparable_support_of<T>(), - less_equal_comparable_support_of<T>(), - greater_equal_comparable_support_of<T>(), - greater_than_comparable_support_of<T>(), swappable_support_of<T>(), - conservative_hashable_support_of<T, ShouldCheckHashability>::Invoke()>; -}; - -#define ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF_IMPL(type, name) \ - template <default_constructible DefaultConstructibleValue, \ - move_constructible MoveConstructibleValue, \ - copy_constructible CopyConstructibleValue, \ - move_assignable MoveAssignableValue, \ - copy_assignable CopyAssignableValue, \ - destructible DestructibleValue, \ - equality_comparable EqualityComparableValue, \ - inequality_comparable InequalityComparableValue, \ - less_than_comparable LessThanComparableValue, \ - less_equal_comparable LessEqualComparableValue, \ - greater_equal_comparable GreaterEqualComparableValue, \ - greater_than_comparable GreaterThanComparableValue, \ - swappable SwappableValue, hashable HashableValue> \ - constexpr type ConformanceProfile< \ - DefaultConstructibleValue, MoveConstructibleValue, \ - CopyConstructibleValue, MoveAssignableValue, CopyAssignableValue, \ - DestructibleValue, EqualityComparableValue, InequalityComparableValue, \ - LessThanComparableValue, LessEqualComparableValue, \ - GreaterEqualComparableValue, GreaterThanComparableValue, SwappableValue, \ - HashableValue>::name - -#define ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(type) \ - ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF_IMPL(type, \ - type##_support); \ - ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF_IMPL(bool, is_##type) - -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(default_constructible); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(move_constructible); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(copy_constructible); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(move_assignable); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(copy_assignable); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(destructible); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(equality_comparable); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(inequality_comparable); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(less_than_comparable); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(less_equal_comparable); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(greater_equal_comparable); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(greater_than_comparable); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(swappable); -ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF(hashable); - -#undef ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF -#undef ABSL_INTERNAL_CONFORMANCE_TESTING_DATA_MEMBER_DEF_IMPL - -// Retrieve the enum with the minimum underlying value. -// Note: std::min is not constexpr in C++11, which is why this is necessary. -template <class H> -constexpr H MinEnum(H head) { - return head; -} - -template <class H, class N, class... T> -constexpr H MinEnum(H head, N next, T... tail) { - return (UnderlyingValue)(head) < (UnderlyingValue)(next) - ? (MinEnum)(head, tail...) - : (MinEnum)(next, tail...); -} - -template <class... Profs> -struct MinimalProfiles { - static constexpr default_constructible - default_constructible_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::default_constructible_support...); - - static constexpr move_constructible move_constructible_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::move_constructible_support...); - - static constexpr copy_constructible copy_constructible_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::copy_constructible_support...); - - static constexpr move_assignable move_assignable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::move_assignable_support...); - - static constexpr copy_assignable copy_assignable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::copy_assignable_support...); - - static constexpr destructible destructible_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::destructible_support...); - - static constexpr equality_comparable equality_comparable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::equality_comparable_support...); - - static constexpr inequality_comparable - inequality_comparable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::inequality_comparable_support...); - - static constexpr less_than_comparable - less_than_comparable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::less_than_comparable_support...); - - static constexpr less_equal_comparable - less_equal_comparable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::less_equal_comparable_support...); - - static constexpr greater_equal_comparable - greater_equal_comparable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::greater_equal_comparable_support...); - - static constexpr greater_than_comparable - greater_than_comparable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::greater_than_comparable_support...); - - static constexpr swappable swappable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::swappable_support...); - - static constexpr hashable hashable_support = // NOLINT - (MinEnum)(PropertiesOfT<Profs>::hashable_support...); - - using properties = ConformanceProfile< - default_constructible_support, move_constructible_support, - copy_constructible_support, move_assignable_support, - copy_assignable_support, destructible_support, - equality_comparable_support, inequality_comparable_support, - less_than_comparable_support, less_equal_comparable_support, - greater_equal_comparable_support, greater_than_comparable_support, - swappable_support, hashable_support>; -}; - -// Retrieve the enum with the greatest underlying value. -// Note: std::max is not constexpr in C++11, which is why this is necessary. -template <class H> -constexpr H MaxEnum(H head) { - return head; -} - -template <class H, class N, class... T> -constexpr H MaxEnum(H head, N next, T... tail) { - return (UnderlyingValue)(next) < (UnderlyingValue)(head) - ? (MaxEnum)(head, tail...) - : (MaxEnum)(next, tail...); -} - -template <class... Profs> -struct CombineProfilesImpl { - static constexpr default_constructible - default_constructible_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::default_constructible_support...); - - static constexpr move_constructible move_constructible_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::move_constructible_support...); - - static constexpr copy_constructible copy_constructible_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::copy_constructible_support...); - - static constexpr move_assignable move_assignable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::move_assignable_support...); - - static constexpr copy_assignable copy_assignable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::copy_assignable_support...); - - static constexpr destructible destructible_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::destructible_support...); - - static constexpr equality_comparable equality_comparable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::equality_comparable_support...); - - static constexpr inequality_comparable - inequality_comparable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::inequality_comparable_support...); - - static constexpr less_than_comparable - less_than_comparable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::less_than_comparable_support...); - - static constexpr less_equal_comparable - less_equal_comparable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::less_equal_comparable_support...); - - static constexpr greater_equal_comparable - greater_equal_comparable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::greater_equal_comparable_support...); - - static constexpr greater_than_comparable - greater_than_comparable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::greater_than_comparable_support...); - - static constexpr swappable swappable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::swappable_support...); - - static constexpr hashable hashable_support = // NOLINT - (MaxEnum)(PropertiesOfT<Profs>::hashable_support...); - - using properties = ConformanceProfile< - default_constructible_support, move_constructible_support, - copy_constructible_support, move_assignable_support, - copy_assignable_support, destructible_support, - equality_comparable_support, inequality_comparable_support, - less_than_comparable_support, less_equal_comparable_support, - greater_equal_comparable_support, greater_than_comparable_support, - swappable_support, hashable_support>; -}; - -// NOTE: We use this as opposed to a direct alias of CombineProfilesImpl so that -// when named aliases of CombineProfiles are created (such as in -// conformance_aliases.h), we only pay for the combination algorithm on the -// profiles that are actually used. -template <class... Profs> -struct CombineProfiles { - using profile_alias_of = CombineProfilesImpl<Profs...>; -}; - -template <> -struct CombineProfiles<> { - using properties = ConformanceProfile<>; -}; - -template <class Profile, class Tag> -struct StrongProfileTypedef { - using properties = PropertiesOfT<Profile>; -}; - -template <class T, class /*Enabler*/ = void> -struct IsProfileImpl : std::false_type {}; - -template <class T> -struct IsProfileImpl<T, absl::void_t<PropertiesOfT<T>>> : std::true_type {}; - -template <class T> -struct IsProfile : IsProfileImpl<T>::type {}; - -// A tag that describes which set of properties we will check when the user -// requires a strict match in conformance (as opposed to a loose match which -// allows more-refined support of any given operation). -// -// Currently only the RegularityDomain exists and it includes all operations -// that the conformance testing suite knows about. The intent is that if the -// suite is expanded to support extension, such as for checking conformance of -// concepts like Iterators or Containers, additional corresponding domains can -// be created. -struct RegularityDomain {}; - -} // namespace types_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_TYPES_INTERNAL_CONFORMANCE_PROFILE_H_ diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_testing.h b/contrib/restricted/abseil-cpp/absl/types/internal/conformance_testing.h deleted file mode 100644 index 487b0f786b..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_testing.h +++ /dev/null @@ -1,1386 +0,0 @@ -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// conformance_testing.h -// ----------------------------------------------------------------------------- -// - -#ifndef ABSL_TYPES_INTERNAL_CONFORMANCE_TESTING_H_ -#define ABSL_TYPES_INTERNAL_CONFORMANCE_TESTING_H_ - -//////////////////////////////////////////////////////////////////////////////// -// // -// Many templates in this file take a `T` and a `Prof` type as explicit // -// template arguments. These are a type to be checked and a // -// "Regularity Profile" that describes what operations that type `T` is // -// expected to support. See "regularity_profiles.h" for more details // -// regarding Regularity Profiles. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#include <cstddef> -#include <set> -#include <tuple> -#include <type_traits> -#include <utility> - -#include "gtest/gtest.h" -#include "absl/meta/type_traits.h" -#include "absl/strings/ascii.h" -#include "absl/strings/str_cat.h" -#include "absl/strings/string_view.h" -#include "absl/types/internal/conformance_aliases.h" -#include "absl/types/internal/conformance_archetype.h" -#include "absl/types/internal/conformance_profile.h" -#include "absl/types/internal/conformance_testing_helpers.h" -#include "absl/types/internal/parentheses.h" -#include "absl/types/internal/transform_args.h" -#include "absl/utility/utility.h" - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace types_internal { - -// Returns true if the compiler incorrectly greedily instantiates constexpr -// templates in any unevaluated context. -constexpr bool constexpr_instantiation_when_unevaluated() { -#if defined(__apple_build_version__) // TODO(calabrese) Make more specific - return true; -#elif defined(__clang__) - return __clang_major__ < 4; -#elif defined(__GNUC__) - // TODO(calabrese) Figure out why gcc 7 fails (seems like a different bug) - return __GNUC__ < 5 || (__GNUC__ == 5 && __GNUC_MINOR__ < 2) || __GNUC__ >= 7; -#else - return false; -#endif -} - -// Returns true if the standard library being used incorrectly produces an error -// when instantiating the definition of a poisoned std::hash specialization. -constexpr bool poisoned_hash_fails_instantiation() { -#if defined(_MSC_VER) && !defined(_LIBCPP_VERSION) - return _MSC_VER < 1914; -#else - return false; -#endif -} - -template <class Fun> -struct GeneratorType { - decltype(std::declval<const Fun&>()()) operator()() const - noexcept(noexcept(std::declval<const Fun&>()())) { - return fun(); - } - - Fun fun; - const char* description; -}; - -// A "make" function for the GeneratorType template that deduces the function -// object type. -template <class Fun, - absl::enable_if_t<IsNullaryCallable<Fun>::value>** = nullptr> -GeneratorType<Fun> Generator(Fun fun, const char* description) { - return GeneratorType<Fun>{absl::move(fun), description}; -} - -// A type that contains a set of nullary function objects that each return an -// instance of the same type and value (though possibly different -// representations, such as +0 and -0 or two vectors with the same elements but -// with different capacities). -template <class... Funs> -struct EquivalenceClassType { - std::tuple<GeneratorType<Funs>...> generators; -}; - -// A "make" function for the EquivalenceClassType template that deduces the -// function object types and is constrained such that a user can only pass in -// function objects that all have the same return type. -template <class... Funs, absl::enable_if_t<AreGeneratorsWithTheSameReturnType< - Funs...>::value>** = nullptr> -EquivalenceClassType<Funs...> EquivalenceClass(GeneratorType<Funs>... funs) { - return {std::make_tuple(absl::move(funs)...)}; -} - -// A type that contains an ordered series of EquivalenceClassTypes, from -// smallest value to largest value. -template <class... EqClasses> -struct OrderedEquivalenceClasses { - std::tuple<EqClasses...> eq_classes; -}; - -// An object containing the parts of a given (name, initialization expression), -// and is capable of generating a string that describes the given. -struct GivenDeclaration { - std::string outputDeclaration(std::size_t width) const { - const std::size_t indent_size = 2; - std::string result = absl::StrCat(" ", name); - - if (!expression.empty()) { - // Indent - result.resize(indent_size + width, ' '); - absl::StrAppend(&result, " = ", expression, ";\n"); - } else { - absl::StrAppend(&result, ";\n"); - } - - return result; - } - - std::string name; - std::string expression; -}; - -// Produce a string that contains all of the givens of an error report. -template <class... Decls> -std::string PrepareGivenContext(const Decls&... decls) { - const std::size_t width = (std::max)({decls.name.size()...}); - return absl::StrCat("Given:\n", decls.outputDeclaration(width)..., "\n"); -} - -//////////////////////////////////////////////////////////////////////////////// -// Function objects that perform a check for each comparison operator // -//////////////////////////////////////////////////////////////////////////////// - -#define ABSL_INTERNAL_EXPECT_OP(name, op) \ - struct Expect##name { \ - template <class T> \ - void operator()(absl::string_view test_name, absl::string_view context, \ - const T& lhs, const T& rhs, absl::string_view lhs_name, \ - absl::string_view rhs_name) const { \ - if (!static_cast<bool>(lhs op rhs)) { \ - errors->addTestFailure( \ - test_name, absl::StrCat(context, \ - "**Unexpected comparison result**\n" \ - "\n" \ - "Expression:\n" \ - " ", \ - lhs_name, " " #op " ", rhs_name, \ - "\n" \ - "\n" \ - "Expected: true\n" \ - " Actual: false")); \ - } else { \ - errors->addTestSuccess(test_name); \ - } \ - } \ - \ - ConformanceErrors* errors; \ - }; \ - \ - struct ExpectNot##name { \ - template <class T> \ - void operator()(absl::string_view test_name, absl::string_view context, \ - const T& lhs, const T& rhs, absl::string_view lhs_name, \ - absl::string_view rhs_name) const { \ - if (lhs op rhs) { \ - errors->addTestFailure( \ - test_name, absl::StrCat(context, \ - "**Unexpected comparison result**\n" \ - "\n" \ - "Expression:\n" \ - " ", \ - lhs_name, " " #op " ", rhs_name, \ - "\n" \ - "\n" \ - "Expected: false\n" \ - " Actual: true")); \ - } else { \ - errors->addTestSuccess(test_name); \ - } \ - } \ - \ - ConformanceErrors* errors; \ - } - -ABSL_INTERNAL_EXPECT_OP(Eq, ==); -ABSL_INTERNAL_EXPECT_OP(Ne, !=); -ABSL_INTERNAL_EXPECT_OP(Lt, <); -ABSL_INTERNAL_EXPECT_OP(Le, <=); -ABSL_INTERNAL_EXPECT_OP(Ge, >=); -ABSL_INTERNAL_EXPECT_OP(Gt, >); - -#undef ABSL_INTERNAL_EXPECT_OP - -// A function object that verifies that two objects hash to the same value by -// way of the std::hash specialization. -struct ExpectSameHash { - template <class T> - void operator()(absl::string_view test_name, absl::string_view context, - const T& lhs, const T& rhs, absl::string_view lhs_name, - absl::string_view rhs_name) const { - if (std::hash<T>()(lhs) != std::hash<T>()(rhs)) { - errors->addTestFailure( - test_name, absl::StrCat(context, - "**Unexpected hash result**\n" - "\n" - "Expression:\n" - " std::hash<T>()(", - lhs_name, ") == std::hash<T>()(", rhs_name, - ")\n" - "\n" - "Expected: true\n" - " Actual: false")); - } else { - errors->addTestSuccess(test_name); - } - } - - ConformanceErrors* errors; -}; - -// A function template that takes two objects and verifies that each comparison -// operator behaves in a way that is consistent with equality. It has "OneWay" -// in the name because the first argument will always be the left-hand operand -// of the corresponding comparison operator and the second argument will -// always be the right-hand operand. It will never switch that order. -// At a higher level in the test suite, the one-way form is called once for each -// of the two possible orders whenever lhs and rhs are not the same initializer. -template <class T, class Prof> -void ExpectOneWayEquality(ConformanceErrors* errors, - absl::string_view test_name, - absl::string_view context, const T& lhs, const T& rhs, - absl::string_view lhs_name, - absl::string_view rhs_name) { - If<PropertiesOfT<Prof>::is_equality_comparable>::Invoke( - ExpectEq{errors}, test_name, context, lhs, rhs, lhs_name, rhs_name); - - If<PropertiesOfT<Prof>::is_inequality_comparable>::Invoke( - ExpectNotNe{errors}, test_name, context, lhs, rhs, lhs_name, rhs_name); - - If<PropertiesOfT<Prof>::is_less_than_comparable>::Invoke( - ExpectNotLt{errors}, test_name, context, lhs, rhs, lhs_name, rhs_name); - - If<PropertiesOfT<Prof>::is_less_equal_comparable>::Invoke( - ExpectLe{errors}, test_name, context, lhs, rhs, lhs_name, rhs_name); - - If<PropertiesOfT<Prof>::is_greater_equal_comparable>::Invoke( - ExpectGe{errors}, test_name, context, lhs, rhs, lhs_name, rhs_name); - - If<PropertiesOfT<Prof>::is_greater_than_comparable>::Invoke( - ExpectNotGt{errors}, test_name, context, lhs, rhs, lhs_name, rhs_name); - - If<PropertiesOfT<Prof>::is_hashable>::Invoke( - ExpectSameHash{errors}, test_name, context, lhs, rhs, lhs_name, rhs_name); -} - -// A function template that takes two objects and verifies that each comparison -// operator behaves in a way that is consistent with equality. This function -// differs from ExpectOneWayEquality in that this will do checks with argument -// order reversed in addition to in-order. -template <class T, class Prof> -void ExpectEquality(ConformanceErrors* errors, absl::string_view test_name, - absl::string_view context, const T& lhs, const T& rhs, - absl::string_view lhs_name, absl::string_view rhs_name) { - (ExpectOneWayEquality<T, Prof>)(errors, test_name, context, lhs, rhs, - lhs_name, rhs_name); - (ExpectOneWayEquality<T, Prof>)(errors, test_name, context, rhs, lhs, - rhs_name, lhs_name); -} - -// Given a generator, makes sure that a generated value and a moved-from -// generated value are equal. -template <class T, class Prof> -struct ExpectMoveConstructOneGenerator { - template <class Fun> - void operator()(const Fun& generator) const { - const T object = generator(); - const T moved_object = absl::move(generator()); // Force no elision. - - (ExpectEquality<T, Prof>)(errors, "Move construction", - PrepareGivenContext( - GivenDeclaration{"const _T object", - generator.description}, - GivenDeclaration{"const _T moved_object", - std::string("std::move(") + - generator.description + - ")"}), - object, moved_object, "object", "moved_object"); - } - - ConformanceErrors* errors; -}; - -// Given a generator, makes sure that a generated value and a copied-from -// generated value are equal. -template <class T, class Prof> -struct ExpectCopyConstructOneGenerator { - template <class Fun> - void operator()(const Fun& generator) const { - const T object = generator(); - const T copied_object = static_cast<const T&>(generator()); - - (ExpectEquality<T, Prof>)(errors, "Copy construction", - PrepareGivenContext( - GivenDeclaration{"const _T object", - generator.description}, - GivenDeclaration{ - "const _T copied_object", - std::string("static_cast<const _T&>(") + - generator.description + ")"}), - object, copied_object, "object", "copied_object"); - } - - ConformanceErrors* errors; -}; - -// Default-construct and do nothing before destruction. -// -// This is useful in exercising the codepath of default construction followed by -// destruction, but does not explicitly test anything. An example of where this -// might fail is a default destructor that default-initializes a scalar and a -// destructor reads the value of that member. Sanitizers can catch this as long -// as our test attempts to execute such a case. -template <class T> -struct ExpectDefaultConstructWithDestruct { - void operator()() const { - // Scoped so that destructor gets called before reporting success. - { - T object; - static_cast<void>(object); - } - - errors->addTestSuccess("Default construction"); - } - - ConformanceErrors* errors; -}; - -// Check move-assign into a default-constructed object. -template <class T, class Prof> -struct ExpectDefaultConstructWithMoveAssign { - template <class Fun> - void operator()(const Fun& generator) const { - const T source_of_truth = generator(); - T object; - object = generator(); - - (ExpectEquality<T, Prof>)(errors, "Move assignment", - PrepareGivenContext( - GivenDeclaration{"const _T object", - generator.description}, - GivenDeclaration{"_T object", ""}, - GivenDeclaration{"object", - generator.description}), - object, source_of_truth, "std::as_const(object)", - "source_of_truth"); - } - - ConformanceErrors* errors; -}; - -// Check copy-assign into a default-constructed object. -template <class T, class Prof> -struct ExpectDefaultConstructWithCopyAssign { - template <class Fun> - void operator()(const Fun& generator) const { - const T source_of_truth = generator(); - T object; - object = static_cast<const T&>(generator()); - - (ExpectEquality<T, Prof>)(errors, "Copy assignment", - PrepareGivenContext( - GivenDeclaration{"const _T source_of_truth", - generator.description}, - GivenDeclaration{"_T object", ""}, - GivenDeclaration{ - "object", - std::string("static_cast<const _T&>(") + - generator.description + ")"}), - object, source_of_truth, "std::as_const(object)", - "source_of_truth"); - } - - ConformanceErrors* errors; -}; - -// Perform a self move-assign. -template <class T, class Prof> -struct ExpectSelfMoveAssign { - template <class Fun> - void operator()(const Fun& generator) const { - T object = generator(); - object = absl::move(object); - - // NOTE: Self move-assign results in a valid-but-unspecified state. - - (ExpectEquality<T, Prof>)(errors, "Move assignment", - PrepareGivenContext( - GivenDeclaration{"_T object", - generator.description}, - GivenDeclaration{"object", - "std::move(object)"}), - object, object, "object", "object"); - } - - ConformanceErrors* errors; -}; - -// Perform a self copy-assign. -template <class T, class Prof> -struct ExpectSelfCopyAssign { - template <class Fun> - void operator()(const Fun& generator) const { - const T source_of_truth = generator(); - T object = generator(); - const T& const_object = object; - object = const_object; - - (ExpectEquality<T, Prof>)(errors, "Copy assignment", - PrepareGivenContext( - GivenDeclaration{"const _T source_of_truth", - generator.description}, - GivenDeclaration{"_T object", - generator.description}, - GivenDeclaration{"object", - "std::as_const(object)"}), - const_object, source_of_truth, - "std::as_const(object)", "source_of_truth"); - } - - ConformanceErrors* errors; -}; - -// Perform a self-swap. -template <class T, class Prof> -struct ExpectSelfSwap { - template <class Fun> - void operator()(const Fun& generator) const { - const T source_of_truth = generator(); - T object = generator(); - - type_traits_internal::Swap(object, object); - - std::string preliminary_info = absl::StrCat( - PrepareGivenContext( - GivenDeclaration{"const _T source_of_truth", generator.description}, - GivenDeclaration{"_T object", generator.description}), - "After performing a self-swap:\n" - " using std::swap;\n" - " swap(object, object);\n" - "\n"); - - (ExpectEquality<T, Prof>)(errors, "Swap", std::move(preliminary_info), - object, source_of_truth, "std::as_const(object)", - "source_of_truth"); - } - - ConformanceErrors* errors; -}; - -// Perform each of the single-generator checks when necessary operations are -// supported. -template <class T, class Prof> -struct ExpectSelfComparison { - template <class Fun> - void operator()(const Fun& generator) const { - const T object = generator(); - (ExpectOneWayEquality<T, Prof>)(errors, "Comparison", - PrepareGivenContext(GivenDeclaration{ - "const _T object", - generator.description}), - object, object, "object", "object"); - } - - ConformanceErrors* errors; -}; - -// Perform each of the single-generator checks when necessary operations are -// supported. -template <class T, class Prof> -struct ExpectConsistency { - template <class Fun> - void operator()(const Fun& generator) const { - If<PropertiesOfT<Prof>::is_move_constructible>::Invoke( - ExpectMoveConstructOneGenerator<T, Prof>{errors}, generator); - - If<PropertiesOfT<Prof>::is_copy_constructible>::Invoke( - ExpectCopyConstructOneGenerator<T, Prof>{errors}, generator); - - If<PropertiesOfT<Prof>::is_default_constructible && - PropertiesOfT<Prof>::is_move_assignable>:: - Invoke(ExpectDefaultConstructWithMoveAssign<T, Prof>{errors}, - generator); - - If<PropertiesOfT<Prof>::is_default_constructible && - PropertiesOfT<Prof>::is_copy_assignable>:: - Invoke(ExpectDefaultConstructWithCopyAssign<T, Prof>{errors}, - generator); - - If<PropertiesOfT<Prof>::is_move_assignable>::Invoke( - ExpectSelfMoveAssign<T, Prof>{errors}, generator); - - If<PropertiesOfT<Prof>::is_copy_assignable>::Invoke( - ExpectSelfCopyAssign<T, Prof>{errors}, generator); - - If<PropertiesOfT<Prof>::is_swappable>::Invoke( - ExpectSelfSwap<T, Prof>{errors}, generator); - } - - ConformanceErrors* errors; -}; - -// Check move-assign with two different values. -template <class T, class Prof> -struct ExpectMoveAssign { - template <class Fun0, class Fun1> - void operator()(const Fun0& generator0, const Fun1& generator1) const { - const T source_of_truth1 = generator1(); - T object = generator0(); - object = generator1(); - - (ExpectEquality<T, Prof>)(errors, "Move assignment", - PrepareGivenContext( - GivenDeclaration{"const _T source_of_truth1", - generator1.description}, - GivenDeclaration{"_T object", - generator0.description}, - GivenDeclaration{"object", - generator1.description}), - object, source_of_truth1, "std::as_const(object)", - "source_of_truth1"); - } - - ConformanceErrors* errors; -}; - -// Check copy-assign with two different values. -template <class T, class Prof> -struct ExpectCopyAssign { - template <class Fun0, class Fun1> - void operator()(const Fun0& generator0, const Fun1& generator1) const { - const T source_of_truth1 = generator1(); - T object = generator0(); - object = static_cast<const T&>(generator1()); - - (ExpectEquality<T, Prof>)(errors, "Copy assignment", - PrepareGivenContext( - GivenDeclaration{"const _T source_of_truth1", - generator1.description}, - GivenDeclaration{"_T object", - generator0.description}, - GivenDeclaration{ - "object", - std::string("static_cast<const _T&>(") + - generator1.description + ")"}), - object, source_of_truth1, "std::as_const(object)", - "source_of_truth1"); - } - - ConformanceErrors* errors; -}; - -// Check swap with two different values. -template <class T, class Prof> -struct ExpectSwap { - template <class Fun0, class Fun1> - void operator()(const Fun0& generator0, const Fun1& generator1) const { - const T source_of_truth0 = generator0(); - const T source_of_truth1 = generator1(); - T object0 = generator0(); - T object1 = generator1(); - - type_traits_internal::Swap(object0, object1); - - const std::string context = - PrepareGivenContext( - GivenDeclaration{"const _T source_of_truth0", - generator0.description}, - GivenDeclaration{"const _T source_of_truth1", - generator1.description}, - GivenDeclaration{"_T object0", generator0.description}, - GivenDeclaration{"_T object1", generator1.description}) + - "After performing a swap:\n" - " using std::swap;\n" - " swap(object0, object1);\n" - "\n"; - - (ExpectEquality<T, Prof>)(errors, "Swap", context, object0, - source_of_truth1, "std::as_const(object0)", - "source_of_truth1"); - (ExpectEquality<T, Prof>)(errors, "Swap", context, object1, - source_of_truth0, "std::as_const(object1)", - "source_of_truth0"); - } - - ConformanceErrors* errors; -}; - -// Validate that `generator0` and `generator1` produce values that are equal. -template <class T, class Prof> -struct ExpectEquivalenceClassComparison { - template <class Fun0, class Fun1> - void operator()(const Fun0& generator0, const Fun1& generator1) const { - const T object0 = generator0(); - const T object1 = generator1(); - - (ExpectEquality<T, Prof>)(errors, "Comparison", - PrepareGivenContext( - GivenDeclaration{"const _T object0", - generator0.description}, - GivenDeclaration{"const _T object1", - generator1.description}), - object0, object1, "object0", "object1"); - } - - ConformanceErrors* errors; -}; - -// Validate that all objects in the same equivalence-class have the same value. -template <class T, class Prof> -struct ExpectEquivalenceClassConsistency { - template <class Fun0, class Fun1> - void operator()(const Fun0& generator0, const Fun1& generator1) const { - If<PropertiesOfT<Prof>::is_move_assignable>::Invoke( - ExpectMoveAssign<T, Prof>{errors}, generator0, generator1); - - If<PropertiesOfT<Prof>::is_copy_assignable>::Invoke( - ExpectCopyAssign<T, Prof>{errors}, generator0, generator1); - - If<PropertiesOfT<Prof>::is_swappable>::Invoke(ExpectSwap<T, Prof>{errors}, - generator0, generator1); - } - - ConformanceErrors* errors; -}; - -// Given a "lesser" object and a "greater" object, perform every combination of -// comparison operators supported for the type, expecting consistent results. -template <class T, class Prof> -void ExpectOrdered(ConformanceErrors* errors, absl::string_view context, - const T& small, const T& big, absl::string_view small_name, - absl::string_view big_name) { - const absl::string_view test_name = "Comparison"; - - If<PropertiesOfT<Prof>::is_equality_comparable>::Invoke( - ExpectNotEq{errors}, test_name, context, small, big, small_name, - big_name); - If<PropertiesOfT<Prof>::is_equality_comparable>::Invoke( - ExpectNotEq{errors}, test_name, context, big, small, big_name, - small_name); - - If<PropertiesOfT<Prof>::is_inequality_comparable>::Invoke( - ExpectNe{errors}, test_name, context, small, big, small_name, big_name); - If<PropertiesOfT<Prof>::is_inequality_comparable>::Invoke( - ExpectNe{errors}, test_name, context, big, small, big_name, small_name); - - If<PropertiesOfT<Prof>::is_less_than_comparable>::Invoke( - ExpectLt{errors}, test_name, context, small, big, small_name, big_name); - If<PropertiesOfT<Prof>::is_less_than_comparable>::Invoke( - ExpectNotLt{errors}, test_name, context, big, small, big_name, - small_name); - - If<PropertiesOfT<Prof>::is_less_equal_comparable>::Invoke( - ExpectLe{errors}, test_name, context, small, big, small_name, big_name); - If<PropertiesOfT<Prof>::is_less_equal_comparable>::Invoke( - ExpectNotLe{errors}, test_name, context, big, small, big_name, - small_name); - - If<PropertiesOfT<Prof>::is_greater_equal_comparable>::Invoke( - ExpectNotGe{errors}, test_name, context, small, big, small_name, - big_name); - If<PropertiesOfT<Prof>::is_greater_equal_comparable>::Invoke( - ExpectGe{errors}, test_name, context, big, small, big_name, small_name); - - If<PropertiesOfT<Prof>::is_greater_than_comparable>::Invoke( - ExpectNotGt{errors}, test_name, context, small, big, small_name, - big_name); - If<PropertiesOfT<Prof>::is_greater_than_comparable>::Invoke( - ExpectGt{errors}, test_name, context, big, small, big_name, small_name); -} - -// For every two elements of an equivalence class, makes sure that those two -// elements compare equal, including checks with the same argument passed as -// both operands. -template <class T, class Prof> -struct ExpectEquivalenceClassComparisons { - template <class... Funs> - void operator()(EquivalenceClassType<Funs...> eq_class) const { - (ForEachTupleElement)(ExpectSelfComparison<T, Prof>{errors}, - eq_class.generators); - - (ForEveryTwo)(ExpectEquivalenceClassComparison<T, Prof>{errors}, - eq_class.generators); - } - - ConformanceErrors* errors; -}; - -// For every element of an equivalence class, makes sure that the element is -// self-consistent (in other words, if any of move/copy/swap are defined, -// perform those operations and make such that results and operands still -// compare equal to known values whenever it is required for that operation. -template <class T, class Prof> -struct ExpectEquivalenceClass { - template <class... Funs> - void operator()(EquivalenceClassType<Funs...> eq_class) const { - (ForEachTupleElement)(ExpectConsistency<T, Prof>{errors}, - eq_class.generators); - - (ForEveryTwo)(ExpectEquivalenceClassConsistency<T, Prof>{errors}, - eq_class.generators); - } - - ConformanceErrors* errors; -}; - -// Validate that the passed-in argument is a generator of a greater value than -// the one produced by the "small_gen" datamember with respect to all of the -// comparison operators that Prof requires, with both argument orders to test. -template <class T, class Prof, class SmallGenerator> -struct ExpectBiggerGeneratorThanComparisons { - template <class BigGenerator> - void operator()(BigGenerator big_gen) const { - const T small = small_gen(); - const T big = big_gen(); - - (ExpectOrdered<T, Prof>)(errors, - PrepareGivenContext( - GivenDeclaration{"const _T small", - small_gen.description}, - GivenDeclaration{"const _T big", - big_gen.description}), - small, big, "small", "big"); - } - - SmallGenerator small_gen; - ConformanceErrors* errors; -}; - -// Perform all of the move, copy, and swap checks on the value generated by -// `small_gen` and the value generated by `big_gen`. -template <class T, class Prof, class SmallGenerator> -struct ExpectBiggerGeneratorThan { - template <class BigGenerator> - void operator()(BigGenerator big_gen) const { - If<PropertiesOfT<Prof>::is_move_assignable>::Invoke( - ExpectMoveAssign<T, Prof>{errors}, small_gen, big_gen); - If<PropertiesOfT<Prof>::is_move_assignable>::Invoke( - ExpectMoveAssign<T, Prof>{errors}, big_gen, small_gen); - - If<PropertiesOfT<Prof>::is_copy_assignable>::Invoke( - ExpectCopyAssign<T, Prof>{errors}, small_gen, big_gen); - If<PropertiesOfT<Prof>::is_copy_assignable>::Invoke( - ExpectCopyAssign<T, Prof>{errors}, big_gen, small_gen); - - If<PropertiesOfT<Prof>::is_swappable>::Invoke(ExpectSwap<T, Prof>{errors}, - small_gen, big_gen); - } - - SmallGenerator small_gen; - ConformanceErrors* errors; -}; - -// Validate that the result of a generator is greater than the results of all -// generators in an equivalence class with respect to comparisons. -template <class T, class Prof, class SmallGenerator> -struct ExpectBiggerGeneratorThanEqClassesComparisons { - template <class BigEqClass> - void operator()(BigEqClass big_eq_class) const { - (ForEachTupleElement)( - ExpectBiggerGeneratorThanComparisons<T, Prof, SmallGenerator>{small_gen, - errors}, - big_eq_class.generators); - } - - SmallGenerator small_gen; - ConformanceErrors* errors; -}; - -// Validate that the non-comparison binary operations required by Prof are -// correct for the result of each generator of big_eq_class and a generator of -// the logically smaller value returned by small_gen. -template <class T, class Prof, class SmallGenerator> -struct ExpectBiggerGeneratorThanEqClasses { - template <class BigEqClass> - void operator()(BigEqClass big_eq_class) const { - (ForEachTupleElement)( - ExpectBiggerGeneratorThan<T, Prof, SmallGenerator>{small_gen, errors}, - big_eq_class.generators); - } - - SmallGenerator small_gen; - ConformanceErrors* errors; -}; - -// Validate that each equivalence class that is passed is logically less than -// the equivalence classes that comes later on in the argument list. -template <class T, class Prof> -struct ExpectOrderedEquivalenceClassesComparisons { - template <class... BigEqClasses> - struct Impl { - // Validate that the value produced by `small_gen` is less than all of the - // values generated by those of the logically larger equivalence classes. - template <class SmallGenerator> - void operator()(SmallGenerator small_gen) const { - (ForEachTupleElement)(ExpectBiggerGeneratorThanEqClassesComparisons< - T, Prof, SmallGenerator>{small_gen, errors}, - big_eq_classes); - } - - std::tuple<BigEqClasses...> big_eq_classes; - ConformanceErrors* errors; - }; - - // When given no equivalence classes, no validation is necessary. - void operator()() const {} - - template <class SmallEqClass, class... BigEqClasses> - void operator()(SmallEqClass small_eq_class, - BigEqClasses... big_eq_classes) const { - // For each generator in the first equivalence class, make sure that it is - // less than each of those in the logically greater equivalence classes. - (ForEachTupleElement)( - Impl<BigEqClasses...>{std::make_tuple(absl::move(big_eq_classes)...), - errors}, - small_eq_class.generators); - - // Recurse so that all equivalence class combinations are checked. - (*this)(absl::move(big_eq_classes)...); - } - - ConformanceErrors* errors; -}; - -// Validate that the non-comparison binary operations required by Prof are -// correct for the result of each generator of big_eq_classes and a generator of -// the logically smaller value returned by small_gen. -template <class T, class Prof> -struct ExpectOrderedEquivalenceClasses { - template <class... BigEqClasses> - struct Impl { - template <class SmallGenerator> - void operator()(SmallGenerator small_gen) const { - (ForEachTupleElement)( - ExpectBiggerGeneratorThanEqClasses<T, Prof, SmallGenerator>{small_gen, - errors}, - big_eq_classes); - } - - std::tuple<BigEqClasses...> big_eq_classes; - ConformanceErrors* errors; - }; - - // Check that small_eq_class is logically consistent and also is logically - // less than all values in big_eq_classes. - template <class SmallEqClass, class... BigEqClasses> - void operator()(SmallEqClass small_eq_class, - BigEqClasses... big_eq_classes) const { - (ForEachTupleElement)( - Impl<BigEqClasses...>{std::make_tuple(absl::move(big_eq_classes)...), - errors}, - small_eq_class.generators); - - (*this)(absl::move(big_eq_classes)...); - } - - // Terminating case of operator(). - void operator()() const {} - - ConformanceErrors* errors; -}; - -// Validate that a type meets the syntactic requirements of std::hash if the -// range of profiles requires it. -template <class T, class MinProf, class MaxProf> -struct ExpectHashable { - void operator()() const { - ExpectModelOfHashable<T, MinProf, MaxProf>(errors); - } - - ConformanceErrors* errors; -}; - -// Validate that the type `T` meets all of the requirements associated with -// `MinProf` and without going beyond the syntactic properties of `MaxProf`. -template <class T, class MinProf, class MaxProf> -struct ExpectModels { - void operator()(ConformanceErrors* errors) const { - ExpectModelOfDefaultConstructible<T, MinProf, MaxProf>(errors); - ExpectModelOfMoveConstructible<T, MinProf, MaxProf>(errors); - ExpectModelOfCopyConstructible<T, MinProf, MaxProf>(errors); - ExpectModelOfMoveAssignable<T, MinProf, MaxProf>(errors); - ExpectModelOfCopyAssignable<T, MinProf, MaxProf>(errors); - ExpectModelOfDestructible<T, MinProf, MaxProf>(errors); - ExpectModelOfEqualityComparable<T, MinProf, MaxProf>(errors); - ExpectModelOfInequalityComparable<T, MinProf, MaxProf>(errors); - ExpectModelOfLessThanComparable<T, MinProf, MaxProf>(errors); - ExpectModelOfLessEqualComparable<T, MinProf, MaxProf>(errors); - ExpectModelOfGreaterEqualComparable<T, MinProf, MaxProf>(errors); - ExpectModelOfGreaterThanComparable<T, MinProf, MaxProf>(errors); - ExpectModelOfSwappable<T, MinProf, MaxProf>(errors); - - // Only check hashability on compilers that have a compliant default-hash. - If<!poisoned_hash_fails_instantiation()>::Invoke( - ExpectHashable<T, MinProf, MaxProf>{errors}); - } -}; - -// A metafunction that yields a Profile matching the set of properties that are -// safe to be checked (lack-of-hashability is only checked on standard library -// implementations that are standards compliant in that they provide a std::hash -// primary template that is SFINAE-friendly) -template <class LogicalProf, class T> -struct MinimalCheckableProfile { - using type = - MinimalProfiles<PropertiesOfT<LogicalProf>, - PropertiesOfT<SyntacticConformanceProfileOf< - T, !PropertiesOfT<LogicalProf>::is_hashable && - poisoned_hash_fails_instantiation() - ? CheckHashability::no - : CheckHashability::yes>>>; -}; - -// An identity metafunction -template <class T> -struct Always { - using type = T; -}; - -// Validate the T meets all of the necessary requirements of LogicalProf, with -// syntactic requirements defined by the profile range [MinProf, MaxProf]. -template <class T, class LogicalProf, class MinProf, class MaxProf, - class... EqClasses> -ConformanceErrors ExpectRegularityImpl( - OrderedEquivalenceClasses<EqClasses...> vals) { - ConformanceErrors errors((NameOf<T>())); - - If<!constexpr_instantiation_when_unevaluated()>::Invoke( - ExpectModels<T, MinProf, MaxProf>(), &errors); - - using minimal_profile = typename absl::conditional_t< - constexpr_instantiation_when_unevaluated(), Always<LogicalProf>, - MinimalCheckableProfile<LogicalProf, T>>::type; - - If<PropertiesOfT<minimal_profile>::is_default_constructible>::Invoke( - ExpectDefaultConstructWithDestruct<T>{&errors}); - - ////////////////////////////////////////////////////////////////////////////// - // Perform all comparison checks first, since later checks depend on their - // correctness. - // - // Check all of the comparisons for all values in the same equivalence - // class (equal with respect to comparison operators and hash the same). - (ForEachTupleElement)( - ExpectEquivalenceClassComparisons<T, minimal_profile>{&errors}, - vals.eq_classes); - - // Check all of the comparisons for each combination of values that are in - // different equivalence classes (not equal with respect to comparison - // operators). - absl::apply( - ExpectOrderedEquivalenceClassesComparisons<T, minimal_profile>{&errors}, - vals.eq_classes); - // - ////////////////////////////////////////////////////////////////////////////// - - // Perform remaining checks, relying on comparisons. - // TODO(calabrese) short circuit if any comparisons above failed. - (ForEachTupleElement)(ExpectEquivalenceClass<T, minimal_profile>{&errors}, - vals.eq_classes); - - absl::apply(ExpectOrderedEquivalenceClasses<T, minimal_profile>{&errors}, - vals.eq_classes); - - return errors; -} - -// A type that represents a range of profiles that are acceptable to be matched. -// -// `MinProf` is the minimum set of syntactic requirements that must be met. -// -// `MaxProf` is the maximum set of syntactic requirements that must be met. -// This maximum is particularly useful for certain "strictness" checking. Some -// examples for when this is useful: -// -// * Making sure that a type is move-only (rather than simply movable) -// -// * Making sure that a member function is *not* noexcept in cases where it -// cannot be noexcept, such as if a dependent datamember has certain -// operations that are not noexcept. -// -// * Making sure that a type tightly matches a spec, such as the standard. -// -// `LogicalProf` is the Profile for which run-time testing is to take place. -// -// Note: The reason for `LogicalProf` is because it is often the case, when -// dealing with templates, that a declaration of a given operation is specified, -// but whose body would fail to instantiate. Examples include the -// copy-constructor of a standard container when the element-type is move-only, -// or the comparison operators of a standard container when the element-type -// does not have the necessary comparison operations defined. The `LogicalProf` -// parameter allows us to capture the intent of what should be tested at -// run-time, even in the cases where syntactically it might otherwise appear as -// though the type undergoing testing supports more than it actually does. -template <class LogicalProf, class MinProf = LogicalProf, - class MaxProf = MinProf> -struct ProfileRange { - using logical_profile = LogicalProf; - using min_profile = MinProf; - using max_profile = MaxProf; -}; - -// Similar to ProfileRange except that it creates a profile range that is -// coupled with a Domain and is used when testing that a type matches exactly -// the "minimum" requirements of LogicalProf. -template <class StrictnessDomain, class LogicalProf, - class MinProf = LogicalProf, class MaxProf = MinProf> -struct StrictProfileRange { - // We do not yet support extension. - static_assert( - std::is_same<StrictnessDomain, RegularityDomain>::value, - "Currently, the only valid StrictnessDomain is RegularityDomain."); - using strictness_domain = StrictnessDomain; - using logical_profile = LogicalProf; - using min_profile = MinProf; - using max_profile = MaxProf; -}; - -//////////////////////////////////////////////////////////////////////////////// -// -// A metafunction that creates a StrictProfileRange from a Domain and either a -// Profile or ProfileRange. -template <class StrictnessDomain, class ProfOrRange> -struct MakeStrictProfileRange; - -template <class StrictnessDomain, class LogicalProf> -struct MakeStrictProfileRange { - using type = StrictProfileRange<StrictnessDomain, LogicalProf>; -}; - -template <class StrictnessDomain, class LogicalProf, class MinProf, - class MaxProf> -struct MakeStrictProfileRange<StrictnessDomain, - ProfileRange<LogicalProf, MinProf, MaxProf>> { - using type = - StrictProfileRange<StrictnessDomain, LogicalProf, MinProf, MaxProf>; -}; - -template <class StrictnessDomain, class ProfOrRange> -using MakeStrictProfileRangeT = - typename MakeStrictProfileRange<StrictnessDomain, ProfOrRange>::type; -// -//////////////////////////////////////////////////////////////////////////////// - -// A profile in the RegularityDomain with the strongest possible requirements. -using MostStrictProfile = - CombineProfiles<TriviallyCompleteProfile, NothrowComparableProfile>; - -// Forms a ProfileRange that treats the Profile as the bare minimum requirements -// of a type. -template <class LogicalProf, class MinProf = LogicalProf> -using LooseProfileRange = StrictProfileRange<RegularityDomain, LogicalProf, - MinProf, MostStrictProfile>; - -template <class Prof> -using MakeLooseProfileRangeT = Prof; - -//////////////////////////////////////////////////////////////////////////////// -// -// The following classes implement the metafunction ProfileRangeOfT<T> that -// takes either a Profile or ProfileRange and yields the ProfileRange to be -// used during testing. -// -template <class T, class /*Enabler*/ = void> -struct ProfileRangeOfImpl; - -template <class T> -struct ProfileRangeOfImpl<T, absl::void_t<PropertiesOfT<T>>> { - using type = LooseProfileRange<T>; -}; - -template <class T> -struct ProfileRangeOf : ProfileRangeOfImpl<T> {}; - -template <class StrictnessDomain, class LogicalProf, class MinProf, - class MaxProf> -struct ProfileRangeOf< - StrictProfileRange<StrictnessDomain, LogicalProf, MinProf, MaxProf>> { - using type = - StrictProfileRange<StrictnessDomain, LogicalProf, MinProf, MaxProf>; -}; - -template <class T> -using ProfileRangeOfT = typename ProfileRangeOf<T>::type; -// -//////////////////////////////////////////////////////////////////////////////// - -// Extract the logical profile of a range (what will be runtime tested). -template <class T> -using LogicalProfileOfT = typename ProfileRangeOfT<T>::logical_profile; - -// Extract the minimal syntactic profile of a range (error if not at least). -template <class T> -using MinProfileOfT = typename ProfileRangeOfT<T>::min_profile; - -// Extract the maximum syntactic profile of a range (error if more than). -template <class T> -using MaxProfileOfT = typename ProfileRangeOfT<T>::max_profile; - -//////////////////////////////////////////////////////////////////////////////// -// -template <class T> -struct IsProfileOrProfileRange : IsProfile<T>::type {}; - -template <class StrictnessDomain, class LogicalProf, class MinProf, - class MaxProf> -struct IsProfileOrProfileRange< - StrictProfileRange<StrictnessDomain, LogicalProf, MinProf, MaxProf>> - : std::true_type {}; -// -//////////////////////////////////////////////////////////////////////////////// - -// TODO(calabrese): Consider naming the functions in this class the same as -// the macros (defined later on) so that auto-complete leads to the correct name -// and so that a user cannot accidentally call a function rather than the macro -// form. -template <bool ExpectSuccess, class T, class... EqClasses> -struct ExpectConformanceOf { - // Add a value to be tested. Subsequent calls to this function on the same - // object must specify logically "larger" values with respect to the - // comparison operators of the type, if any. - // - // NOTE: This function should not be called directly. A stateless lambda is - // implicitly formed and passed when using the INITIALIZER macro at the bottom - // of this file. - template <class Fun, - absl::enable_if_t<std::is_same< - ResultOfGeneratorT<GeneratorType<Fun>>, T>::value>** = nullptr> - ABSL_MUST_USE_RESULT ExpectConformanceOf<ExpectSuccess, T, EqClasses..., - EquivalenceClassType<Fun>> - initializer(GeneratorType<Fun> fun) && { - return { - {std::tuple_cat(absl::move(ordered_vals.eq_classes), - std::make_tuple((EquivalenceClass)(absl::move(fun))))}, - std::move(expected_failed_tests)}; - } - - template <class... TestNames, - absl::enable_if_t<!ExpectSuccess && sizeof...(EqClasses) == 0 && - absl::conjunction<std::is_convertible< - TestNames, absl::string_view>...>::value>** = - nullptr> - ABSL_MUST_USE_RESULT ExpectConformanceOf<ExpectSuccess, T, EqClasses...> - due_to(TestNames&&... test_names) && { - (InsertEach)(&expected_failed_tests, - absl::AsciiStrToLower(absl::string_view(test_names))...); - - return {absl::move(ordered_vals), std::move(expected_failed_tests)}; - } - - template <class... TestNames, int = 0, // MSVC disambiguator - absl::enable_if_t<ExpectSuccess && sizeof...(EqClasses) == 0 && - absl::conjunction<std::is_convertible< - TestNames, absl::string_view>...>::value>** = - nullptr> - ABSL_MUST_USE_RESULT ExpectConformanceOf<ExpectSuccess, T, EqClasses...> - due_to(TestNames&&... test_names) && { - // TODO(calabrese) Instead have DUE_TO only exist via a CRTP base. - // This would produce better errors messages than the static_assert. - static_assert(!ExpectSuccess, - "DUE_TO cannot be called when conformance is expected -- did " - "you mean to use ASSERT_NONCONFORMANCE_OF?"); - } - - // Add a value to be tested. Subsequent calls to this function on the same - // object must specify logically "larger" values with respect to the - // comparison operators of the type, if any. - // - // NOTE: This function should not be called directly. A stateful lambda is - // implicitly formed and passed when using the INITIALIZER macro at the bottom - // of this file. - template <class Fun, - absl::enable_if_t<std::is_same< - ResultOfGeneratorT<GeneratorType<Fun>>, T>::value>** = nullptr> - ABSL_MUST_USE_RESULT ExpectConformanceOf<ExpectSuccess, T, EqClasses..., - EquivalenceClassType<Fun>> - dont_class_directly_stateful_initializer(GeneratorType<Fun> fun) && { - return { - {std::tuple_cat(absl::move(ordered_vals.eq_classes), - std::make_tuple((EquivalenceClass)(absl::move(fun))))}, - std::move(expected_failed_tests)}; - } - - // Add a set of value to be tested, where each value is equal with respect to - // the comparison operators and std::hash specialization, if defined. - template < - class... Funs, - absl::void_t<absl::enable_if_t<std::is_same< - ResultOfGeneratorT<GeneratorType<Funs>>, T>::value>...>** = nullptr> - ABSL_MUST_USE_RESULT ExpectConformanceOf<ExpectSuccess, T, EqClasses..., - EquivalenceClassType<Funs...>> - equivalence_class(GeneratorType<Funs>... funs) && { - return {{std::tuple_cat( - absl::move(ordered_vals.eq_classes), - std::make_tuple((EquivalenceClass)(absl::move(funs)...)))}, - std::move(expected_failed_tests)}; - } - - // Execute the tests for the captured set of values, strictly matching a range - // of expected profiles in a given domain. - template < - class ProfRange, - absl::enable_if_t<IsProfileOrProfileRange<ProfRange>::value>** = nullptr> - ABSL_MUST_USE_RESULT ::testing::AssertionResult with_strict_profile( - ProfRange /*profile*/) { - ConformanceErrors test_result = - (ExpectRegularityImpl< - T, LogicalProfileOfT<ProfRange>, MinProfileOfT<ProfRange>, - MaxProfileOfT<ProfRange>>)(absl::move(ordered_vals)); - - return ExpectSuccess ? test_result.assertionResult() - : test_result.expectFailedTests(expected_failed_tests); - } - - // Execute the tests for the captured set of values, loosely matching a range - // of expected profiles (loose in that an interface is allowed to be more - // refined that a profile suggests, such as a type having a noexcept copy - // constructor when all that is required is that the copy constructor exists). - template <class Prof, absl::enable_if_t<IsProfile<Prof>::value>** = nullptr> - ABSL_MUST_USE_RESULT ::testing::AssertionResult with_loose_profile( - Prof /*profile*/) { - ConformanceErrors test_result = - (ExpectRegularityImpl< - T, Prof, Prof, - CombineProfiles<TriviallyCompleteProfile, - NothrowComparableProfile>>)(absl:: - move(ordered_vals)); - - return ExpectSuccess ? test_result.assertionResult() - : test_result.expectFailedTests(expected_failed_tests); - } - - OrderedEquivalenceClasses<EqClasses...> ordered_vals; - std::set<std::string> expected_failed_tests; -}; - -template <class T> -using ExpectConformanceOfType = ExpectConformanceOf</*ExpectSuccess=*/true, T>; - -template <class T> -using ExpectNonconformanceOfType = - ExpectConformanceOf</*ExpectSuccess=*/false, T>; - -struct EquivalenceClassMaker { - // TODO(calabrese) Constrain to callable - template <class Fun> - static GeneratorType<Fun> initializer(GeneratorType<Fun> fun) { - return fun; - } -}; - -// A top-level macro that begins the builder pattern. -// -// The argument here takes the datatype to be tested. -#define ABSL_INTERNAL_ASSERT_CONFORMANCE_OF(...) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if ABSL_INTERNAL_LPAREN \ - const ::testing::AssertionResult gtest_ar = \ - ABSL_INTERNAL_LPAREN ::absl::types_internal::ExpectConformanceOfType< \ - __VA_ARGS__>() - -// Akin to ASSERT_CONFORMANCE_OF except that it expects failure and tries to -// match text. -#define ABSL_INTERNAL_ASSERT_NONCONFORMANCE_OF(...) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if ABSL_INTERNAL_LPAREN \ - const ::testing::AssertionResult gtest_ar = \ - ABSL_INTERNAL_LPAREN ::absl::types_internal::ExpectNonconformanceOfType< \ - __VA_ARGS__>() - -//////////////////////////////////////////////////////////////////////////////// -// NOTE: The following macros look like they are recursive, but are not (macros -// cannot recurse). These actually refer to member functions of the same name. -// This is done intentionally so that a user cannot accidentally invoke a -// member function of the conformance-testing suite without going through the -// macro. -//////////////////////////////////////////////////////////////////////////////// - -// Specify expected test failures as comma-separated strings. -#define DUE_TO(...) due_to(__VA_ARGS__) - -// Specify a value to be tested. -// -// Note: Internally, this takes an expression and turns it into the return value -// of lambda that captures no data. The expression is stringized during -// preprocessing so that it can be used in error reports. -#define INITIALIZER(...) \ - initializer(::absl::types_internal::Generator( \ - [] { return __VA_ARGS__; }, ABSL_INTERNAL_STRINGIZE(__VA_ARGS__))) - -// Specify a value to be tested. -// -// Note: Internally, this takes an expression and turns it into the return value -// of lambda that captures data by reference. The expression is stringized -// during preprocessing so that it can be used in error reports. -#define STATEFUL_INITIALIZER(...) \ - stateful_initializer(::absl::types_internal::Generator( \ - [&] { return __VA_ARGS__; }, ABSL_INTERNAL_STRINGIZE(__VA_ARGS__))) - -// Used in the builder-pattern. -// -// Takes a series of INITIALIZER and/or STATEFUL_INITIALIZER invocations and -// forwards them along to be tested, grouping them such that the testing suite -// knows that they are supposed to represent the same logical value (the values -// compare the same, hash the same, etc.). -#define EQUIVALENCE_CLASS(...) \ - equivalence_class(ABSL_INTERNAL_TRANSFORM_ARGS( \ - ABSL_INTERNAL_PREPEND_EQ_MAKER, __VA_ARGS__)) - -// An invocation of this or WITH_STRICT_PROFILE must end the builder-pattern. -// It takes a Profile as its argument. -// -// This executes the tests and allows types that are "more referined" than the -// profile specifies, but not less. For instance, if the Profile specifies -// noexcept copy-constructiblity, the test will fail if the copy-constructor is -// not noexcept, however, it will succeed if the copy constructor is trivial. -// -// This is useful for testing that a type meets some minimum set of -// requirements. -#define WITH_LOOSE_PROFILE(...) \ - with_loose_profile( \ - ::absl::types_internal::MakeLooseProfileRangeT<__VA_ARGS__>()) \ - ABSL_INTERNAL_RPAREN ABSL_INTERNAL_RPAREN; \ - else GTEST_FATAL_FAILURE_(gtest_ar.failure_message()) // NOLINT - -// An invocation of this or WITH_STRICT_PROFILE must end the builder-pattern. -// It takes a Domain and a Profile as its arguments. -// -// This executes the tests and disallows types that differ at all from the -// properties of the Profile. For instance, if the Profile specifies noexcept -// copy-constructiblity, the test will fail if the copy constructor is trivial. -// -// This is useful for testing that a type does not do anything more than a -// specification requires, such as to minimize things like Hyrum's Law, or more -// commonly, to prevent a type from being "accidentally" copy-constructible in -// a way that may produce incorrect results, simply because the user forget to -// delete that operation. -#define WITH_STRICT_PROFILE(...) \ - with_strict_profile( \ - ::absl::types_internal::MakeStrictProfileRangeT<__VA_ARGS__>()) \ - ABSL_INTERNAL_RPAREN ABSL_INTERNAL_RPAREN; \ - else GTEST_FATAL_FAILURE_(gtest_ar.failure_message()) // NOLINT - -// Internal macro that is used in the internals of the EDSL when forming -// equivalence classes. -#define ABSL_INTERNAL_PREPEND_EQ_MAKER(arg) \ - ::absl::types_internal::EquivalenceClassMaker().arg - -} // namespace types_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_TYPES_INTERNAL_CONFORMANCE_TESTING_H_ diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_testing_helpers.h b/contrib/restricted/abseil-cpp/absl/types/internal/conformance_testing_helpers.h deleted file mode 100644 index 00775f960c..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/internal/conformance_testing_helpers.h +++ /dev/null @@ -1,391 +0,0 @@ -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef ABSL_TYPES_INTERNAL_CONFORMANCE_TESTING_HELPERS_H_ -#define ABSL_TYPES_INTERNAL_CONFORMANCE_TESTING_HELPERS_H_ - -// Checks to determine whether or not we can use abi::__cxa_demangle -#if (defined(__ANDROID__) || defined(ANDROID)) && !defined(OS_ANDROID) -#define ABSL_INTERNAL_OS_ANDROID -#endif - -// We support certain compilers only. See demangle.h for details. -#if defined(OS_ANDROID) && (defined(__i386__) || defined(__x86_64__)) -#define ABSL_TYPES_INTERNAL_HAS_CXA_DEMANGLE 0 -#elif (__GNUC__ >= 4 || (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4)) && \ - !defined(__mips__) -#define ABSL_TYPES_INTERNAL_HAS_CXA_DEMANGLE 1 -#elif defined(__clang__) && !defined(_MSC_VER) -#define ABSL_TYPES_INTERNAL_HAS_CXA_DEMANGLE 1 -#else -#define ABSL_TYPES_INTERNAL_HAS_CXA_DEMANGLE 0 -#endif - -#include <tuple> -#include <type_traits> -#include <utility> - -#include "absl/meta/type_traits.h" -#include "absl/strings/string_view.h" -#include "absl/utility/utility.h" - -#if ABSL_TYPES_INTERNAL_HAS_CXA_DEMANGLE -#include <cxxabi.h> - -#include <cstdlib> -#endif - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace types_internal { - -// Return a readable name for type T. -template <class T> -absl::string_view NameOfImpl() { -// TODO(calabrese) Investigate using debugging:internal_demangle as a fallback. -#if ABSL_TYPES_INTERNAL_HAS_CXA_DEMANGLE - int status = 0; - char* demangled_name = nullptr; - - demangled_name = - abi::__cxa_demangle(typeid(T).name(), nullptr, nullptr, &status); - - if (status == 0 && demangled_name != nullptr) { - return demangled_name; - } else { - return typeid(T).name(); - } -#else - return typeid(T).name(); -#endif - // NOTE: We intentionally leak demangled_name so that it remains valid - // throughout the remainder of the program. -} - -// Given a type, returns as nice of a type name as we can produce (demangled). -// -// Note: This currently strips cv-qualifiers and references, but that is okay -// because we only use this internally with unqualified object types. -template <class T> -std::string NameOf() { - static const absl::string_view result = NameOfImpl<T>(); - return std::string(result); -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Metafunction to check if a type is callable with no explicit arguments -template <class Fun, class /*Enabler*/ = void> -struct IsNullaryCallableImpl : std::false_type {}; - -template <class Fun> -struct IsNullaryCallableImpl< - Fun, absl::void_t<decltype(std::declval<const Fun&>()())>> - : std::true_type { - using result_type = decltype(std::declval<const Fun&>()()); - - template <class ValueType> - using for_type = std::is_same<ValueType, result_type>; - - using void_if_true = void; -}; - -template <class Fun> -struct IsNullaryCallable : IsNullaryCallableImpl<Fun> {}; -// -//////////////////////////////////////////////////////////////////////////////// - -// A type that contains a function object that returns an instance of a type -// that is undergoing conformance testing. This function is required to always -// return the same value upon invocation. -template <class Fun> -struct GeneratorType; - -// A type that contains a tuple of GeneratorType<Fun> where each Fun has the -// same return type. The result of each of the different generators should all -// be equal values, though the underlying object representation may differ (such -// as if one returns 0.0 and another return -0.0, or if one returns an empty -// vector and another returns an empty vector with a different capacity. -template <class... Funs> -struct EquivalenceClassType; - -//////////////////////////////////////////////////////////////////////////////// -// -// A metafunction to check if a type is a specialization of EquivalenceClassType -template <class T> -struct IsEquivalenceClass : std::false_type {}; - -template <> -struct IsEquivalenceClass<EquivalenceClassType<>> : std::true_type { - using self = IsEquivalenceClass; - - // A metafunction to check if this EquivalenceClassType is a valid - // EquivalenceClassType for a type `ValueType` that is undergoing testing - template <class ValueType> - using for_type = std::true_type; -}; - -template <class Head, class... Tail> -struct IsEquivalenceClass<EquivalenceClassType<Head, Tail...>> - : std::true_type { - using self = IsEquivalenceClass; - - // The type undergoing conformance testing that this EquivalenceClass - // corresponds to - using result_type = typename IsNullaryCallable<Head>::result_type; - - // A metafunction to check if this EquivalenceClassType is a valid - // EquivalenceClassType for a type `ValueType` that is undergoing testing - template <class ValueType> - using for_type = std::is_same<ValueType, result_type>; -}; -// -//////////////////////////////////////////////////////////////////////////////// - -// A type that contains an ordered series of EquivalenceClassTypes, where the -// the function object of each underlying GeneratorType has the same return type -// -// These equivalence classes are required to be in a logical ascending order -// that is consistent with comparison operators that are defined for the return -// type of each GeneratorType, if any. -template <class... EqClasses> -struct OrderedEquivalenceClasses; - -//////////////////////////////////////////////////////////////////////////////// -// -// A metafunction to determine the return type of the function object contained -// in a GeneratorType specialization. -template <class T> -struct ResultOfGenerator {}; - -template <class Fun> -struct ResultOfGenerator<GeneratorType<Fun>> { - using type = decltype(std::declval<const Fun&>()()); -}; - -template <class Fun> -using ResultOfGeneratorT = typename ResultOfGenerator<GeneratorType<Fun>>::type; -// -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// -// A metafunction that yields true iff each of Funs is a GeneratorType -// specialization and they all contain functions with the same return type -template <class /*Enabler*/, class... Funs> -struct AreGeneratorsWithTheSameReturnTypeImpl : std::false_type {}; - -template <> -struct AreGeneratorsWithTheSameReturnTypeImpl<void> : std::true_type {}; - -template <class Head, class... Tail> -struct AreGeneratorsWithTheSameReturnTypeImpl< - typename std::enable_if<absl::conjunction<std::is_same< - ResultOfGeneratorT<Head>, ResultOfGeneratorT<Tail>>...>::value>::type, - Head, Tail...> : std::true_type {}; - -template <class... Funs> -struct AreGeneratorsWithTheSameReturnType - : AreGeneratorsWithTheSameReturnTypeImpl<void, Funs...>::type {}; -// -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// -// A metafunction that yields true iff each of Funs is an EquivalenceClassType -// specialization and they all contain GeneratorType specializations that have -// the same return type -template <class... EqClasses> -struct AreEquivalenceClassesOfTheSameType { - static_assert(sizeof...(EqClasses) != sizeof...(EqClasses), ""); -}; - -template <> -struct AreEquivalenceClassesOfTheSameType<> : std::true_type { - using self = AreEquivalenceClassesOfTheSameType; - - // Metafunction to check that a type is the same as all of the equivalence - // classes, if any. - // Note: In this specialization there are no equivalence classes, so the - // value type is always compatible. - template <class /*ValueType*/> - using for_type = std::true_type; -}; - -template <class... Funs> -struct AreEquivalenceClassesOfTheSameType<EquivalenceClassType<Funs...>> - : std::true_type { - using self = AreEquivalenceClassesOfTheSameType; - - // Metafunction to check that a type is the same as all of the equivalence - // classes, if any. - template <class ValueType> - using for_type = typename IsEquivalenceClass< - EquivalenceClassType<Funs...>>::template for_type<ValueType>; -}; - -template <class... TailEqClasses> -struct AreEquivalenceClassesOfTheSameType< - EquivalenceClassType<>, EquivalenceClassType<>, TailEqClasses...> - : AreEquivalenceClassesOfTheSameType<TailEqClasses...>::self {}; - -template <class HeadNextFun, class... TailNextFuns, class... TailEqClasses> -struct AreEquivalenceClassesOfTheSameType< - EquivalenceClassType<>, EquivalenceClassType<HeadNextFun, TailNextFuns...>, - TailEqClasses...> - : AreEquivalenceClassesOfTheSameType< - EquivalenceClassType<HeadNextFun, TailNextFuns...>, - TailEqClasses...>::self {}; - -template <class HeadHeadFun, class... TailHeadFuns, class... TailEqClasses> -struct AreEquivalenceClassesOfTheSameType< - EquivalenceClassType<HeadHeadFun, TailHeadFuns...>, EquivalenceClassType<>, - TailEqClasses...> - : AreEquivalenceClassesOfTheSameType< - EquivalenceClassType<HeadHeadFun, TailHeadFuns...>, - TailEqClasses...>::self {}; - -template <class HeadHeadFun, class... TailHeadFuns, class HeadNextFun, - class... TailNextFuns, class... TailEqClasses> -struct AreEquivalenceClassesOfTheSameType< - EquivalenceClassType<HeadHeadFun, TailHeadFuns...>, - EquivalenceClassType<HeadNextFun, TailNextFuns...>, TailEqClasses...> - : absl::conditional_t< - IsNullaryCallable<HeadNextFun>::template for_type< - typename IsNullaryCallable<HeadHeadFun>::result_type>::value, - AreEquivalenceClassesOfTheSameType< - EquivalenceClassType<HeadHeadFun, TailHeadFuns...>, - TailEqClasses...>, - std::false_type> {}; -// -//////////////////////////////////////////////////////////////////////////////// - -// Execute a function for each passed-in parameter. -template <class Fun, class... Cases> -void ForEachParameter(const Fun& fun, const Cases&... cases) { - const std::initializer_list<bool> results = { - (static_cast<void>(fun(cases)), true)...}; - - (void)results; -} - -// Execute a function on each passed-in parameter (using a bound function). -template <class Fun> -struct ForEachParameterFun { - template <class... T> - void operator()(const T&... cases) const { - (ForEachParameter)(fun, cases...); - } - - Fun fun; -}; - -// Execute a function on each element of a tuple. -template <class Fun, class Tup> -void ForEachTupleElement(const Fun& fun, const Tup& tup) { - absl::apply(ForEachParameterFun<Fun>{fun}, tup); -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Execute a function for each combination of two elements of a tuple, including -// combinations of an element with itself. -template <class Fun, class... T> -struct ForEveryTwoImpl { - template <class Lhs> - struct WithBoundLhs { - template <class Rhs> - void operator()(const Rhs& rhs) const { - fun(lhs, rhs); - } - - Fun fun; - Lhs lhs; - }; - - template <class Lhs> - void operator()(const Lhs& lhs) const { - (ForEachTupleElement)(WithBoundLhs<Lhs>{fun, lhs}, args); - } - - Fun fun; - std::tuple<T...> args; -}; - -template <class Fun, class... T> -void ForEveryTwo(const Fun& fun, std::tuple<T...> args) { - (ForEachTupleElement)(ForEveryTwoImpl<Fun, T...>{fun, args}, args); -} -// -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// -// Insert all values into an associative container -template<class Container> -void InsertEach(Container* cont) { -} - -template<class Container, class H, class... T> -void InsertEach(Container* cont, H&& head, T&&... tail) { - cont->insert(head); - (InsertEach)(cont, tail...); -} -// -//////////////////////////////////////////////////////////////////////////////// -// A template with a nested "Invoke" static-member-function that executes a -// passed-in Callable when `Condition` is true, otherwise it ignores the -// Callable. This is useful for executing a function object with a condition -// that corresponds to whether or not the Callable can be safely instantiated. -// It has some overlapping uses with C++17 `if constexpr`. -template <bool Condition> -struct If; - -template <> -struct If</*Condition =*/false> { - template <class Fun, class... P> - static void Invoke(const Fun& /*fun*/, P&&... /*args*/) {} -}; - -template <> -struct If</*Condition =*/true> { - template <class Fun, class... P> - static void Invoke(const Fun& fun, P&&... args) { - // TODO(calabrese) Use std::invoke equivalent instead of function-call. - fun(absl::forward<P>(args)...); - } -}; - -// -// ABSL_INTERNAL_STRINGIZE(...) -// -// This variadic macro transforms its arguments into a c-string literal after -// expansion. -// -// Example: -// -// ABSL_INTERNAL_STRINGIZE(std::array<int, 10>) -// -// Results in: -// -// "std::array<int, 10>" -#define ABSL_INTERNAL_STRINGIZE(...) ABSL_INTERNAL_STRINGIZE_IMPL((__VA_ARGS__)) -#define ABSL_INTERNAL_STRINGIZE_IMPL(arg) ABSL_INTERNAL_STRINGIZE_IMPL2 arg -#define ABSL_INTERNAL_STRINGIZE_IMPL2(...) #__VA_ARGS__ - -} // namespace types_internal -ABSL_NAMESPACE_END -} // namespace absl - -#endif // ABSL_TYPES_INTERNAL_CONFORMANCE_TESTING_HELPERS_H_ diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/parentheses.h b/contrib/restricted/abseil-cpp/absl/types/internal/parentheses.h deleted file mode 100644 index 5aebee8fde..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/internal/parentheses.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// parentheses.h -// ----------------------------------------------------------------------------- -// -// This file contains macros that expand to a left parenthesis and a right -// parenthesis. These are in their own file and are generated from macros -// because otherwise clang-format gets confused and clang-format off directives -// do not help. -// -// The parentheses macros are used when wanting to require a rescan before -// expansion of parenthesized text appearing after a function-style macro name. - -#ifndef ABSL_TYPES_INTERNAL_PARENTHESES_H_ -#define ABSL_TYPES_INTERNAL_PARENTHESES_H_ - -#define ABSL_INTERNAL_LPAREN ( - -#define ABSL_INTERNAL_RPAREN ) - -#endif // ABSL_TYPES_INTERNAL_PARENTHESES_H_ diff --git a/contrib/restricted/abseil-cpp/absl/types/internal/transform_args.h b/contrib/restricted/abseil-cpp/absl/types/internal/transform_args.h deleted file mode 100644 index 4a0ab42ac4..0000000000 --- a/contrib/restricted/abseil-cpp/absl/types/internal/transform_args.h +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright 2019 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------- -// transform_args.h -// ----------------------------------------------------------------------------- -// -// This file contains a higher-order macro that "transforms" each element of a -// a variadic argument by a provided secondary macro. - -#ifndef ABSL_TYPES_INTERNAL_TRANSFORM_ARGS_H_ -#define ABSL_TYPES_INTERNAL_TRANSFORM_ARGS_H_ - -// -// ABSL_INTERNAL_CAT(a, b) -// -// This macro takes two arguments and concatenates them together via ## after -// expansion. -// -// Example: -// -// ABSL_INTERNAL_CAT(foo_, bar) -// -// Results in: -// -// foo_bar -#define ABSL_INTERNAL_CAT(a, b) ABSL_INTERNAL_CAT_IMPL(a, b) -#define ABSL_INTERNAL_CAT_IMPL(a, b) a##b - -// -// ABSL_INTERNAL_TRANSFORM_ARGS(m, ...) -// -// This macro takes another macro as an argument followed by a trailing series -// of additional parameters (up to 32 additional arguments). It invokes the -// passed-in macro once for each of the additional arguments, with the -// expansions separated by commas. -// -// Example: -// -// ABSL_INTERNAL_TRANSFORM_ARGS(MY_MACRO, a, b, c) -// -// Results in: -// -// MY_MACRO(a), MY_MACRO(b), MY_MACRO(c) -// -// TODO(calabrese) Handle no arguments as a special case. -#define ABSL_INTERNAL_TRANSFORM_ARGS(m, ...) \ - ABSL_INTERNAL_CAT(ABSL_INTERNAL_TRANSFORM_ARGS, \ - ABSL_INTERNAL_NUM_ARGS(__VA_ARGS__)) \ - (m, __VA_ARGS__) - -#define ABSL_INTERNAL_TRANSFORM_ARGS1(m, a0) m(a0) - -#define ABSL_INTERNAL_TRANSFORM_ARGS2(m, a0, a1) m(a0), m(a1) - -#define ABSL_INTERNAL_TRANSFORM_ARGS3(m, a0, a1, a2) m(a0), m(a1), m(a2) - -#define ABSL_INTERNAL_TRANSFORM_ARGS4(m, a0, a1, a2, a3) \ - m(a0), m(a1), m(a2), m(a3) - -#define ABSL_INTERNAL_TRANSFORM_ARGS5(m, a0, a1, a2, a3, a4) \ - m(a0), m(a1), m(a2), m(a3), m(a4) - -#define ABSL_INTERNAL_TRANSFORM_ARGS6(m, a0, a1, a2, a3, a4, a5) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5) - -#define ABSL_INTERNAL_TRANSFORM_ARGS7(m, a0, a1, a2, a3, a4, a5, a6) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6) - -#define ABSL_INTERNAL_TRANSFORM_ARGS8(m, a0, a1, a2, a3, a4, a5, a6, a7) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7) - -#define ABSL_INTERNAL_TRANSFORM_ARGS9(m, a0, a1, a2, a3, a4, a5, a6, a7, a8) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8) - -#define ABSL_INTERNAL_TRANSFORM_ARGS10(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9) - -#define ABSL_INTERNAL_TRANSFORM_ARGS11(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), m(a10) - -#define ABSL_INTERNAL_TRANSFORM_ARGS12(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11) - -#define ABSL_INTERNAL_TRANSFORM_ARGS13(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12) - -#define ABSL_INTERNAL_TRANSFORM_ARGS14(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13) - -#define ABSL_INTERNAL_TRANSFORM_ARGS15(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14) - -#define ABSL_INTERNAL_TRANSFORM_ARGS16(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15) - -#define ABSL_INTERNAL_TRANSFORM_ARGS17(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16) - -#define ABSL_INTERNAL_TRANSFORM_ARGS18(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16, \ - a17) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17) - -#define ABSL_INTERNAL_TRANSFORM_ARGS19(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16, \ - a17, a18) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18) - -#define ABSL_INTERNAL_TRANSFORM_ARGS20(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16, \ - a17, a18, a19) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19) - -#define ABSL_INTERNAL_TRANSFORM_ARGS21(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16, \ - a17, a18, a19, a20) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20) - -#define ABSL_INTERNAL_TRANSFORM_ARGS22(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16, \ - a17, a18, a19, a20, a21) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21) - -#define ABSL_INTERNAL_TRANSFORM_ARGS23(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16, \ - a17, a18, a19, a20, a21, a22) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22) - -#define ABSL_INTERNAL_TRANSFORM_ARGS24(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16, \ - a17, a18, a19, a20, a21, a22, a23) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22), m(a23) - -#define ABSL_INTERNAL_TRANSFORM_ARGS25(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16, \ - a17, a18, a19, a20, a21, a22, a23, a24) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22), m(a23), m(a24) - -#define ABSL_INTERNAL_TRANSFORM_ARGS26( \ - m, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, \ - a16, a17, a18, a19, a20, a21, a22, a23, a24, a25) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22), m(a23), m(a24), m(a25) - -#define ABSL_INTERNAL_TRANSFORM_ARGS27( \ - m, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, \ - a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22), m(a23), m(a24), m(a25), m(a26) - -#define ABSL_INTERNAL_TRANSFORM_ARGS28( \ - m, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, \ - a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22), m(a23), m(a24), m(a25), m(a26), m(a27) - -#define ABSL_INTERNAL_TRANSFORM_ARGS29( \ - m, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, \ - a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22), m(a23), m(a24), m(a25), m(a26), m(a27), \ - m(a28) - -#define ABSL_INTERNAL_TRANSFORM_ARGS30( \ - m, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, \ - a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22), m(a23), m(a24), m(a25), m(a26), m(a27), \ - m(a28), m(a29) - -#define ABSL_INTERNAL_TRANSFORM_ARGS31( \ - m, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, \ - a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22), m(a23), m(a24), m(a25), m(a26), m(a27), \ - m(a28), m(a29), m(a30) - -#define ABSL_INTERNAL_TRANSFORM_ARGS32(m, a0, a1, a2, a3, a4, a5, a6, a7, a8, \ - a9, a10, a11, a12, a13, a14, a15, a16, \ - a17, a18, a19, a20, a21, a22, a23, a24, \ - a25, a26, a27, a28, a29, a30, a31) \ - m(a0), m(a1), m(a2), m(a3), m(a4), m(a5), m(a6), m(a7), m(a8), m(a9), \ - m(a10), m(a11), m(a12), m(a13), m(a14), m(a15), m(a16), m(a17), m(a18), \ - m(a19), m(a20), m(a21), m(a22), m(a23), m(a24), m(a25), m(a26), m(a27), \ - m(a28), m(a29), m(a30), m(a31) - -#define ABSL_INTERNAL_NUM_ARGS_IMPL(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, \ - a10, a11, a12, a13, a14, a15, a16, a17, \ - a18, a19, a20, a21, a22, a23, a24, a25, \ - a26, a27, a28, a29, a30, a31, result, ...) \ - result - -#define ABSL_INTERNAL_FORCE_EXPANSION(...) __VA_ARGS__ - -#define ABSL_INTERNAL_NUM_ARGS(...) \ - ABSL_INTERNAL_FORCE_EXPANSION(ABSL_INTERNAL_NUM_ARGS_IMPL( \ - __VA_ARGS__, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, \ - 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, )) - -#endif // ABSL_TYPES_INTERNAL_TRANSFORM_ARGS_H_ diff --git a/contrib/restricted/abseil-cpp/absl/utility/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp/absl/utility/.yandex_meta/licenses.list.txt deleted file mode 100644 index 7be6b42848..0000000000 --- a/contrib/restricted/abseil-cpp/absl/utility/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,16 +0,0 @@ -====================Apache-2.0==================== -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -====================COPYRIGHT==================== -// Copyright 2017 The Abseil Authors. diff --git a/contrib/restricted/abseil-cpp/absl/utility/CMakeLists.linux.txt b/contrib/restricted/abseil-cpp/absl/utility/CMakeLists.linux.txt deleted file mode 100644 index e16533d219..0000000000 --- a/contrib/restricted/abseil-cpp/absl/utility/CMakeLists.linux.txt +++ /dev/null @@ -1,10 +0,0 @@ - -# This file was gererated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(abseil-cpp-absl-utility INTERFACE) diff --git a/contrib/restricted/abseil-cpp/absl/utility/CMakeLists.txt b/contrib/restricted/abseil-cpp/absl/utility/CMakeLists.txt index e8c98bfd99..e16533d219 100644 --- a/contrib/restricted/abseil-cpp/absl/utility/CMakeLists.txt +++ b/contrib/restricted/abseil-cpp/absl/utility/CMakeLists.txt @@ -6,6 +6,5 @@ # original buildsystem will not be accepted. -if (UNIX AND NOT APPLE) - include(CMakeLists.linux.txt) -endif() + +add_library(abseil-cpp-absl-utility INTERFACE) diff --git a/contrib/restricted/abseil-cpp/provides.pbtxt b/contrib/restricted/abseil-cpp/provides.pbtxt deleted file mode 100644 index 5e5f196730..0000000000 --- a/contrib/restricted/abseil-cpp/provides.pbtxt +++ /dev/null @@ -1,66 +0,0 @@ -p { i: "abseil-cpp" x: "absl_bad_any_cast_impl" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/types/bad_any_cast" } -p { i: "abseil-cpp" x: "absl_bad_optional_access" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/types/bad_optional_access" } -p { i: "abseil-cpp" x: "absl_bad_variant_access" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/types/bad_variant_access" } -p { i: "abseil-cpp" x: "absl_base" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/base" } -p { i: "abseil-cpp" x: "absl_city" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/city" } -p { i: "abseil-cpp" x: "absl_civil_time" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/time/civil_time" } -p { i: "abseil-cpp" x: "absl_cord" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/strings/cord" } -p { i: "abseil-cpp" x: "absl_cord_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/strings/internal/absl_cord_internal" } -p { i: "abseil-cpp" x: "absl_cordz_functions" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions" } -p { i: "abseil-cpp" x: "absl_cordz_handle" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle" } -p { i: "abseil-cpp" x: "absl_cordz_info" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info" } -p { i: "abseil-cpp" x: "absl_cordz_sample_token" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/strings/internal/cordz_sample_token" } -p { i: "abseil-cpp" x: "absl_debugging_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/debugging" } -p { i: "abseil-cpp" x: "absl_demangle_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/demangle" } -p { i: "abseil-cpp" x: "absl_examine_stack" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/debugging/internal" } -p { i: "abseil-cpp" x: "absl_exponential_biased" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased" } -p { i: "abseil-cpp" x: "absl_failure_signal_handler" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/debugging/failure_signal_handler" } -p { i: "abseil-cpp" x: "absl_flags" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags" } -p { i: "abseil-cpp" x: "absl_flags_commandlineflag" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/commandlineflag" } -p { i: "abseil-cpp" x: "absl_flags_commandlineflag_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag" } -p { i: "abseil-cpp" x: "absl_flags_config" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/usage_config" } -p { i: "abseil-cpp" x: "absl_flags_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/internal/flag" } -p { i: "abseil-cpp" x: "absl_flags_marshalling" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/marshalling" } -p { i: "abseil-cpp" x: "absl_flags_parse" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/parse" } -p { i: "abseil-cpp" x: "absl_flags_private_handle_accessor" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor" } -p { i: "abseil-cpp" x: "absl_flags_program_name" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/internal/program_name" } -p { i: "abseil-cpp" x: "absl_flags_reflection" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/reflection" } -p { i: "abseil-cpp" x: "absl_flags_usage" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/usage" } -p { i: "abseil-cpp" x: "absl_flags_usage_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/flags/internal/usage" } -p { i: "abseil-cpp" x: "absl_graphcycles_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/synchronization/internal" } -p { i: "abseil-cpp" x: "absl_hash" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/hash" } -p { i: "abseil-cpp" x: "absl_hashtablez_sampler" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/container/internal/absl_hashtablez_sampler" } -p { i: "abseil-cpp" x: "absl_int128" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/numeric" } -p { i: "abseil-cpp" x: "absl_leak_check" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/debugging/leak_check" } -p { i: "abseil-cpp" x: "absl_leak_check_disable" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/debugging/leak_check_disable" } -p { i: "abseil-cpp" x: "absl_log_severity" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/base/log_severity" } -p { i: "abseil-cpp" x: "absl_low_level_hash" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/hash/internal" } -p { i: "abseil-cpp" x: "absl_malloc_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc" } -p { i: "abseil-cpp" x: "absl_periodic_sampler" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/profiling/internal/periodic_sampler" } -p { i: "abseil-cpp" x: "absl_random_distributions" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/absl_random_distributions" } -p { i: "abseil-cpp" x: "absl_random_internal_distribution_test_util" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/internal/absl_random_internal_distribution_test_util" } -p { i: "abseil-cpp" x: "absl_random_internal_platform" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/internal/randen_round_keys" } -p { i: "abseil-cpp" x: "absl_random_internal_pool_urbg" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/internal/pool_urbg" } -p { i: "abseil-cpp" x: "absl_random_internal_randen" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/internal/randen" } -p { i: "abseil-cpp" x: "absl_random_internal_randen_hwaes" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/internal/randen_detect" } -p { i: "abseil-cpp" x: "absl_random_internal_randen_hwaes_impl" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/internal/randen_hwaes" } -p { i: "abseil-cpp" x: "absl_random_internal_randen_slow" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/internal/randen_slow" } -p { i: "abseil-cpp" x: "absl_random_internal_seed_material" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/internal/seed_material" } -p { i: "abseil-cpp" x: "absl_random_seed_gen_exception" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/seed_gen_exception" } -p { i: "abseil-cpp" x: "absl_random_seed_sequences" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/random/seed_sequences" } -p { i: "abseil-cpp" x: "absl_raw_hash_set" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set" } -p { i: "abseil-cpp" x: "absl_raw_logging_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/base/internal/raw_logging" } -p { i: "abseil-cpp" x: "absl_scoped_set_env" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/base/internal/scoped_set_env" } -p { i: "abseil-cpp" x: "absl_spinlock_wait" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait" } -p { i: "abseil-cpp" x: "absl_stacktrace" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/debugging/stacktrace" } -p { i: "abseil-cpp" x: "absl_status" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/status" } -p { i: "abseil-cpp" x: "absl_statusor" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/status/statusor" } -p { i: "abseil-cpp" x: "absl_str_format_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/strings/internal/str_format" } -p { i: "abseil-cpp" x: "absl_strerror" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/base/internal/strerror" } -p { i: "abseil-cpp" x: "absl_strings" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/strings" } -p { i: "abseil-cpp" x: "absl_strings_internal" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal" } -p { i: "abseil-cpp" x: "absl_symbolize" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/debugging/symbolize" } -p { i: "abseil-cpp" x: "absl_synchronization" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/synchronization" } -p { i: "abseil-cpp" x: "absl_throw_delegate" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate" } -p { i: "abseil-cpp" x: "absl_time" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/time" } -p { i: "abseil-cpp" x: "absl_time_zone" ix: true peerdir: "contrib/restricted/abseil-cpp/absl/time/time_zone" } |