From dc37c87a60a1e3d67c2ac5d5c5b9fc1e4af89632 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 26 Jan 2024 11:49:45 +0000 Subject: [PATCH] merge llvm libcxx 16.0.6 --- .../libcxx/benchmarks/algorithms.bench.cpp | 337 --- .../cmake/Modules/DefineLinkerScript.cmake | 56 - .../cmake/Modules/HandleCompilerRT.cmake | 64 - .../cmake/Modules/HandleOutOfTreeLLVM.cmake | 78 - .../libcxx/cmake/caches/Generic-32bits.cmake | 1 - .../caches/Generic-debug-iterators.cmake | 2 - .../cmake/caches/Generic-no-debug.cmake | 1 - .../cmake/caches/Generic-singlethreaded.cmake | 3 - gnu/llvm/libcxx/docs/Makefile.sphinx | 37 - gnu/llvm/libcxx/docs/Status/RangesIssues.csv | 80 - gnu/llvm/libcxx/docs/Status/RangesPaper.csv | 149 - .../libcxx/include/__algorithm/ranges_find.h | 8 +- .../include/__algorithm/ranges_find_if.h | 8 +- .../include/__algorithm/ranges_find_if_not.h | 8 +- gnu/llvm/libcxx/include/__bits | 145 - gnu/llvm/libcxx/include/__config | 2165 +++++++------- gnu/llvm/libcxx/include/__function_like.h | 56 - gnu/llvm/libcxx/include/__functional_base | 32 - gnu/llvm/libcxx/include/__libcpp_version | 1 - gnu/llvm/libcxx/include/__locale | 235 +- .../libcxx/include/__memory/pointer_safety.h | 57 - gnu/llvm/libcxx/include/__nullptr | 61 - gnu/llvm/libcxx/include/__string | 1146 -------- .../libcxx/include/__support/ibm/limits.h | 98 - .../include/__support/ibm/locale_mgmt_aix.h | 84 - .../libcxx/include/__support/ibm/support.h | 53 - .../libcxx/include/__support/nuttx/xlocale.h | 18 - .../__support/win32/limits_msvc_win32.h | 71 - gnu/llvm/libcxx/include/__tuple | 551 ---- .../libcxx/include/__utility/__decay_copy.h | 39 - gnu/llvm/libcxx/include/algorithm | 1166 +++++++- .../libcxx/include/experimental/filesystem | 256 -- gnu/llvm/libcxx/include/locale | 684 +++-- gnu/llvm/libcxx/include/math.h | 1665 ++++++----- gnu/llvm/libcxx/include/module.modulemap | 900 ------ gnu/llvm/libcxx/include/stdio.h | 10 +- gnu/llvm/libcxx/include/stdlib.h | 50 +- ...stable.exceptions.no_new_in_libcxx.abilist | 2540 ---------------- ...stable.exceptions.no_new_in_libcxx.abilist | 2570 ----------------- ...stable.exceptions.no_new_in_libcxx.abilist | 2030 ------------- gnu/llvm/libcxx/lib/libc++abi.v1.exp | 150 - gnu/llvm/libcxx/lib/libc++abi.v2.exp | 295 -- gnu/llvm/libcxx/src/random.cpp | 59 +- gnu/llvm/libcxx/src/thread.cpp | 24 +- .../libcxx/utils/ci/runtimes/CMakeLists.txt | 44 - .../utils/generate_private_header_tests.py | 83 - .../utils/google-benchmark/.clang-format | 5 - .../google-benchmark/.github/.libcxx-setup.sh | 24 - .../.github/ISSUE_TEMPLATE/bug_report.md | 32 - .../.github/ISSUE_TEMPLATE/feature_request.md | 20 - .../.github/workflows/bazel.yml | 30 - .../workflows/build-and-test-perfcounters.yml | 44 - .../.github/workflows/build-and-test.yml | 110 - .../.github/workflows/pylint.yml | 26 - .../.github/workflows/sanitizer.yml | 78 - .../.github/workflows/test_bindings.yml | 24 - .../libcxx/utils/google-benchmark/.gitignore | 66 - .../libcxx/utils/google-benchmark/.travis.yml | 208 -- .../utils/google-benchmark/.ycm_extra_conf.py | 115 - .../libcxx/utils/google-benchmark/AUTHORS | 60 - .../libcxx/utils/google-benchmark/BUILD.bazel | 44 - .../utils/google-benchmark/CMakeLists.txt | 313 -- .../utils/google-benchmark/CONTRIBUTING.md | 58 - .../utils/google-benchmark/CONTRIBUTORS | 85 - .../libcxx/utils/google-benchmark/LICENSE | 202 -- .../libcxx/utils/google-benchmark/README.md | 1378 --------- .../libcxx/utils/google-benchmark/WORKSPACE | 51 - .../libcxx/utils/google-benchmark/_config.yml | 2 - .../utils/google-benchmark/appveyor.yml | 50 - .../google-benchmark/bindings/python/BUILD | 3 - .../bindings/python/build_defs.bzl | 25 - .../bindings/python/google_benchmark/BUILD | 38 - .../python/google_benchmark/__init__.py | 158 - .../python/google_benchmark/benchmark.cc | 181 -- .../python/google_benchmark/example.py | 136 - .../bindings/python/pybind11.BUILD | 20 - .../bindings/python/python_headers.BUILD | 6 - .../bindings/python/requirements.txt | 2 - .../cmake/AddCXXCompilerFlag.cmake | 78 - .../cmake/CXXFeatureCheck.cmake | 69 - .../google-benchmark/cmake/Config.cmake.in | 1 - .../cmake/GetGitVersion.cmake | 58 - .../google-benchmark/cmake/GoogleTest.cmake | 41 - .../cmake/GoogleTest.cmake.in | 58 - .../google-benchmark/cmake/benchmark.pc.in | 12 - .../cmake/gnu_posix_regex.cpp | 12 - .../cmake/llvm-toolchain.cmake | 8 - .../google-benchmark/cmake/posix_regex.cpp | 14 - .../google-benchmark/cmake/split_list.cmake | 3 - .../google-benchmark/cmake/std_regex.cpp | 10 - .../google-benchmark/cmake/steady_clock.cpp | 7 - .../cmake/thread_safety_attributes.cpp | 4 - .../utils/google-benchmark/dependencies.md | 18 - .../google-benchmark/docs/AssemblyTests.md | 147 - .../utils/google-benchmark/docs/_config.yml | 1 - .../google-benchmark/docs/perf_counters.md | 34 - .../docs/random_interleaving.md | 13 - .../utils/google-benchmark/docs/releasing.md | 22 - .../utils/google-benchmark/docs/tools.md | 203 -- .../include/benchmark/benchmark.h | 1654 ----------- .../utils/google-benchmark/requirements.txt | 2 - .../libcxx/utils/google-benchmark/setup.py | 140 - .../utils/google-benchmark/src/CMakeLists.txt | 120 - .../utils/google-benchmark/src/arraysize.h | 33 - .../utils/google-benchmark/src/benchmark.cc | 617 ---- .../src/benchmark_api_internal.cc | 94 - .../src/benchmark_api_internal.h | 78 - .../google-benchmark/src/benchmark_main.cc | 17 - .../google-benchmark/src/benchmark_name.cc | 58 - .../src/benchmark_register.cc | 461 --- .../google-benchmark/src/benchmark_register.h | 108 - .../google-benchmark/src/benchmark_runner.cc | 349 --- .../google-benchmark/src/benchmark_runner.h | 106 - .../libcxx/utils/google-benchmark/src/check.h | 82 - .../utils/google-benchmark/src/colorprint.cc | 188 -- .../utils/google-benchmark/src/colorprint.h | 33 - .../google-benchmark/src/commandlineflags.cc | 286 -- .../google-benchmark/src/commandlineflags.h | 116 - .../utils/google-benchmark/src/complexity.cc | 240 -- .../utils/google-benchmark/src/complexity.h | 55 - .../google-benchmark/src/console_reporter.cc | 177 -- .../utils/google-benchmark/src/counter.cc | 80 - .../utils/google-benchmark/src/counter.h | 32 - .../google-benchmark/src/csv_reporter.cc | 154 - .../utils/google-benchmark/src/cycleclock.h | 225 -- .../google-benchmark/src/internal_macros.h | 102 - .../google-benchmark/src/json_reporter.cc | 269 -- .../libcxx/utils/google-benchmark/src/log.h | 74 - .../libcxx/utils/google-benchmark/src/mutex.h | 155 - .../google-benchmark/src/perf_counters.cc | 132 - .../google-benchmark/src/perf_counters.h | 172 -- .../libcxx/utils/google-benchmark/src/re.h | 158 - .../utils/google-benchmark/src/reporter.cc | 116 - .../utils/google-benchmark/src/sleep.cc | 67 - .../libcxx/utils/google-benchmark/src/sleep.h | 15 - .../utils/google-benchmark/src/statistics.cc | 195 -- .../utils/google-benchmark/src/statistics.h | 37 - .../utils/google-benchmark/src/string_util.cc | 268 -- .../utils/google-benchmark/src/string_util.h | 61 - .../utils/google-benchmark/src/sysinfo.cc | 726 ----- .../google-benchmark/src/thread_manager.h | 64 - .../utils/google-benchmark/src/thread_timer.h | 86 - .../utils/google-benchmark/src/timers.cc | 253 -- .../utils/google-benchmark/src/timers.h | 48 - .../google-benchmark/test/AssemblyTests.cmake | 46 - .../libcxx/utils/google-benchmark/test/BUILD | 74 - .../google-benchmark/test/CMakeLists.txt | 271 -- .../test/args_product_test.cc | 77 - .../utils/google-benchmark/test/basic_test.cc | 151 - .../google-benchmark/test/benchmark_gtest.cc | 165 -- .../test/benchmark_name_gtest.cc | 74 - .../benchmark_random_interleaving_gtest.cc | 126 - .../google-benchmark/test/benchmark_test.cc | 245 -- .../test/clobber_memory_assembly_test.cc | 64 - .../test/commandlineflags_gtest.cc | 228 -- .../google-benchmark/test/complexity_test.cc | 222 -- .../utils/google-benchmark/test/cxx03_test.cc | 63 - .../google-benchmark/test/diagnostics_test.cc | 80 - .../test/display_aggregates_only_test.cc | 43 - .../test/donotoptimize_assembly_test.cc | 163 -- .../test/donotoptimize_test.cc | 52 - .../google-benchmark/test/filter_test.cc | 118 - .../google-benchmark/test/fixture_test.cc | 51 - .../test/internal_threading_test.cc | 184 -- .../google-benchmark/test/link_main_test.cc | 8 - .../utils/google-benchmark/test/map_test.cc | 57 - .../test/memory_manager_test.cc | 46 - .../test/multiple_ranges_test.cc | 96 - .../google-benchmark/test/options_test.cc | 76 - .../utils/google-benchmark/test/output_test.h | 213 -- .../test/output_test_helper.cc | 520 ---- .../test/perf_counters_gtest.cc | 145 - .../test/perf_counters_test.cc | 27 - .../test/register_benchmark_test.cc | 184 -- .../google-benchmark/test/repetitions_test.cc | 208 -- .../test/report_aggregates_only_test.cc | 39 - .../test/reporter_output_test.cc | 956 ------ .../test/skip_with_error_test.cc | 195 -- .../test/state_assembly_test.cc | 68 - .../google-benchmark/test/statistics_gtest.cc | 28 - .../test/string_util_gtest.cc | 161 -- .../test/templated_fixture_test.cc | 28 - .../test/user_counters_tabular_test.cc | 500 ---- .../test/user_counters_test.cc | 555 ---- .../test/user_counters_thousands_test.cc | 183 -- .../utils/google-benchmark/tools/BUILD.bazel | 19 - .../utils/google-benchmark/tools/compare.py | 429 --- .../tools/gbench/Inputs/test1_run1.json | 119 - .../tools/gbench/Inputs/test1_run2.json | 119 - .../tools/gbench/Inputs/test2_run.json | 81 - .../tools/gbench/Inputs/test3_run0.json | 65 - .../tools/gbench/Inputs/test3_run1.json | 65 - .../tools/gbench/Inputs/test4_run.json | 96 - .../google-benchmark/tools/gbench/__init__.py | 8 - .../google-benchmark/tools/gbench/report.py | 991 ------- .../google-benchmark/tools/gbench/util.py | 181 -- .../google-benchmark/tools/requirements.txt | 1 - .../utils/google-benchmark/tools/strip_asm.py | 151 - gnu/llvm/libcxx/utils/libcxx/compiler.py | 308 -- gnu/llvm/libcxx/utils/libcxx/test/config.py | 484 ---- .../libcxx/utils/libcxx/test/target_info.py | 171 -- gnu/llvm/libcxx/utils/libcxx/util.py | 301 -- gnu/llvm/libcxx/utils/merge_archives.py | 155 - 203 files changed, 3512 insertions(+), 38102 deletions(-) delete mode 100644 gnu/llvm/libcxx/benchmarks/algorithms.bench.cpp delete mode 100644 gnu/llvm/libcxx/cmake/Modules/DefineLinkerScript.cmake delete mode 100644 gnu/llvm/libcxx/cmake/Modules/HandleCompilerRT.cmake delete mode 100644 gnu/llvm/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake delete mode 100644 gnu/llvm/libcxx/cmake/caches/Generic-32bits.cmake delete mode 100644 gnu/llvm/libcxx/cmake/caches/Generic-debug-iterators.cmake delete mode 100644 gnu/llvm/libcxx/cmake/caches/Generic-no-debug.cmake delete mode 100644 gnu/llvm/libcxx/cmake/caches/Generic-singlethreaded.cmake delete mode 100644 gnu/llvm/libcxx/docs/Makefile.sphinx delete mode 100644 gnu/llvm/libcxx/docs/Status/RangesIssues.csv delete mode 100644 gnu/llvm/libcxx/docs/Status/RangesPaper.csv delete mode 100644 gnu/llvm/libcxx/include/__bits delete mode 100644 gnu/llvm/libcxx/include/__function_like.h delete mode 100644 gnu/llvm/libcxx/include/__functional_base delete mode 100644 gnu/llvm/libcxx/include/__libcpp_version delete mode 100644 gnu/llvm/libcxx/include/__memory/pointer_safety.h delete mode 100644 gnu/llvm/libcxx/include/__nullptr delete mode 100644 gnu/llvm/libcxx/include/__string delete mode 100644 gnu/llvm/libcxx/include/__support/ibm/limits.h delete mode 100644 gnu/llvm/libcxx/include/__support/ibm/locale_mgmt_aix.h delete mode 100644 gnu/llvm/libcxx/include/__support/ibm/support.h delete mode 100644 gnu/llvm/libcxx/include/__support/nuttx/xlocale.h delete mode 100644 gnu/llvm/libcxx/include/__support/win32/limits_msvc_win32.h delete mode 100644 gnu/llvm/libcxx/include/__tuple delete mode 100644 gnu/llvm/libcxx/include/__utility/__decay_copy.h delete mode 100644 gnu/llvm/libcxx/include/experimental/filesystem delete mode 100644 gnu/llvm/libcxx/include/module.modulemap delete mode 100644 gnu/llvm/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.no_new_in_libcxx.abilist delete mode 100644 gnu/llvm/libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.no_new_in_libcxx.abilist delete mode 100644 gnu/llvm/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.no_new_in_libcxx.abilist delete mode 100644 gnu/llvm/libcxx/lib/libc++abi.v1.exp delete mode 100644 gnu/llvm/libcxx/lib/libc++abi.v2.exp delete mode 100644 gnu/llvm/libcxx/utils/ci/runtimes/CMakeLists.txt delete mode 100755 gnu/llvm/libcxx/utils/generate_private_header_tests.py delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.clang-format delete mode 100755 gnu/llvm/libcxx/utils/google-benchmark/.github/.libcxx-setup.sh delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.github/workflows/bazel.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.github/workflows/build-and-test-perfcounters.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.github/workflows/build-and-test.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.github/workflows/pylint.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.github/workflows/sanitizer.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.github/workflows/test_bindings.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.gitignore delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.travis.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/.ycm_extra_conf.py delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/AUTHORS delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/BUILD.bazel delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/CMakeLists.txt delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/CONTRIBUTING.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/CONTRIBUTORS delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/LICENSE delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/README.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/WORKSPACE delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/_config.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/appveyor.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/bindings/python/BUILD delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/bindings/python/build_defs.bzl delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/bindings/python/google_benchmark/BUILD delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/bindings/python/google_benchmark/__init__.py delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/bindings/python/google_benchmark/benchmark.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/bindings/python/google_benchmark/example.py delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/bindings/python/pybind11.BUILD delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/bindings/python/python_headers.BUILD delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/bindings/python/requirements.txt delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/AddCXXCompilerFlag.cmake delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/CXXFeatureCheck.cmake delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/Config.cmake.in delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/GetGitVersion.cmake delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/GoogleTest.cmake delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/GoogleTest.cmake.in delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/benchmark.pc.in delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/gnu_posix_regex.cpp delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/llvm-toolchain.cmake delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/posix_regex.cpp delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/split_list.cmake delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/std_regex.cpp delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/steady_clock.cpp delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/cmake/thread_safety_attributes.cpp delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/dependencies.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/docs/AssemblyTests.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/docs/_config.yml delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/docs/perf_counters.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/docs/random_interleaving.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/docs/releasing.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/docs/tools.md delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/include/benchmark/benchmark.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/requirements.txt delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/setup.py delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/CMakeLists.txt delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/arraysize.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/benchmark.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/benchmark_api_internal.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/benchmark_api_internal.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/benchmark_main.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/benchmark_name.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/benchmark_register.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/benchmark_register.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/benchmark_runner.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/benchmark_runner.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/check.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/colorprint.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/colorprint.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/commandlineflags.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/commandlineflags.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/complexity.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/complexity.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/console_reporter.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/counter.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/counter.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/csv_reporter.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/cycleclock.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/internal_macros.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/json_reporter.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/log.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/mutex.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/perf_counters.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/perf_counters.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/re.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/reporter.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/sleep.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/sleep.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/statistics.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/statistics.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/string_util.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/string_util.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/sysinfo.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/thread_manager.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/thread_timer.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/timers.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/src/timers.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/AssemblyTests.cmake delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/BUILD delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/CMakeLists.txt delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/args_product_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/basic_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/benchmark_gtest.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/benchmark_name_gtest.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/benchmark_random_interleaving_gtest.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/benchmark_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/clobber_memory_assembly_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/commandlineflags_gtest.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/complexity_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/cxx03_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/diagnostics_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/display_aggregates_only_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/donotoptimize_assembly_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/donotoptimize_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/filter_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/fixture_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/internal_threading_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/link_main_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/map_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/memory_manager_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/multiple_ranges_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/options_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/output_test.h delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/output_test_helper.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/perf_counters_gtest.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/perf_counters_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/register_benchmark_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/repetitions_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/report_aggregates_only_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/reporter_output_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/skip_with_error_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/state_assembly_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/statistics_gtest.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/string_util_gtest.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/templated_fixture_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/user_counters_tabular_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/user_counters_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/test/user_counters_thousands_test.cc delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/BUILD.bazel delete mode 100755 gnu/llvm/libcxx/utils/google-benchmark/tools/compare.py delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/gbench/Inputs/test1_run1.json delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/gbench/Inputs/test1_run2.json delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/gbench/Inputs/test2_run.json delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/gbench/Inputs/test3_run0.json delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/gbench/Inputs/test3_run1.json delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/gbench/Inputs/test4_run.json delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/gbench/__init__.py delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/gbench/report.py delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/gbench/util.py delete mode 100644 gnu/llvm/libcxx/utils/google-benchmark/tools/requirements.txt delete mode 100755 gnu/llvm/libcxx/utils/google-benchmark/tools/strip_asm.py delete mode 100644 gnu/llvm/libcxx/utils/libcxx/compiler.py delete mode 100644 gnu/llvm/libcxx/utils/libcxx/test/config.py delete mode 100644 gnu/llvm/libcxx/utils/libcxx/test/target_info.py delete mode 100644 gnu/llvm/libcxx/utils/libcxx/util.py delete mode 100755 gnu/llvm/libcxx/utils/merge_archives.py diff --git a/gnu/llvm/libcxx/benchmarks/algorithms.bench.cpp b/gnu/llvm/libcxx/benchmarks/algorithms.bench.cpp deleted file mode 100644 index 93383e2b9cd..00000000000 --- a/gnu/llvm/libcxx/benchmarks/algorithms.bench.cpp +++ /dev/null @@ -1,337 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include - -#include "CartesianBenchmarks.h" -#include "GenerateInput.h" -#include "benchmark/benchmark.h" -#include "test_macros.h" - -namespace { - -enum class ValueType { Uint32, Uint64, Pair, Tuple, String }; -struct AllValueTypes : EnumValuesAsTuple { - static constexpr const char* Names[] = { - "uint32", "uint64", "pair", - "tuple", "string"}; -}; - -template -using Value = std::conditional_t< - V() == ValueType::Uint32, uint32_t, - std::conditional_t< - V() == ValueType::Uint64, uint64_t, - std::conditional_t< - V() == ValueType::Pair, std::pair, - std::conditional_t, - std::string> > > >; - -enum class Order { - Random, - Ascending, - Descending, - SingleElement, - PipeOrgan, - Heap -}; -struct AllOrders : EnumValuesAsTuple { - static constexpr const char* Names[] = {"Random", "Ascending", - "Descending", "SingleElement", - "PipeOrgan", "Heap"}; -}; - -template -void fillValues(std::vector& V, size_t N, Order O) { - if (O == Order::SingleElement) { - V.resize(N, 0); - } else { - while (V.size() < N) - V.push_back(V.size()); - } -} - -template -void fillValues(std::vector >& V, size_t N, Order O) { - if (O == Order::SingleElement) { - V.resize(N, std::make_pair(0, 0)); - } else { - while (V.size() < N) - // Half of array will have the same first element. - if (V.size() % 2) { - V.push_back(std::make_pair(V.size(), V.size())); - } else { - V.push_back(std::make_pair(0, V.size())); - } - } -} - -template -void fillValues(std::vector >& V, size_t N, Order O) { - if (O == Order::SingleElement) { - V.resize(N, std::make_tuple(0, 0, 0)); - } else { - while (V.size() < N) - // One third of array will have the same first element. - // One third of array will have the same first element and the same second element. - switch (V.size() % 3) { - case 0: - V.push_back(std::make_tuple(V.size(), V.size(), V.size())); - break; - case 1: - V.push_back(std::make_tuple(0, V.size(), V.size())); - break; - case 2: - V.push_back(std::make_tuple(0, 0, V.size())); - break; - } - } -} - -void fillValues(std::vector& V, size_t N, Order O) { - if (O == Order::SingleElement) { - V.resize(N, getRandomString(64)); - } else { - while (V.size() < N) - V.push_back(getRandomString(64)); - } -} - -template -void sortValues(T& V, Order O) { - assert(std::is_sorted(V.begin(), V.end())); - switch (O) { - case Order::Random: { - std::random_device R; - std::mt19937 M(R()); - std::shuffle(V.begin(), V.end(), M); - break; - } - case Order::Ascending: - std::sort(V.begin(), V.end()); - break; - case Order::Descending: - std::sort(V.begin(), V.end(), std::greater<>()); - break; - case Order::SingleElement: - // Nothing to do - break; - case Order::PipeOrgan: - std::sort(V.begin(), V.end()); - std::reverse(V.begin() + V.size() / 2, V.end()); - break; - case Order::Heap: - std::make_heap(V.begin(), V.end()); - break; - } -} - -constexpr size_t TestSetElements = -#if !TEST_HAS_FEATURE(memory_sanitizer) - 1 << 18; -#else - 1 << 14; -#endif - -template -std::vector > > makeOrderedValues(size_t N, - Order O) { - std::vector > > Ret; - const size_t NumCopies = std::max(size_t{1}, TestSetElements / N); - Ret.resize(NumCopies); - for (auto& V : Ret) { - fillValues(V, N, O); - sortValues(V, O); - } - return Ret; -} - -template -TEST_ALWAYS_INLINE void resetCopies(benchmark::State& state, T& Copies, - U& Orig) { - state.PauseTiming(); - for (auto& Copy : Copies) - Copy = Orig; - state.ResumeTiming(); -} - -enum class BatchSize { - CountElements, - CountBatch, -}; - -template -void runOpOnCopies(benchmark::State& state, size_t Quantity, Order O, - BatchSize Count, F Body) { - auto Copies = makeOrderedValues(Quantity, O); - auto Orig = Copies; - - const size_t Batch = Count == BatchSize::CountElements - ? Copies.size() * Quantity - : Copies.size(); - while (state.KeepRunningBatch(Batch)) { - for (auto& Copy : Copies) { - Body(Copy); - benchmark::DoNotOptimize(Copy); - } - state.PauseTiming(); - Copies = Orig; - state.ResumeTiming(); - } -} - -template -struct Sort { - size_t Quantity; - - void run(benchmark::State& state) const { - runOpOnCopies( - state, Quantity, Order(), BatchSize::CountElements, - [](auto& Copy) { std::sort(Copy.begin(), Copy.end()); }); - } - - bool skip() const { return Order() == ::Order::Heap; } - - std::string name() const { - return "BM_Sort" + ValueType::name() + Order::name() + "_" + - std::to_string(Quantity); - }; -}; - -template -struct StableSort { - size_t Quantity; - - void run(benchmark::State& state) const { - runOpOnCopies( - state, Quantity, Order(), BatchSize::CountElements, - [](auto& Copy) { std::stable_sort(Copy.begin(), Copy.end()); }); - } - - bool skip() const { return Order() == ::Order::Heap; } - - std::string name() const { - return "BM_StableSort" + ValueType::name() + Order::name() + "_" + - std::to_string(Quantity); - }; -}; - -template -struct MakeHeap { - size_t Quantity; - - void run(benchmark::State& state) const { - runOpOnCopies( - state, Quantity, Order(), BatchSize::CountElements, - [](auto& Copy) { std::make_heap(Copy.begin(), Copy.end()); }); - } - - std::string name() const { - return "BM_MakeHeap" + ValueType::name() + Order::name() + "_" + - std::to_string(Quantity); - }; -}; - -template -struct SortHeap { - size_t Quantity; - - void run(benchmark::State& state) const { - runOpOnCopies( - state, Quantity, Order::Heap, BatchSize::CountElements, - [](auto& Copy) { std::sort_heap(Copy.begin(), Copy.end()); }); - } - - std::string name() const { - return "BM_SortHeap" + ValueType::name() + "_" + std::to_string(Quantity); - }; -}; - -template -struct MakeThenSortHeap { - size_t Quantity; - - void run(benchmark::State& state) const { - runOpOnCopies(state, Quantity, Order(), BatchSize::CountElements, - [](auto& Copy) { - std::make_heap(Copy.begin(), Copy.end()); - std::sort_heap(Copy.begin(), Copy.end()); - }); - } - - std::string name() const { - return "BM_MakeThenSortHeap" + ValueType::name() + Order::name() + "_" + - std::to_string(Quantity); - }; -}; - -template -struct PushHeap { - size_t Quantity; - - void run(benchmark::State& state) const { - runOpOnCopies( - state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) { - for (auto I = Copy.begin(), E = Copy.end(); I != E; ++I) { - std::push_heap(Copy.begin(), I + 1); - } - }); - } - - bool skip() const { return Order() == ::Order::Heap; } - - std::string name() const { - return "BM_PushHeap" + ValueType::name() + Order::name() + "_" + - std::to_string(Quantity); - }; -}; - -template -struct PopHeap { - size_t Quantity; - - void run(benchmark::State& state) const { - runOpOnCopies( - state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) { - for (auto B = Copy.begin(), I = Copy.end(); I != B; --I) { - std::pop_heap(B, I); - } - }); - } - - std::string name() const { - return "BM_PopHeap" + ValueType::name() + "_" + std::to_string(Quantity); - }; -}; - -} // namespace - -int main(int argc, char** argv) { - benchmark::Initialize(&argc, argv); - if (benchmark::ReportUnrecognizedArguments(argc, argv)) - return 1; - - const std::vector Quantities = {1 << 0, 1 << 2, 1 << 4, 1 << 6, - 1 << 8, 1 << 10, 1 << 14, - // Running each benchmark in parallel consumes too much memory with MSAN - // and can lead to the test process being killed. -#if !TEST_HAS_FEATURE(memory_sanitizer) - 1 << 18 -#endif - }; - makeCartesianProductBenchmark(Quantities); - makeCartesianProductBenchmark( - Quantities); - makeCartesianProductBenchmark(Quantities); - makeCartesianProductBenchmark(Quantities); - makeCartesianProductBenchmark( - Quantities); - makeCartesianProductBenchmark(Quantities); - makeCartesianProductBenchmark(Quantities); - benchmark::RunSpecifiedBenchmarks(); -} \ No newline at end of file diff --git a/gnu/llvm/libcxx/cmake/Modules/DefineLinkerScript.cmake b/gnu/llvm/libcxx/cmake/Modules/DefineLinkerScript.cmake deleted file mode 100644 index be7f026af7e..00000000000 --- a/gnu/llvm/libcxx/cmake/Modules/DefineLinkerScript.cmake +++ /dev/null @@ -1,56 +0,0 @@ -# This function defines a linker script in place of the symlink traditionally -# created for shared libraries. -# -# More specifically, this function goes through the PUBLIC and INTERFACE -# library dependencies of and gathers them into a linker script, -# such that those libraries are linked against when the shared library for -# is linked against. -# -# Arguments: -# : A target representing a shared library. A linker script will be -# created in place of that target's TARGET_LINKER_FILE, which is -# the symlink pointing to the actual shared library (usually -# libFoo.so pointing to libFoo.so.1, which itself points to -# libFoo.so.1.0). - -function(define_linker_script target) - if (NOT TARGET "${target}") - message(FATAL_ERROR "The provided target '${target}' is not actually a target.") - endif() - - get_target_property(target_type "${target}" TYPE) - if (NOT "${target_type}" STREQUAL "SHARED_LIBRARY") - message(FATAL_ERROR "The provided target '${target}' is not a shared library (its type is '${target_type}').") - endif() - - set(symlink "$") - set(soname "$") - - get_target_property(interface_libs "${target}" INTERFACE_LINK_LIBRARIES) - - set(link_libraries) - if (interface_libs) - foreach(lib IN LISTS interface_libs) - if ("${lib}" STREQUAL "cxx-headers") - continue() - endif() - # If ${lib} is not a target, we use a dummy target which we know will - # have an OUTPUT_NAME property so that CMake doesn't fail when evaluating - # the non-selected branch of the `IF`. It doesn't matter what it evaluates - # to because it's not selected, but it must not cause an error. - # See https://gitlab.kitware.com/cmake/cmake/-/issues/21045. - set(output_name_tgt "$,${lib},${target}>") - set(libname "$,$,${lib}>") - list(APPEND link_libraries "${CMAKE_LINK_LIBRARY_FLAG}${libname}") - endforeach() - endif() - string(REPLACE ";" " " link_libraries "${link_libraries}") - - set(linker_script "INPUT(${soname} ${link_libraries})") - add_custom_command(TARGET "${target}" POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E remove "${symlink}" - COMMAND "${CMAKE_COMMAND}" -E echo "${linker_script}" > "${symlink}" - COMMENT "Generating linker script: '${linker_script}' as file ${symlink}" - VERBATIM - ) -endfunction() diff --git a/gnu/llvm/libcxx/cmake/Modules/HandleCompilerRT.cmake b/gnu/llvm/libcxx/cmake/Modules/HandleCompilerRT.cmake deleted file mode 100644 index 1ce25657494..00000000000 --- a/gnu/llvm/libcxx/cmake/Modules/HandleCompilerRT.cmake +++ /dev/null @@ -1,64 +0,0 @@ -function(find_compiler_rt_library name dest) - if (NOT DEFINED LIBCXX_COMPILE_FLAGS) - message(FATAL_ERROR "LIBCXX_COMPILE_FLAGS must be defined when using this function") - endif() - set(dest "" PARENT_SCOPE) - set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} - "--rtlib=compiler-rt" "--print-libgcc-file-name") - if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_TARGET) - list(APPEND CLANG_COMMAND "--target=${CMAKE_CXX_COMPILER_TARGET}") - endif() - get_property(LIBCXX_CXX_FLAGS CACHE CMAKE_CXX_FLAGS PROPERTY VALUE) - string(REPLACE " " ";" LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS}") - list(APPEND CLANG_COMMAND ${LIBCXX_CXX_FLAGS}) - execute_process( - COMMAND ${CLANG_COMMAND} - RESULT_VARIABLE HAD_ERROR - OUTPUT_VARIABLE LIBRARY_FILE - ) - string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) - file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) - string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") - if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") - message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") - set(${dest} "${LIBRARY_FILE}" PARENT_SCOPE) - else() - message(STATUS "Failed to find compiler-rt library") - endif() -endfunction() - -function(find_compiler_rt_dir dest) - if (NOT DEFINED LIBCXX_COMPILE_FLAGS) - message(FATAL_ERROR "LIBCXX_COMPILE_FLAGS must be defined when using this function") - endif() - set(dest "" PARENT_SCOPE) - if (APPLE) - set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} - "-print-file-name=lib") - execute_process( - COMMAND ${CLANG_COMMAND} - RESULT_VARIABLE HAD_ERROR - OUTPUT_VARIABLE LIBRARY_DIR - ) - string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) - file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) - set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") - else() - set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} - "--rtlib=compiler-rt" "--print-libgcc-file-name") - execute_process( - COMMAND ${CLANG_COMMAND} - RESULT_VARIABLE HAD_ERROR - OUTPUT_VARIABLE LIBRARY_FILE - ) - string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) - file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) - get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) - endif() - if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") - message(STATUS "Found compiler-rt directory: ${LIBRARY_DIR}") - set(${dest} "${LIBRARY_DIR}" PARENT_SCOPE) - else() - message(STATUS "Failed to find compiler-rt directory") - endif() -endfunction() diff --git a/gnu/llvm/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake b/gnu/llvm/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake deleted file mode 100644 index ad2820b324d..00000000000 --- a/gnu/llvm/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake +++ /dev/null @@ -1,78 +0,0 @@ -if (NOT DEFINED LLVM_PATH) - set(LLVM_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../llvm CACHE PATH "" FORCE) -endif() - -if(NOT IS_DIRECTORY ${LLVM_PATH}) - message(FATAL_ERROR - "The provided LLVM_PATH (${LLVM_PATH}) is not a valid directory. Note that " - "building libc++ outside of the monorepo is not supported anymore. Please " - "use a Standalone build against the monorepo, a Runtimes build or a classic " - "monorepo build.") -endif() - -set(LLVM_INCLUDE_DIR ${LLVM_PATH}/include CACHE PATH "Path to llvm/include") -set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree") -set(LLVM_MAIN_SRC_DIR ${LLVM_PATH}) -set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules") - -if (EXISTS "${LLVM_CMAKE_PATH}") - list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") -elseif (EXISTS "${LLVM_MAIN_SRC_DIR}/cmake/modules") - list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules") -else() - message(FATAL_ERROR "Neither ${LLVM_CMAKE_PATH} nor ${LLVM_MAIN_SRC_DIR}/cmake/modules found. " - "This is not a supported configuration.") -endif() - -message(STATUS "Configuring for standalone build.") - -# By default, we target the host, but this can be overridden at CMake invocation time. -include(GetHostTriple) -get_host_triple(LLVM_INFERRED_HOST_TRIPLE) -set(LLVM_HOST_TRIPLE "${LLVM_INFERRED_HOST_TRIPLE}" CACHE STRING "Host on which LLVM binaries will run") -set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING "Target triple used by default.") - -# Add LLVM Functions -------------------------------------------------------- -if (WIN32) - set(LLVM_ON_UNIX 0) - set(LLVM_ON_WIN32 1) -else() - set(LLVM_ON_UNIX 1) - set(LLVM_ON_WIN32 0) -endif() - -include(AddLLVM OPTIONAL) - -# LLVM Options -------------------------------------------------------------- -if (NOT DEFINED LLVM_INCLUDE_TESTS) - set(LLVM_INCLUDE_TESTS ON) -endif() -if (NOT DEFINED LLVM_INCLUDE_DOCS) - set(LLVM_INCLUDE_DOCS ON) -endif() -if (NOT DEFINED LLVM_ENABLE_SPHINX) - set(LLVM_ENABLE_SPHINX OFF) -endif() - -if (LLVM_INCLUDE_TESTS) - # Required LIT Configuration ------------------------------------------------ - # Define the default arguments to use with 'lit', and an option for the user - # to override. - set(LLVM_DEFAULT_EXTERNAL_LIT "${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py") - set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported") - if (MSVC OR XCODE) - set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar") - endif() - set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit") -endif() - -# Required doc configuration -if (LLVM_ENABLE_SPHINX) - find_package(Sphinx REQUIRED) -endif() - -if (LLVM_ON_UNIX AND NOT APPLE) - set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) -else() - set(LLVM_HAVE_LINK_VERSION_SCRIPT 0) -endif() diff --git a/gnu/llvm/libcxx/cmake/caches/Generic-32bits.cmake b/gnu/llvm/libcxx/cmake/caches/Generic-32bits.cmake deleted file mode 100644 index ae7b2ac3e8d..00000000000 --- a/gnu/llvm/libcxx/cmake/caches/Generic-32bits.cmake +++ /dev/null @@ -1 +0,0 @@ -set(LLVM_BUILD_32_BITS ON CACHE BOOL "") diff --git a/gnu/llvm/libcxx/cmake/caches/Generic-debug-iterators.cmake b/gnu/llvm/libcxx/cmake/caches/Generic-debug-iterators.cmake deleted file mode 100644 index 2e9cbf77acd..00000000000 --- a/gnu/llvm/libcxx/cmake/caches/Generic-debug-iterators.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(LIBCXX_TEST_PARAMS "debug_level=1" "additional_features=LIBCXX-DEBUG-FIXME" CACHE STRING "") -set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "") diff --git a/gnu/llvm/libcxx/cmake/caches/Generic-no-debug.cmake b/gnu/llvm/libcxx/cmake/caches/Generic-no-debug.cmake deleted file mode 100644 index a62760fa78f..00000000000 --- a/gnu/llvm/libcxx/cmake/caches/Generic-no-debug.cmake +++ /dev/null @@ -1 +0,0 @@ -set(LIBCXX_ENABLE_DEBUG_MODE_SUPPORT OFF CACHE BOOL "") diff --git a/gnu/llvm/libcxx/cmake/caches/Generic-singlethreaded.cmake b/gnu/llvm/libcxx/cmake/caches/Generic-singlethreaded.cmake deleted file mode 100644 index 616baef1be7..00000000000 --- a/gnu/llvm/libcxx/cmake/caches/Generic-singlethreaded.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "") -set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "") -set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "") diff --git a/gnu/llvm/libcxx/docs/Makefile.sphinx b/gnu/llvm/libcxx/docs/Makefile.sphinx deleted file mode 100644 index a34f0cc0bad..00000000000 --- a/gnu/llvm/libcxx/docs/Makefile.sphinx +++ /dev/null @@ -1,37 +0,0 @@ -# Makefile for Sphinx documentation -# -# FIXME: This hack is only in place to allow the libcxx.llvm.org/docs builder -# to work with libcxx. This should be removed when that builder supports -# out-of-tree builds. - -# You can set these variables from the command line. -SPHINXOPTS = -n -W -v -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = _build - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext default - -default: html - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - -clean: - -rm -rf $(BUILDDIR)/* - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @# FIXME: Remove this `cp` once HTML->Sphinx transition is completed. - @# Kind of a hack, but HTML-formatted docs are on the way out anyway. - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - diff --git a/gnu/llvm/libcxx/docs/Status/RangesIssues.csv b/gnu/llvm/libcxx/docs/Status/RangesIssues.csv deleted file mode 100644 index 4cd6c3d1122..00000000000 --- a/gnu/llvm/libcxx/docs/Status/RangesIssues.csv +++ /dev/null @@ -1,80 +0,0 @@ -"Number","Name","Status","Assignee" -`P0896R4 `__,,, -`P1035R7 `__,Input Range Adaptors,, -`P1207R4 `__,Movability Of Single-Pass Iterators,, -`P1243R4 `__,Rangify New Algorithms,, -`P1248R1 `__,Fixing Relations,, -`P1252R2 `__,Ranges Design Cleanup,, -`P1391R4 `__,Range Constructor For string_view,, -`P1456R1 `__,Move-Only Views,, -`P1474R1 `__,Helpful Pointers For contiguous_iterator,, -`P1522R1 `__,Iterator Difference Type And Integer Overflow,, -`P1523R1 `__,Views And Size Types,, -`P1638R1 `__,basic_istream_view::iterator Should Not Be Copyable,, -`P1716R3 `__,Range Comparison Algorithms Are Over-Constrained,, -`P1739R4 `__,Avoiding Template Bloat For Ranges,, -`P1862R1 `__,Range Adaptors For Non-Copyable Iterators,, -`P1870R1 `__,safe_range,, -`P1871R1 `__,disable_sized_sentinel_for,, -`P1878R1 `__,Constraining Readable Types,, -`P1970R2 `__,ranges::ssize,, -`P1983R0 `__,Fixing Minor Ranges Issues,, -`P1994R1 `__,elements_view Needs Its Own sentinel,, -`P2091R0 `__,Fixing Issues With Range Access CPOs,, -`P2106R0 `__,Range Algorithm Result Types,, - -`P2325R3 `__,Views should not be required to be default constructible ,, -`P2328R1 `__,join_view should join all views of ranges,, -`P2210R2 `__,Superior String Splitting,, -`P2281R1 `__,Clarifying range adaptor objects,, -`P2367R0 `__,Remove misuses of list-initialization from Clause 24,, - -`LWG3169 `__, ranges permutation generators discard useful information,, -`LWG3173 `__, Enable CTAD for ref-view,, -`LWG3179 `__, subrange should always model Range,, -`LWG3180 `__, Inconsistently named return type for ranges::minmax_element,, -`LWG3183 `__, Normative permission to specialize Ranges variable templates,, -`LWG3186 `__, "ranges removal, partition, and partial_sort_copy algorithms discard useful information",, -`LWG3191 `__, std::ranges::shuffle synopsis does not match algorithm definition,, -`LWG3276 `__, Class split_view::outer_iterator::value_type should inherit from view_interface,, -`LWG3280 `__, View converting constructors can cause constraint recursion and are unneeded,, -`LWG3281 `__, Conversion from pair-like types to subrange is a silent semantic promotion,, -`LWG3282 `__, subrange converting constructor should disallow derived to base conversions,, -`LWG3286 `__, ranges::size is not required to be valid after a call to ranges::begin on an input range,, -`LWG3291 `__, iota_view::iterator has the wrong iterator_category,, -`LWG3292 `__, iota_view is under-constrained,, -`LWG3299 `__, Pointers don't need customized iterator behavior,, -`LWG3301 `__, transform_view::iterator has incorrect iterator_category,, -`LWG3302 `__, Range adaptor objects keys and values are unspecified,, -`LWG3313 `__, join_view::iterator::operator-- is incorrectly constrained,, -`LWG3323 `__, has-tuple-element helper concept needs convertible_to,, -`LWG3325 `__, Constrain return type of transformation function for transform_view,, -`LWG3335 `__, range_size_t and views::all_t,, -`LWG3355 `__, The memory algorithms should support move-only input iterators introduced by P1207,, -`LWG3363 `__, drop_while_view should opt-out of sized_range,, -`LWG3364 `__, Initialize data members of ranges and their iterators,, -`LWG3381 `__, begin and data must agree for contiguous_range,, -`LWG3384 `__, transform_view::sentinel has an incorrect operator-,, -`LWG3385 `__, common_iterator is not sufficiently constrained for non-copyable iterators,, -`LWG3387 `__, [range.reverse.view] reverse_view unintentionally requires range,, -`LWG3388 `__, view iterator types have ill-formed <=> operators,, -`LWG3389 `__, A move-only iterator still does not have a counted_iterator,, -`LWG3397 `__, ranges::basic_istream_view::iterator should not provide iterator_category,, -`LWG3398 `__, tuple_element_t is also wrong for const subrange,, -`LWG3474 `__, Nesting join_views is broken because of CTAD,, -`LWG3481 `__,"viewable_range mishandles lvalue move-only views",, -`LWG3500 `__, join_view::iterator::operator->() is bogus,, -`LWG3505 `__, split_view::outer-iterator::operator++ misspecified,, -`LWG3517 `__,"join_view::iterator's iter_swap is underconstrained",, -`LWG3520 `__,"iter_move and iter_swap are inconsistent for transform_view::iterator",, -`LWG3522 `__,"Missing requirement on InputIterator template parameter for priority_queue constructors",, -`LWG3523 `__,"iota_view::sentinel is not always iota_view's sentinel",, -`LWG3532 `__,"split_view::inner-iterator::operator++(int) should depend on Base",, -`LWG3533 `__,"Make base() const & consistent across iterator wrappers that supports input_iterators",, -`LWG3541 `__,"indirectly_readable_traits should be SFINAE-friendly for all types",, -`LWG3543 `__,"Definition of when counted_iterators refer to the same sequence isn't quite right",, -`LWG3546 `__,"common_iterator's postfix-proxy is not quite right",, -`LWG3549 `__,"view_interface is overspecified to derive from view_base",, -`LWG3551 `__,"borrowed_{iterator,subrange}_t are overspecified",, -`LWG3553 `__,"Useless constraint in split_view::outer-iterator::value_type::begin()",, -`LWG3555 `__,"{transform,elements}_view::iterator::iterator_concept should consider const-qualification of the underlying range",, diff --git a/gnu/llvm/libcxx/docs/Status/RangesPaper.csv b/gnu/llvm/libcxx/docs/Status/RangesPaper.csv deleted file mode 100644 index a7d28970669..00000000000 --- a/gnu/llvm/libcxx/docs/Status/RangesPaper.csv +++ /dev/null @@ -1,149 +0,0 @@ -Section,Description,Dependencies,Assignee,Complete -[tuple.helper],Update includes.,None,Unassigned,Not started -`[range.cmp] `_,"| `ranges::equal_to `_ -| `ranges::not_equal_to `_ -| `ranges::less `_ -| `ranges::greater `_ -| `ranges::less_equal `_ -| `ranges::greater_equal `_",None,Zoe Carver,✅ -`[readable.traits] `_,"| `indirectly_readable_traits `_ -| `iter_value_t `_",None,Christopher Di Bella,✅ -`[incrementable.traits] `_,"| `incrementable_traits `_ -| `iter_difference_t `_",,Christopher Di Bella,✅ -`[iterator.traits] `_,`Updates to iterator_traits `_,"| indirectly_readable_traits -| incrementable_traits",Christopher Di Bella,✅ -`[special.mem.concepts] `_,"| *no-throw-input-iterator* -| *no-throw-sentinel-for* -| *no-throw-input-range* -| *no-throw-forward-iterator* -| *no-throw-forward-range*","| [iterator.concepts] -| [range.refinements]",Unassigned,Not started -`[specialized.algorithms] `_,"| ranges::uninitialized_default_construct -| ranges::uninitialized_default_construct_n -| ranges::uninitialized_value_construct -| ranges::uninitialized_value_construct_n -| ranges::uninitialized_copy -| ranges::uninitialized_copy_n -| ranges::uninitialized_move -| ranges::uninitialized_move_n -| ranges::uninitialized_fill -| ranges::uninitialized_fill_n -| ranges::construct_at -| ranges::destroy -| ranges::destroy_at -| ranges::destroy_n",[special.mem.concepts],Unassigned,Not started -[strings],Adds begin/end and updates const_iterator.,[iterator.concepts],Unassigned,Not started -[views.span],Same as [strings],[iterator.concepts],Unassigned,Not started -`[iterator.cust.move] `_,`ranges::iter_move `_,,Zoe Carver,✅ -`[iterator.cust.swap] `_,`ranges::iter_swap `_,iter_value_t,Zoe Carver,✅ -`[iterator.concepts] `_,"| `indirectly_readable `_ -| `indirectly_writable `_ -| `weakly_incrementable `_ -| `incrementable `_ -| `input_or_output_iterator `_ -| `sentinel_for `_ -| `sized_sentinel_for `_ -| `input_iterator `_ -| `output_iterator `_ -| `forward_iterator `_ -| `bidirectional_iterator `_ -| `random_access_iterator `_ -| `contiguous_iterator `_",,Various,✅ -`[indirectcallable.indirectinvocable] `_,"| indirectly_unary_invocable -| `indirectly_regular_unary_invocable `_ -| `indirectly_unary_predicate `_ -| `indirectly_binary_predicate `_ -| `indirectly_equivalence_relation `_ -| `indirectly_strict_weak_order `_",[readable.traits],Louis Dionne,✅ -`[projected] `_,`ranges::projected `_,[iterator.concepts],Louis Dionne,✅ -`[common.alg.req] `_: pt. 1,"| `indirectly_movable `_ -| `indirectly_movable_storable `_ -| indirectly_copyable -| indirectly_copyable_storable",[iterator.concepts],Zoe Carver,In progress -[common.alg.req]: pt. 2,indirectly_swappable,"| [iterator.concepts] -| [iterator.cust.swap]",Zoe Carver,✅ -[common.alg.req]: pt. 3,indirectly_comparable,[projected],Louis Dionne,Not started -[common.alg.req]: pt. 4,"| permutable -| mergeable -| sortable",[iterator.concepts],Unassigned,Not started -[std.iterator.tags],,[iterator.traits],Unassigned,Not started -`[range.iter.ops] `_,"| `ranges::advance `_ -| `ranges::distance `_ -| `ranges::next `_ -| `ranges::prev `_",[iterator.concepts],Christopher Di Bella,In progress -[predef.iterators],Updates to predefined iterators.,"| [iterator.concepts] -| [iterator.cust.swap] -| [iterator.cust.move]",Unassigned,Not started -[move.sentinel],,[predef.iterators],Unassigned,Not started -[common.iterator],,"| [iterator.concepts] -| [iterator.cust.swap] -| [iterator.cust.move]",Zoe Carver,✅ -[default.sentinels],std::default_sentinel_t.,No dependencies,Zoe Carver,✅ -[counted.iterator],,"| [iterator.concepts] -| [iterator.cust.swap] -| [iterator.cust.move] -| [default.sentinels]",Zoe Carver,✅ -[stream.iterators],,[default.sentinels],Unassigned,Not started -`[range.access] `_,"| `ranges::begin `_ -| `ranges::end `_ -| `range::cbegin `_ -| `ranges::cend `_ -| ranges::rbegin -| ranges::rend -| ranges::crbegin -| ranges::crend -| `ranges::size `_ -| `ranges::ssize `_ -| `ranges::empty `_ -| `ranges::data `_ -| ranges::cdata",[iterator.concepts],Christopher Di Bella and Zoe Carver,In progress -`[range.range] `_,"| `ranges::range `_ -| `ranges::borrowed_range `_ -| `ranges::enable_borrowed_range `_ -| `ranges::iterator_t `_ -| `ranges::sentinel_t `_ -| `ranges::range_difference_t `_ -| `ranges::range_size_t `_ -| `ranges::range_value_t `_ -| `ranges::range_reference_t `_ -| `ranges::range_rvalue_reference_t `_",[range.access],Christopher Di Bella,✅ -`[range.sized] `_,"| `ranges::sized_range `_ -| `ranges::disable_sized_range `_","| [range.primitives] -| [range.range]",Christopher Di Bella,✅ -`[range.view] `_,"| `ranges::enable_view `_ -| `ranges::view_base `_ -| `ranges::view `_",[range.range],Louis Dionne,✅ -`[range.refinements] `_,"| ranges::output_range -| `ranges::input_range `_ -| `ranges::forward_range: `D100275 `_ -| `ranges::bidirectional_range `_ -| `ranges::random_access_range `_ -| ranges::contiguous_range -| `ranges::common_range `_",[range.range],Christopher Di Bella,✅ -`[range.refinements]`_,`ranges::viewable_range `_,[range.range],Louis Dionne,✅ -`[range.utility.helpers] `_,"| *simple-view* -| *has-arrow* -| *not-same-as*","| [range.range] -| [iterator.concept.input]",Zoe Carver,✅ -`[view.interface] `_,"`ranges::view_interface `_","| [ranges.range] -| [range.view] -| [range.iterator.op.prev] -| [range.refinements]",Zoe Carver,✅ -`[range.subrange] `_,`ranges::subrange `_,[view.interface],Zoe Carver,✅ -`[range.dangling] `_,"| ranges::dangling -| ranges::borrowed_iterator_t -| ranges::borrowed_subrange_t","| [range.range] -| [range.subrange]",Christopher Di Bella,✅ -`[range.all] `_,`view::all `_,"[range.subrange], [range.view.ref]",Zoe Carver,✅ -`[range.view.ref] `_,`ref-view `_,[view.interface],Zoe Carver,✅ -`[range.filter] `_,filter_view,[range.all],Louis Dionne,Not started -`[range.transform] `_,`transform_view `_,[range.all],Zoe Carver,✅ -`[range.iota] `_,iota_view,[range.all],Louis Dionne,Not started -`[range.take] `_,take_view,[range.all],Zoe Carver,In Progress -`[range.join] `_,join_view,[range.all],Christopher Di Bella,Not started -`[range.empty] `_,`empty_view `_,[view.interface],Zoe Carver,✅ -`[range.single] `_,single_view,[view.interface],Zoe Carver,In Progress -`[range.split] `_,split_view,[range.all],Unassigned,Not started -`[range.counted] `_,view::counted,[range.subrange],Zoe Carver,Not started -`[range.common] `_,common_view,[range.all],Zoe Carver,✅ -`[range.reverse] `_,reverse_view,[range.all],Unassigned,Not started diff --git a/gnu/llvm/libcxx/include/__algorithm/ranges_find.h b/gnu/llvm/libcxx/include/__algorithm/ranges_find.h index ca6d2f43829..580c2a14c9e 100644 --- a/gnu/llvm/libcxx/include/__algorithm/ranges_find.h +++ b/gnu/llvm/libcxx/include/__algorithm/ranges_find.h @@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if _LIBCPP_STD_VER > 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -35,7 +35,7 @@ namespace __find { struct __fn { template _Sp, class _Tp, class _Proj = identity> requires indirect_binary_predicate, const _Tp*> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __first, _Sp __last, const _Tp& __value, _Proj __proj = {}) const { auto __pred = [&](auto&& __e) { return std::forward(__e) == __value; }; return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj); @@ -43,7 +43,7 @@ struct __fn { template requires indirect_binary_predicate, _Proj>, const _Tp*> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> operator()(_Rp&& __r, const _Tp& __value, _Proj __proj = {}) const { auto __pred = [&](auto&& __e) { return std::forward(__e) == __value; }; return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); @@ -58,6 +58,6 @@ inline namespace __cpo { _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#endif // _LIBCPP_STD_VER > 17 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_H diff --git a/gnu/llvm/libcxx/include/__algorithm/ranges_find_if.h b/gnu/llvm/libcxx/include/__algorithm/ranges_find_if.h index 65ac122f667..45ce6e460d6 100644 --- a/gnu/llvm/libcxx/include/__algorithm/ranges_find_if.h +++ b/gnu/llvm/libcxx/include/__algorithm/ranges_find_if.h @@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if _LIBCPP_STD_VER > 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -45,14 +45,14 @@ struct __fn { template _Sp, class _Proj = identity, indirect_unary_predicate> _Pred> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj); } template , _Proj>> _Pred> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); } @@ -66,6 +66,6 @@ inline namespace __cpo { _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#endif // _LIBCPP_STD_VER > 17 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_H diff --git a/gnu/llvm/libcxx/include/__algorithm/ranges_find_if_not.h b/gnu/llvm/libcxx/include/__algorithm/ranges_find_if_not.h index 9a1adf71fc5..3dd12132754 100644 --- a/gnu/llvm/libcxx/include/__algorithm/ranges_find_if_not.h +++ b/gnu/llvm/libcxx/include/__algorithm/ranges_find_if_not.h @@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if _LIBCPP_STD_VER > 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -35,7 +35,7 @@ namespace __find_if_not { struct __fn { template _Sp, class _Proj = identity, indirect_unary_predicate> _Pred> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward(__e)); }; return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred2, __proj); @@ -43,7 +43,7 @@ struct __fn { template , _Proj>> _Pred> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward(__e)); }; return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred2, __proj); @@ -58,6 +58,6 @@ inline namespace __cpo { _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#endif // _LIBCPP_STD_VER > 17 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H diff --git a/gnu/llvm/libcxx/include/__bits b/gnu/llvm/libcxx/include/__bits deleted file mode 100644 index b565a782358..00000000000 --- a/gnu/llvm/libcxx/include/__bits +++ /dev/null @@ -1,145 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___BITS -#define _LIBCPP___BITS - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - -_LIBCPP_BEGIN_NAMESPACE_STD - -#ifndef _LIBCPP_COMPILER_MSVC - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); } - - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); } - - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); } - -#else // _LIBCPP_COMPILER_MSVC - -// Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long __where; - if (_BitScanForward(&__where, __x)) - return static_cast(__where); - return 32; -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned long __x) { - static_assert(sizeof(unsigned long) == sizeof(unsigned), ""); - return __ctz(static_cast(__x)); -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned long long __x) { - unsigned long __where; -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanForward64(&__where, __x)) - return static_cast(__where); -#else - // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. - if (_BitScanForward(&__where, static_cast(__x))) - return static_cast(__where); - if (_BitScanForward(&__where, static_cast(__x >> 32))) - return static_cast(__where + 32); -#endif - return 64; -} - -// Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long __where; - if (_BitScanReverse(&__where, __x)) - return static_cast(31 - __where); - return 32; // Undefined Behavior. -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned long __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - return __libcpp_clz(static_cast(__x)); -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned long long __x) { - unsigned long __where; -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanReverse64(&__where, __x)) - return static_cast(63 - __where); -#else - // Win32 doesn't have _BitScanReverse64 so emulate it with two 32 bit calls. - if (_BitScanReverse(&__where, static_cast(__x >> 32))) - return static_cast(63 - (__where + 32)); - if (_BitScanReverse(&__where, static_cast(__x))) - return static_cast(63 - __where); -#endif - return 64; // Undefined Behavior. -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned __x) { - static_assert(sizeof(unsigned) == 4, ""); - return __popcnt(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) { - static_assert(sizeof(unsigned long) == 4, ""); - return __popcnt(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) { - static_assert(sizeof(unsigned long long) == 8, ""); - return __popcnt64(__x); -} - -#endif // _LIBCPP_COMPILER_MSVC - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___BITS diff --git a/gnu/llvm/libcxx/include/__config b/gnu/llvm/libcxx/include/__config index 97e33f3157a..10815388389 100644 --- a/gnu/llvm/libcxx/include/__config +++ b/gnu/llvm/libcxx/include/__config @@ -1,5 +1,5 @@ // -*- C++ -*- -//===--------------------------- __config ---------------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_CONFIG -#define _LIBCPP_CONFIG +#ifndef _LIBCPP___CONFIG +#define _LIBCPP___CONFIG #include <__config_site> @@ -19,1175 +19,958 @@ #endif #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -#pragma GCC system_header +# pragma GCC system_header +#endif + +#if defined(__apple_build_version__) +// Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403) +# define _LIBCPP_COMPILER_CLANG_BASED +# define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000) +#elif defined(__clang__) +# define _LIBCPP_COMPILER_CLANG_BASED +# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) +#elif defined(__GNUC__) +# define _LIBCPP_COMPILER_GCC #endif #ifdef __cplusplus -#ifdef __GNUC__ -# define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) -// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme -// introduced in GCC 5.0. -# define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) -#else -# define _GNUC_VER 0 -# define _GNUC_VER_NEW 0 -#endif +// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. +// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 16.0.1 == 16.00.01), _LIBCPP_VERSION is +// defined to XXYYZZ. +# define _LIBCPP_VERSION 160006 -#define _LIBCPP_VERSION 13000 +# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y +# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) -#ifndef _LIBCPP_ABI_VERSION -# define _LIBCPP_ABI_VERSION 1 -#endif +// Valid C++ identifier that revs with every libc++ version. This can be used to +// generate identifiers that must be unique for every released libc++ version. +# define _LIBCPP_VERSIONED_IDENTIFIER _LIBCPP_CONCAT(v, _LIBCPP_VERSION) -#if __STDC_HOSTED__ == 0 -# define _LIBCPP_FREESTANDING -#endif +# if __STDC_HOSTED__ == 0 +# define _LIBCPP_FREESTANDING +# endif -#ifndef _LIBCPP_STD_VER -# if __cplusplus <= 201103L -# define _LIBCPP_STD_VER 11 -# elif __cplusplus <= 201402L -# define _LIBCPP_STD_VER 14 -# elif __cplusplus <= 201703L -# define _LIBCPP_STD_VER 17 -# elif __cplusplus <= 202002L -# define _LIBCPP_STD_VER 20 +# ifndef _LIBCPP_STD_VER +# if __cplusplus <= 201103L +# define _LIBCPP_STD_VER 11 +# elif __cplusplus <= 201402L +# define _LIBCPP_STD_VER 14 +# elif __cplusplus <= 201703L +# define _LIBCPP_STD_VER 17 +# elif __cplusplus <= 202002L +# define _LIBCPP_STD_VER 20 +# else +// Expected release year of the next C++ standard +# define _LIBCPP_STD_VER 23 +# endif +# endif // _LIBCPP_STD_VER + +# if defined(__ELF__) +# define _LIBCPP_OBJECT_FORMAT_ELF 1 +# elif defined(__MACH__) +# define _LIBCPP_OBJECT_FORMAT_MACHO 1 +# elif defined(_WIN32) +# define _LIBCPP_OBJECT_FORMAT_COFF 1 +# elif defined(__wasm__) +# define _LIBCPP_OBJECT_FORMAT_WASM 1 +# elif defined(_AIX) +# define _LIBCPP_OBJECT_FORMAT_XCOFF 1 # else -# define _LIBCPP_STD_VER 21 // current year, or date of c++2b ratification -# endif -#endif // _LIBCPP_STD_VER - -#if defined(__ELF__) -# define _LIBCPP_OBJECT_FORMAT_ELF 1 -#elif defined(__MACH__) -# define _LIBCPP_OBJECT_FORMAT_MACHO 1 -#elif defined(_WIN32) -# define _LIBCPP_OBJECT_FORMAT_COFF 1 -#elif defined(__wasm__) -# define _LIBCPP_OBJECT_FORMAT_WASM 1 -#else - // ... add new file formats here ... -#endif +// ... add new file formats here ... +# endif -#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 +# if _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. -# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. -# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE +# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE // Fix undefined behavior in how std::list stores its linked nodes. -# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __tree stores its end and parent nodes. -# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __hash_table stores its pointer types. -# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB -# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB -# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE -// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr -// provided under the alternate keyword __nullptr, which changes the mangling -// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. -# define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR +# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB +# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE // Define a key function for `bad_function_call` in the library, to centralize // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. -# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +// Override the default return value of exception::what() for +// bad_function_call::what() with a string that is specific to +// bad_function_call (see http://wg21.link/LWG2233). This is an ABI break +// because it changes the vtable layout of bad_function_call. +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE // Enable optimized version of __do_get_(un)signed which avoids redundant copies. -# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET -// In C++20 and later, don't derive std::plus from std::binary_function, -// nor std::negate from std::unary_function. -# define _LIBCPP_ABI_NO_BINDER_BASES +# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET // Give reverse_iterator one data member of type T, not two. // Also, in C++17 and later, don't derive iterator types from std::iterator. -# define _LIBCPP_ABI_NO_ITERATOR_BASES +# define _LIBCPP_ABI_NO_ITERATOR_BASES // Use the smallest possible integer type to represent the index of the variant. // Previously libc++ used "unsigned int" exclusively. -# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION +# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION // Unstable attempt to provide a more optimized std::function -# define _LIBCPP_ABI_OPTIMIZED_FUNCTION +# define _LIBCPP_ABI_OPTIMIZED_FUNCTION // All the regex constants must be distinct and nonzero. -# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO -// Use raw pointers, not wrapped ones, for std::span's iterator type. -# define _LIBCPP_ABI_SPAN_POINTER_ITERATORS +# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO // Re-worked external template instantiations for std::string with a focus on // performance and fast-path inlining. -# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION +# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION // Enable clang::trivial_abi on std::unique_ptr. -# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI +# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI // Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr -# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI -#elif _LIBCPP_ABI_VERSION == 1 -# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) +# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI +// std::random_device holds some state when it uses an implementation that gets +// entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this +// implementation to another one on a platform that has already shipped +// std::random_device, one needs to retain the same object layout to remain ABI +// compatible. This switch removes these workarounds for platforms that don't care +// about ABI compatibility. +# define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT +// Don't export the legacy __basic_string_common class and its methods from the built library. +# define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON +// Don't export the legacy __vector_base_common class and its methods from the built library. +# define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON +// According to the Standard, `bitset::operator[] const` returns bool +# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL +// Fix the implementation of CityHash used for std::hash. +// This is an ABI break because `std::hash` will return a different result, +// which means that hashing the same object in translation units built against +// different versions of libc++ can return inconsistent results. This is especially +// tricky since std::hash is used in the implementation of unordered containers. +// +// The incorrect implementation of CityHash has the problem that it drops some +// bits on the floor. +# define _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION +// Remove the base 10 implementation of std::to_chars from the dylib. +// The implementation moved to the header, but we still export the symbols from +// the dylib for backwards compatibility. +# define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 +# elif _LIBCPP_ABI_VERSION == 1 +# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) // Enable compiling copies of now inline methods into the dylib to support // applications compiled against older libraries. This is unnecessary with // COFF dllexport semantics, since dllexport forces a non-inline definition // of inline functions to be emitted anyway. Our own non-inline copy would -// conflict with the dllexport-emitted copy, so we disable it. -# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS -# endif +// conflict with the dllexport-emitted copy, so we disable it. For XCOFF, +// the linker will take issue with the symbols in the shared object if the +// weak inline methods get visibility (such as from -fvisibility-inlines-hidden), +// so disable it. +# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS +# endif // Feature macros for disabling pre ABI v1 features. All of these options // are deprecated. -# if defined(__FreeBSD__) -# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +# if defined(__FreeBSD__) +# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +# endif # endif -#endif -#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 +# if defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_ABI_VERSION >= 2 // Enable additional explicit instantiations of iostreams components. This // reduces the number of weak definitions generated in programs that use // iostreams by providing a single strong definition in the shared library. -# define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 -#endif +# define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 -#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y -#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) +// Define a key function for `bad_function_call` in the library, to centralize +// its vtable and typeinfo to libc++ rather than having all other libraries +// using that class define their own copies. +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# endif -#ifndef _LIBCPP_ABI_NAMESPACE -# define _LIBCPP_ABI_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) -#endif +# define _LIBCPP_TOSTRING2(x) #x +# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) -#if __cplusplus < 201103L -#define _LIBCPP_CXX03_LANG -#endif +# if __cplusplus < 201103L +# define _LIBCPP_CXX03_LANG +# endif -#ifndef __has_attribute -#define __has_attribute(__x) 0 -#endif +# ifndef __has_attribute +# define __has_attribute(__x) 0 +# endif -#ifndef __has_builtin -#define __has_builtin(__x) 0 -#endif +# ifndef __has_builtin +# define __has_builtin(__x) 0 +# endif -#ifndef __has_extension -#define __has_extension(__x) 0 -#endif +# ifndef __has_extension +# define __has_extension(__x) 0 +# endif -#ifndef __has_feature -#define __has_feature(__x) 0 -#endif +# ifndef __has_feature +# define __has_feature(__x) 0 +# endif -#ifndef __has_cpp_attribute -#define __has_cpp_attribute(__x) 0 -#endif +# ifndef __has_cpp_attribute +# define __has_cpp_attribute(__x) 0 +# endif + +# ifndef __has_constexpr_builtin +# define __has_constexpr_builtin(x) 0 +# endif // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by // the compiler and '1' otherwise. -#ifndef __is_identifier -#define __is_identifier(__x) 1 -#endif - -#ifndef __has_declspec_attribute -#define __has_declspec_attribute(__x) 0 -#endif +# ifndef __is_identifier +# define __is_identifier(__x) 1 +# endif -#define __has_keyword(__x) !(__is_identifier(__x)) +# ifndef __has_declspec_attribute +# define __has_declspec_attribute(__x) 0 +# endif -#ifndef __has_include -#define __has_include(...) 0 -#endif +# define __has_keyword(__x) !(__is_identifier(__x)) -#if defined(__apple_build_version__) -# define _LIBCPP_COMPILER_CLANG_BASED -# define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000) -#elif defined(__clang__) -# define _LIBCPP_COMPILER_CLANG_BASED -# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) -#elif defined(__GNUC__) -# define _LIBCPP_COMPILER_GCC -#elif defined(_MSC_VER) -# define _LIBCPP_COMPILER_MSVC -#elif defined(__IBMCPP__) -# define _LIBCPP_COMPILER_IBM -#endif +# ifndef __has_include +# define __has_include(...) 0 +# endif -#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L -#error "libc++ does not support using GCC with C++03. Please enable C++11" -#endif +# if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L +# error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11" +# endif // FIXME: ABI detection should be done via compiler builtin macros. This // is just a placeholder until Clang implements such macros. For now assume // that Windows compilers pretending to be MSVC++ target the Microsoft ABI, // and allow the user to explicitly specify the ABI to handle cases where this // heuristic falls short. -#if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" -#elif defined(_LIBCPP_ABI_FORCE_ITANIUM) -# define _LIBCPP_ABI_ITANIUM -#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# define _LIBCPP_ABI_MICROSOFT -#else -# if defined(_WIN32) && defined(_MSC_VER) +# if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) +# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" +# elif defined(_LIBCPP_ABI_FORCE_ITANIUM) +# define _LIBCPP_ABI_ITANIUM +# elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) # define _LIBCPP_ABI_MICROSOFT # else -# define _LIBCPP_ABI_ITANIUM +# if defined(_WIN32) && defined(_MSC_VER) +# define _LIBCPP_ABI_MICROSOFT +# else +# define _LIBCPP_ABI_ITANIUM +# endif # endif -#endif -#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) -# define _LIBCPP_ABI_VCRUNTIME -#endif +# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) +# define _LIBCPP_ABI_VCRUNTIME +# endif -// Need to detect which libc we're using if we're on Linux. -#if defined(__linux__) -# include -# if defined(__GLIBC_PREREQ) -# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) -# else -# define _LIBCPP_GLIBC_PREREQ(a, b) 0 -# endif // defined(__GLIBC_PREREQ) -#endif // defined(__linux__) +# if __has_feature(experimental_library) +# ifndef _LIBCPP_ENABLE_EXPERIMENTAL +# define _LIBCPP_ENABLE_EXPERIMENTAL +# endif +# endif -#ifdef __LITTLE_ENDIAN__ -# if __LITTLE_ENDIAN__ -# define _LIBCPP_LITTLE_ENDIAN -# endif // __LITTLE_ENDIAN__ -#endif // __LITTLE_ENDIAN__ +// Incomplete features get their own specific disabling flags. This makes it +// easier to grep for target specific flags once the feature is complete. +# if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY) +# define _LIBCPP_HAS_NO_INCOMPLETE_FORMAT +# endif + +// Need to detect which libc we're using if we're on Linux. +# if defined(__linux__) +# include +# if defined(__GLIBC_PREREQ) +# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) +# else +# define _LIBCPP_GLIBC_PREREQ(a, b) 0 +# endif // defined(__GLIBC_PREREQ) +# endif // defined(__linux__) -#ifdef __BIG_ENDIAN__ -# if __BIG_ENDIAN__ -# define _LIBCPP_BIG_ENDIAN -# endif // __BIG_ENDIAN__ -#endif // __BIG_ENDIAN__ +# if defined(__MVS__) +# include // for __NATIVE_ASCII_F +# endif -#ifdef __BYTE_ORDER__ -# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# define _LIBCPP_LITTLE_ENDIAN -# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -# define _LIBCPP_BIG_ENDIAN -# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -#endif // __BYTE_ORDER__ - -#ifdef __FreeBSD__ -# include -# include -# if _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -# ifndef __LONG_LONG_SUPPORTED -# define _LIBCPP_HAS_NO_LONG_LONG -# endif // __LONG_LONG_SUPPORTED -#endif // __FreeBSD__ - -#if defined(__NetBSD__) || defined(__OpenBSD__) -# include -# if _BYTE_ORDER == _LITTLE_ENDIAN +# ifdef __LITTLE_ENDIAN__ +# if __LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# endif // __LITTLE_ENDIAN__ +# endif // __LITTLE_ENDIAN__ + +# ifdef __BIG_ENDIAN__ +# if __BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BIG_ENDIAN__ +# endif // __BIG_ENDIAN__ + +# ifdef __BYTE_ORDER__ +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# endif // __BYTE_ORDER__ + +# ifdef __FreeBSD__ +# include +# include +# if _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# endif // __FreeBSD__ + +# if defined(__NetBSD__) || defined(__OpenBSD__) +# include +# if _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# endif // defined(__NetBSD__) || defined(__OpenBSD__) + +# if defined(_WIN32) +# define _LIBCPP_WIN32API # define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -#endif // defined(__NetBSD__) || defined(__OpenBSD__) - -#if defined(_WIN32) -# define _LIBCPP_WIN32API -# define _LIBCPP_LITTLE_ENDIAN -# define _LIBCPP_SHORT_WCHAR 1 +# define _LIBCPP_SHORT_WCHAR 1 // Both MinGW and native MSVC provide a "MSVC"-like environment -# define _LIBCPP_MSVCRT_LIKE +# define _LIBCPP_MSVCRT_LIKE // If mingw not explicitly detected, assume using MS C runtime only if // a MS compatibility version is specified. -# if defined(_MSC_VER) && !defined(__MINGW32__) -# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library -# endif -# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__)) -# define _LIBCPP_HAS_BITSCAN64 -# endif -# define _LIBCPP_HAS_OPEN_WITH_WCHAR -# if defined(_LIBCPP_MSVCRT) -# define _LIBCPP_HAS_QUICK_EXIT -# endif +# if defined(_MSC_VER) && !defined(__MINGW32__) +# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library +# endif +# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__)) +# define _LIBCPP_HAS_BITSCAN64 +# endif +# define _LIBCPP_HAS_OPEN_WITH_WCHAR +# endif // defined(_WIN32) -// Some CRT APIs are unavailable to store apps -# if defined(WINAPI_FAMILY) -# include -# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ - (!defined(WINAPI_PARTITION_SYSTEM) || \ - !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) -# define _LIBCPP_WINDOWS_STORE_APP +# ifdef __sun__ +# include +# ifdef _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else +# define _LIBCPP_BIG_ENDIAN # endif +# endif // __sun__ + +# if defined(_AIX) && !defined(__64BIT__) +// The size of wchar is 2 byte on 32-bit mode on AIX. +# define _LIBCPP_SHORT_WCHAR 1 # endif -#endif // defined(_WIN32) -#ifdef __sun__ -# include -# ifdef _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN +// Libc++ supports various implementations of std::random_device. +// +// _LIBCPP_USING_DEV_RANDOM +// Read entropy from the given file, by default `/dev/urandom`. +// If a token is provided, it is assumed to be the path to a file +// to read entropy from. This is the default behavior if nothing +// else is specified. This implementation requires storing state +// inside `std::random_device`. +// +// _LIBCPP_USING_ARC4_RANDOM +// Use arc4random(). This allows obtaining random data even when +// using sandboxing mechanisms. On some platforms like Apple, this +// is the recommended source of entropy for user-space programs. +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +// +// _LIBCPP_USING_GETENTROPY +// Use getentropy(). +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +// +// _LIBCPP_USING_FUCHSIA_CPRNG +// Use Fuchsia's zx_cprng_draw() system call, which is specified to +// deliver high-quality entropy and cannot fail. +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +// +// _LIBCPP_USING_NACL_RANDOM +// NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, +// including accesses to the special files under `/dev`. This implementation +// uses the NaCL syscall `nacl_secure_random_init()` to get entropy. +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +// +// _LIBCPP_USING_WIN32_RANDOM +// Use rand_s(), for use on Windows. +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ + defined(__DragonFly__) || defined(__sun__) +# define _LIBCPP_USING_ARC4_RANDOM +# elif defined(__wasi__) || defined(__EMSCRIPTEN__) +# define _LIBCPP_USING_GETENTROPY +# elif defined(__Fuchsia__) +# define _LIBCPP_USING_FUCHSIA_CPRNG +# elif defined(__native_client__) +# define _LIBCPP_USING_NACL_RANDOM +# elif defined(_LIBCPP_WIN32API) +# define _LIBCPP_USING_WIN32_RANDOM # else -# define _LIBCPP_BIG_ENDIAN -# endif -#endif // __sun__ - -#if defined(__OpenBSD__) || defined(__CloudABI__) - // Certain architectures provide arc4random(). Prefer using - // arc4random() over /dev/{u,}random to make it possible to obtain - // random data even when using sandboxing mechanisms such as chroots, - // Capsicum, etc. -# define _LIBCPP_USING_ARC4_RANDOM -#elif defined(__Fuchsia__) || defined(__wasi__) -# define _LIBCPP_USING_GETENTROPY -#elif defined(__native_client__) - // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, - // including accesses to the special files under /dev. C++11's - // std::random_device is instead exposed through a NaCl syscall. -# define _LIBCPP_USING_NACL_RANDOM -#elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_USING_WIN32_RANDOM -#else -# define _LIBCPP_USING_DEV_RANDOM -#endif - -#if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -# include -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# elif __BYTE_ORDER == __BIG_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# else // __BYTE_ORDER == __BIG_ENDIAN -# error unable to determine endian +# define _LIBCPP_USING_DEV_RANDOM # endif -#endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) -#else -# define _LIBCPP_NO_CFI -#endif - -// If the compiler supports using_if_exists, pretend we have those functions and they'll -// be picked up if the C library provides them. -// -// TODO: Once we drop support for Clang 12, we can assume the compiler supports using_if_exists -// for platforms that don't have a conforming C11 library, so we can drop this whole thing. -#if __has_attribute(using_if_exists) -# define _LIBCPP_HAS_TIMESPEC_GET -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_ALIGNED_ALLOC -#else -#if (defined(__ISO_C_VISIBLE) && (__ISO_C_VISIBLE >= 2011)) || __cplusplus >= 201103L -# if defined(__FreeBSD__) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_QUICK_EXIT -# if __FreeBSD_version >= 1300064 || \ - (__FreeBSD_version >= 1201504 && __FreeBSD_version < 1300000) -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# elif defined(__BIONIC__) -# if __ANDROID_API__ >= 21 -# define _LIBCPP_HAS_QUICK_EXIT -# endif -# if __ANDROID_API__ >= 28 -# define _LIBCPP_HAS_ALIGNED_ALLOC -# endif -# if __ANDROID_API__ >= 29 -# define _LIBCPP_HAS_TIMESPEC_GET +# if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) +# include +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER == __BIG_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# else // __BYTE_ORDER == __BIG_ENDIAN +# error unable to determine endian # endif -# elif defined(__Fuchsia__) || defined(__wasi__) || defined(__NetBSD__) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_TIMESPEC_GET -# elif defined(__OpenBSD__) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_TIMESPEC_GET -# elif defined(__linux__) -# if !defined(_LIBCPP_HAS_MUSL_LIBC) -# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) -# define _LIBCPP_HAS_QUICK_EXIT -# endif -# if _LIBCPP_GLIBC_PREREQ(2, 17) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# else // defined(_LIBCPP_HAS_MUSL_LIBC) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# elif defined(_LIBCPP_MSVCRT) - // Using Microsoft's C Runtime library, not MinGW -# define _LIBCPP_HAS_TIMESPEC_GET -# elif defined(__APPLE__) - // timespec_get and aligned_alloc were introduced in macOS 10.15 and - // aligned releases -# if ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500) || \ - (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000) || \ - (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000) || \ - (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000)) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# endif // __APPLE__ -#endif -#endif // __has_attribute(using_if_exists) +# endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -#ifndef _LIBCPP_CXX03_LANG -# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) -#elif defined(_LIBCPP_COMPILER_CLANG_BASED) -# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) -#else -# error "We don't know a correct way to implement alignof(T) in C++03 outside of Clang" -#endif +# if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) +# else +# define _LIBCPP_NO_CFI +# endif -#define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) +# ifndef _LIBCPP_CXX03_LANG -#if defined(_LIBCPP_COMPILER_CLANG_BASED) +# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) +# define _ALIGNAS_TYPE(x) alignas(x) +# define _ALIGNAS(x) alignas(x) +# define _LIBCPP_NORETURN [[noreturn]] +# define _NOEXCEPT noexcept +# define _NOEXCEPT_(x) noexcept(x) +# define _LIBCPP_CONSTEXPR constexpr -#if defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) -# error _LIBCPP_ALTERNATE_STRING_LAYOUT is deprecated, please use _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT instead -#endif -#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ - (!defined(__arm__) || __ARM_ARCH_7K__ >= 2) -# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT -#endif +# else -#if __has_feature(cxx_alignas) -# define _ALIGNAS_TYPE(x) alignas(x) -# define _ALIGNAS(x) alignas(x) -#else -# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) -# define _ALIGNAS(x) __attribute__((__aligned__(x))) -#endif +# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) +# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) +# define _ALIGNAS(x) __attribute__((__aligned__(x))) +# define _LIBCPP_NORETURN __attribute__((__noreturn__)) +# define _LIBCPP_HAS_NO_NOEXCEPT +# define nullptr __nullptr +# define _NOEXCEPT throw() +# define _NOEXCEPT_(x) +# define static_assert(...) _Static_assert(__VA_ARGS__) +# define decltype(...) __decltype(__VA_ARGS__) +# define _LIBCPP_CONSTEXPR -#if __cplusplus < 201103L typedef __char16_t char16_t; typedef __char32_t char32_t; -#endif -#if !__has_feature(cxx_exceptions) -# define _LIBCPP_NO_EXCEPTIONS -#endif - -#if !(__has_feature(cxx_strong_enums)) -#define _LIBCPP_HAS_NO_STRONG_ENUMS -#endif - -#if __has_feature(cxx_attributes) -# define _LIBCPP_NORETURN [[noreturn]] -#else -# define _LIBCPP_NORETURN __attribute__ ((noreturn)) -#endif +# endif -#if !(__has_feature(cxx_nullptr)) -# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR) -# define nullptr __nullptr -# else -# define _LIBCPP_HAS_NO_NULLPTR +# if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L +# define _LIBCPP_NO_EXCEPTIONS # endif -#endif -// Objective-C++ features (opt-in) -#if __has_feature(objc_arc) -#define _LIBCPP_HAS_OBJC_ARC -#endif +# define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) -#if __has_feature(objc_arc_weak) -#define _LIBCPP_HAS_OBJC_ARC_WEAK -#endif +# if defined(_LIBCPP_COMPILER_CLANG_BASED) -#if __has_extension(blocks) -# define _LIBCPP_HAS_EXTENSION_BLOCKS -#endif +# if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && (!defined(__arm__) || __ARM_ARCH_7K__ >= 2) +# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +# endif -#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) -# define _LIBCPP_HAS_BLOCKS_RUNTIME -#endif +// Objective-C++ features (opt-in) +# if __has_feature(objc_arc) +# define _LIBCPP_HAS_OBJC_ARC +# endif -#if !(__has_feature(cxx_relaxed_constexpr)) -#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR -#endif +# if __has_feature(objc_arc_weak) +# define _LIBCPP_HAS_OBJC_ARC_WEAK +# endif -#if !(__has_feature(cxx_variable_templates)) -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -#endif +# if __has_extension(blocks) +# define _LIBCPP_HAS_EXTENSION_BLOCKS +# endif -#if !(__has_feature(cxx_noexcept)) -#define _LIBCPP_HAS_NO_NOEXCEPT -#endif +# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) +# define _LIBCPP_HAS_BLOCKS_RUNTIME +# endif -#if !__has_feature(address_sanitizer) -#define _LIBCPP_HAS_NO_ASAN -#endif +# if !__has_feature(address_sanitizer) +# define _LIBCPP_HAS_NO_ASAN +# endif // Allow for build-time disabling of unsigned integer sanitization -#if __has_attribute(no_sanitize) -#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) -#endif - -#if __has_builtin(__builtin_launder) -#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER -#endif +# if __has_attribute(no_sanitize) +# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) +# endif -#if __has_builtin(__builtin_constant_p) -#define _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT_P -#endif +# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) -#if !__is_identifier(__has_unique_object_representations) -#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS -#endif +# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# elif defined(_LIBCPP_COMPILER_GCC) -// Literal operators ""d and ""y are supported starting with LLVM Clang 8 and AppleClang 10.0.1 -#if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 800) || \ - (defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1001) -#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS -#endif +# if !defined(__SANITIZE_ADDRESS__) +# define _LIBCPP_HAS_NO_ASAN +# endif -#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ +# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) -#elif defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ -#define _ALIGNAS(x) __attribute__((__aligned__(x))) -#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) +# endif // _LIBCPP_COMPILER_[CLANG|GCC] -#define _LIBCPP_NORETURN __attribute__((noreturn)) +# if defined(_LIBCPP_OBJECT_FORMAT_COFF) -#if !defined(__EXCEPTIONS) -# define _LIBCPP_NO_EXCEPTIONS -#endif +# ifdef _DLL +# define _LIBCPP_CRT_FUNC __declspec(dllimport) +# else +# define _LIBCPP_CRT_FUNC +# endif -// Determine if GCC supports relaxed constexpr -#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L -#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR -#endif +# if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY)) +# define _LIBCPP_DLL_VIS +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_EXPORTED_FROM_ABI +# elif defined(_LIBCPP_BUILDING_LIBRARY) +# define _LIBCPP_DLL_VIS __declspec(dllexport) +# if defined(__MINGW32__) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# else +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS +# endif +# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport) +# else +# define _LIBCPP_DLL_VIS __declspec(dllimport) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport) +# endif -// GCC 5 supports variable templates -#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -#endif +# define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS +# define _LIBCPP_HIDDEN +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# define _LIBCPP_TEMPLATE_VIS +# define _LIBCPP_TEMPLATE_DATA_VIS +# define _LIBCPP_ENUM_VIS -#if !defined(__SANITIZE_ADDRESS__) -#define _LIBCPP_HAS_NO_ASAN -#endif +# else -#if _GNUC_VER >= 700 -#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER -#define _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT_P -#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis))) +# else +# define _LIBCPP_VISIBILITY(vis) +# endif -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden") +# define _LIBCPP_FUNC_VIS _LIBCPP_VISIBILITY("default") +# define _LIBCPP_TYPE_VIS _LIBCPP_VISIBILITY("default") +# define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default") +# define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default") +# define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBILITY("default") +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default") +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ +// TODO: Make this a proper customization point or remove the option to override it. +# ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default") +# endif -#elif defined(_LIBCPP_COMPILER_MSVC) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +// The inline should be removed once PR32114 is resolved +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN +# else +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# endif -#define _LIBCPP_TOSTRING2(x) #x -#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) -#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# if __has_attribute(__type_visibility__) +# define _LIBCPP_TEMPLATE_VIS __attribute__((__type_visibility__("default"))) +# else +# define _LIBCPP_TEMPLATE_VIS __attribute__((__visibility__("default"))) +# endif +# else +# define _LIBCPP_TEMPLATE_VIS +# endif -#if _MSC_VER < 1900 -#error "MSVC versions prior to Visual Studio 2015 are not supported" -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) +# define _LIBCPP_ENUM_VIS __attribute__((__type_visibility__("default"))) +# else +# define _LIBCPP_ENUM_VIS +# endif -#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -#define __alignof__ __alignof -#define _LIBCPP_NORETURN __declspec(noreturn) -#define _ALIGNAS(x) __declspec(align(x)) -#define _ALIGNAS_TYPE(x) alignas(x) +# endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) -#define _LIBCPP_WEAK +# if __has_attribute(exclude_from_explicit_instantiation) +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__)) +# else +// Try to approximate the effect of exclude_from_explicit_instantiation +// (which is that entities are not assumed to be provided by explicit +// template instantiations in the dylib) by always inlining those entities. +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE +# endif -#define _LIBCPP_HAS_NO_ASAN +// This macro marks a symbol as being hidden from libc++'s ABI. This is achieved +// on two levels: +// 1. The symbol is given hidden visibility, which ensures that users won't start exporting +// symbols from their dynamic library by means of using the libc++ headers. This ensures +// that those symbols stay private to the dynamic library in which it is defined. +// +// 2. The symbol is given an ABI tag that changes with each version of libc++. This ensures +// that no ODR violation can arise from mixing two TUs compiled with different versions +// of libc++ where we would have changed the definition of a symbol. If the symbols shared +// the same name, the ODR would require that their definitions be token-by-token equivalent, +// which basically prevents us from being able to make any change to any function in our +// headers. Using this ABI tag ensures that the symbol name is "bumped" artificially at +// each release, which lets us change the definition of these symbols at our leisure. +// Note that historically, this has been achieved in various ways, including force-inlining +// all functions or giving internal linkage to all functions. Both these (previous) solutions +// suffer from drawbacks that lead notably to code bloat. +// +// Note that we use _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION to ensure that we don't depend +// on _LIBCPP_HIDE_FROM_ABI methods of classes explicitly instantiated in the dynamic library. +// +// Also note that the _LIBCPP_HIDE_FROM_ABI_VIRTUAL macro should be used on virtual functions +// instead of _LIBCPP_HIDE_FROM_ABI. That macro does not use an ABI tag. Indeed, the mangled +// name of a virtual function is part of its ABI, since some architectures like arm64e can sign +// the virtual function pointer in the vtable based on the mangled name of the function. Since +// we use an ABI tag that changes with each released version, the mangled name of the virtual +// function would change, which is incorrect. Note that it doesn't make much sense to change +// the implementation of a virtual function in an ABI-incompatible way in the first place, +// since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable. +// +// TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing +// the length of symbols with an ABI tag. In practice, we should remove the escape hatch and +// use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70. +# ifndef _LIBCPP_NO_ABI_TAG +# define _LIBCPP_HIDE_FROM_ABI \ + _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \ + __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER)))) +# else +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION +# endif +# define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION -#define _LIBCPP_ALWAYS_INLINE __forceinline +// This macro provides a HIDE_FROM_ABI equivalent that can be applied to extern +// "C" function, as those lack mangling. +# define _LIBCPP_HIDE_FROM_ABI_C _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION -#define _LIBCPP_HAS_NO_VECTOR_EXTENSION +# ifdef _LIBCPP_BUILDING_LIBRARY +# if _LIBCPP_ABI_VERSION > 1 +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI +# else +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 +# endif +# else +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI +# endif -#define _LIBCPP_DISABLE_EXTENSION_WARNING +// Just so we can migrate to the new macros gradually. +# define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI -#elif defined(_LIBCPP_COMPILER_IBM) +// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect. +// clang-format off +# define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE { +# define _LIBCPP_END_NAMESPACE_STD }} +# define _VSTD std -#define _ALIGNAS(x) __attribute__((__aligned__(x))) -#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) -#define _ATTRIBUTE(x) __attribute__((x)) -#define _LIBCPP_NORETURN __attribute__((noreturn)) +_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD -#define _LIBCPP_HAS_NO_UNICODE_CHARS -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES +# if _LIBCPP_STD_VER > 14 +# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { +# else +# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { +# endif -#if defined(_AIX) -#define __MULTILOCALE_API -#endif +# define _LIBCPP_END_NAMESPACE_FILESYSTEM _LIBCPP_END_NAMESPACE_STD }} +// clang-format on -#define _LIBCPP_HAS_NO_ASAN +# define _VSTD_FS std::__fs::filesystem -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# if __has_attribute(__enable_if__) +# define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, ""))) +# endif -#define _LIBCPP_HAS_NO_VECTOR_EXTENSION +# ifndef __SIZEOF_INT128__ +# define _LIBCPP_HAS_NO_INT128 +# endif -#define _LIBCPP_DISABLE_EXTENSION_WARNING +# ifndef __cpp_consteval +# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR +# else +# define _LIBCPP_CONSTEVAL consteval +# endif -#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] +# if __has_attribute(__malloc__) +# define _LIBCPP_NOALIAS __attribute__((__malloc__)) +# else +# define _LIBCPP_NOALIAS +# endif -#if defined(_LIBCPP_OBJECT_FORMAT_COFF) +# if __has_attribute(__using_if_exists__) +# define _LIBCPP_USING_IF_EXISTS __attribute__((__using_if_exists__)) +# else +# define _LIBCPP_USING_IF_EXISTS +# endif -#ifdef _DLL -# define _LIBCPP_CRT_FUNC __declspec(dllimport) -#else -# define _LIBCPP_CRT_FUNC -#endif +# ifdef _LIBCPP_CXX03_LANG +# define _LIBCPP_DECLARE_STRONG_ENUM(x) \ + struct _LIBCPP_TYPE_VIS x { \ + enum __lx +// clang-format off +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ + __lx __v_; \ + _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \ + _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ + _LIBCPP_INLINE_VISIBILITY operator int() const { return __v_; } \ + }; +// clang-format on + +# else // _LIBCPP_CXX03_LANG +# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) +# endif // _LIBCPP_CXX03_LANG + +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || defined(__sun__) || \ + defined(__NetBSD__) +# define _LIBCPP_LOCALE__L_EXTENSIONS 1 +# endif -#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_DLL_VIS -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS -# define _LIBCPP_EXPORTED_FROM_ABI -#elif defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_DLL_VIS __declspec(dllexport) -# if defined(__MINGW32__) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# else -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS +# ifdef __FreeBSD__ +# define _DECLARE_C99_LDBL_MATH 1 # endif -# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport) -#else -# define _LIBCPP_DLL_VIS __declspec(dllimport) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS -# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport) -#endif -#define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS -#define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS -#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS -#define _LIBCPP_HIDDEN -#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -#define _LIBCPP_TEMPLATE_VIS -#define _LIBCPP_TEMPLATE_DATA_VIS -#define _LIBCPP_ENUM_VIS +// If we are getting operator new from the MSVC CRT, then allocation overloads +// for align_val_t were added in 19.12, aka VS 2017 version 15.3. +# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912 +# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new) +// We're deferring to Microsoft's STL to provide aligned new et al. We don't +// have it unless the language feature test macro is defined. +# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +# elif defined(__MVS__) +# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +# endif -#endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) +# if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# endif -#ifndef _LIBCPP_HIDDEN -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) -# else -# define _LIBCPP_HIDDEN +// It is not yet possible to use aligned_alloc() on all Apple platforms since +// 10.15 was the first version to ship an implementation of aligned_alloc(). +# if defined(__APPLE__) +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) +# define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC +# endif +# elif defined(__ANDROID__) && __ANDROID_API__ < 28 +// Android only provides aligned_alloc when targeting API 28 or higher. +# define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC # endif -#endif -#ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -// The inline should be removed once PR32114 is resolved -# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN -# else -# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# if defined(__APPLE__) || defined(__FreeBSD__) +# define _LIBCPP_HAS_DEFAULTRUNELOCALE # endif -#endif -#ifndef _LIBCPP_FUNC_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_FUNC_VIS +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) +# define _LIBCPP_WCTYPE_IS_MASK # endif -#endif -#ifndef _LIBCPP_TYPE_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_TYPE_VIS +# if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) +# define _LIBCPP_HAS_NO_CHAR8_T # endif -#endif -#ifndef _LIBCPP_TEMPLATE_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# if __has_attribute(__type_visibility__) -# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default"))) +// Deprecation macros. +// +// Deprecations warnings are always enabled, except when users explicitly opt-out +// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS. +# if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) +# if __has_attribute(deprecated) +# define _LIBCPP_DEPRECATED __attribute__((deprecated)) +# define _LIBCPP_DEPRECATED_(m) __attribute__((deprecated(m))) +# elif _LIBCPP_STD_VER > 11 +# define _LIBCPP_DEPRECATED [[deprecated]] +# define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]] # else -# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default"))) +# define _LIBCPP_DEPRECATED +# define _LIBCPP_DEPRECATED_(m) # endif # else -# define _LIBCPP_TEMPLATE_VIS +# define _LIBCPP_DEPRECATED +# define _LIBCPP_DEPRECATED_(m) # endif -#endif -#ifndef _LIBCPP_TEMPLATE_DATA_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_TEMPLATE_DATA_VIS __attribute__ ((__visibility__("default"))) +# if !defined(_LIBCPP_CXX03_LANG) +# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED # else -# define _LIBCPP_TEMPLATE_DATA_VIS +# define _LIBCPP_DEPRECATED_IN_CXX11 # endif -#endif -#ifndef _LIBCPP_EXPORTED_FROM_ABI -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXPORTED_FROM_ABI __attribute__((__visibility__("default"))) +# if _LIBCPP_STD_VER > 11 +# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED # else -# define _LIBCPP_EXPORTED_FROM_ABI +# define _LIBCPP_DEPRECATED_IN_CXX14 # endif -#endif -#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS -#define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS -#endif - -#ifndef _LIBCPP_EXCEPTION_ABI -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) +# if _LIBCPP_STD_VER > 14 +# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED # else -# define _LIBCPP_EXCEPTION_ABI +# define _LIBCPP_DEPRECATED_IN_CXX17 # endif -#endif -#ifndef _LIBCPP_ENUM_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) -# define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default"))) +# if _LIBCPP_STD_VER > 17 +# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED # else -# define _LIBCPP_ENUM_VIS +# define _LIBCPP_DEPRECATED_IN_CXX20 # endif -#endif - -#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# endif -#endif - -#ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -#define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -#endif -#if __has_attribute(internal_linkage) -# define _LIBCPP_INTERNAL_LINKAGE __attribute__ ((internal_linkage)) +#if _LIBCPP_STD_VER >= 23 +# define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED #else -# define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE +# define _LIBCPP_DEPRECATED_IN_CXX23 #endif -#if __has_attribute(exclude_from_explicit_instantiation) -# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__ ((__exclude_from_explicit_instantiation__)) -#else - // Try to approximate the effect of exclude_from_explicit_instantiation - // (which is that entities are not assumed to be provided by explicit - // template instantiations in the dylib) by always inlining those entities. -# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE -#endif - -#ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU -# ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT -# define _LIBCPP_HIDE_FROM_ABI_PER_TU 0 +# if !defined(_LIBCPP_HAS_NO_CHAR8_T) +# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED # else -# define _LIBCPP_HIDE_FROM_ABI_PER_TU 1 +# define _LIBCPP_DEPRECATED_WITH_CHAR8_T # endif -#endif -#ifndef _LIBCPP_HIDE_FROM_ABI -# if _LIBCPP_HIDE_FROM_ABI_PER_TU -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE +// Macros to enter and leave a state where deprecation warnings are suppressed. +# if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +# define _LIBCPP_SUPPRESS_DEPRECATED_POP _Pragma("GCC diagnostic pop") # else -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH +# define _LIBCPP_SUPPRESS_DEPRECATED_POP # endif -#endif -#ifdef _LIBCPP_BUILDING_LIBRARY -# if _LIBCPP_ABI_VERSION > 1 -# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI +# if _LIBCPP_STD_VER <= 11 +# define _LIBCPP_EXPLICIT_AFTER_CXX11 # else -# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 +# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit # endif -#else -# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI -#endif - -// Just so we can migrate to the new macros gradually. -#define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI - -// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect. -#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE { -#define _LIBCPP_END_NAMESPACE_STD } } -#define _VSTD std::_LIBCPP_ABI_NAMESPACE -_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { -#else -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { -#endif - -#define _LIBCPP_END_NAMESPACE_FILESYSTEM \ - _LIBCPP_END_NAMESPACE_STD } } - -#define _VSTD_FS _VSTD::__fs::filesystem - -#if __has_attribute(__enable_if__) -# define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, ""))) -#endif - -#ifndef _LIBCPP_HAS_NO_NOEXCEPT -# define _NOEXCEPT noexcept -# define _NOEXCEPT_(x) noexcept(x) -#else -# define _NOEXCEPT throw() -# define _NOEXCEPT_(x) -#endif - -#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS -typedef unsigned short char16_t; -typedef unsigned int char32_t; -#endif // _LIBCPP_HAS_NO_UNICODE_CHARS - -#ifndef __SIZEOF_INT128__ -#define _LIBCPP_HAS_NO_INT128 -#endif - -#ifdef _LIBCPP_CXX03_LANG -# define static_assert(...) _Static_assert(__VA_ARGS__) -# define decltype(...) __decltype(__VA_ARGS__) -#endif // _LIBCPP_CXX03_LANG - -#ifdef _LIBCPP_CXX03_LANG -# define _LIBCPP_CONSTEXPR -#else -# define _LIBCPP_CONSTEXPR constexpr -#endif - -#ifndef __cpp_consteval -# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR -#else -# define _LIBCPP_CONSTEVAL consteval -#endif - -#if !defined(__cpp_concepts) || __cpp_concepts < 201907L -#define _LIBCPP_HAS_NO_CONCEPTS -#endif - -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_HAS_NO_CONCEPTS) -#define _LIBCPP_HAS_NO_RANGES -#endif - -#ifdef _LIBCPP_CXX03_LANG -# define _LIBCPP_DEFAULT {} -#else -# define _LIBCPP_DEFAULT = default; -#endif - -#ifdef _LIBCPP_CXX03_LANG -# define _LIBCPP_EQUAL_DELETE -#else -# define _LIBCPP_EQUAL_DELETE = delete -#endif - -#ifdef __GNUC__ -# define _LIBCPP_NOALIAS __attribute__((__malloc__)) -#else -# define _LIBCPP_NOALIAS -#endif - -#if __has_attribute(using_if_exists) -# define _LIBCPP_USING_IF_EXISTS __attribute__((using_if_exists)) -#else -# define _LIBCPP_USING_IF_EXISTS -#endif - -#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS -# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx -# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ - __lx __v_; \ - _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \ - _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ - _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} \ - }; -#else // _LIBCPP_HAS_NO_STRONG_ENUMS -# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x -# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) -#endif // _LIBCPP_HAS_NO_STRONG_ENUMS - -// _LIBCPP_DEBUG potential values: -// - undefined: No assertions. This is the default. -// - 0: Basic assertions -// - 1: Basic assertions + iterator validity checks. -#if !defined(_LIBCPP_DEBUG) -# define _LIBCPP_DEBUG_LEVEL 0 -#elif _LIBCPP_DEBUG == 0 -# define _LIBCPP_DEBUG_LEVEL 1 -#elif _LIBCPP_DEBUG == 1 -# define _LIBCPP_DEBUG_LEVEL 2 -#else -# error Supported values for _LIBCPP_DEBUG are 0 and 1 -#endif - -// Libc++ allows disabling extern template instantiation declarations by -// means of users defining _LIBCPP_DISABLE_EXTERN_TEMPLATE. -// -// Furthermore, when the Debug mode is enabled, we disable extern declarations -// when building user code because we don't want to use the functions compiled -// in the library, which might not have had the debug mode enabled when built. -// However, some extern declarations need to be used, because code correctness -// depends on it (several instances in ). Those special declarations -// are declared with _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE, which is enabled -// even when the debug mode is enabled. -#if defined(_LIBCPP_DISABLE_EXTERN_TEMPLATE) -# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */ -# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) /* nothing */ -#elif _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */ -# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__; -#else -# define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; -# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__; -#endif - -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \ - defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__) -#define _LIBCPP_LOCALE__L_EXTENSIONS 1 -#endif - -#ifdef __FreeBSD__ -#define _DECLARE_C99_LDBL_MATH 1 -#endif - -// If we are getting operator new from the MSVC CRT, then allocation overloads -// for align_val_t were added in 19.12, aka VS 2017 version 15.3. -#if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912 -# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION -#elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new) - // We're deferring to Microsoft's STL to provide aligned new et al. We don't - // have it unless the language feature test macro is defined. -# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION -#elif defined(__MVS__) -# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION -#endif -#if defined(__APPLE__) -# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ - defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) -# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# if _LIBCPP_STD_VER > 11 +# define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr +# else +# define _LIBCPP_CONSTEXPR_SINCE_CXX14 # endif -#endif // defined(__APPLE__) - -#if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \ - (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) -# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION -#endif - -#if defined(__APPLE__) || defined(__FreeBSD__) -#define _LIBCPP_HAS_DEFAULTRUNELOCALE -#endif - -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) -#define _LIBCPP_WCTYPE_IS_MASK -#endif - -#if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) -#define _LIBCPP_HAS_NO_CHAR8_T -#endif -// Deprecation macros. -// -// Deprecations warnings are always enabled, except when users explicitly opt-out -// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS. -#if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) -# if __has_attribute(deprecated) -# define _LIBCPP_DEPRECATED __attribute__ ((deprecated)) -# elif _LIBCPP_STD_VER > 11 -# define _LIBCPP_DEPRECATED [[deprecated]] +# if _LIBCPP_STD_VER > 14 +# define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr # else -# define _LIBCPP_DEPRECATED +# define _LIBCPP_CONSTEXPR_SINCE_CXX17 # endif -#else -# define _LIBCPP_DEPRECATED -#endif - -#if !defined(_LIBCPP_CXX03_LANG) -# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX11 -#endif - -#if _LIBCPP_STD_VER >= 14 -# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX14 -#endif - -#if _LIBCPP_STD_VER >= 17 -# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX17 -#endif - -#if _LIBCPP_STD_VER > 17 -# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX20 -#endif - -#if !defined(_LIBCPP_HAS_NO_CHAR8_T) -# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_WITH_CHAR8_T -#endif - -// Macros to enter and leave a state where deprecation warnings are suppressed. -#if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -# define _LIBCPP_SUPPRESS_DEPRECATED_POP \ - _Pragma("GCC diagnostic pop") -#else -# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH -# define _LIBCPP_SUPPRESS_DEPRECATED_POP -#endif - -#if _LIBCPP_STD_VER <= 11 -# define _LIBCPP_EXPLICIT_AFTER_CXX11 -#else -# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit -#endif - -#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -# define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr -#else -# define _LIBCPP_CONSTEXPR_AFTER_CXX11 -#endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -# define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr -#else -# define _LIBCPP_CONSTEXPR_AFTER_CXX14 -#endif +# if _LIBCPP_STD_VER > 17 +# define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr +# else +# define _LIBCPP_CONSTEXPR_SINCE_CXX20 +# endif -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -# define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr -#else -# define _LIBCPP_CONSTEXPR_AFTER_CXX17 -#endif +# if _LIBCPP_STD_VER > 20 +# define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr +# else +# define _LIBCPP_CONSTEXPR_SINCE_CXX23 +# endif -// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other -// NODISCARD macros to the correct attribute. -#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_NODISCARD_ATTRIBUTE [[nodiscard]] -#elif defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_CXX03_LANG) -# define _LIBCPP_NODISCARD_ATTRIBUTE [[clang::warn_unused_result]] -#else +# if __has_cpp_attribute(nodiscard) +# define _LIBCPP_NODISCARD [[nodiscard]] +# else // We can't use GCC's [[gnu::warn_unused_result]] and // __attribute__((warn_unused_result)), because GCC does not silence them via // (void) cast. -# define _LIBCPP_NODISCARD_ATTRIBUTE -#endif +# define _LIBCPP_NODISCARD +# endif // _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not // specified as such as an extension. -#if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT) -# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD_ATTRIBUTE -#else -# define _LIBCPP_NODISCARD_EXT -#endif - -#if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && \ - (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD)) -# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD_ATTRIBUTE -#else -# define _LIBCPP_NODISCARD_AFTER_CXX17 -#endif - -#if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) -# define _LIBCPP_INLINE_VAR inline -#else -# define _LIBCPP_INLINE_VAR -#endif +# if !defined(_LIBCPP_DISABLE_NODISCARD_EXT) +# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD +# else +# define _LIBCPP_NODISCARD_EXT +# endif -#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -# define _LIBCPP_CONSTEXPR_IF_NODEBUG -#else -# define _LIBCPP_CONSTEXPR_IF_NODEBUG constexpr -#endif +# if _LIBCPP_STD_VER > 17 || !defined(_LIBCPP_DISABLE_NODISCARD_EXT) +# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD +# else +# define _LIBCPP_NODISCARD_AFTER_CXX17 +# endif -#if __has_attribute(no_destroy) -# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) -#else -# define _LIBCPP_NO_DESTROY -#endif +# if __has_attribute(__no_destroy__) +# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) +# else +# define _LIBCPP_NO_DESTROY +# endif -#ifndef _LIBCPP_HAS_NO_ASAN -extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( - const void *, const void *, const void *, const void *); -#endif +# ifndef _LIBCPP_HAS_NO_ASAN + extern "C" _LIBCPP_FUNC_VIS void + __sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*); +# endif // Try to find out if RTTI is disabled. -#if defined(_LIBCPP_COMPILER_CLANG_BASED) && !__has_feature(cxx_rtti) -# define _LIBCPP_NO_RTTI -#elif defined(__GNUC__) && !defined(__GXX_RTTI) -# define _LIBCPP_NO_RTTI -#elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI) -# define _LIBCPP_NO_RTTI -#endif +# if !defined(__cpp_rtti) || __cpp_rtti < 199711L +# define _LIBCPP_HAS_NO_RTTI +# endif -#ifndef _LIBCPP_WEAK -#define _LIBCPP_WEAK __attribute__((__weak__)) -#endif +# ifndef _LIBCPP_WEAK +# define _LIBCPP_WEAK __attribute__((__weak__)) +# endif // Thread API -#if !defined(_LIBCPP_HAS_NO_THREADS) && \ - !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ - !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ - !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -# if defined(__FreeBSD__) || \ - defined(__wasi__) || \ - defined(__NetBSD__) || \ - defined(__OpenBSD__) || \ - defined(__NuttX__) || \ - defined(__linux__) || \ - defined(__GNU__) || \ - defined(__APPLE__) || \ - defined(__CloudABI__) || \ - defined(__sun__) || \ - defined(__MVS__) || \ - defined(_AIX) || \ - (defined(__MINGW32__) && __has_include()) -# define _LIBCPP_HAS_THREAD_API_PTHREAD -# elif defined(__Fuchsia__) - // TODO(44575): Switch to C11 thread API when possible. -# define _LIBCPP_HAS_THREAD_API_PTHREAD -# elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_HAS_THREAD_API_WIN32 -# else -# error "No thread API" -# endif // _LIBCPP_HAS_THREAD_API -#endif // _LIBCPP_HAS_NO_THREADS - -#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -#if defined(__ANDROID__) && __ANDROID_API__ >= 30 -#define _LIBCPP_HAS_COND_CLOCKWAIT -#elif defined(_LIBCPP_GLIBC_PREREQ) -#if _LIBCPP_GLIBC_PREREQ(2, 30) -#define _LIBCPP_HAS_COND_CLOCKWAIT -#endif -#endif -#endif +// clang-format off +# if !defined(_LIBCPP_HAS_NO_THREADS) && \ + !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ + !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ + !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) + +# if defined(__FreeBSD__) || \ + defined(__wasi__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NuttX__) || \ + defined(__linux__) || \ + defined(__GNU__) || \ + defined(__APPLE__) || \ + defined(__sun__) || \ + defined(__MVS__) || \ + defined(_AIX) || \ + defined(__EMSCRIPTEN__) +// clang-format on +# define _LIBCPP_HAS_THREAD_API_PTHREAD +# elif defined(__Fuchsia__) +// TODO(44575): Switch to C11 thread API when possible. +# define _LIBCPP_HAS_THREAD_API_PTHREAD +# elif defined(_LIBCPP_WIN32API) +# define _LIBCPP_HAS_THREAD_API_WIN32 +# else +# error "No thread API" +# endif // _LIBCPP_HAS_THREAD_API +# endif // _LIBCPP_HAS_NO_THREADS + +# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +# if defined(__ANDROID__) && __ANDROID_API__ >= 30 +# define _LIBCPP_HAS_COND_CLOCKWAIT +# elif defined(_LIBCPP_GLIBC_PREREQ) +# if _LIBCPP_GLIBC_PREREQ(2, 30) +# define _LIBCPP_HAS_COND_CLOCKWAIT +# endif +# endif +# endif -#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ +# if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +# error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ _LIBCPP_HAS_NO_THREADS is not defined. -#endif +# endif -#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -#error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ +# if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) +# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ _LIBCPP_HAS_NO_THREADS is defined. -#endif +# endif -#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) -#error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ +# if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) +# error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ _LIBCPP_HAS_NO_THREADS is defined. -#endif +# endif -#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) -#define __STDCPP_THREADS__ 1 -#endif +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) +# define __STDCPP_THREADS__ 1 +# endif // The glibc and Bionic implementation of pthreads implements // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32 @@ -1199,11 +982,13 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( // // TODO(EricWF): Enable this optimization on Bionic after speaking to their // respective stakeholders. -#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \ - || (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) \ - || defined(_LIBCPP_HAS_THREAD_API_WIN32) -# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION -#endif +// clang-format off +# if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) || \ + (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || \ + defined(_LIBCPP_HAS_THREAD_API_WIN32) +// clang-format on +# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION +# endif // Destroying a condvar is a nop on Windows. // @@ -1213,260 +998,274 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( // // TODO(EricWF): This is potentially true for some pthread implementations // as well. -#if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || \ - defined(_LIBCPP_HAS_THREAD_API_WIN32) -# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION -#endif - -// Systems that use capability-based security (FreeBSD with Capsicum, -// Nuxi CloudABI) may only provide local filesystem access (using *at()). -// Functions like open(), rename(), unlink() and stat() should not be -// used, as they attempt to access the global filesystem namespace. -#ifdef __CloudABI__ -#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE -#endif - -// CloudABI is intended for running networked services. Processes do not -// have standard input and output channels. -#ifdef __CloudABI__ -#define _LIBCPP_HAS_NO_STDIN -#define _LIBCPP_HAS_NO_STDOUT -#endif +# if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || defined(_LIBCPP_HAS_THREAD_API_WIN32) +# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION +# endif // Some systems do not provide gets() in their C library, for security reasons. -#if defined(_LIBCPP_MSVCRT) || \ - (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || \ - defined(__OpenBSD__) -# define _LIBCPP_C_HAS_NO_GETS -#endif - -#if defined(__BIONIC__) || defined(__CloudABI__) || defined(__NuttX__) || \ - defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) || \ - defined(__MVS__) || defined(__OpenBSD__) -#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE -#endif - -// Thread-unsafe functions such as strtok() and localtime() -// are not available. -#ifdef __CloudABI__ -#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS -#endif +# if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || defined(__OpenBSD__) +# define _LIBCPP_C_HAS_NO_GETS +# endif -#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) -# define _LIBCPP_HAS_C_ATOMIC_IMP -#elif defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_HAS_GCC_ATOMIC_IMP -#endif +# if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \ + defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) +# define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE +# endif -#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \ - !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \ - !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)) \ - || defined(_LIBCPP_HAS_NO_THREADS) -# define _LIBCPP_HAS_NO_ATOMIC_HEADER -#else -# ifndef _LIBCPP_ATOMIC_FLAG_TYPE -# define _LIBCPP_ATOMIC_FLAG_TYPE bool +# if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) +# define _LIBCPP_HAS_C_ATOMIC_IMP +# elif defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_HAS_GCC_ATOMIC_IMP # endif -# ifdef _LIBCPP_FREESTANDING -# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS + +# if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \ + !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP) +# define _LIBCPP_HAS_NO_ATOMIC_HEADER +# else +# ifndef _LIBCPP_ATOMIC_FLAG_TYPE +# define _LIBCPP_ATOMIC_FLAG_TYPE bool +# endif +# ifdef _LIBCPP_FREESTANDING +# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS +# endif # endif -#endif -#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK -#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK -#endif +# ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +# endif -#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) -# if defined(__clang__) && __has_attribute(acquire_capability) +# if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) +# if defined(__clang__) && __has_attribute(acquire_capability) // Work around the attribute handling in clang. When both __declspec and // __attribute__ are present, the processing goes awry preventing the definition -// of the types. -# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) -# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +// of the types. In MinGW mode, __declspec evaluates to __attribute__, and thus +// combining the two does work. +# if !defined(_MSC_VER) +# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +# endif # endif # endif -#endif -#ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS -# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) -#else -# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) -#endif - -#if __has_attribute(require_constant_initialization) -# define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) -#else -# define _LIBCPP_SAFE_STATIC -#endif - -#if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700 -#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF -#endif +# ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) +# else +# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) +# endif -#if !__has_builtin(__builtin_is_constant_evaluated) && _GNUC_VER < 900 -#define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED -#endif +# if _LIBCPP_STD_VER > 17 +# define _LIBCPP_CONSTINIT constinit +# elif __has_attribute(__require_constant_initialization__) +# define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) +# else +# define _LIBCPP_CONSTINIT +# endif -#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) -# define _LIBCPP_DIAGNOSE_WARNING(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "warning"))) -# define _LIBCPP_DIAGNOSE_ERROR(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "error"))) -#else -# define _LIBCPP_DIAGNOSE_WARNING(...) -# define _LIBCPP_DIAGNOSE_ERROR(...) -#endif +# if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) +# define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning"))) +# else +# define _LIBCPP_DIAGNOSE_WARNING(...) +# endif // Use a function like macro to imply that it must be followed by a semicolon -#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) -# define _LIBCPP_FALLTHROUGH() [[fallthrough]] -#elif __has_cpp_attribute(clang::fallthrough) -# define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]] -#elif __has_attribute(fallthrough) || _GNUC_VER >= 700 -# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) -#else -# define _LIBCPP_FALLTHROUGH() ((void)0) -#endif - -#if __has_attribute(__nodebug__) -#define _LIBCPP_NODEBUG __attribute__((__nodebug__)) -#else -#define _LIBCPP_NODEBUG -#endif - -#if __has_attribute(__nodebug__) && (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 900) -# define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug)) -#else -# define _LIBCPP_NODEBUG_TYPE -#endif - -#if __has_attribute(__standalone_debug__) -#define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__)) -#else -#define _LIBCPP_STANDALONE_DEBUG -#endif - -#if __has_attribute(__preferred_name__) -#define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x))) -#else -#define _LIBCPP_PREFERRED_NAME(x) -#endif - -#if defined(_LIBCPP_ABI_MICROSOFT) && \ - (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) -# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) -#else -# define _LIBCPP_DECLSPEC_EMPTY_BASES -#endif +# if __has_cpp_attribute(fallthrough) +# define _LIBCPP_FALLTHROUGH() [[fallthrough]] +# elif __has_attribute(__fallthrough__) +# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) +# else +# define _LIBCPP_FALLTHROUGH() ((void)0) +# endif -#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) -#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS -#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE -#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES - -#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) -#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS -#define _LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS -#define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS -#define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR -#define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS -#endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES - -#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 -#define _LIBCPP_HAS_NO_DEDUCTION_GUIDES -#endif +# if __has_cpp_attribute(_Clang::__lifetimebound__) +# define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]] +# else +# define _LIBCPP_LIFETIMEBOUND +# endif -#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001) -#define _LIBCPP_HAS_NO_IS_AGGREGATE -#endif +# if __has_attribute(__nodebug__) +# define _LIBCPP_NODEBUG __attribute__((__nodebug__)) +# else +# define _LIBCPP_NODEBUG +# endif -#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L -#define _LIBCPP_HAS_NO_COROUTINES -#endif +# if __has_attribute(__standalone_debug__) +# define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__)) +# else +# define _LIBCPP_STANDALONE_DEBUG +# endif -#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201907L -#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR -#endif +# if __has_attribute(__preferred_name__) +# define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x))) +# else +# define _LIBCPP_PREFERRED_NAME(x) +# endif -#if defined(_LIBCPP_COMPILER_IBM) -#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO -#endif +// We often repeat things just for handling wide characters in the library. +// When wide characters are disabled, it can be useful to have a quick way of +// disabling it without having to resort to #if-#endif, which has a larger +// impact on readability. +# if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# define _LIBCPP_IF_WIDE_CHARACTERS(...) +# else +# define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__ +# endif -#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) -# define _LIBCPP_PUSH_MACROS -# define _LIBCPP_POP_MACROS -#else - // Don't warn about macro conflicts when we can restore them at the - // end of the header. -# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# endif -# if defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_PUSH_MACROS \ - __pragma(push_macro("min")) \ - __pragma(push_macro("max")) -# define _LIBCPP_POP_MACROS \ - __pragma(pop_macro("min")) \ - __pragma(pop_macro("max")) +# if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases) +# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) # else -# define _LIBCPP_PUSH_MACROS \ - _Pragma("push_macro(\"min\")") \ - _Pragma("push_macro(\"max\")") -# define _LIBCPP_POP_MACROS \ - _Pragma("pop_macro(\"min\")") \ - _Pragma("pop_macro(\"max\")") +# define _LIBCPP_DECLSPEC_EMPTY_BASES # endif -#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) -#ifndef _LIBCPP_NO_AUTO_LINK -# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# pragma comment(lib, "c++.lib") -# else -# pragma comment(lib, "libc++.lib") -# endif -# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) -#endif // _LIBCPP_NO_AUTO_LINK +# if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) +# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR +# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS +# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE +# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS +# define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION +# endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES + +# if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) +# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS +# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION +# define _LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS +# define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS +# define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR +# define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS +# endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES + +# define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") +# define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") + +# ifndef _LIBCPP_NO_AUTO_LINK +# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# pragma comment(lib, "c++.lib") +# else +# pragma comment(lib, "libc++.lib") +# endif +# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# endif // _LIBCPP_NO_AUTO_LINK // Configures the fopen close-on-exec mode character, if any. This string will // be appended to any mode string used by fstream for fopen/fdopen. // // Not all platforms support this, but it helps avoid fd-leaks on platforms that // do. -#if defined(__BIONIC__) -# define _LIBCPP_FOPEN_CLOEXEC_MODE "e" -#else -# define _LIBCPP_FOPEN_CLOEXEC_MODE -#endif - -#ifdef _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT_P -#define _LIBCPP_BUILTIN_CONSTANT_P(x) __builtin_constant_p(x) -#else -#define _LIBCPP_BUILTIN_CONSTANT_P(x) false -#endif +# if defined(__BIONIC__) +# define _LIBCPP_FOPEN_CLOEXEC_MODE "e" +# else +# define _LIBCPP_FOPEN_CLOEXEC_MODE +# endif // Support for _FILE_OFFSET_BITS=64 landed gradually in Android, so the full set // of functions used in cstdio may not be available for low API levels when // using 64-bit file offsets on LP32. -#if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24 -#define _LIBCPP_HAS_NO_FGETPOS_FSETPOS -#endif +# if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24 +# define _LIBCPP_HAS_NO_FGETPOS_FSETPOS +# endif -#if __has_attribute(init_priority) -# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101))) -#else -# define _LIBCPP_INIT_PRIORITY_MAX -#endif +# if __has_attribute(__init_priority__) +# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100))) +# else +# define _LIBCPP_INIT_PRIORITY_MAX +# endif + +# if __has_attribute(__format__) +// The attribute uses 1-based indices for ordinary and static member functions. +// The attribute uses 2-based indices for non-static member functions. +# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \ + __attribute__((__format__(archetype, format_string_index, first_format_arg_index))) +# else +# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) /* nothing */ +# endif -#if defined(__GNUC__) || defined(__clang__) -#define _LIBCPP_FORMAT_PRINTF(a, b) \ - __attribute__((__format__(__printf__, a, b))) +# if __has_cpp_attribute(msvc::no_unique_address) +// MSVC implements [[no_unique_address]] as a silent no-op currently. +// (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) +// However, MSVC implements [[msvc::no_unique_address]] which does what +// [[no_unique_address]] is supposed to do, in general. + +// Clang-cl does not yet (14.0) implement either [[no_unique_address]] or +// [[msvc::no_unique_address]] though. If/when it does implement +// [[msvc::no_unique_address]], this should be preferred though. +# define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] +# elif __has_cpp_attribute(no_unique_address) +# define _LIBCPP_NO_UNIQUE_ADDRESS [[no_unique_address]] +# else +# define _LIBCPP_NO_UNIQUE_ADDRESS /* nothing */ +// Note that this can be replaced by #error as soon as clang-cl +// implements msvc::no_unique_address, since there should be no C++20 +// compiler that doesn't support one of the two attributes at that point. +// We generally don't want to use this macro outside of C++20-only code, +// because using it conditionally in one language version only would make +// the ABI inconsistent. +# endif + +# ifdef _LIBCPP_COMPILER_CLANG_BASED +# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") +# define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str)) +# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) +# elif defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") +# define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) +# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str)) +# else +# define _LIBCPP_DIAGNOSTIC_PUSH +# define _LIBCPP_DIAGNOSTIC_POP +# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) +# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) +# endif + +# if defined(_AIX) && !defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_PACKED_BYTE_FOR_AIX _Pragma("pack(1)") +# define _LIBCPP_PACKED_BYTE_FOR_AIX_END _Pragma("pack(pop)") +# else +# define _LIBCPP_PACKED_BYTE_FOR_AIX /* empty */ +# define _LIBCPP_PACKED_BYTE_FOR_AIX_END /* empty */ +# endif + +# if __has_attribute(__packed__) +# define _LIBCPP_PACKED __attribute__((__packed__)) +# else +# define _LIBCPP_PACKED +# endif + +// c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these +// functions is gradually being added to existing C libraries. The conditions +// below check for known C library versions and conditions under which these +// functions are declared by the C library. +# define _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 +// GNU libc 2.36 and newer declare c8rtomb() and mbrtoc8() in C++ modes if +// __cpp_char8_t is defined or if C2X extensions are enabled. Determining +// the latter depends on internal GNU libc details that are not appropriate +// to depend on here, so any declarations present when __cpp_char8_t is not +// defined are ignored. +# if defined(_LIBCPP_GLIBC_PREREQ) +# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t) +# undef _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 +# endif +# endif + +// There are a handful of public standard library types that are intended to +// support CTAD but don't need any explicit deduction guides to do so. This +// macro is used to mark them as such, which suppresses the +// '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code +// with these classes. +#if _LIBCPP_STD_VER >= 17 +# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \ + template \ + _ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...> #else -#define _LIBCPP_FORMAT_PRINTF(a, b) +# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") #endif +// TODO(varconst): currently, there are bugs in Clang's intrinsics when handling Objective-C++ `id`, so don't use +// compiler intrinsics in the Objective-C++ mode. +# ifdef __OBJC__ +# define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS +# endif + #endif // __cplusplus -#endif // _LIBCPP_CONFIG +#endif // _LIBCPP___CONFIG diff --git a/gnu/llvm/libcxx/include/__function_like.h b/gnu/llvm/libcxx/include/__function_like.h deleted file mode 100644 index 8a3597bacdc..00000000000 --- a/gnu/llvm/libcxx/include/__function_like.h +++ /dev/null @@ -1,56 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___ITERATOR_FUNCTION_LIKE_H -#define _LIBCPP___ITERATOR_FUNCTION_LIKE_H - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if !defined(_LIBCPP_HAS_NO_RANGES) - -namespace ranges { -// Per [range.iter.ops.general] and [algorithms.requirements], functions in namespace std::ranges -// can't be found by ADL and inhibit ADL when found by unqualified lookup. The easiest way to -// facilitate this is to use function objects. -// -// Since these are still standard library functions, we use `__function_like` to eliminate most of -// the properties that function objects get by default (e.g. semiregularity, addressability), to -// limit the surface area of the unintended public interface, so as to curb the effect of Hyrum's -// law. -struct __function_like { - __function_like() = delete; - __function_like(__function_like const&) = delete; - __function_like& operator=(__function_like const&) = delete; - - void operator&() const = delete; - - struct __tag { }; - -protected: - constexpr explicit __function_like(__tag) noexcept {} - ~__function_like() = default; -}; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___ITERATOR_FUNCTION_LIKE_H diff --git a/gnu/llvm/libcxx/include/__functional_base b/gnu/llvm/libcxx/include/__functional_base deleted file mode 100644 index ccc3f3a58ca..00000000000 --- a/gnu/llvm/libcxx/include/__functional_base +++ /dev/null @@ -1,32 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_FUNCTIONAL_BASE -#define _LIBCPP_FUNCTIONAL_BASE - -#include <__config> -#include <__functional/binary_function.h> -#include <__functional/invoke.h> -#include <__functional/operations.h> -#include <__functional/reference_wrapper.h> -#include <__functional/unary_function.h> -#include <__functional/weak_result_type.h> -#include <__memory/allocator_arg_t.h> -#include <__memory/uses_allocator.h> -#include -#include -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -#endif // _LIBCPP_FUNCTIONAL_BASE diff --git a/gnu/llvm/libcxx/include/__libcpp_version b/gnu/llvm/libcxx/include/__libcpp_version deleted file mode 100644 index 09514aa4db9..00000000000 --- a/gnu/llvm/libcxx/include/__libcpp_version +++ /dev/null @@ -1 +0,0 @@ -13000 diff --git a/gnu/llvm/libcxx/include/__locale b/gnu/llvm/libcxx/include/__locale index ad742997d9a..e0ffa0ca00f 100644 --- a/gnu/llvm/libcxx/include/__locale +++ b/gnu/llvm/libcxx/include/__locale @@ -12,31 +12,30 @@ #include <__availability> #include <__config> -#include -#include -#include -#include -#include #include +#include #include +#include +#include + +// Some platforms require more includes than others. Keep the includes on all plaforms for now. +#include +#include + #if defined(_LIBCPP_MSVCRT_LIKE) -# include # include <__support/win32/locale_win32.h> -#elif defined(__NuttX__) -# include <__support/nuttx/xlocale.h> #elif defined(_AIX) || defined(__MVS__) # include <__support/ibm/xlocale.h> #elif defined(__ANDROID__) # include <__support/android/locale_bionic.h> #elif defined(__sun__) -# include # include <__support/solaris/xlocale.h> +# include #elif defined(_NEWLIB_VERSION) # include <__support/newlib/xlocale.h> #elif defined(__OpenBSD__) # include <__support/openbsd/xlocale.h> -#elif (defined(__APPLE__) || defined(__FreeBSD__) \ - || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) +#elif (defined(__APPLE__) || defined(__FreeBSD__)) # include #elif defined(__Fuchsia__) # include <__support/fuchsia/xlocale.h> @@ -48,7 +47,7 @@ #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header +# pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -194,12 +193,12 @@ protected: explicit facet(size_t __refs = 0) : __shared_count(static_cast(__refs)-1) {} - virtual ~facet(); + ~facet() override; // facet(const facet&) = delete; // effectively done in __shared_count // void operator=(const facet&) = delete; private: - virtual void __on_zero_shared() _NOEXCEPT; + void __on_zero_shared() _NOEXCEPT override; }; class _LIBCPP_TYPE_VIS locale::id @@ -210,10 +209,11 @@ class _LIBCPP_TYPE_VIS locale::id static int32_t __next_id; public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {} + void operator=(const id&) = delete; + id(const id&) = delete; + private: void __init(); - void operator=(const id&); // = delete; - id(const id&); // = delete; public: // only needed for tests long __get(); @@ -293,7 +293,7 @@ public: static locale::id id; protected: - ~collate(); + ~collate() override; virtual int do_compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const; virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const @@ -339,8 +339,10 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const return static_cast(__h); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate; +#endif // template class collate_byname; @@ -350,7 +352,7 @@ template <> class _LIBCPP_TYPE_VIS collate_byname : public collate { - locale_t __l; + locale_t __l_; public: typedef char char_type; typedef basic_string string_type; @@ -359,17 +361,18 @@ public: explicit collate_byname(const string& __n, size_t __refs = 0); protected: - ~collate_byname(); - virtual int do_compare(const char_type* __lo1, const char_type* __hi1, - const char_type* __lo2, const char_type* __hi2) const; - virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; + ~collate_byname() override; + int do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const override; + string_type do_transform(const char_type* __lo, const char_type* __hi) const override; }; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS collate_byname : public collate { - locale_t __l; + locale_t __l_; public: typedef wchar_t char_type; typedef basic_string string_type; @@ -378,12 +381,13 @@ public: explicit collate_byname(const string& __n, size_t __refs = 0); protected: - ~collate_byname(); + ~collate_byname() override; - virtual int do_compare(const char_type* __lo1, const char_type* __hi1, - const char_type* __lo2, const char_type* __hi2) const; - virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; + int do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const override; + string_type do_transform(const char_type* __lo, const char_type* __hi) const override; }; +#endif template bool @@ -448,8 +452,9 @@ public: static const mask punct = _PUNCT; static const mask xdigit = _HEX; static const mask blank = _BLANK; - static const mask __regex_word = 0x80; + static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT +# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) # ifdef __APPLE__ typedef __uint32_t mask; @@ -489,7 +494,11 @@ public: static const mask punct = _ISPUNCT; static const mask xdigit = _ISXDIGIT; static const mask blank = _ISBLANK; +# if defined(_AIX) + static const mask __regex_word = 0x8000; +# else static const mask __regex_word = 0x80; +# endif #elif defined(_NEWLIB_VERSION) // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h. typedef char mask; @@ -503,10 +512,38 @@ public: static const mask punct = _P; static const mask xdigit = _X | _N; static const mask blank = _B; - static const mask __regex_word = 0x80; + // mask is already fully saturated, use a different type in regex_type_traits. + static const unsigned short __regex_word = 0x100; # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT +#elif defined(__MVS__) +# if defined(__NATIVE_ASCII_F) + typedef unsigned int mask; + static const mask space = _ISSPACE_A; + static const mask print = _ISPRINT_A; + static const mask cntrl = _ISCNTRL_A; + static const mask upper = _ISUPPER_A; + static const mask lower = _ISLOWER_A; + static const mask alpha = _ISALPHA_A; + static const mask digit = _ISDIGIT_A; + static const mask punct = _ISPUNCT_A; + static const mask xdigit = _ISXDIGIT_A; + static const mask blank = _ISBLANK_A; +# else + typedef unsigned short mask; + static const mask space = __ISSPACE; + static const mask print = __ISPRINT; + static const mask cntrl = __ISCNTRL; + static const mask upper = __ISUPPER; + static const mask lower = __ISLOWER; + static const mask alpha = __ISALPHA; + static const mask digit = __ISDIGIT; + static const mask punct = __ISPUNCT; + static const mask xdigit = __ISXDIGIT; + static const mask blank = __ISBLANK; +# endif + static const mask __regex_word = 0x8000; #else # error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE? #endif @@ -514,10 +551,15 @@ public: static const mask graph = alnum | punct; _LIBCPP_INLINE_VISIBILITY ctype_base() {} + + static_assert((__regex_word & ~(std::make_unsigned::type)(space | print | cntrl | upper | lower | alpha | + digit | punct | xdigit | blank)) == __regex_word, + "__regex_word can't overlap other bits"); }; template class _LIBCPP_TEMPLATE_VIS ctype; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS ctype : public locale::facet, @@ -605,7 +647,7 @@ public: static locale::id id; protected: - ~ctype(); + ~ctype() override; virtual bool do_is(mask __m, char_type __c) const; virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; @@ -619,6 +661,7 @@ protected: virtual char do_narrow(char_type, char __dfault) const; virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS ctype @@ -658,7 +701,7 @@ public: const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const { for (; __low != __high; ++__low) - if (!(isascii(*__low) && (__tab_[static_cast(*__low)] & __m))) + if (!isascii(*__low) || !(__tab_[static_cast(*__low)] & __m)) break; return __low; } @@ -728,9 +771,13 @@ public: static const short* __classic_upper_table() _NOEXCEPT; static const short* __classic_lower_table() _NOEXCEPT; #endif +#if defined(__MVS__) + static const unsigned short* __classic_upper_table() _NOEXCEPT; + static const unsigned short* __classic_lower_table() _NOEXCEPT; +#endif protected: - ~ctype(); + ~ctype() override; virtual char_type do_toupper(char_type __c) const; virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; virtual char_type do_tolower(char_type __c) const; @@ -749,52 +796,54 @@ template <> class _LIBCPP_TYPE_VIS ctype_byname : public ctype { - locale_t __l; + locale_t __l_; public: explicit ctype_byname(const char*, size_t = 0); explicit ctype_byname(const string&, size_t = 0); protected: - ~ctype_byname(); - virtual char_type do_toupper(char_type) const; - virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; - virtual char_type do_tolower(char_type) const; - virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; + ~ctype_byname() override; + char_type do_toupper(char_type) const override; + const char_type* do_toupper(char_type* __low, const char_type* __high) const override; + char_type do_tolower(char_type) const override; + const char_type* do_tolower(char_type* __low, const char_type* __high) const override; }; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS ctype_byname : public ctype { - locale_t __l; + locale_t __l_; public: explicit ctype_byname(const char*, size_t = 0); explicit ctype_byname(const string&, size_t = 0); protected: - ~ctype_byname(); - virtual bool do_is(mask __m, char_type __c) const; - virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; - virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; - virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; - virtual char_type do_toupper(char_type) const; - virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; - virtual char_type do_tolower(char_type) const; - virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; - virtual char_type do_widen(char) const; - virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; - virtual char do_narrow(char_type, char __dfault) const; - virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; + ~ctype_byname() override; + bool do_is(mask __m, char_type __c) const override; + const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const override; + const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const override; + const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const override; + char_type do_toupper(char_type) const override; + const char_type* do_toupper(char_type* __low, const char_type* __high) const override; + char_type do_tolower(char_type) const override; + const char_type* do_tolower(char_type* __low, const char_type* __high) const override; + char_type do_widen(char) const override; + const char* do_widen(const char* __low, const char* __high, char_type* __dest) const override; + char do_narrow(char_type, char __dfault) const override; + const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override; }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS template inline _LIBCPP_INLINE_VISIBILITY bool isspace(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::space, __c); + return std::use_facet >(__loc).is(ctype_base::space, __c); } template @@ -802,7 +851,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isprint(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::print, __c); + return std::use_facet >(__loc).is(ctype_base::print, __c); } template @@ -810,7 +859,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool iscntrl(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::cntrl, __c); + return std::use_facet >(__loc).is(ctype_base::cntrl, __c); } template @@ -818,7 +867,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isupper(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::upper, __c); + return std::use_facet >(__loc).is(ctype_base::upper, __c); } template @@ -826,7 +875,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool islower(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::lower, __c); + return std::use_facet >(__loc).is(ctype_base::lower, __c); } template @@ -834,7 +883,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isalpha(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::alpha, __c); + return std::use_facet >(__loc).is(ctype_base::alpha, __c); } template @@ -842,7 +891,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isdigit(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::digit, __c); + return std::use_facet >(__loc).is(ctype_base::digit, __c); } template @@ -850,7 +899,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool ispunct(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::punct, __c); + return std::use_facet >(__loc).is(ctype_base::punct, __c); } template @@ -858,7 +907,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isxdigit(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::xdigit, __c); + return std::use_facet >(__loc).is(ctype_base::xdigit, __c); } template @@ -866,7 +915,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isalnum(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::alnum, __c); + return std::use_facet >(__loc).is(ctype_base::alnum, __c); } template @@ -874,7 +923,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isgraph(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::graph, __c); + return std::use_facet >(__loc).is(ctype_base::graph, __c); } template @@ -882,7 +931,7 @@ inline _LIBCPP_INLINE_VISIBILITY _CharT toupper(_CharT __c, const locale& __loc) { - return use_facet >(__loc).toupper(__c); + return std::use_facet >(__loc).toupper(__c); } template @@ -890,7 +939,7 @@ inline _LIBCPP_INLINE_VISIBILITY _CharT tolower(_CharT __c, const locale& __loc) { - return use_facet >(__loc).tolower(__c); + return std::use_facet >(__loc).tolower(__c); } // codecvt_base @@ -976,7 +1025,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -994,12 +1043,13 @@ protected: // template <> class codecvt +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS codecvt : public locale::facet, public codecvt_base { - locale_t __l; + locale_t __l_; public: typedef wchar_t intern_type; typedef char extern_type; @@ -1059,7 +1109,7 @@ public: protected: explicit codecvt(const char*, size_t __refs = 0); - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1074,6 +1124,7 @@ protected: virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_max_length() const _NOEXCEPT; }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS // template <> class codecvt // deprecated in C++20 @@ -1145,7 +1196,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1233,7 +1284,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1321,7 +1372,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1409,7 +1460,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1441,7 +1492,7 @@ public: explicit codecvt_byname(const string& __nm, size_t __refs = 0) : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {} protected: - ~codecvt_byname(); + ~codecvt_byname() override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -1451,13 +1502,15 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() } _LIBCPP_SUPPRESS_DEPRECATED_POP -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // deprecated in C++20 -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // deprecated in C++20 +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname; +#endif +extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname; // deprecated in C++20 +extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname; // deprecated in C++20 #ifndef _LIBCPP_HAS_NO_CHAR8_T -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // C++20 -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // C++20 +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname; // C++20 +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname; // C++20 #endif template @@ -1491,7 +1544,7 @@ struct _LIBCPP_TYPE_VIS __narrow_to_utf8<16> __narrow_to_utf8() : codecvt(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__narrow_to_utf8(); + ~__narrow_to_utf8() override; template _LIBCPP_INLINE_VISIBILITY @@ -1527,7 +1580,7 @@ struct _LIBCPP_TYPE_VIS __narrow_to_utf8<32> __narrow_to_utf8() : codecvt(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__narrow_to_utf8(); + ~__narrow_to_utf8() override; template _LIBCPP_INLINE_VISIBILITY @@ -1585,7 +1638,7 @@ struct _LIBCPP_TYPE_VIS __widen_from_utf8<16> __widen_from_utf8() : codecvt(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__widen_from_utf8(); + ~__widen_from_utf8() override; template _LIBCPP_INLINE_VISIBILITY @@ -1621,7 +1674,7 @@ struct _LIBCPP_TYPE_VIS __widen_from_utf8<32> __widen_from_utf8() : codecvt(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__widen_from_utf8(); + ~__widen_from_utf8() override; template _LIBCPP_INLINE_VISIBILITY @@ -1671,7 +1724,7 @@ public: static locale::id id; protected: - ~numpunct(); + ~numpunct() override; virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; @@ -1683,6 +1736,7 @@ protected: string __grouping_; }; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS numpunct : public locale::facet @@ -1702,7 +1756,7 @@ public: static locale::id id; protected: - ~numpunct(); + ~numpunct() override; virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; @@ -1713,6 +1767,7 @@ protected: char_type __thousands_sep_; string __grouping_; }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS // template class numpunct_byname @@ -1730,12 +1785,13 @@ public: explicit numpunct_byname(const string& __nm, size_t __refs = 0); protected: - ~numpunct_byname(); + ~numpunct_byname() override; private: void __init(const char*); }; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS numpunct_byname : public numpunct @@ -1748,11 +1804,12 @@ public: explicit numpunct_byname(const string& __nm, size_t __refs = 0); protected: - ~numpunct_byname(); + ~numpunct_byname() override; private: void __init(const char*); }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS _LIBCPP_END_NAMESPACE_STD diff --git a/gnu/llvm/libcxx/include/__memory/pointer_safety.h b/gnu/llvm/libcxx/include/__memory/pointer_safety.h deleted file mode 100644 index 87a6a9659e0..00000000000 --- a/gnu/llvm/libcxx/include/__memory/pointer_safety.h +++ /dev/null @@ -1,57 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___MEMORY_POINTER_SAFETY_H -#define _LIBCPP___MEMORY_POINTER_SAFETY_H - -#include <__config> -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if !defined(_LIBCPP_CXX03_LANG) - -enum class pointer_safety : unsigned char { - relaxed, - preferred, - strict -}; - -inline _LIBCPP_INLINE_VISIBILITY -pointer_safety get_pointer_safety() _NOEXCEPT { - return pointer_safety::relaxed; -} - -_LIBCPP_FUNC_VIS void declare_reachable(void* __p); -_LIBCPP_FUNC_VIS void declare_no_pointers(char* __p, size_t __n); -_LIBCPP_FUNC_VIS void undeclare_no_pointers(char* __p, size_t __n); -_LIBCPP_FUNC_VIS void* __undeclare_reachable(void* __p); - -template -inline _LIBCPP_INLINE_VISIBILITY -_Tp* -undeclare_reachable(_Tp* __p) -{ - return static_cast<_Tp*>(__undeclare_reachable(__p)); -} - -#endif // !C++03 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___MEMORY_POINTER_SAFETY_H diff --git a/gnu/llvm/libcxx/include/__nullptr b/gnu/llvm/libcxx/include/__nullptr deleted file mode 100644 index e1475116423..00000000000 --- a/gnu/llvm/libcxx/include/__nullptr +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- -//===--------------------------- __nullptr --------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_NULLPTR -#define _LIBCPP_NULLPTR - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -#ifdef _LIBCPP_HAS_NO_NULLPTR - -_LIBCPP_BEGIN_NAMESPACE_STD - -struct _LIBCPP_TEMPLATE_VIS nullptr_t -{ - void* __lx; - - struct __nat {int __for_bool_;}; - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {} - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;} - - template - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - operator _Tp* () const {return 0;} - - template - _LIBCPP_INLINE_VISIBILITY - operator _Tp _Up::* () const {return 0;} - - friend _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;} - friend _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;} -}; - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);} - -#define nullptr _VSTD::__get_nullptr_t() - -_LIBCPP_END_NAMESPACE_STD - -#else // _LIBCPP_HAS_NO_NULLPTR - -namespace std -{ - typedef decltype(nullptr) nullptr_t; -} - -#endif // _LIBCPP_HAS_NO_NULLPTR - -#endif // _LIBCPP_NULLPTR diff --git a/gnu/llvm/libcxx/include/__string b/gnu/llvm/libcxx/include/__string deleted file mode 100644 index b77a7fb4f8d..00000000000 --- a/gnu/llvm/libcxx/include/__string +++ /dev/null @@ -1,1146 +0,0 @@ -// -*- C++ -*- -//===-------------------------- __string ----------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___STRING -#define _LIBCPP___STRING - -#include <__config> -#include <__algorithm/copy.h> -#include <__algorithm/copy_backward.h> -#include <__algorithm/copy_n.h> -#include <__algorithm/fill_n.h> -#include <__algorithm/find_first_of.h> -#include <__algorithm/find_end.h> -#include <__algorithm/min.h> -#include <__functional/hash.h> // for __murmur2_or_cityhash -#include <__iterator/iterator_traits.h> -#include // for EOF -#include // for uint_least16_t -#include // for memcpy -#include // for wmemcpy -#include // for __libcpp_is_constant_evaluated - -#include <__debug> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - -_LIBCPP_BEGIN_NAMESPACE_STD - -// The the extern template ABI lists are kept outside of to improve the -// readability of that header. - -// The extern template ABI lists are kept outside of to improve the -// readability of that header. We maintain 2 ABI lists: -// - _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST -// - _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST -// As the name implies, the ABI lists define the V1 (Stable) and unstable ABI. -// -// For unstable, we may explicitly remove function that are external in V1, -// and add (new) external functions to better control inlining and compiler -// optimization opportunities. -// -// For stable, the ABI list should rarely change, except for adding new -// functions supporting new c++ version / API changes. Typically entries -// must never be removed from the stable list. -#define _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_Func, _CharType) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, allocator<_CharType> const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS const _CharType& basic_string<_CharType>::at(size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::reserve(size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by(size_type, size_type, size_type, size_type, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by_and_replace(size_type, size_type, size_type, size_type, size_type, size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::push_back(value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS const basic_string<_CharType>::size_type basic_string<_CharType>::npos) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::erase(size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*) const) \ - _Func(_LIBCPP_FUNC_VIS _CharType& basic_string<_CharType>::at(size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, basic_string const&, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(basic_string const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::iterator basic_string<_CharType>::insert(basic_string::const_iterator, value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::resize(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) - -#define _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_Func, _CharType) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init_copy_ctor_external(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS const _CharType& basic_string<_CharType>::at(size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_external(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_external(value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::reserve(size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by(size_type, size_type, size_type, size_type, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by_and_replace(size_type, size_type, size_type, size_type, size_type, size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_no_alias(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_no_alias(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::push_back(value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS const basic_string<_CharType>::size_type basic_string<_CharType>::npos) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__erase_external_with_move(size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*) const) \ - _Func(_LIBCPP_FUNC_VIS _CharType& basic_string<_CharType>::at(size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, basic_string const&, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::iterator basic_string<_CharType>::insert(basic_string::const_iterator, value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::resize(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) - - -// char_traits - -template -struct _LIBCPP_TEMPLATE_VIS char_traits -{ - typedef _CharT char_type; - typedef int int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; - - static inline void _LIBCPP_CONSTEXPR_AFTER_CXX14 - assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 < __c2;} - - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n); - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - size_t length(const char_type* __s); - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a); - static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* move(char_type* __s1, const char_type* __s2, size_t __n); - _LIBCPP_INLINE_VISIBILITY - static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); - _LIBCPP_INLINE_VISIBILITY - static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* assign(char_type* __s, size_t __n, char_type __a); - - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type(__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(EOF);} -}; - -template -_LIBCPP_CONSTEXPR_AFTER_CXX14 int -char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) -{ - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -} - -template -inline -_LIBCPP_CONSTEXPR_AFTER_CXX14 size_t -char_traits<_CharT>::length(const char_type* __s) -{ - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -} - -template -inline -_LIBCPP_CONSTEXPR_AFTER_CXX14 const _CharT* -char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) -{ - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return nullptr; -} - -template -_LIBCPP_CONSTEXPR_AFTER_CXX17 _CharT* -char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) -{ - if (__n == 0) return __s1; - char_type* __r = __s1; - if (__s1 < __s2) - { - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - } - else if (__s2 < __s1) - { - __s1 += __n; - __s2 += __n; - for (; __n; --__n) - assign(*--__s1, *--__s2); - } - return __r; -} - -template -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* -char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) -{ - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - char_type* __r = __s1; - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - return __r; -} - -template -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* -char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) -{ - char_type* __r = __s; - for (; __n; --__n, ++__s) - assign(*__s, __a); - return __r; -} - -// constexpr versions of move/copy/assign. - -template -static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) return __s1; - if (__s1 < __s2) { - _VSTD::copy(__s2, __s2 + __n, __s1); - } else if (__s2 < __s1) { - _VSTD::copy_backward(__s2, __s2 + __n, __s1 + __n); - } - return __s1; -} - -template -static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT -{ - _VSTD::copy_n(__s2, __n, __s1); - return __s1; -} - -template -static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT -{ - _VSTD::fill_n(__s, __n, __a); - return __s; -} - -// char_traits - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits -{ - typedef char char_type; - typedef int int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; - - static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 - void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return (unsigned char)__c1 < (unsigned char)__c2;} - - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - static inline size_t _LIBCPP_CONSTEXPR_AFTER_CXX14 - length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);} - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__move_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n); - } - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - return __libcpp_is_constant_evaluated() - ? _VSTD::__copy_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n); - } - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__assign_constexpr(__s, __n, __a) - : __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n); - } - - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type((unsigned char)__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(EOF);} -}; - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -int -char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) - return 0; -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_memcmp(__s1, __s2, __n); -#elif _LIBCPP_STD_VER <= 14 - return _VSTD::memcmp(__s1, __s2, __n); -#else - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -#endif -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -const char* -char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - if (__n == 0) - return nullptr; -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_char_memchr(__s, to_int_type(__a), __n); -#elif _LIBCPP_STD_VER <= 14 - return (const char_type*) _VSTD::memchr(__s, to_int_type(__a), __n); -#else - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return nullptr; -#endif -} - - -// char_traits - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits -{ - typedef wchar_t char_type; - typedef wint_t int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; - - static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 - void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 < __c2;} - - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - size_t length(const char_type* __s) _NOEXCEPT; - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__move_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : _VSTD::wmemmove(__s1, __s2, __n); - } - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - return __libcpp_is_constant_evaluated() - ? _VSTD::__copy_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : _VSTD::wmemcpy(__s1, __s2, __n); - } - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__assign_constexpr(__s, __n, __a) - : __n == 0 ? __s : _VSTD::wmemset(__s, __a, __n); - } - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type(__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(WEOF);} -}; - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -int -char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) - return 0; -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_wmemcmp(__s1, __s2, __n); -#elif _LIBCPP_STD_VER <= 14 - return _VSTD::wmemcmp(__s1, __s2, __n); -#else - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -#endif -} - - -template -_LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR -inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL >= 1 - return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0); -#else - return _Traits::length(__s); -#endif -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -size_t -char_traits::length(const char_type* __s) _NOEXCEPT -{ -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_wcslen(__s); -#elif _LIBCPP_STD_VER <= 14 - return _VSTD::wcslen(__s); -#else - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -#endif -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -const wchar_t* -char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - if (__n == 0) - return nullptr; -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_wmemchr(__s, __a, __n); -#elif _LIBCPP_STD_VER <= 14 - return _VSTD::wmemchr(__s, __a, __n); -#else - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return nullptr; -#endif -} - - -#ifndef _LIBCPP_HAS_NO_CHAR8_T - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits -{ - typedef char8_t char_type; - typedef unsigned int int_type; - typedef streamoff off_type; - typedef u8streampos pos_type; - typedef mbstate_t state_type; - - static inline constexpr void assign(char_type& __c1, const char_type& __c2) noexcept - {__c1 = __c2;} - static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept - {return __c1 == __c2;} - static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept - {return __c1 < __c2;} - - static constexpr - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - - static constexpr - size_t length(const char_type* __s) _NOEXCEPT; - - _LIBCPP_INLINE_VISIBILITY static constexpr - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - - static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__move_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n); - } - - static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - return __libcpp_is_constant_evaluated() - ? _VSTD::__copy_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n); - } - - static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__assign_constexpr(__s, __n, __a) - : __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n); - } - - static inline constexpr int_type not_eof(int_type __c) noexcept - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline constexpr char_type to_char_type(int_type __c) noexcept - {return char_type(__c);} - static inline constexpr int_type to_int_type(char_type __c) noexcept - {return int_type(__c);} - static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept - {return __c1 == __c2;} - static inline constexpr int_type eof() noexcept - {return int_type(EOF);} -}; - -// TODO use '__builtin_strlen' if it ever supports char8_t ?? -inline constexpr -size_t -char_traits::length(const char_type* __s) _NOEXCEPT -{ - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -} - -inline constexpr -int -char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_memcmp(__s1, __s2, __n); -#else - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -#endif -} - -// TODO use '__builtin_char_memchr' if it ever supports char8_t ?? -inline constexpr -const char8_t* -char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return nullptr; -} - -#endif // #_LIBCPP_HAS_NO_CHAR8_T - -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits -{ - typedef char16_t char_type; - typedef uint_least16_t int_type; - typedef streamoff off_type; - typedef u16streampos pos_type; - typedef mbstate_t state_type; - - static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 - void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 < __c2;} - - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - size_t length(const char_type* __s) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; - - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type(__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(0xFFFF);} -}; - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -int -char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -size_t -char_traits::length(const char_type* __s) _NOEXCEPT -{ - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -const char16_t* -char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return nullptr; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char16_t* -char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) return __s1; - char_type* __r = __s1; - if (__s1 < __s2) - { - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - } - else if (__s2 < __s1) - { - __s1 += __n; - __s2 += __n; - for (; __n; --__n) - assign(*--__s1, *--__s2); - } - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char16_t* -char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - char_type* __r = __s1; - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char16_t* -char_traits::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT -{ - char_type* __r = __s; - for (; __n; --__n, ++__s) - assign(*__s, __a); - return __r; -} - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits -{ - typedef char32_t char_type; - typedef uint_least32_t int_type; - typedef streamoff off_type; - typedef u32streampos pos_type; - typedef mbstate_t state_type; - - static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 - void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 < __c2;} - - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - size_t length(const char_type* __s) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; - - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type(__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(0xFFFFFFFF);} -}; - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -int -char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -size_t -char_traits::length(const char_type* __s) _NOEXCEPT -{ - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -const char32_t* -char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return nullptr; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char32_t* -char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) return __s1; - char_type* __r = __s1; - if (__s1 < __s2) - { - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - } - else if (__s2 < __s1) - { - __s1 += __n; - __s2 += __n; - for (; __n; --__n) - assign(*--__s1, *--__s2); - } - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char32_t* -char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - char_type* __r = __s1; - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char32_t* -char_traits::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT -{ - char_type* __r = __s; - for (; __n; --__n, ++__s) - assign(*__s, __a); - return __r; -} - -#endif // _LIBCPP_HAS_NO_UNICODE_CHARS - -// helper fns for basic_string and string_view - -// __str_find -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT -{ - if (__pos >= __sz) - return __npos; - const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c); - if (__r == nullptr) - return __npos; - return static_cast<_SizeT>(__r - __p); -} - -template -inline _LIBCPP_CONSTEXPR_AFTER_CXX11 const _CharT * -__search_substring(const _CharT *__first1, const _CharT *__last1, - const _CharT *__first2, const _CharT *__last2) _NOEXCEPT { - // Take advantage of knowing source and pattern lengths. - // Stop short when source is smaller than pattern. - const ptrdiff_t __len2 = __last2 - __first2; - if (__len2 == 0) - return __first1; - - ptrdiff_t __len1 = __last1 - __first1; - if (__len1 < __len2) - return __last1; - - // First element of __first2 is loop invariant. - _CharT __f2 = *__first2; - while (true) { - __len1 = __last1 - __first1; - // Check whether __first1 still has at least __len2 bytes. - if (__len1 < __len2) - return __last1; - - // Find __f2 the first byte matching in __first1. - __first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2); - if (__first1 == nullptr) - return __last1; - - // It is faster to compare from the first byte of __first1 even if we - // already know that it matches the first byte of __first2: this is because - // __first2 is most likely aligned, as it is user's "pattern" string, and - // __first1 + 1 is most likely not aligned, as the match is in the middle of - // the string. - if (_Traits::compare(__first1, __first2, __len2) == 0) - return __first1; - - ++__first1; - } -} - -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - if (__pos > __sz) - return __npos; - - if (__n == 0) // There is nothing to search, just return __pos. - return __pos; - - const _CharT *__r = __search_substring<_CharT, _Traits>( - __p + __pos, __p + __sz, __s, __s + __n); - - if (__r == __p + __sz) - return __npos; - return static_cast<_SizeT>(__r - __p); -} - - -// __str_rfind - -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_rfind(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT -{ - if (__sz < 1) - return __npos; - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - for (const _CharT* __ps = __p + __pos; __ps != __p;) - { - if (_Traits::eq(*--__ps, __c)) - return static_cast<_SizeT>(__ps - __p); - } - return __npos; -} - -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_rfind(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - __pos = _VSTD::min(__pos, __sz); - if (__n < __sz - __pos) - __pos += __n; - else - __pos = __sz; - const _CharT* __r = _VSTD::__find_end( - __p, __p + __pos, __s, __s + __n, _Traits::eq, - random_access_iterator_tag(), random_access_iterator_tag()); - if (__n > 0 && __r == __p + __pos) - return __npos; - return static_cast<_SizeT>(__r - __p); -} - -// __str_find_first_of -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_first_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - if (__pos >= __sz || __n == 0) - return __npos; - const _CharT* __r = _VSTD::__find_first_of_ce - (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq ); - if (__r == __p + __sz) - return __npos; - return static_cast<_SizeT>(__r - __p); -} - - -// __str_find_last_of -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_last_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT - { - if (__n != 0) - { - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - for (const _CharT* __ps = __p + __pos; __ps != __p;) - { - const _CharT* __r = _Traits::find(__s, __n, *--__ps); - if (__r) - return static_cast<_SizeT>(__ps - __p); - } - } - return __npos; -} - - -// __str_find_first_not_of -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_first_not_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - if (__pos < __sz) - { - const _CharT* __pe = __p + __sz; - for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) - if (_Traits::find(__s, __n, *__ps) == nullptr) - return static_cast<_SizeT>(__ps - __p); - } - return __npos; -} - - -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_first_not_of(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT -{ - if (__pos < __sz) - { - const _CharT* __pe = __p + __sz; - for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) - if (!_Traits::eq(*__ps, __c)) - return static_cast<_SizeT>(__ps - __p); - } - return __npos; -} - - -// __str_find_last_not_of -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_last_not_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - for (const _CharT* __ps = __p + __pos; __ps != __p;) - if (_Traits::find(__s, __n, *--__ps) == nullptr) - return static_cast<_SizeT>(__ps - __p); - return __npos; -} - - -template -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_last_not_of(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT -{ - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - for (const _CharT* __ps = __p + __pos; __ps != __p;) - if (!_Traits::eq(*--__ps, __c)) - return static_cast<_SizeT>(__ps - __p); - return __npos; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -size_t __do_string_hash(_Ptr __p, _Ptr __e) -{ - typedef typename iterator_traits<_Ptr>::value_type value_type; - return __murmur2_or_cityhash()(__p, (__e-__p)*sizeof(value_type)); -} - -template > -struct __quoted_output_proxy -{ - _Iter __first; - _Iter __last; - _CharT __delim; - _CharT __escape; - - __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e) - : __first(__f), __last(__l), __delim(__d), __escape(__e) {} - // This would be a nice place for a string_ref -}; - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___STRING diff --git a/gnu/llvm/libcxx/include/__support/ibm/limits.h b/gnu/llvm/libcxx/include/__support/ibm/limits.h deleted file mode 100644 index 45f1f1e3684..00000000000 --- a/gnu/llvm/libcxx/include/__support/ibm/limits.h +++ /dev/null @@ -1,98 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H -#define _LIBCPP_SUPPORT_IBM_LIMITS_H - -#if !defined(_AIX) // Linux -#include // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN - -static const unsigned int _QNAN_F = 0x7fc00000; -#define NANF (*((float *)(&_QNAN_F))) -static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0}; -#define NANL (*((long double *)(&_QNAN_LDBL128))) -static const unsigned int _SNAN_F= 0x7f855555; -#define NANSF (*((float *)(&_SNAN_F))) -static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555}; -#define NANS (*((double *)(&_SNAN_D))) -static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0}; -#define NANSL (*((long double *)(&_SNAN_LDBL128))) - -#define __builtin_huge_val() HUGE_VAL -#define __builtin_huge_valf() HUGE_VALF -#define __builtin_huge_vall() HUGE_VALL -#define __builtin_nan(__dummy) NAN -#define __builtin_nanf(__dummy) NANF -#define __builtin_nanl(__dummy) NANL -#define __builtin_nans(__dummy) NANS -#define __builtin_nansf(__dummy) NANSF -#define __builtin_nansl(__dummy) NANSL - -#else - -#include -#include // limit constants - -#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000 -#define __builtin_huge_valf() HUGE_VALF //0x7f800000 -#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000 -#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000 -#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000 -#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000 -#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555 -#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555 -#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555 - -#define __FLT_MANT_DIG__ FLT_MANT_DIG -#define __FLT_DIG__ FLT_DIG -#define __FLT_RADIX__ FLT_RADIX -#define __FLT_MIN_EXP__ FLT_MIN_EXP -#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP -#define __FLT_MAX_EXP__ FLT_MAX_EXP -#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP -#define __FLT_MIN__ FLT_MIN -#define __FLT_MAX__ FLT_MAX -#define __FLT_EPSILON__ FLT_EPSILON -// predefined by XLC on LoP -#define __FLT_DENORM_MIN__ 1.40129846e-45F - -#define __DBL_MANT_DIG__ DBL_MANT_DIG -#define __DBL_DIG__ DBL_DIG -#define __DBL_MIN_EXP__ DBL_MIN_EXP -#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP -#define __DBL_MAX_EXP__ DBL_MAX_EXP -#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP -#define __DBL_MIN__ DBL_MIN -#define __DBL_MAX__ DBL_MAX -#define __DBL_EPSILON__ DBL_EPSILON -// predefined by XLC on LoP -#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 - -#define __LDBL_MANT_DIG__ LDBL_MANT_DIG -#define __LDBL_DIG__ LDBL_DIG -#define __LDBL_MIN_EXP__ LDBL_MIN_EXP -#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP -#define __LDBL_MAX_EXP__ LDBL_MAX_EXP -#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP -#define __LDBL_MIN__ LDBL_MIN -#define __LDBL_MAX__ LDBL_MAX -#define __LDBL_EPSILON__ LDBL_EPSILON -// predefined by XLC on LoP -#if __LONGDOUBLE128 -#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L -#else -#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L -#endif - -// predefined by XLC on LoP -#define __CHAR_BIT__ 8 - -#endif // _AIX - -#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H diff --git a/gnu/llvm/libcxx/include/__support/ibm/locale_mgmt_aix.h b/gnu/llvm/libcxx/include/__support/ibm/locale_mgmt_aix.h deleted file mode 100644 index 4f658c3eee3..00000000000 --- a/gnu/llvm/libcxx/include/__support/ibm/locale_mgmt_aix.h +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H -#define _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H - -#if defined(_AIX) -#include "cstdlib" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_AIX71) -// AIX 7.1 and higher has these definitions. Definitions and stubs -// are provied here as a temporary workaround on AIX 6.1. - -#define LC_COLLATE_MASK 1 -#define LC_CTYPE_MASK 2 -#define LC_MESSAGES_MASK 4 -#define LC_MONETARY_MASK 8 -#define LC_NUMERIC_MASK 16 -#define LC_TIME_MASK 32 -#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | \ - LC_MESSAGES_MASK | LC_MONETARY_MASK |\ - LC_NUMERIC_MASK | LC_TIME_MASK) - -typedef void* locale_t; - -// The following are stubs. They are not supported on AIX 6.1. -static inline -locale_t newlocale(int category_mask, const char *locale, locale_t base) -{ - _LC_locale_t *newloc, *loc; - if ((loc = (_LC_locale_t *)__xopen_locale(locale)) == NULL) - { - errno = EINVAL; - return (locale_t)0; - } - if ((newloc = (_LC_locale_t *)calloc(1, sizeof(_LC_locale_t))) == NULL) - { - errno = ENOMEM; - return (locale_t)0; - } - if (!base) - base = (_LC_locale_t *)__xopen_locale("C"); - memcpy(newloc, base, sizeof (_LC_locale_t)); - if (category_mask & LC_COLLATE_MASK) - newloc->lc_collate = loc->lc_collate; - if (category_mask & LC_CTYPE_MASK) - newloc->lc_ctype = loc->lc_ctype; - //if (category_mask & LC_MESSAGES_MASK) - // newloc->lc_messages = loc->lc_messages; - if (category_mask & LC_MONETARY_MASK) - newloc->lc_monetary = loc->lc_monetary; - if (category_mask & LC_TIME_MASK) - newloc->lc_time = loc->lc_time; - if (category_mask & LC_NUMERIC_MASK) - newloc->lc_numeric = loc->lc_numeric; - return (locale_t)newloc; -} -static inline -void freelocale(locale_t locobj) -{ - free(locobj); -} -static inline -locale_t uselocale(locale_t newloc) -{ - return (locale_t)0; -} -#endif // !defined(_AIX71) - -#ifdef __cplusplus -} -#endif -#endif // defined(_AIX) -#endif // _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H diff --git a/gnu/llvm/libcxx/include/__support/ibm/support.h b/gnu/llvm/libcxx/include/__support/ibm/support.h deleted file mode 100644 index a7751b01766..00000000000 --- a/gnu/llvm/libcxx/include/__support/ibm/support.h +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_SUPPORT_H -#define _LIBCPP_SUPPORT_IBM_SUPPORT_H - -extern "builtin" int __popcnt4(unsigned int); -extern "builtin" int __popcnt8(unsigned long long); -extern "builtin" unsigned int __cnttz4(unsigned int); -extern "builtin" unsigned int __cnttz8(unsigned long long); -extern "builtin" unsigned int __cntlz4(unsigned int); -extern "builtin" unsigned int __cntlz8(unsigned long long); - -// Builtin functions for counting population -#define __builtin_popcount(x) __popcnt4(x) -#define __builtin_popcountll(x) __popcnt8(x) -#if defined(__64BIT__) -#define __builtin_popcountl(x) __builtin_popcountll(x) -#else -#define __builtin_popcountl(x) __builtin_popcount(x) -#endif - -// Builtin functions for counting trailing zeros -#define __builtin_ctz(x) __cnttz4(x) -#define __builtin_ctzll(x) __cnttz8(x) -#if defined(__64BIT__) -#define __builtin_ctzl(x) __builtin_ctzll(x) -#else -#define __builtin_ctzl(x) __builtin_ctz(x) -#endif - -// Builtin functions for counting leading zeros -#define __builtin_clz(x) __cntlz4(x) -#define __builtin_clzll(x) __cntlz8(x) -#if defined(__64BIT__) -#define __builtin_clzl(x) __builtin_clzll(x) -#else -#define __builtin_clzl(x) __builtin_clz(x) -#endif - -#if defined(__64BIT__) -#define __SIZE_WIDTH__ 64 -#else -#define __SIZE_WIDTH__ 32 -#endif - -#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H diff --git a/gnu/llvm/libcxx/include/__support/nuttx/xlocale.h b/gnu/llvm/libcxx/include/__support/nuttx/xlocale.h deleted file mode 100644 index be738e3b64e..00000000000 --- a/gnu/llvm/libcxx/include/__support/nuttx/xlocale.h +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_NUTTX_XLOCALE_H -#define _LIBCPP_SUPPORT_NUTTX_XLOCALE_H - -#if defined(__NuttX__) -#include <__support/xlocale/__posix_l_fallback.h> -#include <__support/xlocale/__strtonum_fallback.h> -#endif // __NuttX__ - -#endif diff --git a/gnu/llvm/libcxx/include/__support/win32/limits_msvc_win32.h b/gnu/llvm/libcxx/include/__support/win32/limits_msvc_win32.h deleted file mode 100644 index c80df6693ce..00000000000 --- a/gnu/llvm/libcxx/include/__support/win32/limits_msvc_win32.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H -#define _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H - -#if !defined(_LIBCPP_MSVCRT) -#error "This header complements the Microsoft C Runtime library, and should not be included otherwise." -#endif -#if defined(__clang__) -#error "This header should only be included when using Microsofts C1XX frontend" -#endif - -#include // limit constants -#include // CHAR_BIT -#include // HUGE_VAL -#include // internal MSVC header providing the needed functionality - -#define __CHAR_BIT__ CHAR_BIT - -#define __FLT_MANT_DIG__ FLT_MANT_DIG -#define __FLT_DIG__ FLT_DIG -#define __FLT_RADIX__ FLT_RADIX -#define __FLT_MIN_EXP__ FLT_MIN_EXP -#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP -#define __FLT_MAX_EXP__ FLT_MAX_EXP -#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP -#define __FLT_MIN__ FLT_MIN -#define __FLT_MAX__ FLT_MAX -#define __FLT_EPSILON__ FLT_EPSILON -// predefined by MinGW GCC -#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F - -#define __DBL_MANT_DIG__ DBL_MANT_DIG -#define __DBL_DIG__ DBL_DIG -#define __DBL_RADIX__ DBL_RADIX -#define __DBL_MIN_EXP__ DBL_MIN_EXP -#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP -#define __DBL_MAX_EXP__ DBL_MAX_EXP -#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP -#define __DBL_MIN__ DBL_MIN -#define __DBL_MAX__ DBL_MAX -#define __DBL_EPSILON__ DBL_EPSILON -// predefined by MinGW GCC -#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L) - -#define __LDBL_MANT_DIG__ LDBL_MANT_DIG -#define __LDBL_DIG__ LDBL_DIG -#define __LDBL_RADIX__ LDBL_RADIX -#define __LDBL_MIN_EXP__ LDBL_MIN_EXP -#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP -#define __LDBL_MAX_EXP__ LDBL_MAX_EXP -#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP -#define __LDBL_MIN__ LDBL_MIN -#define __LDBL_MAX__ LDBL_MAX -#define __LDBL_EPSILON__ LDBL_EPSILON -// predefined by MinGW GCC -#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L - -// __builtin replacements/workarounds -#define __builtin_huge_vall() _LInf._Long_double -#define __builtin_nanl(__dummmy) _LNan._Long_double -#define __builtin_nansl(__dummy) _LSnan._Long_double - -#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H diff --git a/gnu/llvm/libcxx/include/__tuple b/gnu/llvm/libcxx/include/__tuple deleted file mode 100644 index 082ec869eec..00000000000 --- a/gnu/llvm/libcxx/include/__tuple +++ /dev/null @@ -1,551 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___TUPLE -#define _LIBCPP___TUPLE - -#include <__config> -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - - -_LIBCPP_BEGIN_NAMESPACE_STD - -template struct _LIBCPP_TEMPLATE_VIS tuple_size; - -#if !defined(_LIBCPP_CXX03_LANG) -template -using __enable_if_tuple_size_imp = _Tp; - -template -struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< - const _Tp, - typename enable_if::value>::type, - integral_constant)>>> - : public integral_constant::value> {}; - -template -struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< - volatile _Tp, - typename enable_if::value>::type, - integral_constant)>>> - : public integral_constant::value> {}; - -template -struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< - const volatile _Tp, - integral_constant)>>> - : public integral_constant::value> {}; - -#else -template struct _LIBCPP_TEMPLATE_VIS tuple_size : public tuple_size<_Tp> {}; -template struct _LIBCPP_TEMPLATE_VIS tuple_size : public tuple_size<_Tp> {}; -template struct _LIBCPP_TEMPLATE_VIS tuple_size : public tuple_size<_Tp> {}; -#endif - -template struct _LIBCPP_TEMPLATE_VIS tuple_element; - -template -struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp> -{ - typedef _LIBCPP_NODEBUG_TYPE typename add_const::type>::type type; -}; - -template -struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp> -{ - typedef _LIBCPP_NODEBUG_TYPE typename add_volatile::type>::type type; -}; - -template -struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> -{ - typedef _LIBCPP_NODEBUG_TYPE typename add_cv::type>::type type; -}; - -template struct __tuple_like : false_type {}; - -template struct __tuple_like : public __tuple_like<_Tp> {}; -template struct __tuple_like : public __tuple_like<_Tp> {}; -template struct __tuple_like : public __tuple_like<_Tp> {}; - -// tuple specializations - -#ifndef _LIBCPP_CXX03_LANG - -template struct __tuple_indices {}; - -template -struct __integer_sequence { - template