summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Varlamov <varconsteq@gmail.com>2023-11-08 09:10:00 -1000
committerGitHub <noreply@github.com>2023-11-08 09:10:00 -1000
commit64d413efdd76f2e6464ae6f578161811b9d12411 (patch)
treea608350407dc0f12ab8181d1623b864d9cd91319
parentb8a062061571b7868013f1fefb891bdaa2da1adc (diff)
[libc++][hardening] Rework macros for enabling the hardening mode. (#70575)
1. Instead of using individual "boolean" macros, have an "enum" macro `_LIBCPP_HARDENING_MODE`. This avoids issues with macros being mutually exclusive and makes overriding the hardening mode within a TU more straightforward. 2. Rename the safe mode to debug-lite. This brings the code in line with the RFC: https://discourse.llvm.org/t/rfc-hardening-in-libc/73925 Fixes #65101
-rw-r--r--libcxx/CMakeLists.txt30
-rw-r--r--libcxx/cmake/caches/Generic-hardened-mode.cmake1
-rw-r--r--libcxx/cmake/caches/Generic-hardening-mode-debug.cmake (renamed from libcxx/cmake/caches/Generic-debug-mode.cmake)0
-rw-r--r--libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake (renamed from libcxx/cmake/caches/Generic-safe-mode.cmake)2
-rw-r--r--libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake (renamed from libcxx/cmake/caches/Generic-hardened-mode-with-abi-breaks.cmake)2
-rw-r--r--libcxx/cmake/caches/Generic-hardening-mode-fast.cmake1
-rw-r--r--libcxx/docs/Hardening.rst73
-rw-r--r--libcxx/docs/ReleaseNotes/18.rst33
-rw-r--r--libcxx/docs/UsingLibcxx.rst10
-rw-r--r--libcxx/include/__algorithm/comp_ref_type.h2
-rw-r--r--libcxx/include/__algorithm/three_way_comp_ref_type.h2
-rw-r--r--libcxx/include/__config100
-rw-r--r--libcxx/include/__config_site.in4
-rw-r--r--libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp2
-rw-r--r--libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp2
-rw-r--r--libcxx/test/libcxx/assertions/modes/debug.pass.cpp4
-rw-r--r--libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp29
-rw-r--r--libcxx/test/libcxx/assertions/modes/debug_mode_not_1_or_0.verify.cpp19
-rw-r--r--libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp (renamed from libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp)15
-rw-r--r--libcxx/test/libcxx/assertions/modes/extensive.pass.cpp (renamed from libcxx/test/libcxx/assertions/modes/hardened.pass.cpp)10
-rw-r--r--libcxx/test/libcxx/assertions/modes/fast.pass.cpp (renamed from libcxx/test/libcxx/assertions/modes/safe.pass.cpp)10
-rw-r--r--libcxx/test/libcxx/assertions/modes/hardened_and_debug_mutually_exclusive.verify.cpp18
-rw-r--r--libcxx/test/libcxx/assertions/modes/hardened_and_safe_mutually_exclusive.verify.cpp18
-rw-r--r--libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp23
-rw-r--r--libcxx/test/libcxx/assertions/modes/hardened_mode_not_1_or_0.verify.cpp19
-rw-r--r--libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp26
-rw-r--r--libcxx/test/libcxx/assertions/modes/none.pass.cpp (renamed from libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp)7
-rw-r--r--libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp (renamed from libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp)13
-rw-r--r--libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp30
-rw-r--r--libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp (renamed from libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp)12
-rw-r--r--libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp (renamed from libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp)12
-rw-r--r--libcxx/test/libcxx/assertions/modes/safe_and_debug_mutually_exclusive.verify.cpp18
-rw-r--r--libcxx/test/libcxx/assertions/modes/safe_mode_disabled_in_tu.pass.cpp23
-rw-r--r--libcxx/test/libcxx/assertions/modes/safe_mode_not_1_or_0.verify.cpp19
-rw-r--r--libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/array/array.zero/assert.front.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/array/array.zero/assert.subscript.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/vector/assert.back.empty.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/vector/assert.cback.empty.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/vector/assert.cfront.empty.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/vector/assert.cindex.oob.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/vector/assert.front.empty.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/vector/assert.index.oob.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/extents/assert.conversion.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/extents/assert.obs.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.conversion.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_stride.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.conversion.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_stride.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.conversion.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_array.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_span.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.conversion.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_size.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp2
-rw-r--r--libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp2
-rw-r--r--libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/assert.deallocate.pass.cpp2
-rw-r--r--libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp2
-rw-r--r--libcxx/test/libcxx/iterators/assert.advance.pass.cpp2
-rw-r--r--libcxx/test/libcxx/iterators/assert.next.pass.cpp2
-rw-r--r--libcxx/test/libcxx/iterators/assert.prev.pass.cpp2
-rw-r--r--libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp2
-rw-r--r--libcxx/test/libcxx/odr_signature.hardening.sh.cpp25
-rw-r--r--libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp2
-rw-r--r--libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp2
-rw-r--r--libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp2
-rw-r--r--libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp2
-rw-r--r--libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.access/assert.back.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.access/assert.cback.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.access/assert.cfront.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.access/assert.cindex.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.access/assert.front.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.access/assert.index.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.erase_iter.null.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.pop_back.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.barrier/assert.arrive.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.latch/assert.count_down.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.semaphore/assert.ctor.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp2
-rw-r--r--libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp2
-rw-r--r--libcxx/test/libcxx/utilities/expected/expected.expected/assert.arrow.pass.cpp2
-rw-r--r--libcxx/test/libcxx/utilities/expected/expected.expected/assert.deref.pass.cpp2
-rw-r--r--libcxx/test/libcxx/utilities/expected/expected.expected/assert.error.pass.cpp2
-rw-r--r--libcxx/test/libcxx/utilities/expected/expected.void/assert.deref.pass.cpp2
-rw-r--r--libcxx/test/libcxx/utilities/expected/expected.void/assert.error.pass.cpp2
-rw-r--r--libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.dereference.pass.cpp2
-rw-r--r--libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.op_arrow.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.clamp/assert.ranges_clamp.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.ranges_pop_heap.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/ranges_sort_heap.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp2
-rw-r--r--libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp2
-rw-r--r--libcxx/test/support/container_debug_tests.h2
-rw-r--r--libcxx/test/support/test.support/test_check_assertion.pass.cpp2
-rw-r--r--libcxx/utils/ci/buildkite-pipeline.yml16
-rwxr-xr-xlibcxx/utils/ci/run-buildbot18
-rw-r--r--libcxx/utils/data/ignore_format.txt8
-rw-r--r--libcxx/utils/libcxx/test/params.py11
149 files changed, 363 insertions, 524 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index de7fa8e3be31..6716f31a6c63 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -59,8 +59,8 @@ option(LIBCXX_ENABLE_FILESYSTEM
available on the platform. This includes things like most parts of <filesystem> and
others like <fstream>" ON)
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
-set(LIBCXX_SUPPORTED_HARDENING_MODES unchecked hardened safe debug)
-set(LIBCXX_HARDENING_MODE "unchecked" CACHE STRING
+set(LIBCXX_SUPPORTED_HARDENING_MODES none fast extensive debug)
+set(LIBCXX_HARDENING_MODE "none" CACHE STRING
"Specify the default hardening mode to use. This mode will be used inside the
compiled library and will be the default when compiling user code. Note that
users can override this setting in their own code. This does not affect the
@@ -751,24 +751,16 @@ config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_N
# TODO(LLVM 19): Produce a deprecation warning.
if (LIBCXX_ENABLE_ASSERTIONS)
- set(LIBCXX_HARDENING_MODE "safe")
-endif()
-if (LIBCXX_HARDENING_MODE STREQUAL "hardened")
- config_define(1 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT)
- config_define(0 _LIBCPP_ENABLE_SAFE_MODE_DEFAULT)
- config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT)
-elseif (LIBCXX_HARDENING_MODE STREQUAL "safe")
- config_define(0 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT)
- config_define(1 _LIBCPP_ENABLE_SAFE_MODE_DEFAULT)
- config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT)
+ set(LIBCXX_HARDENING_MODE "extensive")
+endif()
+if (LIBCXX_HARDENING_MODE STREQUAL "none")
+ config_define(2 _LIBCPP_HARDENING_MODE_DEFAULT)
+elseif (LIBCXX_HARDENING_MODE STREQUAL "fast")
+ config_define(4 _LIBCPP_HARDENING_MODE_DEFAULT)
+elseif (LIBCXX_HARDENING_MODE STREQUAL "extensive")
+ config_define(16 _LIBCPP_HARDENING_MODE_DEFAULT)
elseif (LIBCXX_HARDENING_MODE STREQUAL "debug")
- config_define(0 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT)
- config_define(0 _LIBCPP_ENABLE_SAFE_MODE_DEFAULT)
- config_define(1 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT)
-elseif (LIBCXX_HARDENING_MODE STREQUAL "unchecked")
- config_define(0 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT)
- config_define(0 _LIBCPP_ENABLE_SAFE_MODE_DEFAULT)
- config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT)
+ config_define(8 _LIBCPP_HARDENING_MODE_DEFAULT)
endif()
if (LIBCXX_PSTL_CPU_BACKEND STREQUAL "serial")
diff --git a/libcxx/cmake/caches/Generic-hardened-mode.cmake b/libcxx/cmake/caches/Generic-hardened-mode.cmake
deleted file mode 100644
index 66c18741d198..000000000000
--- a/libcxx/cmake/caches/Generic-hardened-mode.cmake
+++ /dev/null
@@ -1 +0,0 @@
-set(LIBCXX_HARDENING_MODE "hardened" CACHE STRING "")
diff --git a/libcxx/cmake/caches/Generic-debug-mode.cmake b/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake
index 1d401ba69ab8..1d401ba69ab8 100644
--- a/libcxx/cmake/caches/Generic-debug-mode.cmake
+++ b/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake
diff --git a/libcxx/cmake/caches/Generic-safe-mode.cmake b/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake
index 32bef601caae..0487377d4e9b 100644
--- a/libcxx/cmake/caches/Generic-safe-mode.cmake
+++ b/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake
@@ -1,2 +1,2 @@
set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
-set(LIBCXX_HARDENING_MODE "safe" CACHE STRING "")
+set(LIBCXX_HARDENING_MODE "extensive" CACHE STRING "")
diff --git a/libcxx/cmake/caches/Generic-hardened-mode-with-abi-breaks.cmake b/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake
index de5d3820fba4..4860b590dcde 100644
--- a/libcxx/cmake/caches/Generic-hardened-mode-with-abi-breaks.cmake
+++ b/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake
@@ -1,2 +1,2 @@
-set(LIBCXX_HARDENING_MODE "hardened" CACHE STRING "")
+set(LIBCXX_HARDENING_MODE "fast" CACHE STRING "")
set(LIBCXX_ABI_DEFINES "_LIBCPP_ABI_BOUNDED_ITERATORS" CACHE STRING "")
diff --git a/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake b/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake
new file mode 100644
index 000000000000..cad5a1c4837f
--- /dev/null
+++ b/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake
@@ -0,0 +1 @@
+set(LIBCXX_HARDENING_MODE "fast" CACHE STRING "")
diff --git a/libcxx/docs/Hardening.rst b/libcxx/docs/Hardening.rst
index ec115d3d6012..7692f2a2c788 100644
--- a/libcxx/docs/Hardening.rst
+++ b/libcxx/docs/Hardening.rst
@@ -10,52 +10,63 @@ Hardening Modes
Using hardening modes
=====================
-The hardened mode enables a set of security-critical assertions that prevent
-undefined behavior caused by violating preconditions of the standard library.
-These assertions can be done with relatively little overhead in constant time
-and are intended to be used in production.
-
-In addition to the hardened mode, libc++ also provides two other hardening
-modes:
-- safe mode;
+libc++ provides several hardening modes, where each mode enables a set of
+assertions that prevent undefined behavior caused by violating preconditions of
+the standard library. Different hardening modes make different trade-offs
+between the amount of checking and runtime performance. The available hardening
+modes are:
+- fast mode;
+- extensive mode;
- debug mode.
-The safe mode contains all the checks from the hardened mode and additionally
+The fast mode contains a set of security-critical checks that can be done with
+relatively little overhead in constant time and are intended to be used in
+production. We recommend most projects to adopt the fast mode.
+
+The extensive mode contains all the checks from the fast mode and additionally
some checks for undefined behavior that incur relatively little overhead but
aren't security-critical. While the performance penalty is somewhat more
-significant compared to the hardened mode, the safe mode is still intended to be
-usable in production.
+significant compared to the fast mode, the extensive mode is still intended to
+be usable in production.
-The debug mode, in turn, contains all the checks from the safe mode and
-additionally more expensive checks that may affect the complexity of algorithms.
-The debug mode is intended to be used for testing, not in production.
+The debug mode enables all the available checks in the library, including
+internal assertions, some of which might be very expensive. This mode is
+intended to be used for testing, not in production.
Vendors can set the default hardening mode by using the
-``LIBCXX_HARDENING_MODE`` variable at CMake configuration time. Setting
-``LIBCXX_HARDENING_MODE`` to ``hardened`` enables the hardened mode, and
-similarly setting the variable to ``safe`` enables the safe mode, and to
-``debug`` enables the debug mode. The default value is ``unchecked`` which
-doesn't enable any hardening.
+``LIBCXX_HARDENING_MODE`` variable at CMake configuration time with the possible
+values of ``none``, ``fast``, ``extensive`` and ``debug``. The default value is
+``none`` which doesn't enable any hardening checks (this mode is sometimes
+called the ``unchecked`` mode).
When hardening is enabled, the compiled library is built with the corresponding
mode enabled, **and** user code will be built with the same mode enabled by
-default. If the mode is set to "unchecked" at the CMake configuration time, the
+default. If the mode is set to "none" at the CMake configuration time, the
compiled library will not contain any assertions and the default when building
user code will be to have assertions disabled. As a user, you can consult your
vendor to know which level of hardening is enabled by default.
Furthermore, independently of any vendor-selected default, users can always
-control which level of hardening is enabled in their code by defining
-``_LIBCPP_ENABLE_HARDENED_MODE=0|1`` (or ``_LIBCPP_ENABLE_SAFE_MODE=0|1``, or
-``_LIBCPP_ENABLE_DEBUG_MODE=0|1``) before including any libc++ header (we
-recommend passing ``-D_LIBCPP_ENABLE_HARDENED_MODE=X``, etc. to the compiler).
-Note that if the compiled library was built by the vendor in the unchecked mode,
-functions compiled inside the static or shared library won't have any hardening
-enabled even if the user compiles with hardening enabled (the same is true for
-the inverse case where the static or shared library was compiled **with**
-hardening enabled but the user tries to disable it). However, most of the code
-in libc++ is in the headers, so the user-selected value for
-``_LIBCPP_ENABLE_HARDENED|SAFE|DEBUG_MODE``, if any, will usually be respected.
+control which level of hardening is enabled in their code by defining the macro
+``_LIBCPP_HARDENING_MODE`` before including any libc++ headers (preferably by
+passing ``-D_LIBCPP_HARDENING_MODE=X`` to the compiler). The macro can be
+set to one of the following possible values:
+
+- ``_LIBCPP_HARDENING_MODE_NONE``;
+- ``_LIBCPP_HARDENING_MODE_FAST``;
+- ``_LIBCPP_HARDENING_MODE_EXTENSIVE``;
+- ``_LIBCPP_HARDENING_MODE_DEBUG``.
+
+The exact numeric values of these macros are unspecified and users should not
+rely on them (e.g. expect the values to be sorted in any way).
+
+Note that if the compiled library was built by the vendor with the hardening
+mode set to "none", functions compiled inside the static or shared library won't
+have any hardening enabled even if the user compiles with hardening enabled (the
+same is true for the inverse case where the static or shared library was
+compiled **with** hardening enabled but the user tries to disable it). However,
+most of the code in libc++ is in the headers, so the user-selected value for
+``_LIBCPP_HARDENING_MODE``, if any, will usually be respected.
Enabling hardening has no impact on the ABI.
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index cf70d45e9788..27a1758fcc79 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -56,19 +56,14 @@ Improvements and New Features
- ``std::ranges::count`` is now optimized for ``vector<bool>::iterator``, which
can lead up to 350x performance improvements.
-- The library now provides a hardened mode under which common cases of library undefined behavior will be turned into
- a reliable program termination. Vendors can configure whether the hardened mode is enabled by default with the
- ``LIBCXX_HARDENING_MODE`` variable at CMake configuration time. Users can control whether the hardened mode is
- enabled on a per translation unit basis using the ``-D_LIBCPP_ENABLE_HARDENED_MODE=1`` macro. See
- :ref:`the hardening documentation <using-hardening-modes>` for more details.
-
-- The library now provides a debug mode which is a superset of the safe mode, additionally enabling more expensive
- checks that are not suitable to be used in production. This replaces the legacy debug mode that was removed in this
- release. Unlike the legacy debug mode, this doesn't affect the ABI and doesn't require locking. Vendors can configure
- whether the debug mode is enabled by default with the ``LIBCXX_HARDENING_MODE`` variable at CMake configuration time.
- Users can control whether the debug mode is enabled on a per translation unit basis using the
- ``-D_LIBCPP_ENABLE_DEBUG_MODE=1`` macro. See :ref:`the hardening documentation <using-hardening-modes>` for more
- details.
+- The library now provides several hardening modes under which common cases of library undefined behavior will be turned
+ into a reliable program termination. The ``fast`` hardening mode enables a set of security-critical checks with
+ minimal runtime overhead; the ``extensive`` hardening mode additionally enables relatively cheap checks that catch
+ common logic errors but aren't necessarily security-critical; and the ``debug`` hardening mode enables all available
+ checks, some of which might be very expensive. Vendors can configure which hardening mode is enabled by default with
+ the ``LIBCXX_HARDENING_MODE`` variable at CMake configuration time. Users can control which hardening mode is enabled
+ on a per translation unit basis using the ``_LIBCPP_HARDENING_MODE`` macro. See :ref:`the hardening documentation
+ <using-hardening-modes>` for more details.
Deprecations and Removals
-------------------------
@@ -88,8 +83,8 @@ LLVM 18
~~~~~~~
- The ``_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED`` macro will not be honored anymore in LLVM 18.
- Please see the updated documentation about the safe libc++ mode and in particular the ``_LIBCPP_VERBOSE_ABORT``
- macro for details.
+ Please see the updated documentation about the hardening modes in libc++ and in particular the
+ ``_LIBCPP_VERBOSE_ABORT`` macro for details.
- The headers ``<experimental/deque>``, ``<experimental/forward_list>``, ``<experimental/list>``,
``<experimental/map>``, ``<experimental/memory_resource>``, ``<experimental/regex>``, ``<experimental/set>``,
@@ -101,10 +96,10 @@ LLVM 19
~~~~~~~
- The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable that was used to enable the safe mode will be deprecated and setting
- it will trigger an error; use the ``LIBCXX_HARDENING_MODE`` variable with the value ``safe`` instead. Similarly, the
- ``_LIBCPP_ENABLE_ASSERTIONS`` macro will be deprecated (setting it to ``1`` still enables the safe mode the LLVM 19
- release while also issuing a deprecation warning). See :ref:`the hardening documentation <using-hardening-modes>` for
- more details.
+ it will trigger an error; use the ``LIBCXX_HARDENING_MODE`` variable with the value ``extensive`` instead. Similarly,
+ the ``_LIBCPP_ENABLE_ASSERTIONS`` macro will be deprecated (setting it to ``1`` still enables the extensive mode the
+ LLVM 19 release while also issuing a deprecation warning). See :ref:`the hardening documentation
+ <using-hardening-modes>` for more details.
- The base template for ``std::char_traits`` has been marked as deprecated and will be removed in LLVM 19. If you
are using ``std::char_traits`` with types other than ``char``, ``wchar_t``, ``char8_t``, ``char16_t``, ``char32_t``
diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst
index 52c76f3b1054..24d6a7b95f5b 100644
--- a/libcxx/docs/UsingLibcxx.rst
+++ b/libcxx/docs/UsingLibcxx.rst
@@ -223,14 +223,8 @@ safety annotations.
``std::mutex`` and ``std::lock_guard``. By default, these annotations are
disabled and must be manually enabled by the user.
-**_LIBCPP_ENABLE_HARDENED_MODE**:
- This macro is used to enable the :ref:`hardened mode <using-hardening-modes>`.
-
-**_LIBCPP_ENABLE_SAFE_MODE**:
- This macro is used to enable the :ref:`safe mode <using-hardening-modes>`.
-
-**_LIBCPP_ENABLE_DEBUG_MODE**:
- This macro is used to enable the :ref:`debug mode <using-hardening-modes>`.
+**_LIBCPP_HARDENING_MODE**:
+ This macro is used to choose the :ref:`hardening mode <using-hardening-modes>`.
**_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS**:
This macro is used to disable all visibility annotations inside libc++.
diff --git a/libcxx/include/__algorithm/comp_ref_type.h b/libcxx/include/__algorithm/comp_ref_type.h
index d16bd0f53100..2aeb55f550b5 100644
--- a/libcxx/include/__algorithm/comp_ref_type.h
+++ b/libcxx/include/__algorithm/comp_ref_type.h
@@ -65,7 +65,7 @@ struct __debug_less
// Pass the comparator by lvalue reference. Or in debug mode, using a
// debugging wrapper that stores a reference.
-#if _LIBCPP_ENABLE_DEBUG_MODE
+# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
template <class _Comp>
using __comp_ref_type = __debug_less<_Comp>;
#else
diff --git a/libcxx/include/__algorithm/three_way_comp_ref_type.h b/libcxx/include/__algorithm/three_way_comp_ref_type.h
index 7731c0fd791d..8fd15c5d66f2 100644
--- a/libcxx/include/__algorithm/three_way_comp_ref_type.h
+++ b/libcxx/include/__algorithm/three_way_comp_ref_type.h
@@ -58,7 +58,7 @@ struct __debug_three_way_comp {
// Pass the comparator by lvalue reference. Or in debug mode, using a
// debugging wrapper that stores a reference.
-# if _LIBCPP_ENABLE_DEBUG_MODE
+# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
template <class _Comp>
using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>;
# else
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 28802be542e4..51eb484297f6 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -217,33 +217,37 @@
// TODO(hardening): deprecate this in LLVM 19.
// This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes)
-// equivalent to setting the safe mode.
+// equivalent to setting the extensive mode.
# ifdef _LIBCPP_ENABLE_ASSERTIONS
# if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1
# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1"
# endif
# if _LIBCPP_ENABLE_ASSERTIONS
-# define _LIBCPP_ENABLE_SAFE_MODE 1
+# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_EXTENSIVE
# endif
# endif
-// Enables the hardened mode which consists of all checks intended to be used in production. Hardened mode prioritizes
-// security-critical checks that can be done with relatively little overhead in constant time. Mutually exclusive with
-// `_LIBCPP_ENABLE_SAFE_MODE` and `_LIBCPP_ENABLE_DEBUG_MODE`.
+// The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values:
//
-// #define _LIBCPP_ENABLE_HARDENED_MODE 1
-
-// Enables the safe mode which extends the hardened mode with checks that are relatively cheap and prevent common types
-// of errors but are not security-critical. Mutually exclusive with `_LIBCPP_ENABLE_HARDENED_MODE` and
-// `_LIBCPP_ENABLE_DEBUG_MODE`.
+// - `_LIBCPP_HARDENING_MODE_NONE`;
+// - `_LIBCPP_HARDENING_MODE_FAST`;
+// - `_LIBCPP_HARDENING_MODE_EXTENSIVE`;
+// - `_LIBCPP_HARDENING_MODE_DEBUG`.
//
-// #define _LIBCPP_ENABLE_SAFE_MODE 1
-
-// Enables the debug mode which contains all the checks from the hardened mode and additionally more expensive checks
-// that may affect the complexity of algorithms. The debug mode is intended to be used for testing, not in production.
-// Mutually exclusive with `_LIBCPP_ENABLE_HARDENED_MODE` and `_LIBCPP_ENABLE_SAFE_MODE`.
+// These values have the following effects:
+//
+// - `_LIBCPP_HARDENING_MODE_NONE` -- sets the hardening mode to "none" which disables all runtime hardening checks;
+//
+// - `_LIBCPP_HARDENING_MODE_FAST` -- sets that hardening mode to "fast". The fast mode enables security-critical checks
+// that can be done with relatively little runtime overhead in constant time;
//
-// #define _LIBCPP_ENABLE_DEBUG_MODE 1
+// - `_LIBCPP_HARDENING_MODE_EXTENSIVE` -- sets the hardening mode to "extensive". The extensive mode is a superset of
+// the fast mode that additionally enables checks that are relatively cheap and prevent common types of logic errors
+// but are not necessarily security-critical;
+//
+// - `_LIBCPP_HARDENING_MODE_DEBUG` -- sets the hardening mode to "debug". The debug mode is a superset of the extensive
+// mode and enables all checks available in the library, including internal assertions. Checks that are part of the
+// debug mode can be very expensive and thus the debug mode is intended to be used for testing, not in production.
// Inside the library, assertions are categorized so they can be cherry-picked based on the chosen hardening mode. These
// macros are only for internal use -- users should only pick one of the high-level hardening modes described above.
@@ -274,38 +278,32 @@
//
// - `_LIBCPP_ASSERT_UNCATEGORIZED` -- for assertions that haven't been properly classified yet.
-# ifndef _LIBCPP_ENABLE_HARDENED_MODE
-# define _LIBCPP_ENABLE_HARDENED_MODE _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT
-# endif
-# if _LIBCPP_ENABLE_HARDENED_MODE != 0 && _LIBCPP_ENABLE_HARDENED_MODE != 1
-# error "_LIBCPP_ENABLE_HARDENED_MODE must be set to 0 or 1."
-# endif
-
-# ifndef _LIBCPP_ENABLE_SAFE_MODE
-# define _LIBCPP_ENABLE_SAFE_MODE _LIBCPP_ENABLE_SAFE_MODE_DEFAULT
-# endif
-# if _LIBCPP_ENABLE_SAFE_MODE != 0 && _LIBCPP_ENABLE_SAFE_MODE != 1
-# error "_LIBCPP_ENABLE_SAFE_MODE must be set to 0 or 1."
-# endif
+// clang-format off
+# define _LIBCPP_HARDENING_MODE_NONE (1 << 1)
+# define _LIBCPP_HARDENING_MODE_FAST (1 << 2)
+# define _LIBCPP_HARDENING_MODE_EXTENSIVE (1 << 4) // Deliberately not ordered.
+# define _LIBCPP_HARDENING_MODE_DEBUG (1 << 3)
+// clang-format on
-# ifndef _LIBCPP_ENABLE_DEBUG_MODE
-# define _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT
-# endif
-# if _LIBCPP_ENABLE_DEBUG_MODE != 0 && _LIBCPP_ENABLE_DEBUG_MODE != 1
-# error "_LIBCPP_ENABLE_DEBUG_MODE must be set to 0 or 1."
+# ifndef _LIBCPP_HARDENING_MODE
+# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEFAULT
# endif
-# if (_LIBCPP_ENABLE_HARDENED_MODE && _LIBCPP_ENABLE_SAFE_MODE) || \
- (_LIBCPP_ENABLE_HARDENED_MODE && _LIBCPP_ENABLE_DEBUG_MODE) || \
- (_LIBCPP_ENABLE_SAFE_MODE && _LIBCPP_ENABLE_DEBUG_MODE)
-# error \
- "Only one of _LIBCPP_ENABLE_HARDENED_MODE, _LIBCPP_ENABLE_SAFE_MODE and _LIBCPP_ENABLE_DEBUG_MODE can be enabled."
+# if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_NONE && \
+ _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_FAST && \
+ _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_EXTENSIVE && \
+ _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
+# error _LIBCPP_HARDENING_MODE must be set to one of the following values: \
+_LIBCPP_HARDENING_MODE_NONE, \
+_LIBCPP_HARDENING_MODE_FAST, \
+_LIBCPP_HARDENING_MODE_EXTENSIVE, \
+_LIBCPP_HARDENING_MODE_DEBUG
# endif
// clang-format off
-// Hardened mode checks.
+// Fast hardening mode checks.
-# if _LIBCPP_ENABLE_HARDENED_MODE
+# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
// Enabled checks.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
@@ -320,9 +318,9 @@
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression)
-// Safe mode checks.
+// Extensive hardening mode checks.
-# elif _LIBCPP_ENABLE_SAFE_MODE
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
// Enabled checks.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
@@ -334,9 +332,9 @@
// Disabled checks.
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
-// Debug mode checks.
+// Debug hardening mode checks.
-# elif _LIBCPP_ENABLE_DEBUG_MODE
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
// All checks enabled.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
@@ -360,7 +358,7 @@
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression)
-# endif // _LIBCPP_ENABLE_HARDENED_MODE
+# endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
// clang-format on
// } HARDENING
@@ -741,14 +739,14 @@ typedef __char32_t char32_t;
# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
# endif
-# if _LIBCPP_ENABLE_HARDENED_MODE
-# define _LIBCPP_HARDENING_SIG h
-# elif _LIBCPP_ENABLE_SAFE_MODE
+# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
+# define _LIBCPP_HARDENING_SIG f
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
# define _LIBCPP_HARDENING_SIG s
-# elif _LIBCPP_ENABLE_DEBUG_MODE
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_HARDENING_SIG d
# else
-# define _LIBCPP_HARDENING_SIG u // for unchecked
+# define _LIBCPP_HARDENING_SIG n // "none"
# endif
# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in
index c85cbcd02c44..6cade6f10d8a 100644
--- a/libcxx/include/__config_site.in
+++ b/libcxx/include/__config_site.in
@@ -36,9 +36,7 @@
#cmakedefine _LIBCPP_PSTL_CPU_BACKEND_LIBDISPATCH
// Hardening.
-#cmakedefine01 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT
-#cmakedefine01 _LIBCPP_ENABLE_SAFE_MODE_DEFAULT
-#cmakedefine01 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT
+#cmakedefine _LIBCPP_HARDENING_MODE_DEFAULT @_LIBCPP_HARDENING_MODE_DEFAULT@
// __USE_MINGW_ANSI_STDIO gets redefined on MinGW
#ifdef __clang__
diff --git a/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp b/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp
index a8032d032a46..81ff96c7295f 100644
--- a/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp
@@ -64,7 +64,7 @@ int main(int, char**)
std::make_heap(v.begin(), v.end());
assert(stats.copied == 0);
assert(stats.moved == 153'486);
-#if !_LIBCPP_ENABLE_DEBUG_MODE
+#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
assert(stats.compared == 188'285);
#endif
diff --git a/libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp b/libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp
index 7bbf2735a90d..b23b4d4530ee 100644
--- a/libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp
@@ -10,7 +10,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <algorithm>
diff --git a/libcxx/test/libcxx/assertions/modes/debug.pass.cpp b/libcxx/test/libcxx/assertions/modes/debug.pass.cpp
index 781fa57c9cf8..ea9770b0b2fb 100644
--- a/libcxx/test/libcxx/assertions/modes/debug.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/debug.pass.cpp
@@ -20,9 +20,7 @@
int main(int, char**) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire");
- }(), "Should fire");
+ TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp
deleted file mode 100644
index 78373b992569..000000000000
--- a/libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test ensures that we can enable the debug mode on a per-TU basis.
-
-// Other hardening modes would additionally trigger the error that they are mutually exclusive.
-// REQUIRES: libcpp-hardening-mode=unchecked
-// `check_assertion.h` is only available starting from C++11 and requires Unix headers.
-// UNSUPPORTED: c++03, !has-unix-headers
-// The ability to set a custom abort message is required to compare the assertion message.
-// XFAIL: availability-verbose_abort-missing
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_DEBUG_MODE=1
-
-#include <cassert>
-#include "check_assertion.h"
-
-int main(int, char**) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire");
- }(), "Should fire");
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/assertions/modes/debug_mode_not_1_or_0.verify.cpp b/libcxx/test/libcxx/assertions/modes/debug_mode_not_1_or_0.verify.cpp
deleted file mode 100644
index b3b249fc0e15..000000000000
--- a/libcxx/test/libcxx/assertions/modes/debug_mode_not_1_or_0.verify.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test verifies that setting the debug mode to a value other than `0` or `1` triggers a compile-time error.
-
-// Other hardening modes would additionally trigger the error that they are mutually exclusive.
-// REQUIRES: libcpp-hardening-mode=unchecked
-// Modules build produces a different error ("Could not build module 'std'").
-// UNSUPPORTED: clang-modules-build
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_DEBUG_MODE=2
-
-#include <cassert>
-
-// expected-error@*:* {{_LIBCPP_ENABLE_DEBUG_MODE must be set to 0 or 1.}}
diff --git a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
index 61cf26bd2ae1..be08159d561b 100644
--- a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
@@ -7,26 +7,25 @@
//===----------------------------------------------------------------------===//
// TODO(hardening): remove in LLVM 20.
-// This test ensures that enabling assertions now enables the safe mode.
+// This test ensures that enabling assertions with the legacy `_LIBCPP_ENABLE_ASSERTIONS` now enables the extensive
+// hardening mode.
-// Other hardening modes would additionally trigger the error that they are mutually exclusive.
-// REQUIRES: libcpp-hardening-mode=unchecked
// `check_assertion.h` is only available starting from C++11 and requires Unix headers.
// UNSUPPORTED: c++03, !has-unix-headers
// The ability to set a custom abort message is required to compare the assertion message.
// XFAIL: availability-verbose_abort-missing
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1
+// Note that GCC doesn't support `-Wno-macro-redefined`.
+// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_ENABLE_ASSERTIONS=1
#include <cassert>
#include "check_assertion.h"
int main(int, char**) {
- static_assert(_LIBCPP_ENABLE_SAFE_MODE == 1, "Safe mode should be implicitly enabled");
+ static_assert(_LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE,
+ "The extensive hardening mode should be implicitly enabled");
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire");
- }(), "Should fire");
+ TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/hardened.pass.cpp b/libcxx/test/libcxx/assertions/modes/extensive.pass.cpp
index 8338f63f01fe..e9e494eae341 100644
--- a/libcxx/test/libcxx/assertions/modes/hardened.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/extensive.pass.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that assertions trigger without the user having to do anything when the hardened mode has been
-// enabled by default.
+// This test ensures that assertions trigger without the user having to do anything when the extensive hardening mode
+// has been enabled by default.
-// REQUIRES: libcpp-hardening-mode=hardened
+// REQUIRES: libcpp-hardening-mode=extensive
// `check_assertion.h` is only available starting from C++11.
// UNSUPPORTED: c++03
// `check_assertion.h` requires Unix headers.
@@ -21,9 +21,7 @@
int main(int, char**) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire");
- }(), "Should fire");
+ TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/safe.pass.cpp b/libcxx/test/libcxx/assertions/modes/fast.pass.cpp
index 7174fd3078d6..33377f03fe87 100644
--- a/libcxx/test/libcxx/assertions/modes/safe.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/fast.pass.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that assertions trigger without the user having to do anything when the safe mode has been
-// enabled by default.
+// This test ensures that assertions trigger without the user having to do anything when the fast hardening mode has
+// been enabled by default.
-// REQUIRES: libcpp-hardening-mode=safe
+// REQUIRES: libcpp-hardening-mode=fast
// `check_assertion.h` is only available starting from C++11.
// UNSUPPORTED: c++03
// `check_assertion.h` requires Unix headers.
@@ -21,9 +21,7 @@
int main(int, char**) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire");
- }(), "Should fire");
+ TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/hardened_and_debug_mutually_exclusive.verify.cpp b/libcxx/test/libcxx/assertions/modes/hardened_and_debug_mutually_exclusive.verify.cpp
deleted file mode 100644
index d7b261068757..000000000000
--- a/libcxx/test/libcxx/assertions/modes/hardened_and_debug_mutually_exclusive.verify.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test verifies that `_LIBCPP_ENABLE_HARDENED_MODE` and `_LIBCPP_ENABLE_DEBUG_MODE` are mutually exclusive.
-
-// REQUIRES: libcpp-hardening-mode=unchecked
-// Modules build produces a different error ("Could not build module 'std'").
-// UNSUPPORTED: clang-modules-build
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_HARDENED_MODE=1 -D_LIBCPP_ENABLE_DEBUG_MODE=1
-
-#include <cassert>
-
-// expected-error@*:* {{Only one of _LIBCPP_ENABLE_HARDENED_MODE, _LIBCPP_ENABLE_SAFE_MODE and _LIBCPP_ENABLE_DEBUG_MODE can be enabled.}}
diff --git a/libcxx/test/libcxx/assertions/modes/hardened_and_safe_mutually_exclusive.verify.cpp b/libcxx/test/libcxx/assertions/modes/hardened_and_safe_mutually_exclusive.verify.cpp
deleted file mode 100644
index 464f9b86de23..000000000000
--- a/libcxx/test/libcxx/assertions/modes/hardened_and_safe_mutually_exclusive.verify.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test verifies that `_LIBCPP_ENABLE_HARDENED_MODE` and `_LIBCPP_ENABLE_SAFE_MODE` are mutually exclusive.
-
-// REQUIRES: libcpp-hardening-mode=unchecked
-// Modules build produces a different error ("Could not build module 'std'").
-// UNSUPPORTED: clang-modules-build
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_HARDENED_MODE=1 -D_LIBCPP_ENABLE_SAFE_MODE=1
-
-#include <cassert>
-
-// expected-error@*:* {{Only one of _LIBCPP_ENABLE_HARDENED_MODE, _LIBCPP_ENABLE_SAFE_MODE and _LIBCPP_ENABLE_DEBUG_MODE can be enabled.}}
diff --git a/libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp
deleted file mode 100644
index 161275977166..000000000000
--- a/libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test ensures that we can disable the hardened mode on a per-TU basis.
-
-// Other hardening modes would still make the assertions fire (disabling the hardened mode doesn't disable e.g. the
-// debug mode).
-// REQUIRES: libcpp-hardening-mode=hardened
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_HARDENED_MODE=0
-
-#include <cassert>
-
-int main(int, char**) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Also should not fire");
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/assertions/modes/hardened_mode_not_1_or_0.verify.cpp b/libcxx/test/libcxx/assertions/modes/hardened_mode_not_1_or_0.verify.cpp
deleted file mode 100644
index f11148d63a95..000000000000
--- a/libcxx/test/libcxx/assertions/modes/hardened_mode_not_1_or_0.verify.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test verifies that setting the hardened mode to a value other than `0` or `1` triggers a compile-time error.
-
-// Other hardening modes would additionally trigger the error that they are mutually exclusive.
-// REQUIRES: libcpp-hardening-mode=unchecked
-// Modules build produces a different error ("Could not build module 'std'").
-// UNSUPPORTED: clang-modules-build
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_HARDENED_MODE=2
-
-#include <cassert>
-
-// expected-error@*:* {{_LIBCPP_ENABLE_HARDENED_MODE must be set to 0 or 1.}}
diff --git a/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
new file mode 100644
index 000000000000..751ff7247445
--- /dev/null
+++ b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// This test verifies that setting the hardening mode to a value that's not part of the predefined constants triggers
+// a compile-time error.
+
+// Modules build produces a different error ("Could not build module 'std'").
+// UNSUPPORTED: clang-modules-build
+// REQUIRES: verify-support
+
+// Note that GCC doesn't support `-Wno-macro-redefined`.
+// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=42
+// Make sure that common cases of misuse produce readable errors. We deliberately disallow setting the hardening mode as
+// if it were a boolean flag.
+// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=0
+// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=1
+// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE
+
+#include <cassert>
+
+// expected-error@*:* {{_LIBCPP_HARDENING_MODE must be set to one of the following values: _LIBCPP_HARDENING_MODE_NONE, _LIBCPP_HARDENING_MODE_FAST, _LIBCPP_HARDENING_MODE_EXTENSIVE, _LIBCPP_HARDENING_MODE_DEBUG}}
diff --git a/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp b/libcxx/test/libcxx/assertions/modes/none.pass.cpp
index 0e0d86983081..4644c5692e70 100644
--- a/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/none.pass.cpp
@@ -9,12 +9,15 @@
// This test checks that if no hardening mode is defined (i.e., in the unchecked mode), by default assertions aren't
// triggered.
-// REQUIRES: libcpp-hardening-mode=unchecked
+// REQUIRES: libcpp-hardening-mode=none
#include <cassert>
bool executed_condition = false;
-bool f() { executed_condition = true; return false; }
+bool f() {
+ executed_condition = true;
+ return false;
+}
int main(int, char**) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
diff --git a/libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
index 4f9b236f920d..665babf59c25 100644
--- a/libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
@@ -6,26 +6,23 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that we can enable the safe mode on a per-TU basis.
+// This test ensures that we can override any hardening mode with the debug mode on a per-TU basis.
-// Other hardening modes would additionally trigger the error that they are mutually exclusive.
-// REQUIRES: libcpp-hardening-mode=unchecked
// `check_assertion.h` is only available starting from C++11.
// UNSUPPORTED: c++03
// `check_assertion.h` requires Unix headers.
// REQUIRES: has-unix-headers
// The ability to set a custom abort message is required to compare the assertion message.
// XFAIL: availability-verbose_abort-missing
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_SAFE_MODE=1
+// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG
#include <cassert>
#include "check_assertion.h"
int main(int, char**) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire");
- }(), "Should fire");
+ _LIBCPP_ASSERT_INTERNAL(true, "Should not fire");
+ TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should fire"); }(),
+ "Debug-mode assertions should fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
new file mode 100644
index 000000000000..e2b0ea720811
--- /dev/null
+++ b/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// This test ensures that we can override any hardening mode with the extensive hardening mode on a per-TU basis.
+
+// `check_assertion.h` is only available starting from C++11.
+// UNSUPPORTED: c++03
+// `check_assertion.h` requires Unix headers.
+// REQUIRES: has-unix-headers
+// The ability to set a custom abort message is required to compare the assertion message.
+// XFAIL: availability-verbose_abort-missing
+// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
+
+#include <cassert>
+#include "check_assertion.h"
+
+int main(int, char**) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(true, "Should not fire");
+ TEST_LIBCPP_ASSERT_FAILURE(
+ [] { _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Extensive-mode assertions should fire"); }(),
+ "Extensive-mode assertions should fire");
+ _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should not fire");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
index e652ee338ca8..b38afed17e56 100644
--- a/libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
@@ -6,26 +6,24 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that we can enable the hardened mode on a per-TU basis.
+// This test ensures that we can override any hardening mode with the fast mode on a per-TU basis.
-// Other hardening modes would additionally trigger the error that they are mutually exclusive.
-// REQUIRES: libcpp-hardening-mode=unchecked
// `check_assertion.h` is only available starting from C++11.
// UNSUPPORTED: c++03
// `check_assertion.h` requires Unix headers.
// REQUIRES: has-unix-headers
// The ability to set a custom abort message is required to compare the assertion message.
// XFAIL: availability-verbose_abort-missing
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_HARDENED_MODE=1
+// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST
#include <cassert>
#include "check_assertion.h"
int main(int, char**) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire");
- }(), "Should fire");
+ TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Fast-mode assertions should fire"); }(),
+ "Fast-mode assertions should fire");
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Extensive-mode assertions should not fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
index fc8158ca0d69..65707a9863d0 100644
--- a/libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
@@ -6,14 +6,16 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that we can disable the debug mode on a per-TU basis.
+// This test ensures that we can override any hardening mode with the unchecked mode on a per-TU basis.
-// Other hardening modes would still make the assertions fire (disabling the debug mode doesn't disable e.g. the
-// hardened mode).
-// REQUIRES: libcpp-hardening-mode=debug
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_DEBUG_MODE=0
+// `check_assertion.h` is only available starting from C++11.
+// UNSUPPORTED: c++03
+// `check_assertion.h` requires Unix headers.
+// REQUIRES: has-unix-headers
+// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE
#include <cassert>
+#include "check_assertion.h"
int main(int, char**) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
diff --git a/libcxx/test/libcxx/assertions/modes/safe_and_debug_mutually_exclusive.verify.cpp b/libcxx/test/libcxx/assertions/modes/safe_and_debug_mutually_exclusive.verify.cpp
deleted file mode 100644
index 5ef9bab0abe6..000000000000
--- a/libcxx/test/libcxx/assertions/modes/safe_and_debug_mutually_exclusive.verify.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test verifies that `_LIBCPP_ENABLE_SAFE_MODE` and `_LIBCPP_ENABLE_DEBUG_MODE` are mutually exclusive.
-
-// REQUIRES: libcpp-hardening-mode=unchecked
-// Modules build produces a different error ("Could not build module 'std'").
-// UNSUPPORTED: clang-modules-build
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_SAFE_MODE=1 -D_LIBCPP_ENABLE_DEBUG_MODE=1
-
-#include <cassert>
-
-// expected-error@*:* {{Only one of _LIBCPP_ENABLE_HARDENED_MODE, _LIBCPP_ENABLE_SAFE_MODE and _LIBCPP_ENABLE_DEBUG_MODE can be enabled.}}
diff --git a/libcxx/test/libcxx/assertions/modes/safe_mode_disabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/safe_mode_disabled_in_tu.pass.cpp
deleted file mode 100644
index 81d155705f19..000000000000
--- a/libcxx/test/libcxx/assertions/modes/safe_mode_disabled_in_tu.pass.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test ensures that we can disable the safe mode on a per-TU basis.
-
-// Other hardening modes would still make the assertions fire (disabling the safe mode doesn't disable e.g. the debug
-// mode).
-// REQUIRES: libcpp-hardening-mode=safe
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_SAFE_MODE=0
-
-#include <cassert>
-
-int main(int, char**) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Also should not fire");
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/assertions/modes/safe_mode_not_1_or_0.verify.cpp b/libcxx/test/libcxx/assertions/modes/safe_mode_not_1_or_0.verify.cpp
deleted file mode 100644
index 578d1123a3e8..000000000000
--- a/libcxx/test/libcxx/assertions/modes/safe_mode_not_1_or_0.verify.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test verifies that setting the safe mode to a value other than `0` or `1` triggers a compile-time error.
-
-// Other hardening modes would additionally trigger the error that they are mutually exclusive.
-// REQUIRES: libcpp-hardening-mode=unchecked
-// Modules build produces a different error ("Could not build module 'std'").
-// UNSUPPORTED: clang-modules-build
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_SAFE_MODE=2
-
-#include <cassert>
-
-// expected-error@*:* {{_LIBCPP_ENABLE_SAFE_MODE must be set to 0 or 1.}}
diff --git a/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp b/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp
index 8c6bd4129860..7bd399fca7e0 100644
--- a/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// test that array<T, 0>::back() triggers an assertion
diff --git a/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.front.pass.cpp b/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.front.pass.cpp
index 603be9389a29..fcfb26ff4272 100644
--- a/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.front.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.front.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// test that array<T, 0>::back() triggers an assertion
diff --git a/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.subscript.pass.cpp b/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.subscript.pass.cpp
index 10337f84468a..e221e361405a 100644
--- a/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.subscript.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.subscript.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// test that array<T, 0>::operator[] triggers an assertion
diff --git a/libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp
index 4dcd3033b94b..e0f102b3cc1f 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <deque>
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp
index 7d0863d0f3a3..a6471f7389b8 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <list>
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp
index d65c133564e8..04e933430a7b 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <list>
diff --git a/libcxx/test/libcxx/containers/sequences/vector/assert.back.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/assert.back.empty.pass.cpp
index 6d0acddeac7a..b68b5dece684 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/assert.back.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/assert.back.empty.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <vector>
diff --git a/libcxx/test/libcxx/containers/sequences/vector/assert.cback.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/assert.cback.empty.pass.cpp
index e74f797eebc3..0c1571f67a53 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/assert.cback.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/assert.cback.empty.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <vector>
diff --git a/libcxx/test/libcxx/containers/sequences/vector/assert.cfront.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/assert.cfront.empty.pass.cpp
index ac8b2a7920bf..6d0f4eacf44c 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/assert.cfront.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/assert.cfront.empty.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <vector>
diff --git a/libcxx/test/libcxx/containers/sequences/vector/assert.cindex.oob.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/assert.cindex.oob.pass.cpp
index 8baafedf081a..47a531fb3cf7 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/assert.cindex.oob.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/assert.cindex.oob.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <vector>
diff --git a/libcxx/test/libcxx/containers/sequences/vector/assert.front.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/assert.front.empty.pass.cpp
index aec3bee2e2df..687f8fa8664a 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/assert.front.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/assert.front.empty.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <vector>
diff --git a/libcxx/test/libcxx/containers/sequences/vector/assert.index.oob.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/assert.index.oob.pass.cpp
index 1a5542df1131..1f3cae3479a1 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/assert.index.oob.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/assert.index.oob.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <vector>
diff --git a/libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp
index 0138534d6567..4ed3fab6d22b 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <vector>
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp
index 72114e6e4623..51718c013ba5 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_map>
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp
index b8191f8df089..de6aa442c6b3 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp
@@ -16,7 +16,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_map>
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp
index 8d7b2906c7cb..7b6a83559f9e 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp
@@ -17,7 +17,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_map>
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp
index 728c9fb2415f..2b2859c1e194 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp
@@ -16,7 +16,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_map>
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp
index c07e6e3af8d1..6100ef37a33b 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp
@@ -16,7 +16,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_map>
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp
index fa126bfcd775..8c80821b823d 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp
@@ -17,7 +17,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_map>
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp
index 5f29e6b2b954..40c68fd6c0c0 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp
@@ -16,7 +16,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_set>
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp
index 21606acbe253..8599b53ae30c 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp
@@ -16,7 +16,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_set>
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp
index 053f9f96b457..0dedebed4acf 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp
@@ -17,7 +17,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_set>
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp
index 69cbaf94359c..d5a3cd9a5c1b 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp
@@ -16,7 +16,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_set>
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp
index e88033c0f482..f8f5feea48aa 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp
@@ -16,7 +16,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_set>
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp
index 0d79d0f9bb0a..002e5f396214 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp
@@ -17,7 +17,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_set>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.conversion.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.conversion.pass.cpp
index 41781f4e407d..e8cde6bf8856 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.conversion.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.conversion.pass.cpp
@@ -6,7 +6,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp
index 85d4ec2e34b4..886375e54ca3 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp
@@ -6,7 +6,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp
index cdd5d76954f2..e03bb28ba1cf 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp
@@ -6,7 +6,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp
index 5583c241823b..d2e1910b1946 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp
@@ -6,7 +6,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// Test construction from span:
diff --git a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.obs.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.obs.pass.cpp
index a987f77f629c..44e6d48e9e17 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.obs.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.obs.pass.cpp
@@ -6,7 +6,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.conversion.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.conversion.pass.cpp
index b9f889ac6db4..44e11d625897 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.conversion.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.conversion.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp
index 955d98a4f393..a225a323d125 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp
index 9c6486d76852..d11cf9c2362d 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_stride.pass.cpp
index 25ffa46a90ef..60c08a86d200 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_stride.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_stride.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// ADDITIONAL_COMPILE_FLAGS: -Wno-ctad-maybe-unsupported
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp
index 2f3ac2b9de16..6718c231877b 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp
index 8d67ae32b28e..e06ec0c4fc42 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.conversion.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.conversion.pass.cpp
index 451c0a925d1a..2d877a50781b 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.conversion.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.conversion.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp
index f85968e4fa13..83fb320edf2c 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp
index 134562a38d8d..29903595a2a7 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_stride.pass.cpp
index b8b78fceebbd..a14459823ff6 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_stride.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_stride.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// ADDITIONAL_COMPILE_FLAGS: -Wno-ctad-maybe-unsupported
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp
index c6e67efa03fd..fa7eb4a54758 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp
index bab3fb468883..95179cdc31ac 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.conversion.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.conversion.pass.cpp
index e8bad8b0d512..24b5ff903c10 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.conversion.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.conversion.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_array.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_array.pass.cpp
index 6eea40c239f0..c7a7febd0904 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_array.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_array.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_span.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_span.pass.cpp
index cd06bbb545dd..c6cd8d9f980a 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_span.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_span.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp
index 8a42861a0be0..b88ceb7240c2 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.conversion.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.conversion.pass.cpp
index 8caaf2295c0a..22bceb8e177e 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.conversion.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.conversion.pass.cpp
@@ -6,7 +6,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp
index bd12344ab4c5..174bddb56d53 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp
index 9b5b872bb359..3ff5a5f4d690 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp
@@ -6,7 +6,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <mdspan>
diff --git a/libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp
index 2449a5f25039..360e7a981a0d 100644
--- a/libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp
@@ -10,7 +10,7 @@
// Make sure that std::span's iterators check for OOB accesses when the debug mode is enabled.
// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
#include <span>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp
index 94cc7d002b8d..c268ae51e79a 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp
@@ -19,7 +19,7 @@
// Check that we ensure that `[it, sent)` is a valid range.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <array>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_size.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_size.pass.cpp
index cf9a88c20c90..3c800e9f2fdf 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_size.pass.cpp
@@ -16,7 +16,7 @@
// dynamic_extent version.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <array>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp
index 74d362f7783f..f1b7d2183625 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp
@@ -14,7 +14,7 @@
// Check that we ensure `other.size() == Extent`.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <array>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp
index cd40afad7f21..18ed7ce213b9 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp
@@ -14,7 +14,7 @@
// Check that we ensure `size(r) == Extent`.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <span>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp
index 4fbc8ef50fb4..d15b02414977 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp
@@ -14,7 +14,7 @@
// Make sure that accessing a span out-of-bounds triggers an assertion.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <array>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp
index 5331103ca767..588123af6499 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp
@@ -14,7 +14,7 @@
// Make sure that accessing a span out-of-bounds triggers an assertion.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <array>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp
index af00fb9b6969..8a74739c79dd 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp
@@ -14,7 +14,7 @@
// Make sure that accessing a span out-of-bounds triggers an assertion.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <array>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp
index c9c72fbc8b0d..01d5658291f1 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp
@@ -14,7 +14,7 @@
// Make sure that creating a sub-span with an incorrect number of elements triggers an assertion.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <array>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp
index 69312bab8911..4e6587443c6a 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp
@@ -14,7 +14,7 @@
// Make sure that creating a sub-span with an incorrect number of elements triggers an assertion.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <array>
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp
index 6b3a59c7142e..52e4fe9ecc5c 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp
@@ -22,7 +22,7 @@
// Make sure that creating a sub-span with an incorrect number of elements triggers an assertion.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <array>
diff --git a/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/assert.deallocate.pass.cpp b/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/assert.deallocate.pass.cpp
index e12e0fc7280d..135f5e5f297f 100644
--- a/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/assert.deallocate.pass.cpp
+++ b/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/assert.deallocate.pass.cpp
@@ -14,7 +14,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
diff --git a/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp b/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp
index 99b1ad6e6957..caee61e6a9b0 100644
--- a/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp
+++ b/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp
@@ -14,7 +14,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
diff --git a/libcxx/test/libcxx/iterators/assert.advance.pass.cpp b/libcxx/test/libcxx/iterators/assert.advance.pass.cpp
index 4fe78cc3ff11..b7e6962b443e 100644
--- a/libcxx/test/libcxx/iterators/assert.advance.pass.cpp
+++ b/libcxx/test/libcxx/iterators/assert.advance.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <list>
diff --git a/libcxx/test/libcxx/iterators/assert.next.pass.cpp b/libcxx/test/libcxx/iterators/assert.next.pass.cpp
index 2bf2e5702b6d..da4f4ea3150c 100644
--- a/libcxx/test/libcxx/iterators/assert.next.pass.cpp
+++ b/libcxx/test/libcxx/iterators/assert.next.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <list>
diff --git a/libcxx/test/libcxx/iterators/assert.prev.pass.cpp b/libcxx/test/libcxx/iterators/assert.prev.pass.cpp
index a8600e51eb81..6a71cad9ef04 100644
--- a/libcxx/test/libcxx/iterators/assert.prev.pass.cpp
+++ b/libcxx/test/libcxx/iterators/assert.prev.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <list>
diff --git a/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp b/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp
index 3bded601f77a..095e8a8fef6e 100644
--- a/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp
+++ b/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp
@@ -13,7 +13,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <iterator>
diff --git a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
index 3ae95c8910a9..0dc280bf2818 100644
--- a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
+++ b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
@@ -6,48 +6,43 @@
//
//===----------------------------------------------------------------------===//
-// TODO: Remove these UNSUPPORTED lines once we change how hardening is enabled to avoid
-// mutually exclusive modes being enabled at the same time.
-// UNSUPPORTED: libcpp-hardening-mode=hardened
-// UNSUPPORTED: libcpp-hardening-mode=safe
-// UNSUPPORTED: libcpp-hardening-mode=debug
-
// TODO: Investigate
// XFAIL: msvc
// Test that we encode the hardening mode in an ABI tag to avoid ODR violations
// when linking TUs that have different values for it.
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU1 -D_LIBCPP_ENABLE_HARDENED_MODE -o %t.tu1.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -D_LIBCPP_ENABLE_SAFE_MODE -o %t.tu2.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -D_LIBCPP_ENABLE_DEBUG_MODE -o %t.tu3.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -o %t.tu4.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DMAIN -o %t.main.o
+// Note that GCC doesn't support `-Wno-macro-redefined`.
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU1 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -o %t.tu1.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -o %t.tu2.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -o %t.tu3.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -o %t.tu4.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DMAIN -o %t.main.o
// RUN: %{cxx} %t.tu1.o %t.tu2.o %t.tu3.o %t.tu4.o %t.main.o %{flags} %{link_flags} -o %t.exe
// RUN: %{exec} %t.exe
-// hardened mode
+// fast hardening mode
#ifdef TU1
# include <__config>
_LIBCPP_HIDE_FROM_ABI inline int f() { return 1; }
int tu1() { return f(); }
#endif // TU1
-// safe mode
+// extensive hardening mode
#ifdef TU2
# include <__config>
_LIBCPP_HIDE_FROM_ABI inline int f() { return 2; }
int tu2() { return f(); }
#endif // TU2
-// debug mode
+// debug hardening mode
#ifdef TU3
# include <__config>
_LIBCPP_HIDE_FROM_ABI inline int f() { return 3; }
int tu3() { return f(); }
#endif // TU3
-// unchecked mode
+// No hardening
#ifdef TU4
# include <__config>
_LIBCPP_HIDE_FROM_ABI inline int f() { return 4; }
diff --git a/libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp b/libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp
index dcca2dff79e7..a2b11fb54ed9 100644
--- a/libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp
+++ b/libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp
@@ -13,7 +13,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: no-exceptions
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <ranges>
diff --git a/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp b/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp
index a15c5bacadb0..86ee2841f249 100644
--- a/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp
+++ b/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <ranges>
diff --git a/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp b/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp
index e72900bdb4eb..d4a3bbc513c4 100644
--- a/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp
+++ b/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <ranges>
diff --git a/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp b/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp
index 2b2632081246..6d4e541d9890 100644
--- a/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp
+++ b/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// REQUIRES: has-unix-headers
// XFAIL: availability-verbose_abort-missing
diff --git a/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp b/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp
index a648e41c78d7..2e9c74bc3597 100644
--- a/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp
+++ b/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// REQUIRES: has-unix-headers
// XFAIL: availability-verbose_abort-missing
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/assert.back.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/assert.back.pass.cpp
index 9c6d49af7883..42beb28c47b1 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/assert.back.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/assert.back.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <string>
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/assert.cback.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/assert.cback.pass.cpp
index 7a89d06d2474..7a3d3e166163 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/assert.cback.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/assert.cback.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <string>
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/assert.cfront.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/assert.cfront.pass.cpp
index 30dc29a951c7..66432dc099b5 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/assert.cfront.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/assert.cfront.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <string>
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/assert.cindex.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/assert.cindex.pass.cpp
index 2b4072826fd6..41bb48b6f574 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/assert.cindex.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/assert.cindex.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <string>
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/assert.front.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/assert.front.pass.cpp
index e75908ee07c1..1033e17961b2 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/assert.front.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/assert.front.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <string>
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/assert.index.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/assert.index.pass.cpp
index 95701314faf8..776bba32da18 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/assert.index.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/assert.index.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <string>
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.erase_iter.null.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.erase_iter.null.pass.cpp
index 8c6d704a684b..0b4cb9db51c9 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.erase_iter.null.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.erase_iter.null.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <string>
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.pop_back.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.pop_back.pass.cpp
index 1bdf3af36743..2bab67bdc3ed 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.pop_back.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.pop_back.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <string>
diff --git a/libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp b/libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp
index 9eb12cbe07bd..addcae5ec186 100644
--- a/libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp
+++ b/libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// Construct a string_view from an invalid length
diff --git a/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp b/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp
index 37d1f21cf308..b38e0585d031 100644
--- a/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp
+++ b/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// Construct a string_view from a null pointer
diff --git a/libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp b/libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp
index 3dc998a458a1..5064319a0aee 100644
--- a/libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp
+++ b/libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp
@@ -9,7 +9,7 @@
// Make sure that std::string_view's iterators check for OOB accesses when the debug mode is enabled.
// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
#include <string_view>
diff --git a/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception.pass.cpp b/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception.pass.cpp
index 0796e7dd36bf..fe7b3616b5a7 100644
--- a/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception.pass.cpp
+++ b/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, no-threads
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <future>
diff --git a/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp b/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp
index 7e2c14ef64d4..f28db8caba94 100644
--- a/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp
+++ b/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, no-threads
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <future>
diff --git a/libcxx/test/libcxx/thread/thread.barrier/assert.arrive.pass.cpp b/libcxx/test/libcxx/thread/thread.barrier/assert.arrive.pass.cpp
index f9b0891548dd..58bc4b844eb5 100644
--- a/libcxx/test/libcxx/thread/thread.barrier/assert.arrive.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.barrier/assert.arrive.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: no-threads
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
diff --git a/libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp b/libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp
index 25a2e6a099cd..3af43bdbe7b1 100644
--- a/libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: no-threads
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
diff --git a/libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp b/libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp
index 4a9ccadd7c25..442ae0d96263 100644
--- a/libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp
@@ -17,7 +17,7 @@
// Make sure that calling arrive_and_wait with a negative value triggers an assertion.
// REQUIRES: has-unix-headers
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <latch>
diff --git a/libcxx/test/libcxx/thread/thread.latch/assert.count_down.pass.cpp b/libcxx/test/libcxx/thread/thread.latch/assert.count_down.pass.cpp
index 67185b11a406..1547dd6390d6 100644
--- a/libcxx/test/libcxx/thread/thread.latch/assert.count_down.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.latch/assert.count_down.pass.cpp
@@ -18,7 +18,7 @@
// higher than the internal counter triggers an assertion.
// REQUIRES: has-unix-headers
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <latch>
diff --git a/libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp b/libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp
index 5cd1272d44ff..b20911e0c3b9 100644
--- a/libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp
@@ -17,7 +17,7 @@
// Make sure that calling latch with a negative value triggers an assertion
// REQUIRES: has-unix-headers
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <latch>
diff --git a/libcxx/test/libcxx/thread/thread.semaphore/assert.ctor.pass.cpp b/libcxx/test/libcxx/thread/thread.semaphore/assert.ctor.pass.cpp
index 5a3b87814cb3..91b1e3542908 100644
--- a/libcxx/test/libcxx/thread/thread.semaphore/assert.ctor.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.semaphore/assert.ctor.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: no-threads
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
diff --git a/libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp b/libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp
index b4219d339234..09b4de366535 100644
--- a/libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: no-threads
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
diff --git a/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp b/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp
index dc5fb946850a..8c14b84278cb 100644
--- a/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp
+++ b/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// ADDITIONAL_COMPILE_FLAGS: -fno-exceptions
diff --git a/libcxx/test/libcxx/utilities/expected/expected.expected/assert.arrow.pass.cpp b/libcxx/test/libcxx/utilities/expected/expected.expected/assert.arrow.pass.cpp
index 2ee77234687a..27dcdfe95123 100644
--- a/libcxx/test/libcxx/utilities/expected/expected.expected/assert.arrow.pass.cpp
+++ b/libcxx/test/libcxx/utilities/expected/expected.expected/assert.arrow.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// constexpr const T* operator->() const noexcept;
diff --git a/libcxx/test/libcxx/utilities/expected/expected.expected/assert.deref.pass.cpp b/libcxx/test/libcxx/utilities/expected/expected.expected/assert.deref.pass.cpp
index 4fc3f358389b..01078ac27e96 100644
--- a/libcxx/test/libcxx/utilities/expected/expected.expected/assert.deref.pass.cpp
+++ b/libcxx/test/libcxx/utilities/expected/expected.expected/assert.deref.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// constexpr const T& operator*() const & noexcept;
diff --git a/libcxx/test/libcxx/utilities/expected/expected.expected/assert.error.pass.cpp b/libcxx/test/libcxx/utilities/expected/expected.expected/assert.error.pass.cpp
index 7c1f417ea428..ff574b350cc9 100644
--- a/libcxx/test/libcxx/utilities/expected/expected.expected/assert.error.pass.cpp
+++ b/libcxx/test/libcxx/utilities/expected/expected.expected/assert.error.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// constexpr const E& error() const & noexcept;
diff --git a/libcxx/test/libcxx/utilities/expected/expected.void/assert.deref.pass.cpp b/libcxx/test/libcxx/utilities/expected/expected.void/assert.deref.pass.cpp
index 5cc2874a6be8..e5d7ac3eae69 100644
--- a/libcxx/test/libcxx/utilities/expected/expected.void/assert.deref.pass.cpp
+++ b/libcxx/test/libcxx/utilities/expected/expected.void/assert.deref.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// constexpr void operator*() const noexcept;
diff --git a/libcxx/test/libcxx/utilities/expected/expected.void/assert.error.pass.cpp b/libcxx/test/libcxx/utilities/expected/expected.void/assert.error.pass.cpp
index 9f5f07e6475e..7bf4844b29b0 100644
--- a/libcxx/test/libcxx/utilities/expected/expected.void/assert.error.pass.cpp
+++ b/libcxx/test/libcxx/utilities/expected/expected.void/assert.error.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
// constexpr const E& error() const & noexcept;
diff --git a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.dereference.pass.cpp b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.dereference.pass.cpp
index 60c468651115..2ba5f299bc34 100644
--- a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.dereference.pass.cpp
+++ b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.dereference.pass.cpp
@@ -15,7 +15,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <optional>
diff --git a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.op_arrow.pass.cpp b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.op_arrow.pass.cpp
index ebccf6545e10..f93569979d18 100644
--- a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.op_arrow.pass.cpp
+++ b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.op_arrow.pass.cpp
@@ -13,7 +13,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <optional>
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.clamp/assert.ranges_clamp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.clamp/assert.ranges_clamp.pass.cpp
index fdc3d3acc80f..07e56e73b6f3 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.clamp/assert.ranges_clamp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.clamp/assert.ranges_clamp.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <algorithm>
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp
index 9dd749cf4961..539e234750e0 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp
@@ -108,7 +108,7 @@ constexpr bool test() {
return value;
};
assert(std::ranges::clamp(3, 2, 4, std::ranges::less{}, projection_function) == 3);
-#if !(defined(_LIBCPP_ENABLE_SAFE_MODE) || defined(_LIBCPP_ENABLE_DEBUG_MODE))
+#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_EXTENSIVE && _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
assert(counter <= 3);
#endif
}
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp
index bb6ff68a4a85..b6b6babafba1 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <algorithm>
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.ranges_pop_heap.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.ranges_pop_heap.pass.cpp
index eb540d6c6428..ba55c14bf559 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.ranges_pop_heap.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.ranges_pop_heap.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <algorithm>
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp
index 47b4f3bb1932..dbf7b5340695 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp
@@ -68,7 +68,7 @@ int main(int, char**) {
std::sort_heap(first, last);
LIBCPP_ASSERT(stats.copied == 0);
LIBCPP_ASSERT(stats.moved <= 2 * n + n * logn);
-#if !_LIBCPP_ENABLE_DEBUG_MODE
+#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
LIBCPP_ASSERT(stats.compared <= n * logn);
(void)debug_comparisons;
#else
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/ranges_sort_heap.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/ranges_sort_heap.pass.cpp
index 245d163f984c..3076474765af 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/ranges_sort_heap.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/ranges_sort_heap.pass.cpp
@@ -245,7 +245,7 @@ void test_complexity() {
std::ranges::sort_heap(first, last, &MyInt::Comp);
LIBCPP_ASSERT(stats.copied == 0);
LIBCPP_ASSERT(stats.moved <= 2 * n + n * logn);
-#if !_LIBCPP_ENABLE_DEBUG_MODE
+#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
LIBCPP_ASSERT(stats.compared <= n * logn);
(void)debug_comparisons;
#else
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
index c82ad2623ee8..0a35fad40e89 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
@@ -79,7 +79,7 @@ test_one(unsigned N, unsigned M)
assert(ia[0] == static_cast<int>(N)-1);
assert(ia[N-1] == 0);
assert(std::is_sorted(ia, ia+N, std::greater<value_type>()));
-#if !_LIBCPP_ENABLE_DEBUG_MODE
+#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
assert(pred.count() <= (N-1));
#endif
}
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp
index dd413cfbaa2a..d3c2814d642a 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp
@@ -156,7 +156,7 @@ constexpr void test_comparator_invocation_count() {
// The comparator is invoked only `min(left.size(), right.size())` times
test_lexicographical_compare<const int*, const int*>(
std::array{0, 1, 2}, std::array{0, 1, 2, 3}, compare_last_digit_counting, std::strong_ordering::less);
-#if !_LIBCPP_ENABLE_DEBUG_MODE
+#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
assert(compare_invocation_count <= 3);
#else
assert(compare_invocation_count <= 6);
diff --git a/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp b/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp
index 12c45f83c13c..112b687cb17e 100644
--- a/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp
+++ b/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// REQUIRES: libcpp-hardening-mode={{safe|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// Make sure that reaching std::unreachable() with assertions enabled triggers an assertion.
diff --git a/libcxx/test/support/container_debug_tests.h b/libcxx/test/support/container_debug_tests.h
index 07db855e58dc..c35da37a87da 100644
--- a/libcxx/test/support/container_debug_tests.h
+++ b/libcxx/test/support/container_debug_tests.h
@@ -14,7 +14,7 @@
#error This header may only be used for libc++ tests
#endif
-#if !_LIBCPP_ENABLE_DEBUG_MODE
+#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
#error The library must be built with the debug mode enabled in order to use this header
#endif
diff --git a/libcxx/test/support/test.support/test_check_assertion.pass.cpp b/libcxx/test/support/test.support/test_check_assertion.pass.cpp
index 53fd197508c8..7cf0e0966ce8 100644
--- a/libcxx/test/support/test.support/test_check_assertion.pass.cpp
+++ b/libcxx/test/support/test.support/test_check_assertion.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: has-unix-headers
// UNSUPPORTED: c++03
-// UNSUPPORTED: libcpp-hardening-mode=unchecked
+// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: availability-verbose_abort-missing
#include <cassert>
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 41b3d27d48f7..c2537618c56b 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -404,8 +404,8 @@ steps:
limit: 2
timeout_in_minutes: 120
- - label: "Hardened mode"
- command: "libcxx/utils/ci/run-buildbot generic-hardened-mode"
+ - label: "Fast hardening mode"
+ command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-fast"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
@@ -422,8 +422,8 @@ steps:
limit: 2
timeout_in_minutes: 120
- - label: "Hardened mode with ABI breaks"
- command: "libcxx/utils/ci/run-buildbot generic-hardened-mode-with-abi-breaks"
+ - label: "Fast hardening mode with ABI breaks"
+ command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-fast-with-abi-breaks"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
@@ -440,8 +440,8 @@ steps:
limit: 2
timeout_in_minutes: 120
- - label: "Safe mode"
- command: "libcxx/utils/ci/run-buildbot generic-safe-mode"
+ - label: "Extensive hardening mode"
+ command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-extensive"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
@@ -461,8 +461,8 @@ steps:
limit: 2
timeout_in_minutes: 120
- - label: "Debug mode"
- command: "libcxx/utils/ci/run-buildbot generic-debug-mode"
+ - label: "Debug hardening mode"
+ command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-debug"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index c4834330d7e3..fe99388a799b 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -395,27 +395,27 @@ generic-merged)
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
check-runtimes
;;
-generic-hardened-mode)
+generic-hardening-mode-fast)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake"
check-runtimes
check-abi-list
;;
-generic-hardened-mode-with-abi-breaks)
+generic-hardening-mode-fast-with-abi-breaks)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode-with-abi-breaks.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake"
check-runtimes
check-abi-list
;;
-generic-safe-mode)
+generic-hardening-mode-extensive)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-safe-mode.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake"
check-runtimes
check-abi-list
;;
-generic-debug-mode)
+generic-hardening-mode-debug)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-mode.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake"
check-runtimes
check-abi-list
;;
@@ -539,7 +539,7 @@ apple-system-backdeployment-hardened-*)
PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
- PARAMS+=";hardening_mode=hardened"
+ PARAMS+=";hardening_mode=fast"
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
-DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt
index 309bd7c6ca63..123d06d56e29 100644
--- a/libcxx/utils/data/ignore_format.txt
+++ b/libcxx/utils/data/ignore_format.txt
@@ -588,14 +588,6 @@ libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothro
libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp
libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp
libcxx/test/libcxx/assertions/deprecated-link-time-custom-handler.pass.cpp
-libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp
-libcxx/test/libcxx/assertions/modes/debug.pass.cpp
-libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp
-libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp
-libcxx/test/libcxx/assertions/modes/hardened.pass.cpp
-libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp
-libcxx/test/libcxx/assertions/modes/safe.pass.cpp
-libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp
libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp
libcxx/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp
libcxx/test/libcxx/atomics/atomics.order/memory_order.underlying_type.pass.cpp
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index cf190cf40d1c..e31130572df6 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -288,17 +288,18 @@ DEFAULT_PARAMETERS = [
),
Parameter(
name="hardening_mode",
- choices=["unchecked", "hardened", "safe", "debug"],
+ choices=["none", "fast", "extensive", "debug"],
type=str,
- default="unchecked",
+ default="none",
help="Whether to enable one of the hardening modes when compiling the test suite. This is only "
"meaningful when running the tests against libc++.",
actions=lambda hardening_mode: filter(
None,
[
- AddCompileFlag("-D_LIBCPP_ENABLE_HARDENED_MODE=1") if hardening_mode == "hardened" else None,
- AddCompileFlag("-D_LIBCPP_ENABLE_SAFE_MODE=1") if hardening_mode == "safe" else None,
- AddCompileFlag("-D_LIBCPP_ENABLE_DEBUG_MODE=1") if hardening_mode == "debug" else None,
+ AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE") if hardening_mode == "none" else None,
+ AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST") if hardening_mode == "fast" else None,
+ AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE") if hardening_mode == "extensive" else None,
+ AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG") if hardening_mode == "debug" else None,
AddFeature("libcpp-hardening-mode={}".format(hardening_mode)),
],
),