[libcxx] [llvm] [libc++][hardening] Rework macros for enabling the hardening mode. (PR #70575)
Konstantin Varlamov via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 2 16:38:41 PDT 2023
https://github.com/var-const updated https://github.com/llvm/llvm-project/pull/70575
>From f4b7b81e19a19a924b5b69485385ef0bd5431442 Mon Sep 17 00:00:00 2001
From: Konstantin Varlamov <varconsteq at gmail.com>
Date: Fri, 27 Oct 2023 14:16:34 -0700
Subject: [PATCH 1/8] [libc++][hardening] Rework macros for enabling the
hardening mode.
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
---
libcxx/CMakeLists.txt | 28 +++----
libcxx/docs/Hardening.rst | 39 +++++----
libcxx/docs/ReleaseNotes/18.rst | 23 +++--
libcxx/docs/UsingLibcxx.rst | 10 +--
libcxx/include/__algorithm/comp_ref_type.h | 2 +-
.../__algorithm/three_way_comp_ref_type.h | 2 +-
libcxx/include/__config | 83 +++++++++----------
libcxx/include/__config_site.in | 4 +-
.../make.heap/complexity.pass.cpp | 2 +-
.../{safe.pass.cpp => debug_lite.pass.cpp} | 4 +-
.../modes/debug_mode_disabled_in_tu.pass.cpp | 23 -----
.../modes/debug_mode_not_1_or_0.verify.cpp | 19 -----
...ling_assertions_enables_safe_mode.pass.cpp | 9 +-
...ed_and_debug_mutually_exclusive.verify.cpp | 18 ----
...ned_and_safe_mutually_exclusive.verify.cpp | 18 ----
.../hardened_mode_disabled_in_tu.pass.cpp | 23 -----
...hardening_mode_incorrect_value.verify.cpp} | 9 +-
.../override_with_debug_lite_mode.pass.cpp | 30 +++++++
....cpp => override_with_debug_mode.pass.cpp} | 18 ++--
...p => override_with_hardened_mode.pass.cpp} | 11 ++-
... => override_with_unchecked_mode.pass.cpp} | 10 +--
...fe_and_debug_mutually_exclusive.verify.cpp | 18 ----
.../modes/safe_mode_disabled_in_tu.pass.cpp | 23 -----
.../modes/safe_mode_not_1_or_0.verify.cpp | 19 -----
.../libcxx/odr_signature.hardening.sh.cpp | 16 ++--
.../sort.heap/complexity.pass.cpp | 2 +-
.../sort.heap/ranges_sort_heap.pass.cpp | 2 +-
.../alg.merge/inplace_merge_comp.pass.cpp | 2 +-
...ographical_compare_three_way_comp.pass.cpp | 2 +-
libcxx/test/support/container_debug_tests.h | 2 +-
libcxx/utils/ci/buildkite-pipeline.yml | 4 +-
libcxx/utils/libcxx/test/params.py | 9 +-
.../gn/secondary/libcxx/include/BUILD.gn | 4 +-
33 files changed, 170 insertions(+), 318 deletions(-)
rename libcxx/test/libcxx/assertions/modes/{safe.pass.cpp => debug_lite.pass.cpp} (90%)
delete mode 100644 libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp
delete mode 100644 libcxx/test/libcxx/assertions/modes/debug_mode_not_1_or_0.verify.cpp
delete mode 100644 libcxx/test/libcxx/assertions/modes/hardened_and_debug_mutually_exclusive.verify.cpp
delete mode 100644 libcxx/test/libcxx/assertions/modes/hardened_and_safe_mutually_exclusive.verify.cpp
delete mode 100644 libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp
rename libcxx/test/libcxx/assertions/modes/{hardened_mode_not_1_or_0.verify.cpp => hardening_mode_incorrect_value.verify.cpp} (53%)
create mode 100644 libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp
rename libcxx/test/libcxx/assertions/modes/{debug_mode_enabled_in_tu.pass.cpp => override_with_debug_mode.pass.cpp} (52%)
rename libcxx/test/libcxx/assertions/modes/{safe_mode_enabled_in_tu.pass.cpp => override_with_hardened_mode.pass.cpp} (66%)
rename libcxx/test/libcxx/assertions/modes/{hardened_mode_enabled_in_tu.pass.cpp => override_with_unchecked_mode.pass.cpp} (66%)
delete mode 100644 libcxx/test/libcxx/assertions/modes/safe_and_debug_mutually_exclusive.verify.cpp
delete mode 100644 libcxx/test/libcxx/assertions/modes/safe_mode_disabled_in_tu.pass.cpp
delete mode 100644 libcxx/test/libcxx/assertions/modes/safe_mode_not_1_or_0.verify.cpp
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index d03421afde1e755..b9f7ab8466aa806 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -59,7 +59,7 @@ 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_SUPPORTED_HARDENING_MODES unchecked hardened debug_lite debug)
set(LIBCXX_HARDENING_MODE "unchecked" 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
@@ -752,24 +752,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 "debug_lite")
+endif()
+if (LIBCXX_HARDENING_MODE STREQUAL "unchecked")
+ config_define(2 _LIBCPP_HARDENING_MODE_DEFAULT)
+elseif (LIBCXX_HARDENING_MODE STREQUAL "hardened")
+ config_define(4 _LIBCPP_HARDENING_MODE_DEFAULT)
+elseif (LIBCXX_HARDENING_MODE STREQUAL "debug_lite")
+ 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/docs/Hardening.rst b/libcxx/docs/Hardening.rst
index ec115d3d6012bfe..738fd3235d12e22 100644
--- a/libcxx/docs/Hardening.rst
+++ b/libcxx/docs/Hardening.rst
@@ -17,25 +17,25 @@ and are intended to be used in production.
In addition to the hardened mode, libc++ also provides two other hardening
modes:
-- safe mode;
+- debug-lite mode;
- debug mode.
-The safe mode contains all the checks from the hardened 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.
+The debug-lite mode contains all the checks from the hardened 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 debug-lite mode is still
+intended to be usable in production.
-The debug mode, in turn, contains all the checks from the safe mode and
+The debug mode, in turn, contains all the checks from the debug-lite 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.
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.
+similarly setting the variable to ``debug_lite`` enables the debug-lite mode,
+and to ``debug`` enables the debug mode. The default value is ``unchecked``
+which doesn't enable any hardening.
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
@@ -45,17 +45,26 @@ 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).
+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_UNCHECKED``;
+- ``_LIBCPP_HARDENING_MODE_HARDENED``;
+- ``_LIBCPP_HARDENING_MODE_DEBUG_LITE``;
+- ``_LIBCPP_HARDENING_MODE_DEBUG``.
+
+The exact numeric values of these macros are unspecified and you 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 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.
+``_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 41c3f7cc455f185..71dcc75f8d3d910 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -58,16 +58,23 @@ Improvements and New Features
- 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
+ enabled on a per translation unit basis using the ``_LIBCPP_HARDENING_MODE`` 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
+- The library now provides a debug-lite mode which is a superset of the hardened mode, additionally enabling checks that
+ catch common logic errors that aren't necessarily security-critical. This mode is largely a replacement for the safe
+ release. Unlike the legacy debug mode, this doesn't affect the ABI and doesn't require locking. Vendors can configure
+ whether the debug-lite mode is enabled by default with the ``LIBCXX_HARDENING_MODE`` variable at CMake configuration
+ time. ``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 ``_LIBCPP_HARDENING_MODE`` 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 debug-lite 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.
+ Users can control whether the debug 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
-------------------------
@@ -87,7 +94,7 @@ 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``
+ Please see the updated documentation about the hardened libc++ mode and in particular the ``_LIBCPP_VERBOSE_ABORT``
macro for details.
- The headers ``<experimental/deque>``, ``<experimental/forward_list>``, ``<experimental/list>``,
@@ -100,8 +107,8 @@ 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
+ it will trigger an error; use the ``LIBCXX_HARDENING_MODE`` variable with the value ``debug_lite`` instead. Similarly, the
+ ``_LIBCPP_ENABLE_ASSERTIONS`` macro will be deprecated (setting it to ``1`` still enables the debug-lite mode the LLVM 19
release while also issuing a deprecation warning). See :ref:`the hardening documentation <using-hardening-modes>` for
more details.
diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst
index 52c76f3b10548fb..24d6a7b95f5b2e4 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 d16bd0f5310003f..2aeb55f550b53c2 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 7731c0fd791d809..8fd15c5d66f2fc9 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 4bf171f998c6f05..d5aa49f72934640 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -217,33 +217,36 @@
// 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 debug-lite 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_DEBUG_LITE
# endif
# endif
+// The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values:
+// - `_LIBCPP_HARDENING_MODE_UNCHECKED`;
+// - `_LIBCPP_HARDENING_MODE_HARDENED`;
+// - `_LIBCPP_HARDENING_MODE_DEBUG_LITE`;
+// - `_LIBCPP_HARDENING_MODE_DEBUG`.
+
// 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`.
+// security-critical checks that can be done with relatively little overhead in constant time.
//
-// #define _LIBCPP_ENABLE_HARDENED_MODE 1
+// #define _LIBCPP_HARDENING_MODE_HARDENED 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`.
+// Enables the debug-lite mode which extends the hardened mode with checks that are relatively cheap and prevent common
+// types of errors but are not security-critical.
//
-// #define _LIBCPP_ENABLE_SAFE_MODE 1
+// #define _LIBCPP_HARDENING_MODE_DEBUG_LITE 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`.
//
-// #define _LIBCPP_ENABLE_DEBUG_MODE 1
+// #define _LIBCPP_HARDENING_MODE_DEBUG 1
// 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.
@@ -269,38 +272,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_UNCHECKED (1 << 1)
+# define _LIBCPP_HARDENING_MODE_HARDENED (1 << 2)
+# define _LIBCPP_HARDENING_MODE_DEBUG_LITE (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_UNCHECKED && \
+ _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_HARDENED && \
+ _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG_LITE && \
+ _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
+# error _LIBCPP_HARDENING_MODE must be set to one of the following values: \
+_LIBCPP_HARDENING_MODE_UNCHECKED, \
+_LIBCPP_HARDENING_MODE_HARDENED, \
+_LIBCPP_HARDENING_MODE_DEBUG_LITE, \
+_LIBCPP_HARDENING_MODE_DEBUG
# endif
// clang-format off
// Hardened mode checks.
-# if _LIBCPP_ENABLE_HARDENED_MODE
+# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_HARDENED
// Enabled checks.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
@@ -313,9 +310,9 @@
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression)
-// Safe mode checks.
+// Debug-lite mode checks.
-# elif _LIBCPP_ENABLE_SAFE_MODE
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG_LITE
// Enabled checks.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
@@ -328,7 +325,7 @@
// Debug 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)
@@ -350,7 +347,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_HARDENED
// clang-format on
// } HARDENING
@@ -730,11 +727,11 @@ typedef __char32_t char32_t;
# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
# endif
-# if _LIBCPP_ENABLE_HARDENED_MODE
+# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_HARDENED
# define _LIBCPP_HARDENING_SIG h
-# elif _LIBCPP_ENABLE_SAFE_MODE
-# define _LIBCPP_HARDENING_SIG s
-# elif _LIBCPP_ENABLE_DEBUG_MODE
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG_LITE
+# define _LIBCPP_HARDENING_SIG s // "safe"
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_HARDENING_SIG d
# else
# define _LIBCPP_HARDENING_SIG u // for unchecked
diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in
index c85cbcd02c441b9..6cade6f10d8acc1 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 a8032d032a4671b..81ff96c7295fa1e 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/assertions/modes/safe.pass.cpp b/libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp
similarity index 90%
rename from libcxx/test/libcxx/assertions/modes/safe.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp
index 7174fd3078d63b9..ad3f7ca2a150905 100644
--- a/libcxx/test/libcxx/assertions/modes/safe.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/debug_lite.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
+// This test ensures that assertions trigger without the user having to do anything when the debug-lite mode has been
// enabled by default.
-// REQUIRES: libcpp-hardening-mode=safe
+// REQUIRES: libcpp-hardening-mode=debug_lite
// `check_assertion.h` is only available starting from C++11.
// UNSUPPORTED: c++03
// `check_assertion.h` requires Unix headers.
diff --git a/libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp
deleted file mode 100644
index fc8158ca0d696ca..000000000000000
--- a/libcxx/test/libcxx/assertions/modes/debug_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 debug 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
-
-#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/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 b3b249fc0e15cbb..000000000000000
--- 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_safe_mode.pass.cpp
index 61cf26bd2ae142d..9f5458519f9faed 100644
--- a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp
@@ -7,21 +7,20 @@
//===----------------------------------------------------------------------===//
// TODO(hardening): remove in LLVM 20.
-// This test ensures that enabling assertions now enables the safe mode.
+// This test ensures that enabling assertions now enables the debug-lite 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
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -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_DEBUG_LITE,
+ "Debug-lite mode should be implicitly enabled");
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
TEST_LIBCPP_ASSERT_FAILURE([] {
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 d7b2610687578ff..000000000000000
--- 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 464f9b86de236c4..000000000000000
--- 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 161275977166a58..000000000000000
--- 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/hardening_mode_incorrect_value.verify.cpp
similarity index 53%
rename from libcxx/test/libcxx/assertions/modes/hardened_mode_not_1_or_0.verify.cpp
rename to libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.verify.cpp
index f11148d63a95348..c0723e3f13c5b2e 100644
--- a/libcxx/test/libcxx/assertions/modes/hardened_mode_not_1_or_0.verify.cpp
+++ b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.verify.cpp
@@ -6,14 +6,13 @@
//
//===----------------------------------------------------------------------===//
-// This test verifies that setting the hardened mode to a value other than `0` or `1` triggers a compile-time error.
+// This test verifies that setting the hardening mode to a value that's not part of the predefined constants 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
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=42
#include <cassert>
-// expected-error@*:* {{_LIBCPP_ENABLE_HARDENED_MODE must be set to 0 or 1.}}
+// expected-error@*:* {{_LIBCPP_HARDENING_MODE must be set to one of the following values: _LIBCPP_HARDENING_MODE_UNCHECKED, _LIBCPP_HARDENING_MODE_HARDENED, _LIBCPP_HARDENING_MODE_DEBUG_LITE, _LIBCPP_HARDENING_MODE_DEBUG}}
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp
new file mode 100644
index 000000000000000..32f6a90089625bc
--- /dev/null
+++ b/libcxx/test/libcxx/assertions/modes/override_with_debug_lite_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 debug-lite 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: -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG_LITE
+
+#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, "Debug-lite-mode assertions should fire");
+ }(), "Debug-lite-mode assertions should fire");
+ _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should not fire");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
similarity index 52%
rename from libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
index 78373b992569cb4..caf28371f0a5c49 100644
--- a/libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
@@ -6,24 +6,24 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that we can enable the debug 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 and requires Unix headers.
-// UNSUPPORTED: c++03, !has-unix-headers
+// `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_DEBUG_MODE=1
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -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");
+ _LIBCPP_ASSERT_INTERNAL(true, "Should not fire");
TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire");
- }(), "Should fire");
+ _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should fire");
+ }(), "Debug-mode assertions should fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp
similarity index 66%
rename from libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp
index 4f9b236f920db4e..3f38b368aef4bfe 100644
--- a/libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp
@@ -6,17 +6,15 @@
//
//===----------------------------------------------------------------------===//
-// 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 hardened 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: -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_HARDENED
#include <cassert>
#include "check_assertion.h"
@@ -24,8 +22,9 @@
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_VALID_ELEMENT_ACCESS(false, "Hardened-mode assertions should fire");
+ }(), "Hardened-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_unchecked_mode.pass.cpp
similarity index 66%
rename from libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
index e652ee338ca8e96..56df977eff86ecf 100644
--- a/libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
@@ -6,26 +6,22 @@
//
//===----------------------------------------------------------------------===//
-// 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 unchecked 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: -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_UNCHECKED
#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_VALID_ELEMENT_ACCESS(false, "Also should not fire");
return 0;
}
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 5ef9bab0abe66fd..000000000000000
--- 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 81d155705f1924e..000000000000000
--- 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 578d1123a3e80dc..000000000000000
--- 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/odr_signature.hardening.sh.cpp b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
index 3ae95c8910a9296..c01159eb9fbe363 100644
--- a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
+++ b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
@@ -6,23 +6,17 @@
//
//===----------------------------------------------------------------------===//
-// 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
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU1 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_HARDENED -o %t.tu1.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG_LITE -o %t.tu2.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -o %t.tu3.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_UNCHECKED -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
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 47b4f3bb19329f5..dbf7b534069517a 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 5723ed0d3db25e4..2231b07e09eee17 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
@@ -262,7 +262,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 c82ad2623ee8b50..0a35fad40e89a54 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 dd413cfbaa2a92d..d3c2814d642a7d4 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/support/container_debug_tests.h b/libcxx/test/support/container_debug_tests.h
index 07db855e58dc4a9..c35da37a87da6eb 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/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 5a5bc39c5797bdd..a3ef9a2738b04bc 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -422,8 +422,8 @@ steps:
limit: 2
timeout_in_minutes: 120
- - label: "Safe mode"
- command: "libcxx/utils/ci/run-buildbot generic-safe-mode"
+ - label: "Debug-lite mode"
+ command: "libcxx/utils/ci/run-buildbot generic-debug-lite-mode"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 2ead641354e585d..c0532eb9f85765e 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -287,7 +287,7 @@ def getStdFlag(cfg, std):
),
Parameter(
name="hardening_mode",
- choices=["unchecked", "hardened", "safe", "debug"],
+ choices=["unchecked", "hardened", "debug_lite", "debug"],
type=str,
default="unchecked",
help="Whether to enable one of the hardening modes when compiling the test suite. This is only "
@@ -295,9 +295,10 @@ def getStdFlag(cfg, std):
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_HARDENED") if hardening_mode == "hardened" else None,
+ AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG_LITE") if hardening_mode == "debug_lite" else None,
+ AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG") if hardening_mode == "debug" else None,
+ AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_UNCHECKED") if hardening_mode == "unchecked" else None,
AddFeature("libcpp-hardening-mode={}".format(hardening_mode)),
],
),
diff --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index 50969e0f3f2ae17..76de0eb769d1155 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -35,9 +35,7 @@ if (current_toolchain == default_toolchain) {
"_LIBCPP_HAS_NO_WIDE_CHARACTERS=",
"_LIBCPP_HAS_NO_STD_MODULES=",
"_LIBCPP_ABI_DEFINES=",
- "_LIBCPP_ENABLE_DEBUG_MODE_DEFAULT=",
- "_LIBCPP_ENABLE_HARDENED_MODE_DEFAULT=",
- "_LIBCPP_ENABLE_SAFE_MODE_DEFAULT=",
+ "_LIBCPP_HARDENING_MODE_DEFAULT=",
"_LIBCPP_PSTL_CPU_BACKEND_LIBDISPATCH=",
"_LIBCPP_PSTL_CPU_BACKEND_SERIAL=1",
"_LIBCPP_PSTL_CPU_BACKEND_THREAD=",
>From f5d2b7b29b8814ad83462264490b394ee98a65a2 Mon Sep 17 00:00:00 2001
From: Konstantin Varlamov <varconsteq at gmail.com>
Date: Wed, 1 Nov 2023 18:43:43 -0700
Subject: [PATCH 2/8] - Address most feedback; - Switch to the
(none|fast|strict|debug) naming scheme.
---
libcxx/CMakeLists.txt | 12 ++--
...ake => Generic-debug-hardening-mode.cmake} | 0
.../caches/Generic-fast-hardening-mode.cmake | 1 +
.../cmake/caches/Generic-hardened-mode.cmake | 1 -
...ke => Generic-strict-hardening-mode.cmake} | 2 +-
libcxx/docs/Hardening.rst | 67 ++++++++---------
libcxx/docs/ReleaseNotes/18.rst | 36 ++++------
libcxx/include/__config | 72 +++++++++----------
.../alg.sorting/assert.min.max.pass.cpp | 2 +-
.../libcxx/assertions/modes/debug.pass.cpp | 4 +-
...g_assertions_enables_strict_mode.pass.cpp} | 11 ++-
.../{hardened.pass.cpp => fast.pass.cpp} | 10 ++-
.../hardening_mode_incorrect_value.verify.cpp | 2 +-
.../modes/override_with_debug_mode.pass.cpp | 5 +-
...s.cpp => override_with_fast_mode.pass.cpp} | 11 ++-
...cpp => override_with_strict_mode.pass.cpp} | 9 ++-
.../override_with_unchecked_mode.pass.cpp | 2 +-
.../{debug_lite.pass.cpp => strict.pass.cpp} | 10 ++-
.../assertions/modes/unchecked.pass.cpp | 7 +-
.../array/array.zero/assert.back.pass.cpp | 2 +-
.../array/array.zero/assert.front.pass.cpp | 2 +-
.../array.zero/assert.subscript.pass.cpp | 2 +-
.../deque/assert.pop_back.empty.pass.cpp | 2 +-
.../assert.erase_iter.end.pass.cpp | 2 +-
.../assert.pop_back.empty.pass.cpp | 2 +-
.../vector/assert.back.empty.pass.cpp | 2 +-
.../vector/assert.cback.empty.pass.cpp | 2 +-
.../vector/assert.cindex.oob.pass.cpp | 2 +-
.../vector/assert.front.empty.pass.cpp | 2 +-
.../vector/assert.index.oob.pass.cpp | 2 +-
.../vector/assert.pop_back.empty.pass.cpp | 2 +-
.../unord/unord.map/assert.bucket.pass.cpp | 2 +-
.../unord.map/assert.bucket_size.pass.cpp | 2 +-
.../unord.map/assert.max_load_factor.pass.cpp | 2 +-
.../unord.multimap/assert.bucket.pass.cpp | 2 +-
.../assert.bucket_size.pass.cpp | 2 +-
.../assert.max_load_factor.pass.cpp | 2 +-
.../unord.multiset/assert.bucket.pass.cpp | 2 +-
.../assert.bucket_size.pass.cpp | 2 +-
.../assert.max_load_factor.pass.cpp | 2 +-
.../unord/unord.set/assert.bucket.pass.cpp | 2 +-
.../unord.set/assert.bucket_size.pass.cpp | 2 +-
.../unord.set/assert.max_load_factor.pass.cpp | 2 +-
.../mdspan/extents/assert.conversion.pass.cpp | 2 +-
.../extents/assert.ctor_from_array.pass.cpp | 2 +-
.../assert.ctor_from_integral.pass.cpp | 2 +-
.../extents/assert.ctor_from_span.pass.cpp | 2 +-
.../views/mdspan/extents/assert.obs.pass.cpp | 2 +-
.../layout_left/assert.conversion.pass.cpp | 2 +-
.../layout_left/assert.ctor.extents.pass.cpp | 2 +-
.../assert.ctor.layout_right.pass.cpp | 2 +-
.../assert.ctor.layout_stride.pass.cpp | 2 +-
.../assert.index_operator.pass.cpp | 2 +-
.../mdspan/layout_left/assert.stride.pass.cpp | 2 +-
.../layout_right/assert.conversion.pass.cpp | 2 +-
.../layout_right/assert.ctor.extents.pass.cpp | 2 +-
.../assert.ctor.layout_left.pass.cpp | 2 +-
.../assert.ctor.layout_stride.pass.cpp | 2 +-
.../assert.index_operator.pass.cpp | 2 +-
.../layout_right/assert.stride.pass.cpp | 2 +-
.../layout_stride/assert.conversion.pass.cpp | 2 +-
.../assert.ctor.extents_array.pass.cpp | 2 +-
.../assert.ctor.extents_span.pass.cpp | 2 +-
.../layout_stride/assert.stride.pass.cpp | 2 +-
.../mdspan/mdspan/assert.conversion.pass.cpp | 2 +-
.../mdspan/assert.index_operator.pass.cpp | 2 +-
.../views/mdspan/mdspan/assert.size.pass.cpp | 2 +-
.../span.cons/assert.iter_sent.pass.cpp | 2 +-
.../span.cons/assert.iter_size.pass.cpp | 2 +-
.../span.cons/assert.other_span.pass.cpp | 2 +-
.../span.cons/assert.range.pass.cpp | 2 +-
.../views.span/span.elem/assert.back.pass.cpp | 2 +-
.../span.elem/assert.front.pass.cpp | 2 +-
.../span.elem/assert.op_idx.pass.cpp | 2 +-
.../views.span/span.sub/assert.first.pass.cpp | 2 +-
.../views.span/span.sub/assert.last.pass.cpp | 2 +-
.../span.sub/assert.subspan.pass.cpp | 2 +-
.../assert.deallocate.pass.cpp | 2 +-
.../assert.deallocate.pass.cpp | 2 +-
.../libcxx/iterators/assert.advance.pass.cpp | 2 +-
.../libcxx/iterators/assert.next.pass.cpp | 2 +-
.../libcxx/iterators/assert.prev.pass.cpp | 2 +-
.../bounded_iter/dereference.pass.cpp | 2 +-
.../libcxx/odr_signature.hardening.sh.cpp | 18 ++---
.../range.drop.while/assert.begin.pass.cpp | 2 +-
.../assert.equal.pass.cpp | 2 +-
.../assert.equal.pass.cpp | 2 +-
.../range.repeat.view/ctor.piecewise.pass.cpp | 2 +-
.../ctor.value.bound.pass.cpp | 2 +-
.../string.access/assert.back.pass.cpp | 2 +-
.../string.access/assert.cback.pass.cpp | 2 +-
.../string.access/assert.cfront.pass.cpp | 2 +-
.../string.access/assert.cindex.pass.cpp | 2 +-
.../string.access/assert.front.pass.cpp | 2 +-
.../string.access/assert.index.pass.cpp | 2 +-
.../assert.erase_iter.null.pass.cpp | 2 +-
.../string.modifiers/assert.pop_back.pass.cpp | 2 +-
.../string.view/assert.ctor.length.pass.cpp | 2 +-
.../string.view/assert.ctor.pointer.pass.cpp | 2 +-
.../assert.set_exception.pass.cpp | 2 +-
...sert.set_exception_at_thread_exit.pass.cpp | 2 +-
.../thread.barrier/assert.arrive.pass.cpp | 2 +-
.../thread.barrier/assert.ctor.pass.cpp | 2 +-
.../assert.arrive_and_wait.pass.cpp | 2 +-
.../thread.latch/assert.count_down.pass.cpp | 2 +-
.../thread/thread.latch/assert.ctor.pass.cpp | 2 +-
.../thread.semaphore/assert.ctor.pass.cpp | 2 +-
.../thread.semaphore/assert.release.pass.cpp | 2 +-
...ert.exception_guard.no_exceptions.pass.cpp | 2 +-
.../expected.expected/assert.arrow.pass.cpp | 2 +-
.../expected.expected/assert.deref.pass.cpp | 2 +-
.../expected.expected/assert.error.pass.cpp | 2 +-
.../expected.void/assert.deref.pass.cpp | 2 +-
.../expected.void/assert.error.pass.cpp | 2 +-
.../assert.dereference.pass.cpp | 2 +-
.../assert.op_arrow.pass.cpp | 2 +-
.../alg.clamp/assert.ranges_clamp.pass.cpp | 2 +-
.../pop.heap/assert.pop_heap.pass.cpp | 2 +-
.../pop.heap/assert.ranges_pop_heap.pass.cpp | 2 +-
.../assert.unreachable.pass.cpp | 2 +-
.../test_check_assertion.pass.cpp | 2 +-
libcxx/utils/ci/buildkite-pipeline.yml | 12 ++--
libcxx/utils/ci/run-buildbot | 14 ++--
libcxx/utils/data/ignore_format.txt | 8 ---
libcxx/utils/libcxx/test/params.py | 12 ++--
.../gn/secondary/libcxx/include/BUILD.gn | 4 +-
126 files changed, 255 insertions(+), 279 deletions(-)
rename libcxx/cmake/caches/{Generic-debug-mode.cmake => Generic-debug-hardening-mode.cmake} (100%)
create mode 100644 libcxx/cmake/caches/Generic-fast-hardening-mode.cmake
delete mode 100644 libcxx/cmake/caches/Generic-hardened-mode.cmake
rename libcxx/cmake/caches/{Generic-safe-mode.cmake => Generic-strict-hardening-mode.cmake} (65%)
rename libcxx/test/libcxx/assertions/modes/{enabling_assertions_enables_safe_mode.pass.cpp => enabling_assertions_enables_strict_mode.pass.cpp} (71%)
rename libcxx/test/libcxx/assertions/modes/{hardened.pass.cpp => fast.pass.cpp} (76%)
rename libcxx/test/libcxx/assertions/modes/{override_with_hardened_mode.pass.cpp => override_with_fast_mode.pass.cpp} (73%)
rename libcxx/test/libcxx/assertions/modes/{override_with_debug_lite_mode.pass.cpp => override_with_strict_mode.pass.cpp} (78%)
rename libcxx/test/libcxx/assertions/modes/{debug_lite.pass.cpp => strict.pass.cpp} (76%)
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index b9f7ab8466aa806..8ec4680676e6930 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 debug_lite debug)
-set(LIBCXX_HARDENING_MODE "unchecked" CACHE STRING
+set(LIBCXX_SUPPORTED_HARDENING_MODES none fast strict 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
@@ -752,13 +752,13 @@ 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 "debug_lite")
+ set(LIBCXX_HARDENING_MODE "strict")
endif()
-if (LIBCXX_HARDENING_MODE STREQUAL "unchecked")
+if (LIBCXX_HARDENING_MODE STREQUAL "none")
config_define(2 _LIBCPP_HARDENING_MODE_DEFAULT)
-elseif (LIBCXX_HARDENING_MODE STREQUAL "hardened")
+elseif (LIBCXX_HARDENING_MODE STREQUAL "fast")
config_define(4 _LIBCPP_HARDENING_MODE_DEFAULT)
-elseif (LIBCXX_HARDENING_MODE STREQUAL "debug_lite")
+elseif (LIBCXX_HARDENING_MODE STREQUAL "strict")
config_define(16 _LIBCPP_HARDENING_MODE_DEFAULT)
elseif (LIBCXX_HARDENING_MODE STREQUAL "debug")
config_define(8 _LIBCPP_HARDENING_MODE_DEFAULT)
diff --git a/libcxx/cmake/caches/Generic-debug-mode.cmake b/libcxx/cmake/caches/Generic-debug-hardening-mode.cmake
similarity index 100%
rename from libcxx/cmake/caches/Generic-debug-mode.cmake
rename to libcxx/cmake/caches/Generic-debug-hardening-mode.cmake
diff --git a/libcxx/cmake/caches/Generic-fast-hardening-mode.cmake b/libcxx/cmake/caches/Generic-fast-hardening-mode.cmake
new file mode 100644
index 000000000000000..cad5a1c4837fc5b
--- /dev/null
+++ b/libcxx/cmake/caches/Generic-fast-hardening-mode.cmake
@@ -0,0 +1 @@
+set(LIBCXX_HARDENING_MODE "fast" CACHE STRING "")
diff --git a/libcxx/cmake/caches/Generic-hardened-mode.cmake b/libcxx/cmake/caches/Generic-hardened-mode.cmake
deleted file mode 100644
index 66c18741d198b2c..000000000000000
--- 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-safe-mode.cmake b/libcxx/cmake/caches/Generic-strict-hardening-mode.cmake
similarity index 65%
rename from libcxx/cmake/caches/Generic-safe-mode.cmake
rename to libcxx/cmake/caches/Generic-strict-hardening-mode.cmake
index 32bef601caaeb88..7f4ce107082baa0 100644
--- a/libcxx/cmake/caches/Generic-safe-mode.cmake
+++ b/libcxx/cmake/caches/Generic-strict-hardening-mode.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 "strict" CACHE STRING "")
diff --git a/libcxx/docs/Hardening.rst b/libcxx/docs/Hardening.rst
index 738fd3235d12e22..84aeff759779a69 100644
--- a/libcxx/docs/Hardening.rst
+++ b/libcxx/docs/Hardening.rst
@@ -10,36 +10,37 @@ 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:
-- debug-lite 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;
+- strict mode;
- debug mode.
-The debug-lite mode contains all the checks from the hardened 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 debug-lite mode is still
-intended to be usable in production.
+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 strict 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 fast mode, the strict mode is still intended to be usable in
+production.
-The debug mode, in turn, contains all the checks from the debug-lite 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 ``debug_lite`` enables the debug-lite 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``, ``strict`` and ``debug``. The default value is
+``none`` which doesn't enable any hardening checks.
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.
@@ -50,20 +51,20 @@ control which level of hardening is enabled in their code by defining the macro
passing ``-D_LIBCPP_HARDENING_MODE=X`` to the compiler). The macro can be
set to one of the following possible values:
-- ``_LIBCPP_HARDENING_MODE_UNCHECKED``;
-- ``_LIBCPP_HARDENING_MODE_HARDENED``;
-- ``_LIBCPP_HARDENING_MODE_DEBUG_LITE``;
+- ``_LIBCPP_HARDENING_MODE_NONE``;
+- ``_LIBCPP_HARDENING_MODE_FAST``;
+- ``_LIBCPP_HARDENING_MODE_STRICT``;
- ``_LIBCPP_HARDENING_MODE_DEBUG``.
-The exact numeric values of these macros are unspecified and you should not rely
-on them (e.g. expect the values to be sorted in any way).
+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 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
+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 71dcc75f8d3d910..cc44cc76302964b 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -55,26 +55,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 ``_LIBCPP_HARDENING_MODE`` macro. See
- :ref:`the hardening documentation <using-hardening-modes>` for more details.
-
-- The library now provides a debug-lite mode which is a superset of the hardened mode, additionally enabling checks that
- catch common logic errors that aren't necessarily security-critical. This mode is largely a replacement for the safe
- release. Unlike the legacy debug mode, this doesn't affect the ABI and doesn't require locking. Vendors can configure
- whether the debug-lite mode is enabled by default with the ``LIBCXX_HARDENING_MODE`` variable at CMake configuration
- time. ``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 ``_LIBCPP_HARDENING_MODE`` 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 debug-lite 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 ``_LIBCPP_HARDENING_MODE``
- 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 strict 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
-------------------------
@@ -94,8 +82,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 hardened 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>``,
@@ -107,8 +95,8 @@ 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 ``debug_lite`` instead. Similarly, the
- ``_LIBCPP_ENABLE_ASSERTIONS`` macro will be deprecated (setting it to ``1`` still enables the debug-lite mode the LLVM 19
+ it will trigger an error; use the ``LIBCXX_HARDENING_MODE`` variable with the value ``strict`` instead. Similarly, the
+ ``_LIBCPP_ENABLE_ASSERTIONS`` macro will be deprecated (setting it to ``1`` still enables the strict mode the LLVM 19
release while also issuing a deprecation warning). See :ref:`the hardening documentation <using-hardening-modes>` for
more details.
diff --git a/libcxx/include/__config b/libcxx/include/__config
index d5aa49f72934640..3060c66b12c57e7 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -217,36 +217,36 @@
// 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 debug-lite mode.
+// equivalent to setting the strict 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_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEBUG_LITE
+# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_STRICT
# endif
# endif
// The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values:
-// - `_LIBCPP_HARDENING_MODE_UNCHECKED`;
-// - `_LIBCPP_HARDENING_MODE_HARDENED`;
-// - `_LIBCPP_HARDENING_MODE_DEBUG_LITE`;
+//
+// - `_LIBCPP_HARDENING_MODE_NONE`;
+// - `_LIBCPP_HARDENING_MODE_FAST`;
+// - `_LIBCPP_HARDENING_MODE_STRICT`;
// - `_LIBCPP_HARDENING_MODE_DEBUG`.
-
-// 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.
//
-// #define _LIBCPP_HARDENING_MODE_HARDENED 1
-
-// Enables the debug-lite mode which extends the hardened mode with checks that are relatively cheap and prevent common
-// types of errors but are not security-critical.
+// These values have the following effects:
//
-// #define _LIBCPP_HARDENING_MODE_DEBUG_LITE 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.
+// - `_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;
+//
+// - `_LIBCPP_HARDENING_MODE_STRICT` -- sets the hardening mode to "strict". The strict mode extends the fast mode with
+// checks that are relatively cheap and prevent common types of errors but are not necessarily security-critical;
//
-// #define _LIBCPP_HARDENING_MODE_DEBUG 1
+// - `_LIBCPP_HARDENING_MODE_DEBUG` -- sets the hardening mode to "debug". The debug mode extends the strict 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.
@@ -273,31 +273,31 @@
// - `_LIBCPP_ASSERT_UNCATEGORIZED` -- for assertions that haven't been properly classified yet.
// clang-format off
-# define _LIBCPP_HARDENING_MODE_UNCHECKED (1 << 1)
-# define _LIBCPP_HARDENING_MODE_HARDENED (1 << 2)
-# define _LIBCPP_HARDENING_MODE_DEBUG_LITE (1 << 4) // Deliberately not ordered.
-# define _LIBCPP_HARDENING_MODE_DEBUG (1 << 3)
+# define _LIBCPP_HARDENING_MODE_NONE (1 << 1)
+# define _LIBCPP_HARDENING_MODE_FAST (1 << 2)
+# define _LIBCPP_HARDENING_MODE_STRICT (1 << 4) // Deliberately not ordered.
+# define _LIBCPP_HARDENING_MODE_DEBUG (1 << 3)
// clang-format on
# ifndef _LIBCPP_HARDENING_MODE
# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEFAULT
# endif
-# if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_UNCHECKED && \
- _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_HARDENED && \
- _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG_LITE && \
+# if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_NONE && \
+ _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_FAST && \
+ _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_STRICT && \
_LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
# error _LIBCPP_HARDENING_MODE must be set to one of the following values: \
-_LIBCPP_HARDENING_MODE_UNCHECKED, \
-_LIBCPP_HARDENING_MODE_HARDENED, \
-_LIBCPP_HARDENING_MODE_DEBUG_LITE, \
+_LIBCPP_HARDENING_MODE_NONE, \
+_LIBCPP_HARDENING_MODE_FAST, \
+_LIBCPP_HARDENING_MODE_STRICT, \
_LIBCPP_HARDENING_MODE_DEBUG
# endif
// clang-format off
-// Hardened mode checks.
+// Fast hardening mode checks.
-# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_HARDENED
+# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
// Enabled checks.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
@@ -310,9 +310,9 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression)
-// Debug-lite mode checks.
+// Strict hardening mode checks.
-# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG_LITE
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_STRICT
// Enabled checks.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
@@ -323,7 +323,7 @@ _LIBCPP_HARDENING_MODE_DEBUG
// Disabled checks.
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
-// Debug mode checks.
+// Debug hardening mode checks.
# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
@@ -347,7 +347,7 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression)
-# endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_HARDENED
+# endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
// clang-format on
// } HARDENING
@@ -727,14 +727,14 @@ typedef __char32_t char32_t;
# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
# endif
-# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_HARDENED
+# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
# define _LIBCPP_HARDENING_SIG h
-# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG_LITE
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_STRICT
# define _LIBCPP_HARDENING_SIG s // "safe"
# 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 u // "unchecked"
# endif
# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
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 7bbf2735a90d909..b0709803cff96ac 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={{strict|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 781fa57c9cf88a4..ea9770b0b2fbca0 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/enabling_assertions_enables_safe_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_strict_mode.pass.cpp
similarity index 71%
rename from libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_strict_mode.pass.cpp
index 9f5458519f9faed..d277223f76b25b7 100644
--- a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_strict_mode.pass.cpp
@@ -7,7 +7,8 @@
//===----------------------------------------------------------------------===//
// TODO(hardening): remove in LLVM 20.
-// This test ensures that enabling assertions now enables the debug-lite mode.
+// This test ensures that enabling assertions with the legacy `_LIBCPP_ENABLE_ASSERTIONS` now enables the strict
+// hardening mode.
// `check_assertion.h` is only available starting from C++11 and requires Unix headers.
// UNSUPPORTED: c++03, !has-unix-headers
@@ -19,13 +20,11 @@
#include "check_assertion.h"
int main(int, char**) {
- static_assert(_LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG_LITE,
- "Debug-lite mode should be implicitly enabled");
+ static_assert(
+ _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_STRICT, "Strict 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/fast.pass.cpp
similarity index 76%
rename from libcxx/test/libcxx/assertions/modes/hardened.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/fast.pass.cpp
index 8338f63f01fe060..33377f03fe870ff 100644
--- a/libcxx/test/libcxx/assertions/modes/hardened.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 hardened 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=hardened
+// 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/hardening_mode_incorrect_value.verify.cpp b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.verify.cpp
index c0723e3f13c5b2e..95d9b5fa684d758 100644
--- a/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.verify.cpp
+++ b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.verify.cpp
@@ -15,4 +15,4 @@
#include <cassert>
-// expected-error@*:* {{_LIBCPP_HARDENING_MODE must be set to one of the following values: _LIBCPP_HARDENING_MODE_UNCHECKED, _LIBCPP_HARDENING_MODE_HARDENED, _LIBCPP_HARDENING_MODE_DEBUG_LITE, _LIBCPP_HARDENING_MODE_DEBUG}}
+// 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_STRICT, _LIBCPP_HARDENING_MODE_DEBUG}}
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
index caf28371f0a5c49..41c9870bc921458 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
@@ -21,9 +21,8 @@
int main(int, char**) {
_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");
+ 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_hardened_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
similarity index 73%
rename from libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
index 3f38b368aef4bfe..224db666529958c 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that we can override any hardening mode with 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.
// `check_assertion.h` is only available starting from C++11.
// UNSUPPORTED: c++03
@@ -14,17 +14,16 @@
// 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_HARDENING_MODE=_LIBCPP_HARDENING_MODE_HARDENED
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -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, "Hardened-mode assertions should fire");
- }(), "Hardened-mode assertions should fire");
- _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should not 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, "Strict-mode assertions should not fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_strict_mode.pass.cpp
similarity index 78%
rename from libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/override_with_strict_mode.pass.cpp
index 32f6a90089625bc..76abf6e701ac77e 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_strict_mode.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that we can override any hardening mode with the debug-lite mode on a per-TU basis.
+// This test ensures that we can override any hardening mode with the strict hardening mode on a per-TU basis.
// `check_assertion.h` is only available starting from C++11.
// UNSUPPORTED: c++03
@@ -14,16 +14,15 @@
// 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_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG_LITE
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_STRICT
#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, "Debug-lite-mode assertions should fire");
- }(), "Debug-lite-mode assertions should fire");
+ TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Strict-mode assertions should fire"); }(),
+ "Strict-mode assertions should fire");
_LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should not fire");
return 0;
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
index 56df977eff86ecf..b123ed6aa82b7f4 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
@@ -14,7 +14,7 @@
// 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_HARDENING_MODE=_LIBCPP_HARDENING_MODE_UNCHECKED
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE
#include <cassert>
#include "check_assertion.h"
diff --git a/libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp b/libcxx/test/libcxx/assertions/modes/strict.pass.cpp
similarity index 76%
rename from libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/strict.pass.cpp
index ad3f7ca2a150905..ed17ac522f47743 100644
--- a/libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/strict.pass.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that assertions trigger without the user having to do anything when the debug-lite mode has been
-// enabled by default.
+// This test ensures that assertions trigger without the user having to do anything when the strict hardening mode has
+// been enabled by default.
-// REQUIRES: libcpp-hardening-mode=debug_lite
+// REQUIRES: libcpp-hardening-mode=strict
// `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/unchecked.pass.cpp b/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp
index 0e0d86983081990..4644c5692e70be9 100644
--- a/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/unchecked.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/containers/sequences/array/array.zero/assert.back.pass.cpp b/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp
index 8c6bd412986052a..7bd399fca7e0be7 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 603be9389a2950f..fcfb26ff42726fc 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 10337f84468ae71..e221e361405adcb 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 4dcd3033b94b136..e0f102b3cc1f828 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 7d0863d0f3a3e35..a6471f7389b871c 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 d65c133564e8474..04e933430a7b05f 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 6d0acddeac7ad64..b68b5dece684042 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 e74f797eebc353c..0c1571f67a53cd0 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.cindex.oob.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/assert.cindex.oob.pass.cpp
index 8baafedf081a007..47a531fb3cf7565 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 aec3bee2e2dfb71..687f8fa8664a6e9 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 1a5542df1131825..1f3cae3479a1b81 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 0138534d6567d26..4ed3fab6d22bb7e 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 72114e6e4623bb9..55a73adc0adde52 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={{strict|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 b8191f8df089b15..4dcff788db3662a 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={{strict|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 8d7b2906c7cbc92..6b00f19d65b876e 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={{strict|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 728c9fb2415f608..4415adaf9eb6679 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={{strict|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 c07e6e3af8d11e2..d8ef9ddbfad6495 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={{strict|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 fa126bfcd775b5a..9772d6f02e31b21 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={{strict|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 5f29e6b2b9545bf..7c94aa2229ee7e4 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={{strict|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 21606acbe253fe4..d696ba556914f16 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={{strict|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 053f9f96b457f98..b19db3543290400 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={{strict|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 69cbaf94359c44a..cc726e910be4828 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={{strict|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 e88033c0f482fd8..6a2bf468bf0d4cb 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={{strict|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 0d79d0f9bb0a0e1..61b82f8b0d2ed11 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={{strict|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 41781f4e407da09..e8cde6bf8856c8d 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 85d4ec2e34b4592..886375e54ca3caa 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 cdd5d76954f20bb..e03bb28ba1cfba0 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 5583c241823b425..d2e1910b1946233 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 a987f77f629cbf9..44e6d48e9e17805 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 b9f889ac6db4b86..44e11d6258977fa 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 955d98a4f39392b..a225a323d12554a 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 9c6486d76852804..d11cf9c2362dde6 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 25ffa46a90ef27a..60c08a86d20036c 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 2f3ac2b9de16c06..bdee8912abfde11 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={{strict|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 8d67ae32b28e13d..e06ec0c4fc42e1d 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 451c0a925d1a5b2..2d877a50781b8b0 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 f85968e4fa13835..83fb320edf2cf3b 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 134562a38d8d184..29903595a2a7f0c 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 b8b78fceebbd5de..a14459823ff6a2f 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 c6e67efa03fd7bf..d6a6cc94278c225 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={{strict|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 bab3fb468883394..95179cdc31acac1 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 e8bad8b0d512495..24b5ff903c10b91 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 6eea40c239f09d4..c7a7febd090440d 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 cd06bbb545dd52d..c6cd8d9f980aa43 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 8a42861a0be0799..b88ceb7240c26f9 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 8caaf2295c0a1b3..22bceb8e177e912 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 bd12344ab4c573f..174bddb56d53c80 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 9b5b872bb3596f2..268b26462487440 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={{strict|debug}}
// XFAIL: availability-verbose_abort-missing
// <mdspan>
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 94cc7d002b8df14..c268ae51e79ac70 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 cf9a88c20c90bda..3c800e9f2fdf9ed 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 74d362f7783fa2e..f1b7d2183625b5b 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 cd40afad7f21e2e..18ed7ce213b90a4 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 4fbc8ef50fb4237..d15b024149775ef 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 5331103ca767270..588123af6499b0c 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 af00fb9b696999e..8a74739c79ddfb8 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 c9c72fbc8b0d55e..01d5658291f1d9b 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 69312bab8911623..4e6587443c6a783 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 6b3a59c7142eaad..52e4fe9ecc5c70e 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 e12e0fc7280d1f6..00e1db49abca349 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={{strict|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 99b1ad6e6957af1..0ed30b83c07a601 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={{strict|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 4fe78cc3ff1167d..15232e773f62cf9 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={{strict|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 2bf2e5702b6d080..75fcdc869335428 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={{strict|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 a8600e51eb81ded..a2d1f230ae57836 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={{strict|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 3bded601f77afa4..095e8a8fef6ef69 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 c01159eb9fbe363..b87377fe1c9d0d0 100644
--- a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
+++ b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
@@ -12,36 +12,36 @@
// 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 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_HARDENED -o %t.tu1.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG_LITE -o %t.tu2.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -o %t.tu3.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_UNCHECKED -o %t.tu4.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DMAIN -o %t.main.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU1 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -o %t.tu1.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_STRICT -o %t.tu2.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -o %t.tu3.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -Wno-macro-redefined -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
+// stricthardening 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 dcca2dff79e76f8..1662cec0dbbbf4f 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={{strict|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 a15c5bacadb045c..7afbc20463af66b 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={{strict|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 e72900bdb4eb04a..8de62111ff8b75e 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={{strict|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 2b2632081246632..7635e9efefe991c 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={{strict|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 a648e41c78d7540..7c4167e4d553665 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={{strict|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 9c6d49af7883e72..42beb28c47b1363 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 7a89d06d2474135..7a3d3e1661636ae 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 30dc29a951c7bf6..66432dc099b5ffc 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 2b4072826fd604d..41bb48b6f574c86 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 e75908ee07c1366..1033e17961b2421 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 95701314faf8e2d..776bba32da184d6 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 8c6d704a684b530..0b4cb9db51c94c5 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 1bdf3af36743028..2bab67bdc3edc57 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 9eb12cbe07bd3b4..5af499192655267 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={{strict|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 37d1f21cf30825e..1b65d6d6d54d98f 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={{strict|debug}}
// XFAIL: availability-verbose_abort-missing
// Construct a string_view from a null pointer
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 0796e7dd36bf069..c18adfb1766d510 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={{strict|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 7e2c14ef64d4785..a724ff7ba4bd05f 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={{strict|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 f9b0891548dd0a1..35e6b3ede6633e2 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={{strict|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 25a2e6a099cd7b7..df48cfd46b35b8b 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={{strict|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 4a9ccadd7c255ba..6260bf955b7b781 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={{strict|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 67185b11a40698d..05eaf6804df701f 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={{strict|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 5cd1272d44ff2d6..d8a1d5fe2d21c4c 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={{strict|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 5a3b87814cb3d4f..30e063e7484899d 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={{strict|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 b4219d339234c8f..3ddb26dc2d3a63e 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={{strict|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 dc5fb946850acf6..95995e069277084 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={{strict|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 2ee77234687af24..27dcdfe951230a4 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 4fc3f358389bb63..01078ac27e96a98 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 7c1f417ea428cc6..ff574b350cc9e1e 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 5cc2874a6be808d..e5d7ac3eae69885 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 9f5f07e6475ea7e..7bf4844b29b0174 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 60c468651115896..2ba5f299bc34e6b 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 ebccf6545e104b2..f93569979d18868 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 fdc3d3acc80f2e5..2c0f4775a124362 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={{strict|debug}}
// XFAIL: availability-verbose_abort-missing
// <algorithm>
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 bb6ff68a4a85a73..979e61a19b9ec55 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={{strict|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 eb540d6c6428ff7..178a325c707f606 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={{strict|debug}}
// XFAIL: availability-verbose_abort-missing
// <algorithm>
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 12c45f83c13c8f2..62e8736f0e522bb 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={{strict|debug}}
// XFAIL: availability-verbose_abort-missing
// Make sure that reaching std::unreachable() with assertions enabled triggers an assertion.
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 53fd197508c8a9f..7cf0e0966ce89dd 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 a3ef9a2738b04bc..f3459a0f7ad1dbb 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-fast-hardening-mode"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
@@ -422,8 +422,8 @@ steps:
limit: 2
timeout_in_minutes: 120
- - label: "Debug-lite mode"
- command: "libcxx/utils/ci/run-buildbot generic-debug-lite-mode"
+ - label: "Strict hardening mode"
+ command: "libcxx/utils/ci/run-buildbot generic-strict-hardening-mode"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
@@ -443,8 +443,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-debug-hardening-mode"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index ebb255243ba9c15..12bddfc0ad9f51f 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -395,21 +395,21 @@ generic-merged)
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
check-runtimes
;;
-generic-hardened-mode)
+generic-fast-hardening-mode)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-fast-hardening-mode.cmake"
check-runtimes
check-abi-list
;;
-generic-safe-mode)
+generic-strict-hardening-mode)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-safe-mode.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-strict-hardening-mode.cmake"
check-runtimes
check-abi-list
;;
-generic-debug-mode)
+generic-debug-hardening-mode)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-mode.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-hardening-mode.cmake"
check-runtimes
check-abi-list
;;
@@ -533,7 +533,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 a81b27ea688655c..d566c7bec6bde33 100644
--- a/libcxx/utils/data/ignore_format.txt
+++ b/libcxx/utils/data/ignore_format.txt
@@ -587,14 +587,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 c0532eb9f85765e..9d20aa6374e7cb0 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -287,18 +287,18 @@ def getStdFlag(cfg, std):
),
Parameter(
name="hardening_mode",
- choices=["unchecked", "hardened", "debug_lite", "debug"],
+ choices=["none", "fast", "strict", "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_HARDENING_MODE=_LIBCPP_HARDENING_MODE_HARDENED") if hardening_mode == "hardened" else None,
- AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG_LITE") if hardening_mode == "debug_lite" else None,
- AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG") if hardening_mode == "debug" else None,
- AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_UNCHECKED") if hardening_mode == "unchecked" 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_STRICT") if hardening_mode == "strict" else None,
+ AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG") if hardening_mode == "debug" else None,
AddFeature("libcpp-hardening-mode={}".format(hardening_mode)),
],
),
diff --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index 76de0eb769d1155..50969e0f3f2ae17 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -35,7 +35,9 @@ if (current_toolchain == default_toolchain) {
"_LIBCPP_HAS_NO_WIDE_CHARACTERS=",
"_LIBCPP_HAS_NO_STD_MODULES=",
"_LIBCPP_ABI_DEFINES=",
- "_LIBCPP_HARDENING_MODE_DEFAULT=",
+ "_LIBCPP_ENABLE_DEBUG_MODE_DEFAULT=",
+ "_LIBCPP_ENABLE_HARDENED_MODE_DEFAULT=",
+ "_LIBCPP_ENABLE_SAFE_MODE_DEFAULT=",
"_LIBCPP_PSTL_CPU_BACKEND_LIBDISPATCH=",
"_LIBCPP_PSTL_CPU_BACKEND_SERIAL=1",
"_LIBCPP_PSTL_CPU_BACKEND_THREAD=",
>From 10625a9d0bc5dcf03a5073f8d488abeee91bd4e8 Mon Sep 17 00:00:00 2001
From: Konstantin Varlamov <varconsteq at gmail.com>
Date: Wed, 1 Nov 2023 19:17:38 -0700
Subject: [PATCH 3/8] Test more incorrect hardening values.
---
...erify.cpp => hardening_mode_incorrect_value.sh.cpp} | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
rename libcxx/test/libcxx/assertions/modes/{hardening_mode_incorrect_value.verify.cpp => hardening_mode_incorrect_value.sh.cpp} (50%)
diff --git a/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.verify.cpp b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
similarity index 50%
rename from libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.verify.cpp
rename to libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
index 95d9b5fa684d758..13fcbb0f03fd79a 100644
--- a/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.verify.cpp
+++ b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
@@ -11,8 +11,14 @@
// Modules build produces a different error ("Could not build module 'std'").
// UNSUPPORTED: clang-modules-build
-// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=42
+
+// RUN: %{verify} -Wno-macro-redefined -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} -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=0
+// RUN: %{verify} -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=1
+// RUN: %{verify} -Wno-macro-redefined -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_STRICT, _LIBCPP_HARDENING_MODE_DEBUG}}
+// 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_STRICT, _LIBCPP_HARDENING_MODE_DEBUG}}
>From 8e971f337c9d8daaba61f1ac475ce153cb367868 Mon Sep 17 00:00:00 2001
From: Konstantin Varlamov <varconsteq at gmail.com>
Date: Wed, 1 Nov 2023 22:46:55 -0700
Subject: [PATCH 4/8] Fix a forgotten mention of `unchecked`
---
.../containers/sequences/vector/assert.cfront.empty.pass.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 ac8b2a7920bfaae..6d0f4eacf44c0cb 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>
>From 84c5fc736021b3e00095ca647dfb4b94359b0b5e Mon Sep 17 00:00:00 2001
From: Konstantin Varlamov <varconsteq at gmail.com>
Date: Thu, 2 Nov 2023 15:13:09 -0700
Subject: [PATCH 5/8] Feedback (foo-hardening-mode -> hardening-mode-foo)
---
...mode.cmake => Generic-hardening-mode-debug.cmake} | 0
...-mode.cmake => Generic-hardening-mode-fast.cmake} | 0
...ode.cmake => Generic-hardening-mode-strict.cmake} | 0
libcxx/utils/ci/buildkite-pipeline.yml | 6 +++---
libcxx/utils/ci/run-buildbot | 12 ++++++------
5 files changed, 9 insertions(+), 9 deletions(-)
rename libcxx/cmake/caches/{Generic-debug-hardening-mode.cmake => Generic-hardening-mode-debug.cmake} (100%)
rename libcxx/cmake/caches/{Generic-fast-hardening-mode.cmake => Generic-hardening-mode-fast.cmake} (100%)
rename libcxx/cmake/caches/{Generic-strict-hardening-mode.cmake => Generic-hardening-mode-strict.cmake} (100%)
diff --git a/libcxx/cmake/caches/Generic-debug-hardening-mode.cmake b/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake
similarity index 100%
rename from libcxx/cmake/caches/Generic-debug-hardening-mode.cmake
rename to libcxx/cmake/caches/Generic-hardening-mode-debug.cmake
diff --git a/libcxx/cmake/caches/Generic-fast-hardening-mode.cmake b/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake
similarity index 100%
rename from libcxx/cmake/caches/Generic-fast-hardening-mode.cmake
rename to libcxx/cmake/caches/Generic-hardening-mode-fast.cmake
diff --git a/libcxx/cmake/caches/Generic-strict-hardening-mode.cmake b/libcxx/cmake/caches/Generic-hardening-mode-strict.cmake
similarity index 100%
rename from libcxx/cmake/caches/Generic-strict-hardening-mode.cmake
rename to libcxx/cmake/caches/Generic-hardening-mode-strict.cmake
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index f3459a0f7ad1dbb..1fafc4311b0abb2 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -405,7 +405,7 @@ steps:
timeout_in_minutes: 120
- label: "Fast hardening mode"
- command: "libcxx/utils/ci/run-buildbot generic-fast-hardening-mode"
+ command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-fast"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
@@ -423,7 +423,7 @@ steps:
timeout_in_minutes: 120
- label: "Strict hardening mode"
- command: "libcxx/utils/ci/run-buildbot generic-strict-hardening-mode"
+ command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-strict"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
@@ -444,7 +444,7 @@ steps:
timeout_in_minutes: 120
- label: "Debug hardening mode"
- command: "libcxx/utils/ci/run-buildbot generic-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 12bddfc0ad9f51f..2c3e00e9bc431c6 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -395,21 +395,21 @@ generic-merged)
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
check-runtimes
;;
-generic-fast-hardening-mode)
+generic-hardening-mode-fast)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-fast-hardening-mode.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake"
check-runtimes
check-abi-list
;;
-generic-strict-hardening-mode)
+generic-hardening-mode-strict)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-strict-hardening-mode.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-strict.cmake"
check-runtimes
check-abi-list
;;
-generic-debug-hardening-mode)
+generic-hardening-mode-debug)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-hardening-mode.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake"
check-runtimes
check-abi-list
;;
>From feba6fe6072376f1c8a7ca74b872c1adad920f02 Mon Sep 17 00:00:00 2001
From: Konstantin Varlamov <varconsteq at gmail.com>
Date: Thu, 2 Nov 2023 15:18:41 -0700
Subject: [PATCH 6/8] Address feedback
---
libcxx/docs/Hardening.rst | 3 ++-
libcxx/docs/ReleaseNotes/18.rst | 12 ++++++------
libcxx/include/__config | 6 +++---
.../modes/hardening_mode_incorrect_value.sh.cpp | 1 +
.../modes/{unchecked.pass.cpp => none.pass.cpp} | 0
libcxx/test/libcxx/odr_signature.hardening.sh.cpp | 2 +-
6 files changed, 13 insertions(+), 11 deletions(-)
rename libcxx/test/libcxx/assertions/modes/{unchecked.pass.cpp => none.pass.cpp} (100%)
diff --git a/libcxx/docs/Hardening.rst b/libcxx/docs/Hardening.rst
index 84aeff759779a69..0a44b612b351136 100644
--- a/libcxx/docs/Hardening.rst
+++ b/libcxx/docs/Hardening.rst
@@ -36,7 +36,8 @@ 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 with the possible
values of ``none``, ``fast``, ``strict`` and ``debug``. The default value is
-``none`` which doesn't enable any hardening checks.
+``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
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index cc44cc76302964b..40a412cdb9785d6 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -56,12 +56,12 @@ Improvements and New Features
can lead up to 350x performance improvements.
- 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 strict 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
+ into a reliable program termination. The ``fast`` hardening mode enables a set of security-critical checks with
+ minimal runtime overhead; the ``strict`` 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
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 3060c66b12c57e7..af1d7c7a1a31b78 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -728,13 +728,13 @@ typedef __char32_t char32_t;
# endif
# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
-# define _LIBCPP_HARDENING_SIG h
+# define _LIBCPP_HARDENING_SIG f
# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_STRICT
-# define _LIBCPP_HARDENING_SIG s // "safe"
+# define _LIBCPP_HARDENING_SIG s
# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_HARDENING_SIG d
# else
-# define _LIBCPP_HARDENING_SIG u // "unchecked"
+# define _LIBCPP_HARDENING_SIG n // "none"
# endif
# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
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
index 13fcbb0f03fd79a..0c01cee88f8b5ca 100644
--- a/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
+++ b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
@@ -11,6 +11,7 @@
// Modules build produces a different error ("Could not build module 'std'").
// UNSUPPORTED: clang-modules-build
+// REQUIRES: verify-support
// RUN: %{verify} -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=42
// Make sure that common cases of misuse produce readable errors. We deliberately disallow setting the hardening mode as
diff --git a/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp b/libcxx/test/libcxx/assertions/modes/none.pass.cpp
similarity index 100%
rename from libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/none.pass.cpp
diff --git a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
index b87377fe1c9d0d0..f96be008057894f 100644
--- a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
+++ b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
@@ -27,7 +27,7 @@ _LIBCPP_HIDE_FROM_ABI inline int f() { return 1; }
int tu1() { return f(); }
#endif // TU1
-// stricthardening mode
+// strict hardening mode
#ifdef TU2
# include <__config>
_LIBCPP_HIDE_FROM_ABI inline int f() { return 2; }
>From 7d43c6f7df86a20d5b623bf7616ea80d8ee12ff6 Mon Sep 17 00:00:00 2001
From: Konstantin Varlamov <varconsteq at gmail.com>
Date: Thu, 2 Nov 2023 15:33:30 -0700
Subject: [PATCH 7/8] Rename the "strict" mode to "extensive"
---
libcxx/CMakeLists.txt | 6 ++--
...=> Generic-hardening-mode-extensive.cmake} | 2 +-
libcxx/docs/Hardening.rst | 16 ++++-----
libcxx/docs/ReleaseNotes/18.rst | 18 +++++-----
libcxx/include/__config | 35 ++++++++++---------
.../alg.sorting/assert.min.max.pass.cpp | 2 +-
...ssertions_enables_extensive_mode.pass.cpp} | 6 ++--
.../{strict.pass.cpp => extensive.pass.cpp} | 6 ++--
.../hardening_mode_incorrect_value.sh.cpp | 2 +-
... => override_with_extensive_mode.pass.cpp} | 9 ++---
.../modes/override_with_fast_mode.pass.cpp | 2 +-
.../unord/unord.map/assert.bucket.pass.cpp | 2 +-
.../unord.map/assert.bucket_size.pass.cpp | 2 +-
.../unord.map/assert.max_load_factor.pass.cpp | 2 +-
.../unord.multimap/assert.bucket.pass.cpp | 2 +-
.../assert.bucket_size.pass.cpp | 2 +-
.../assert.max_load_factor.pass.cpp | 2 +-
.../unord.multiset/assert.bucket.pass.cpp | 2 +-
.../assert.bucket_size.pass.cpp | 2 +-
.../assert.max_load_factor.pass.cpp | 2 +-
.../unord/unord.set/assert.bucket.pass.cpp | 2 +-
.../unord.set/assert.bucket_size.pass.cpp | 2 +-
.../unord.set/assert.max_load_factor.pass.cpp | 2 +-
.../assert.index_operator.pass.cpp | 2 +-
.../assert.index_operator.pass.cpp | 2 +-
.../views/mdspan/mdspan/assert.size.pass.cpp | 2 +-
.../assert.deallocate.pass.cpp | 2 +-
.../assert.deallocate.pass.cpp | 2 +-
.../libcxx/iterators/assert.advance.pass.cpp | 2 +-
.../libcxx/iterators/assert.next.pass.cpp | 2 +-
.../libcxx/iterators/assert.prev.pass.cpp | 2 +-
.../libcxx/odr_signature.hardening.sh.cpp | 12 +++----
.../range.drop.while/assert.begin.pass.cpp | 2 +-
.../assert.equal.pass.cpp | 2 +-
.../assert.equal.pass.cpp | 2 +-
.../range.repeat.view/ctor.piecewise.pass.cpp | 2 +-
.../ctor.value.bound.pass.cpp | 2 +-
.../string.view/assert.ctor.length.pass.cpp | 2 +-
.../string.view/assert.ctor.pointer.pass.cpp | 2 +-
.../assert.set_exception.pass.cpp | 2 +-
...sert.set_exception_at_thread_exit.pass.cpp | 2 +-
.../thread.barrier/assert.arrive.pass.cpp | 2 +-
.../thread.barrier/assert.ctor.pass.cpp | 2 +-
.../assert.arrive_and_wait.pass.cpp | 2 +-
.../thread.latch/assert.count_down.pass.cpp | 2 +-
.../thread/thread.latch/assert.ctor.pass.cpp | 2 +-
.../thread.semaphore/assert.ctor.pass.cpp | 2 +-
.../thread.semaphore/assert.release.pass.cpp | 2 +-
...ert.exception_guard.no_exceptions.pass.cpp | 2 +-
.../alg.clamp/assert.ranges_clamp.pass.cpp | 2 +-
.../pop.heap/assert.pop_heap.pass.cpp | 2 +-
.../pop.heap/assert.ranges_pop_heap.pass.cpp | 2 +-
.../assert.unreachable.pass.cpp | 2 +-
libcxx/utils/ci/buildkite-pipeline.yml | 4 +--
libcxx/utils/ci/run-buildbot | 4 +--
libcxx/utils/libcxx/test/params.py | 10 +++---
56 files changed, 109 insertions(+), 107 deletions(-)
rename libcxx/cmake/caches/{Generic-hardening-mode-strict.cmake => Generic-hardening-mode-extensive.cmake} (64%)
rename libcxx/test/libcxx/assertions/modes/{enabling_assertions_enables_strict_mode.pass.cpp => enabling_assertions_enables_extensive_mode.pass.cpp} (84%)
rename libcxx/test/libcxx/assertions/modes/{strict.pass.cpp => extensive.pass.cpp} (87%)
rename libcxx/test/libcxx/assertions/modes/{override_with_strict_mode.pass.cpp => override_with_extensive_mode.pass.cpp} (78%)
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 8ec4680676e6930..3de592e5cb3c834 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -59,7 +59,7 @@ 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 none fast strict debug)
+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
@@ -752,13 +752,13 @@ 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 "strict")
+ 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 "strict")
+elseif (LIBCXX_HARDENING_MODE STREQUAL "extensive")
config_define(16 _LIBCPP_HARDENING_MODE_DEFAULT)
elseif (LIBCXX_HARDENING_MODE STREQUAL "debug")
config_define(8 _LIBCPP_HARDENING_MODE_DEFAULT)
diff --git a/libcxx/cmake/caches/Generic-hardening-mode-strict.cmake b/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake
similarity index 64%
rename from libcxx/cmake/caches/Generic-hardening-mode-strict.cmake
rename to libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake
index 7f4ce107082baa0..0487377d4e9ba2c 100644
--- a/libcxx/cmake/caches/Generic-hardening-mode-strict.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 "strict" CACHE STRING "")
+set(LIBCXX_HARDENING_MODE "extensive" CACHE STRING "")
diff --git a/libcxx/docs/Hardening.rst b/libcxx/docs/Hardening.rst
index 0a44b612b351136..7692f2a2c788725 100644
--- a/libcxx/docs/Hardening.rst
+++ b/libcxx/docs/Hardening.rst
@@ -16,18 +16,18 @@ 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;
-- strict mode;
+- extensive mode;
- debug mode.
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 strict 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 fast mode, the strict mode is still intended to be usable in
-production.
+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 fast mode, the extensive mode is still intended to
+be usable 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
@@ -35,7 +35,7 @@ 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 with the possible
-values of ``none``, ``fast``, ``strict`` and ``debug``. The default value is
+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).
@@ -54,7 +54,7 @@ set to one of the following possible values:
- ``_LIBCPP_HARDENING_MODE_NONE``;
- ``_LIBCPP_HARDENING_MODE_FAST``;
-- ``_LIBCPP_HARDENING_MODE_STRICT``;
+- ``_LIBCPP_HARDENING_MODE_EXTENSIVE``;
- ``_LIBCPP_HARDENING_MODE_DEBUG``.
The exact numeric values of these macros are unspecified and users should not
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 40a412cdb9785d6..40f9ef66adf29a4 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -57,11 +57,11 @@ Improvements and New Features
- 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 ``strict`` 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
+ 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
@@ -95,10 +95,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 ``strict`` instead. Similarly, the
- ``_LIBCPP_ENABLE_ASSERTIONS`` macro will be deprecated (setting it to ``1`` still enables the strict 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/include/__config b/libcxx/include/__config
index af1d7c7a1a31b78..4de745ffe7f745e 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -217,13 +217,13 @@
// 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 strict 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_HARDENING_MODE _LIBCPP_HARDENING_MODE_STRICT
+# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_EXTENSIVE
# endif
# endif
@@ -231,7 +231,7 @@
//
// - `_LIBCPP_HARDENING_MODE_NONE`;
// - `_LIBCPP_HARDENING_MODE_FAST`;
-// - `_LIBCPP_HARDENING_MODE_STRICT`;
+// - `_LIBCPP_HARDENING_MODE_EXTENSIVE`;
// - `_LIBCPP_HARDENING_MODE_DEBUG`.
//
// These values have the following effects:
@@ -241,12 +241,13 @@
// - `_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;
//
-// - `_LIBCPP_HARDENING_MODE_STRICT` -- sets the hardening mode to "strict". The strict mode extends the fast mode with
-// checks that are relatively cheap and prevent common types of errors but are not necessarily security-critical;
+// - `_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 extends the strict 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.
+// - `_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.
@@ -273,10 +274,10 @@
// - `_LIBCPP_ASSERT_UNCATEGORIZED` -- for assertions that haven't been properly classified yet.
// clang-format off
-# define _LIBCPP_HARDENING_MODE_NONE (1 << 1)
-# define _LIBCPP_HARDENING_MODE_FAST (1 << 2)
-# define _LIBCPP_HARDENING_MODE_STRICT (1 << 4) // Deliberately not ordered.
-# define _LIBCPP_HARDENING_MODE_DEBUG (1 << 3)
+# 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_HARDENING_MODE
@@ -285,12 +286,12 @@
# if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_NONE && \
_LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_FAST && \
- _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_STRICT && \
+ _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_STRICT, \
+_LIBCPP_HARDENING_MODE_EXTENSIVE, \
_LIBCPP_HARDENING_MODE_DEBUG
# endif
@@ -310,9 +311,9 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression)
-// Strict hardening mode checks.
+// Extensive hardening mode checks.
-# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_STRICT
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
// Enabled checks.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
@@ -729,7 +730,7 @@ typedef __char32_t char32_t;
# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
# define _LIBCPP_HARDENING_SIG f
-# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_STRICT
+# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
# define _LIBCPP_HARDENING_SIG s
# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_HARDENING_SIG d
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 b0709803cff96ac..b23b4d4530eec1e 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={{strict|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <algorithm>
diff --git a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_strict_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
similarity index 84%
rename from libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_strict_mode.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
index d277223f76b25b7..8c75cded508ae91 100644
--- a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_strict_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// TODO(hardening): remove in LLVM 20.
-// This test ensures that enabling assertions with the legacy `_LIBCPP_ENABLE_ASSERTIONS` now enables the strict
+// This test ensures that enabling assertions with the legacy `_LIBCPP_ENABLE_ASSERTIONS` now enables the extensive
// hardening mode.
// `check_assertion.h` is only available starting from C++11 and requires Unix headers.
@@ -20,8 +20,8 @@
#include "check_assertion.h"
int main(int, char**) {
- static_assert(
- _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_STRICT, "Strict hardening 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");
diff --git a/libcxx/test/libcxx/assertions/modes/strict.pass.cpp b/libcxx/test/libcxx/assertions/modes/extensive.pass.cpp
similarity index 87%
rename from libcxx/test/libcxx/assertions/modes/strict.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/extensive.pass.cpp
index ed17ac522f47743..e9e494eae341b44 100644
--- a/libcxx/test/libcxx/assertions/modes/strict.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 strict hardening 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=strict
+// REQUIRES: libcpp-hardening-mode=extensive
// `check_assertion.h` is only available starting from C++11.
// UNSUPPORTED: c++03
// `check_assertion.h` requires Unix headers.
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
index 0c01cee88f8b5ca..e3cb6a37add72fb 100644
--- a/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
+++ b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
@@ -22,4 +22,4 @@
#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_STRICT, _LIBCPP_HARDENING_MODE_DEBUG}}
+// 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/override_with_strict_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
similarity index 78%
rename from libcxx/test/libcxx/assertions/modes/override_with_strict_mode.pass.cpp
rename to libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
index 76abf6e701ac77e..8c6bf17364fcfe0 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_strict_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// This test ensures that we can override any hardening mode with the strict hardening mode on a per-TU basis.
+// 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
@@ -14,15 +14,16 @@
// 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_HARDENING_MODE=_LIBCPP_HARDENING_MODE_STRICT
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -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, "Strict-mode assertions should fire"); }(),
- "Strict-mode assertions should 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/override_with_fast_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
index 224db666529958c..bcd2c94fe542b80 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
@@ -23,7 +23,7 @@ int main(int, char**) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not 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, "Strict-mode assertions should not fire");
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Extensive-mode assertions should not fire");
return 0;
}
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 55a73adc0adde52..51718c013ba560e 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={{strict|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 4dcff788db3662a..de6aa442c6b3bad 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={{strict|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 6b00f19d65b876e..7b6a83559f9ee13 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={{strict|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 4415adaf9eb6679..2b2859c1e194071 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={{strict|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 d8ef9ddbfad6495..6100ef37a33b110 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={{strict|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 9772d6f02e31b21..8c80821b823d440 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={{strict|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 7c94aa2229ee7e4..40c68fd6c0c09b5 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={{strict|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 d696ba556914f16..8599b53ae30c8b6 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={{strict|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 b19db3543290400..0dedebed4acfcf8 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={{strict|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 cc726e910be4828..d5a3cd9a5c1b30e 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={{strict|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 6a2bf468bf0d4cb..f8f5feea48aabf6 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={{strict|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 61b82f8b0d2ed11..002e5f3962146ad 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={{strict|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
#include <unordered_set>
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 bdee8912abfde11..6718c231877bc0a 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={{strict|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.index_operator.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp
index d6a6cc94278c225..fa7eb4a54758ff5 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={{strict|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// 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 268b26462487440..3ff5a5f4d690fbc 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={{strict|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <mdspan>
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 00e1db49abca349..135f5e5f297f792 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={{strict|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 0ed30b83c07a601..caee61e6a9b053e 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={{strict|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 15232e773f62cf9..b7e6962b443efb9 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={{strict|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 75fcdc869335428..da4f4ea3150c391 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={{strict|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 a2d1f230ae57836..6a71cad9ef0489f 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={{strict|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <list>
diff --git a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
index f96be008057894f..9d2f54307a09fb6 100644
--- a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
+++ b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp
@@ -12,11 +12,11 @@
// 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 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -o %t.tu1.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_STRICT -o %t.tu2.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -o %t.tu3.o
-// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -Wno-macro-redefined -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} %s %{flags} %{compile_flags} -c -DTU1 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -o %t.tu1.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -o %t.tu2.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -Wno-macro-redefined -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -o %t.tu3.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -Wno-macro-redefined -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
@@ -27,7 +27,7 @@ _LIBCPP_HIDE_FROM_ABI inline int f() { return 1; }
int tu1() { return f(); }
#endif // TU1
-// strict hardening mode
+// extensive hardening mode
#ifdef TU2
# include <__config>
_LIBCPP_HIDE_FROM_ABI inline int f() { return 2; }
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 1662cec0dbbbf4f..a2b11fb54ed9da2 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={{strict|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 7afbc20463af66b..86ee2841f249e94 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={{strict|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 8de62111ff8b75e..d4a3bbc513c49a9 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={{strict|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 7635e9efefe991c..6d4e541d989063c 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={{strict|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 7c4167e4d553665..2e9c74bc35978d0 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={{strict|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// REQUIRES: has-unix-headers
// XFAIL: availability-verbose_abort-missing
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 5af499192655267..addcae5ec1863ef 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={{strict|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 1b65d6d6d54d98f..b38e0585d031204 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={{strict|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/thread/futures/futures.promise/assert.set_exception.pass.cpp b/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception.pass.cpp
index c18adfb1766d510..fe7b3616b5a764e 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={{strict|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 a724ff7ba4bd05f..f28db8caba94971 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={{strict|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 35e6b3ede6633e2..58bc4b844eb59df 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={{strict|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 df48cfd46b35b8b..3af43bdbe7b1395 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={{strict|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 6260bf955b7b781..442ae0d962631a7 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={{strict|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 05eaf6804df701f..1547dd6390d6cbd 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={{strict|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 d8a1d5fe2d21c4c..b20911e0c3b9f05 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={{strict|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 30e063e7484899d..91b1e3542908882 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={{strict|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 3ddb26dc2d3a63e..09b4de366535978 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={{strict|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 95995e069277084..8c14b84278cb4c3 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={{strict|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// ADDITIONAL_COMPILE_FLAGS: -fno-exceptions
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 2c0f4775a124362..07e56e73b6f345d 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={{strict|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.pop_heap.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp
index 979e61a19b9ec55..b6b6babafba1bff 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={{strict|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 178a325c707f606..ba55c14bf559041 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={{strict|debug}}
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
// XFAIL: availability-verbose_abort-missing
// <algorithm>
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 62e8736f0e522bb..112b687cb17e26e 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={{strict|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/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 1fafc4311b0abb2..d82885806040a07 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -422,8 +422,8 @@ steps:
limit: 2
timeout_in_minutes: 120
- - label: "Strict hardening mode"
- command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-strict"
+ - label: "Extensive hardening mode"
+ command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-extensive"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 2c3e00e9bc431c6..8dccf57f3937bdb 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -401,9 +401,9 @@ generic-hardening-mode-fast)
check-runtimes
check-abi-list
;;
-generic-hardening-mode-strict)
+generic-hardening-mode-extensive)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-strict.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake"
check-runtimes
check-abi-list
;;
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 9d20aa6374e7cb0..23f9ed2f3744bc2 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -287,7 +287,7 @@ def getStdFlag(cfg, std):
),
Parameter(
name="hardening_mode",
- choices=["none", "fast", "strict", "debug"],
+ choices=["none", "fast", "extensive", "debug"],
type=str,
default="none",
help="Whether to enable one of the hardening modes when compiling the test suite. This is only "
@@ -295,10 +295,10 @@ def getStdFlag(cfg, std):
actions=lambda hardening_mode: filter(
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_STRICT") if hardening_mode == "strict" else None,
- AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG") 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)),
],
),
>From b41e169ca3b1e7c53c8e096fec6ac76773604043 Mon Sep 17 00:00:00 2001
From: Konstantin Varlamov <varconsteq at gmail.com>
Date: Thu, 2 Nov 2023 16:38:16 -0700
Subject: [PATCH 8/8] clang-format
---
libcxx/include/__config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 4de745ffe7f745e..0033ff38b6229ca 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -286,7 +286,7 @@
# 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_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, \
More information about the llvm-commits
mailing list