diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index de7fa8e3be31a..6716f31a6c63b 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 and others like " ON) option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS}) -set(LIBCXX_SUPPORTED_HARDENING_MODES unchecked hardened safe debug) -set(LIBCXX_HARDENING_MODE "unchecked" CACHE STRING +set(LIBCXX_SUPPORTED_HARDENING_MODES none fast extensive debug) +set(LIBCXX_HARDENING_MODE "none" CACHE STRING "Specify the default hardening mode to use. This mode will be used inside the compiled library and will be the default when compiling user code. Note that users can override this setting in their own code. This does not affect the @@ -751,24 +751,16 @@ config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_N # TODO(LLVM 19): Produce a deprecation warning. if (LIBCXX_ENABLE_ASSERTIONS) - set(LIBCXX_HARDENING_MODE "safe") -endif() -if (LIBCXX_HARDENING_MODE STREQUAL "hardened") - config_define(1 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT) - config_define(0 _LIBCPP_ENABLE_SAFE_MODE_DEFAULT) - config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT) -elseif (LIBCXX_HARDENING_MODE STREQUAL "safe") - config_define(0 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT) - config_define(1 _LIBCPP_ENABLE_SAFE_MODE_DEFAULT) - config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT) + set(LIBCXX_HARDENING_MODE "extensive") +endif() +if (LIBCXX_HARDENING_MODE STREQUAL "none") + config_define(2 _LIBCPP_HARDENING_MODE_DEFAULT) +elseif (LIBCXX_HARDENING_MODE STREQUAL "fast") + config_define(4 _LIBCPP_HARDENING_MODE_DEFAULT) +elseif (LIBCXX_HARDENING_MODE STREQUAL "extensive") + config_define(16 _LIBCPP_HARDENING_MODE_DEFAULT) elseif (LIBCXX_HARDENING_MODE STREQUAL "debug") - config_define(0 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT) - config_define(0 _LIBCPP_ENABLE_SAFE_MODE_DEFAULT) - config_define(1 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT) -elseif (LIBCXX_HARDENING_MODE STREQUAL "unchecked") - config_define(0 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT) - config_define(0 _LIBCPP_ENABLE_SAFE_MODE_DEFAULT) - config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT) + config_define(8 _LIBCPP_HARDENING_MODE_DEFAULT) endif() if (LIBCXX_PSTL_CPU_BACKEND STREQUAL "serial") diff --git a/libcxx/cmake/caches/Generic-hardened-mode.cmake b/libcxx/cmake/caches/Generic-hardened-mode.cmake deleted file mode 100644 index 66c18741d198b..0000000000000 --- a/libcxx/cmake/caches/Generic-hardened-mode.cmake +++ /dev/null @@ -1 +0,0 @@ -set(LIBCXX_HARDENING_MODE "hardened" CACHE STRING "") diff --git a/libcxx/cmake/caches/Generic-debug-mode.cmake b/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake similarity index 100% rename from libcxx/cmake/caches/Generic-debug-mode.cmake rename to libcxx/cmake/caches/Generic-hardening-mode-debug.cmake diff --git a/libcxx/cmake/caches/Generic-safe-mode.cmake b/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake similarity index 64% rename from libcxx/cmake/caches/Generic-safe-mode.cmake rename to libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake index 32bef601caaeb..0487377d4e9ba 100644 --- a/libcxx/cmake/caches/Generic-safe-mode.cmake +++ b/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake @@ -1,2 +1,2 @@ set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically. -set(LIBCXX_HARDENING_MODE "safe" CACHE STRING "") +set(LIBCXX_HARDENING_MODE "extensive" CACHE STRING "") diff --git a/libcxx/cmake/caches/Generic-hardened-mode-with-abi-breaks.cmake b/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake similarity index 57% rename from libcxx/cmake/caches/Generic-hardened-mode-with-abi-breaks.cmake rename to libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake index de5d3820fba4c..4860b590dcde9 100644 --- a/libcxx/cmake/caches/Generic-hardened-mode-with-abi-breaks.cmake +++ b/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake @@ -1,2 +1,2 @@ -set(LIBCXX_HARDENING_MODE "hardened" CACHE STRING "") +set(LIBCXX_HARDENING_MODE "fast" CACHE STRING "") set(LIBCXX_ABI_DEFINES "_LIBCPP_ABI_BOUNDED_ITERATORS" CACHE STRING "") diff --git a/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake b/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake new file mode 100644 index 0000000000000..cad5a1c4837fc --- /dev/null +++ b/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake @@ -0,0 +1 @@ +set(LIBCXX_HARDENING_MODE "fast" CACHE STRING "") diff --git a/libcxx/docs/Hardening.rst b/libcxx/docs/Hardening.rst index ec115d3d6012b..7692f2a2c7887 100644 --- a/libcxx/docs/Hardening.rst +++ b/libcxx/docs/Hardening.rst @@ -10,52 +10,63 @@ Hardening Modes Using hardening modes ===================== -The hardened mode enables a set of security-critical assertions that prevent -undefined behavior caused by violating preconditions of the standard library. -These assertions can be done with relatively little overhead in constant time -and are intended to be used in production. - -In addition to the hardened mode, libc++ also provides two other hardening -modes: -- safe mode; +libc++ provides several hardening modes, where each mode enables a set of +assertions that prevent undefined behavior caused by violating preconditions of +the standard library. Different hardening modes make different trade-offs +between the amount of checking and runtime performance. The available hardening +modes are: +- fast mode; +- extensive mode; - debug mode. -The safe mode contains all the checks from the hardened mode and additionally +The fast mode contains a set of security-critical checks that can be done with +relatively little overhead in constant time and are intended to be used in +production. We recommend most projects to adopt the fast mode. + +The extensive mode contains all the checks from the fast mode and additionally some checks for undefined behavior that incur relatively little overhead but aren't security-critical. While the performance penalty is somewhat more -significant compared to the hardened mode, the safe mode is still intended to be -usable in production. +significant compared to the fast mode, the extensive mode is still intended to +be usable in production. -The debug mode, in turn, contains all the checks from the safe mode and -additionally more expensive checks that may affect the complexity of algorithms. -The debug mode is intended to be used for testing, not in production. +The debug mode enables all the available checks in the library, including +internal assertions, some of which might be very expensive. This mode is +intended to be used for testing, not in production. Vendors can set the default hardening mode by using the -``LIBCXX_HARDENING_MODE`` variable at CMake configuration time. Setting -``LIBCXX_HARDENING_MODE`` to ``hardened`` enables the hardened mode, and -similarly setting the variable to ``safe`` enables the safe mode, and to -``debug`` enables the debug mode. The default value is ``unchecked`` which -doesn't enable any hardening. +``LIBCXX_HARDENING_MODE`` variable at CMake configuration time with the possible +values of ``none``, ``fast``, ``extensive`` and ``debug``. The default value is +``none`` which doesn't enable any hardening checks (this mode is sometimes +called the ``unchecked`` mode). When hardening is enabled, the compiled library is built with the corresponding mode enabled, **and** user code will be built with the same mode enabled by -default. If the mode is set to "unchecked" at the CMake configuration time, the +default. If the mode is set to "none" at the CMake configuration time, the compiled library will not contain any assertions and the default when building user code will be to have assertions disabled. As a user, you can consult your vendor to know which level of hardening is enabled by default. Furthermore, independently of any vendor-selected default, users can always -control which level of hardening is enabled in their code by defining -``_LIBCPP_ENABLE_HARDENED_MODE=0|1`` (or ``_LIBCPP_ENABLE_SAFE_MODE=0|1``, or -``_LIBCPP_ENABLE_DEBUG_MODE=0|1``) before including any libc++ header (we -recommend passing ``-D_LIBCPP_ENABLE_HARDENED_MODE=X``, etc. to the compiler). -Note that if the compiled library was built by the vendor in the unchecked mode, -functions compiled inside the static or shared library won't have any hardening -enabled even if the user compiles with hardening enabled (the same is true for -the inverse case where the static or shared library was compiled **with** -hardening enabled but the user tries to disable it). However, most of the code -in libc++ is in the headers, so the user-selected value for -``_LIBCPP_ENABLE_HARDENED|SAFE|DEBUG_MODE``, if any, will usually be respected. +control which level of hardening is enabled in their code by defining the macro +``_LIBCPP_HARDENING_MODE`` before including any libc++ headers (preferably by +passing ``-D_LIBCPP_HARDENING_MODE=X`` to the compiler). The macro can be +set to one of the following possible values: + +- ``_LIBCPP_HARDENING_MODE_NONE``; +- ``_LIBCPP_HARDENING_MODE_FAST``; +- ``_LIBCPP_HARDENING_MODE_EXTENSIVE``; +- ``_LIBCPP_HARDENING_MODE_DEBUG``. + +The exact numeric values of these macros are unspecified and users should not +rely on them (e.g. expect the values to be sorted in any way). + +Note that if the compiled library was built by the vendor with the hardening +mode set to "none", functions compiled inside the static or shared library won't +have any hardening enabled even if the user compiles with hardening enabled (the +same is true for the inverse case where the static or shared library was +compiled **with** hardening enabled but the user tries to disable it). However, +most of the code in libc++ is in the headers, so the user-selected value for +``_LIBCPP_HARDENING_MODE``, if any, will usually be respected. Enabling hardening has no impact on the ABI. diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst index 41c3f7cc455f1..40f9ef66adf29 100644 --- a/libcxx/docs/ReleaseNotes/18.rst +++ b/libcxx/docs/ReleaseNotes/18.rst @@ -55,19 +55,14 @@ Improvements and New Features - ``std::ranges::count`` is now optimized for ``vector::iterator``, which can lead up to 350x performance improvements. -- The library now provides a hardened mode under which common cases of library undefined behavior will be turned into - a reliable program termination. Vendors can configure whether the hardened mode is enabled by default with the - ``LIBCXX_HARDENING_MODE`` variable at CMake configuration time. Users can control whether the hardened mode is - enabled on a per translation unit basis using the ``-D_LIBCPP_ENABLE_HARDENED_MODE=1`` macro. See - :ref:`the hardening documentation ` for more details. - -- The library now provides a debug mode which is a superset of the safe mode, additionally enabling more expensive - checks that are not suitable to be used in production. This replaces the legacy debug mode that was removed in this - release. Unlike the legacy debug mode, this doesn't affect the ABI and doesn't require locking. Vendors can configure - whether the debug mode is enabled by default with the ``LIBCXX_HARDENING_MODE`` variable at CMake configuration time. - Users can control whether the debug mode is enabled on a per translation unit basis using the - ``-D_LIBCPP_ENABLE_DEBUG_MODE=1`` macro. See :ref:`the hardening documentation ` for more - details. +- The library now provides several hardening modes under which common cases of library undefined behavior will be turned + into a reliable program termination. The ``fast`` hardening mode enables a set of security-critical checks with + minimal runtime overhead; the ``extensive`` hardening mode additionally enables relatively cheap checks that catch + common logic errors but aren't necessarily security-critical; and the ``debug`` hardening mode enables all available + checks, some of which might be very expensive. Vendors can configure which hardening mode is enabled by default with + the ``LIBCXX_HARDENING_MODE`` variable at CMake configuration time. Users can control which hardening mode is enabled + on a per translation unit basis using the ``_LIBCPP_HARDENING_MODE`` macro. See :ref:`the hardening documentation + ` for more details. Deprecations and Removals ------------------------- @@ -87,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 safe libc++ mode and in particular the ``_LIBCPP_VERBOSE_ABORT`` - macro for details. + Please see the updated documentation about the hardening modes in libc++ and in particular the + ``_LIBCPP_VERBOSE_ABORT`` macro for details. - The headers ````, ````, ````, ````, ````, ````, ````, @@ -100,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 ``safe`` instead. Similarly, the - ``_LIBCPP_ENABLE_ASSERTIONS`` macro will be deprecated (setting it to ``1`` still enables the safe mode the LLVM 19 - release while also issuing a deprecation warning). See :ref:`the hardening documentation ` 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 + ` for more details. - The base template for ``std::char_traits`` has been marked as deprecated and will be removed in LLVM 19. If you are using ``std::char_traits`` with types other than ``char``, ``wchar_t``, ``char8_t``, ``char16_t``, ``char32_t`` diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst index 52c76f3b10548..24d6a7b95f5b2 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 `. - -**_LIBCPP_ENABLE_SAFE_MODE**: - This macro is used to enable the :ref:`safe mode `. - -**_LIBCPP_ENABLE_DEBUG_MODE**: - This macro is used to enable the :ref:`debug mode `. +**_LIBCPP_HARDENING_MODE**: + This macro is used to choose the :ref:`hardening mode `. **_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 d16bd0f531000..2aeb55f550b53 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 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 7731c0fd791d8..8fd15c5d66f2f 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 using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>; # else diff --git a/libcxx/include/__config b/libcxx/include/__config index b9b20fbfb271e..aea08b9374335 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -217,33 +217,37 @@ // TODO(hardening): deprecate this in LLVM 19. // This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes) -// equivalent to setting the safe mode. +// equivalent to setting the extensive mode. # ifdef _LIBCPP_ENABLE_ASSERTIONS # if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1 # error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1" # endif # if _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_SAFE_MODE 1 +# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_EXTENSIVE # endif # endif -// Enables the hardened mode which consists of all checks intended to be used in production. Hardened mode prioritizes -// security-critical checks that can be done with relatively little overhead in constant time. Mutually exclusive with -// `_LIBCPP_ENABLE_SAFE_MODE` and `_LIBCPP_ENABLE_DEBUG_MODE`. +// The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values: // -// #define _LIBCPP_ENABLE_HARDENED_MODE 1 - -// Enables the safe mode which extends the hardened mode with checks that are relatively cheap and prevent common types -// of errors but are not security-critical. Mutually exclusive with `_LIBCPP_ENABLE_HARDENED_MODE` and -// `_LIBCPP_ENABLE_DEBUG_MODE`. +// - `_LIBCPP_HARDENING_MODE_NONE`; +// - `_LIBCPP_HARDENING_MODE_FAST`; +// - `_LIBCPP_HARDENING_MODE_EXTENSIVE`; +// - `_LIBCPP_HARDENING_MODE_DEBUG`. // -// #define _LIBCPP_ENABLE_SAFE_MODE 1 - -// Enables the debug mode which contains all the checks from the hardened mode and additionally more expensive checks -// that may affect the complexity of algorithms. The debug mode is intended to be used for testing, not in production. -// Mutually exclusive with `_LIBCPP_ENABLE_HARDENED_MODE` and `_LIBCPP_ENABLE_SAFE_MODE`. +// These values have the following effects: +// +// - `_LIBCPP_HARDENING_MODE_NONE` -- sets the hardening mode to "none" which disables all runtime hardening checks; +// +// - `_LIBCPP_HARDENING_MODE_FAST` -- sets that hardening mode to "fast". The fast mode enables security-critical checks +// that can be done with relatively little runtime overhead in constant time; // -// #define _LIBCPP_ENABLE_DEBUG_MODE 1 +// - `_LIBCPP_HARDENING_MODE_EXTENSIVE` -- sets the hardening mode to "extensive". The extensive mode is a superset of +// the fast mode that additionally enables checks that are relatively cheap and prevent common types of logic errors +// but are not necessarily security-critical; +// +// - `_LIBCPP_HARDENING_MODE_DEBUG` -- sets the hardening mode to "debug". The debug mode is a superset of the extensive +// mode and enables all checks available in the library, including internal assertions. Checks that are part of the +// debug mode can be very expensive and thus the debug mode is intended to be used for testing, not in production. // Inside the library, assertions are categorized so they can be cherry-picked based on the chosen hardening mode. These // macros are only for internal use -- users should only pick one of the high-level hardening modes described above. @@ -274,38 +278,32 @@ // // - `_LIBCPP_ASSERT_UNCATEGORIZED` -- for assertions that haven't been properly classified yet. -# ifndef _LIBCPP_ENABLE_HARDENED_MODE -# define _LIBCPP_ENABLE_HARDENED_MODE _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT -# endif -# if _LIBCPP_ENABLE_HARDENED_MODE != 0 && _LIBCPP_ENABLE_HARDENED_MODE != 1 -# error "_LIBCPP_ENABLE_HARDENED_MODE must be set to 0 or 1." -# endif - -# ifndef _LIBCPP_ENABLE_SAFE_MODE -# define _LIBCPP_ENABLE_SAFE_MODE _LIBCPP_ENABLE_SAFE_MODE_DEFAULT -# endif -# if _LIBCPP_ENABLE_SAFE_MODE != 0 && _LIBCPP_ENABLE_SAFE_MODE != 1 -# error "_LIBCPP_ENABLE_SAFE_MODE must be set to 0 or 1." -# endif +// clang-format off +# define _LIBCPP_HARDENING_MODE_NONE (1 << 1) +# define _LIBCPP_HARDENING_MODE_FAST (1 << 2) +# define _LIBCPP_HARDENING_MODE_EXTENSIVE (1 << 4) // Deliberately not ordered. +# define _LIBCPP_HARDENING_MODE_DEBUG (1 << 3) +// clang-format on -# ifndef _LIBCPP_ENABLE_DEBUG_MODE -# define _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT -# endif -# if _LIBCPP_ENABLE_DEBUG_MODE != 0 && _LIBCPP_ENABLE_DEBUG_MODE != 1 -# error "_LIBCPP_ENABLE_DEBUG_MODE must be set to 0 or 1." +# ifndef _LIBCPP_HARDENING_MODE +# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEFAULT # endif -# if (_LIBCPP_ENABLE_HARDENED_MODE && _LIBCPP_ENABLE_SAFE_MODE) || \ - (_LIBCPP_ENABLE_HARDENED_MODE && _LIBCPP_ENABLE_DEBUG_MODE) || \ - (_LIBCPP_ENABLE_SAFE_MODE && _LIBCPP_ENABLE_DEBUG_MODE) -# error \ - "Only one of _LIBCPP_ENABLE_HARDENED_MODE, _LIBCPP_ENABLE_SAFE_MODE and _LIBCPP_ENABLE_DEBUG_MODE can be enabled." +# if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_NONE && \ + _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_FAST && \ + _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_EXTENSIVE && \ + _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG +# error _LIBCPP_HARDENING_MODE must be set to one of the following values: \ +_LIBCPP_HARDENING_MODE_NONE, \ +_LIBCPP_HARDENING_MODE_FAST, \ +_LIBCPP_HARDENING_MODE_EXTENSIVE, \ +_LIBCPP_HARDENING_MODE_DEBUG # endif // clang-format off -// Hardened mode checks. +// Fast hardening mode checks. -# if _LIBCPP_ENABLE_HARDENED_MODE +# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST // Enabled checks. # define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message) @@ -320,9 +318,9 @@ # define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) # define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) -// Safe mode checks. +// Extensive hardening mode checks. -# elif _LIBCPP_ENABLE_SAFE_MODE +# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE // Enabled checks. # define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message) @@ -334,9 +332,9 @@ // Disabled checks. # define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) -// Debug mode checks. +// Debug hardening mode checks. -# elif _LIBCPP_ENABLE_DEBUG_MODE +# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG // All checks enabled. # define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message) @@ -360,7 +358,7 @@ # define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) # define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) -# endif // _LIBCPP_ENABLE_HARDENED_MODE +# endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST // clang-format on // } HARDENING @@ -740,14 +738,14 @@ typedef __char32_t char32_t; # define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE # endif -# if _LIBCPP_ENABLE_HARDENED_MODE -# define _LIBCPP_HARDENING_SIG h -# elif _LIBCPP_ENABLE_SAFE_MODE +# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST +# define _LIBCPP_HARDENING_SIG f +# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE # define _LIBCPP_HARDENING_SIG s -# elif _LIBCPP_ENABLE_DEBUG_MODE +# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG # define _LIBCPP_HARDENING_SIG d # else -# define _LIBCPP_HARDENING_SIG u // for unchecked +# define _LIBCPP_HARDENING_SIG n // "none" # endif # ifdef _LIBCPP_HAS_NO_EXCEPTIONS diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in index c85cbcd02c441..6cade6f10d8ac 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 a8032d032a467..81ff96c7295fa 100644 --- a/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp +++ b/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp @@ -64,7 +64,7 @@ int main(int, char**) std::make_heap(v.begin(), v.end()); assert(stats.copied == 0); assert(stats.moved == 153'486); -#if !_LIBCPP_ENABLE_DEBUG_MODE +#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG assert(stats.compared == 188'285); #endif diff --git a/libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp b/libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp index 7bbf2735a90d9..b23b4d4530eec 100644 --- a/libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp +++ b/libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp @@ -10,7 +10,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include diff --git a/libcxx/test/libcxx/assertions/modes/debug.pass.cpp b/libcxx/test/libcxx/assertions/modes/debug.pass.cpp index 781fa57c9cf88..ea9770b0b2fbc 100644 --- a/libcxx/test/libcxx/assertions/modes/debug.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/debug.pass.cpp @@ -20,9 +20,7 @@ int main(int, char**) { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); - }(), "Should fire"); + TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire"); return 0; } diff --git a/libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp deleted file mode 100644 index fc8158ca0d696..0000000000000 --- 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 - -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_enabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp deleted file mode 100644 index 78373b992569c..0000000000000 --- a/libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// This test ensures that we can enable the debug mode on a per-TU basis. - -// Other hardening modes would additionally trigger the error that they are mutually exclusive. -// REQUIRES: libcpp-hardening-mode=unchecked -// `check_assertion.h` is only available starting from C++11 and requires Unix headers. -// UNSUPPORTED: c++03, !has-unix-headers -// The ability to set a custom abort message is required to compare the assertion message. -// XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_DEBUG_MODE=1 - -#include -#include "check_assertion.h" - -int main(int, char**) { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); - }(), "Should fire"); - - return 0; -} diff --git a/libcxx/test/libcxx/assertions/modes/debug_mode_not_1_or_0.verify.cpp b/libcxx/test/libcxx/assertions/modes/debug_mode_not_1_or_0.verify.cpp deleted file mode 100644 index b3b249fc0e15c..0000000000000 --- 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 - -// expected-error@*:* {{_LIBCPP_ENABLE_DEBUG_MODE must be set to 0 or 1.}} diff --git a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp similarity index 60% rename from libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp rename to libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp index 61cf26bd2ae14..be08159d561bb 100644 --- a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp @@ -7,26 +7,25 @@ //===----------------------------------------------------------------------===// // TODO(hardening): remove in LLVM 20. -// This test ensures that enabling assertions now enables the safe mode. +// This test ensures that enabling assertions with the legacy `_LIBCPP_ENABLE_ASSERTIONS` now enables the extensive +// hardening mode. -// Other hardening modes would additionally trigger the error that they are mutually exclusive. -// REQUIRES: libcpp-hardening-mode=unchecked // `check_assertion.h` is only available starting from C++11 and requires Unix headers. // UNSUPPORTED: c++03, !has-unix-headers // The ability to set a custom abort message is required to compare the assertion message. // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 +// Note that GCC doesn't support `-Wno-macro-redefined`. +// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #include "check_assertion.h" int main(int, char**) { - static_assert(_LIBCPP_ENABLE_SAFE_MODE == 1, "Safe mode should be implicitly enabled"); + static_assert(_LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE, + "The extensive hardening mode should be implicitly enabled"); _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); - }(), "Should fire"); + TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire"); return 0; } diff --git a/libcxx/test/libcxx/assertions/modes/hardened.pass.cpp b/libcxx/test/libcxx/assertions/modes/extensive.pass.cpp similarity index 76% rename from libcxx/test/libcxx/assertions/modes/hardened.pass.cpp rename to libcxx/test/libcxx/assertions/modes/extensive.pass.cpp index 8338f63f01fe0..e9e494eae341b 100644 --- a/libcxx/test/libcxx/assertions/modes/hardened.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/extensive.pass.cpp @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -// This test ensures that assertions trigger without the user having to do anything when the hardened mode has been -// enabled by default. +// This test ensures that assertions trigger without the user having to do anything when the extensive hardening mode +// has been enabled by default. -// REQUIRES: libcpp-hardening-mode=hardened +// REQUIRES: libcpp-hardening-mode=extensive // `check_assertion.h` is only available starting from C++11. // UNSUPPORTED: c++03 // `check_assertion.h` requires Unix headers. @@ -21,9 +21,7 @@ int main(int, char**) { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); - }(), "Should fire"); + TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire"); return 0; } diff --git a/libcxx/test/libcxx/assertions/modes/safe.pass.cpp b/libcxx/test/libcxx/assertions/modes/fast.pass.cpp similarity index 77% rename from libcxx/test/libcxx/assertions/modes/safe.pass.cpp rename to libcxx/test/libcxx/assertions/modes/fast.pass.cpp index 7174fd3078d63..33377f03fe870 100644 --- a/libcxx/test/libcxx/assertions/modes/safe.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/fast.pass.cpp @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -// This test ensures that assertions trigger without the user having to do anything when the safe mode has been -// enabled by default. +// This test ensures that assertions trigger without the user having to do anything when the fast hardening mode has +// been enabled by default. -// REQUIRES: libcpp-hardening-mode=safe +// REQUIRES: libcpp-hardening-mode=fast // `check_assertion.h` is only available starting from C++11. // UNSUPPORTED: c++03 // `check_assertion.h` requires Unix headers. @@ -21,9 +21,7 @@ int main(int, char**) { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); - }(), "Should fire"); + TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire"); return 0; } diff --git a/libcxx/test/libcxx/assertions/modes/hardened_and_debug_mutually_exclusive.verify.cpp b/libcxx/test/libcxx/assertions/modes/hardened_and_debug_mutually_exclusive.verify.cpp deleted file mode 100644 index d7b2610687578..0000000000000 --- 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 - -// 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 464f9b86de236..0000000000000 --- 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 - -// 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_not_1_or_0.verify.cpp b/libcxx/test/libcxx/assertions/modes/hardened_mode_not_1_or_0.verify.cpp deleted file mode 100644 index f11148d63a953..0000000000000 --- a/libcxx/test/libcxx/assertions/modes/hardened_mode_not_1_or_0.verify.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// This test verifies that setting the hardened mode to a value other than `0` or `1` triggers a compile-time error. - -// Other hardening modes would additionally trigger the error that they are mutually exclusive. -// REQUIRES: libcpp-hardening-mode=unchecked -// Modules build produces a different error ("Could not build module 'std'"). -// UNSUPPORTED: clang-modules-build -// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_HARDENED_MODE=2 - -#include - -// expected-error@*:* {{_LIBCPP_ENABLE_HARDENED_MODE must be set to 0 or 1.}} diff --git a/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp new file mode 100644 index 0000000000000..751ff7247445f --- /dev/null +++ b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// This test verifies that setting the hardening mode to a value that's not part of the predefined constants triggers +// a compile-time error. + +// Modules build produces a different error ("Could not build module 'std'"). +// UNSUPPORTED: clang-modules-build +// REQUIRES: verify-support + +// Note that GCC doesn't support `-Wno-macro-redefined`. +// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=42 +// Make sure that common cases of misuse produce readable errors. We deliberately disallow setting the hardening mode as +// if it were a boolean flag. +// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=0 +// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=1 +// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE + +#include + +// expected-error@*:* {{_LIBCPP_HARDENING_MODE must be set to one of the following values: _LIBCPP_HARDENING_MODE_NONE, _LIBCPP_HARDENING_MODE_FAST, _LIBCPP_HARDENING_MODE_EXTENSIVE, _LIBCPP_HARDENING_MODE_DEBUG}} diff --git a/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp b/libcxx/test/libcxx/assertions/modes/none.pass.cpp similarity index 89% rename from libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp rename to libcxx/test/libcxx/assertions/modes/none.pass.cpp index 0e0d869830819..4644c5692e70b 100644 --- a/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/none.pass.cpp @@ -9,12 +9,15 @@ // This test checks that if no hardening mode is defined (i.e., in the unchecked mode), by default assertions aren't // triggered. -// REQUIRES: libcpp-hardening-mode=unchecked +// REQUIRES: libcpp-hardening-mode=none #include bool executed_condition = false; -bool f() { executed_condition = true; return false; } +bool f() { + executed_condition = true; + return false; +} int main(int, char**) { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); diff --git a/libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp similarity index 60% rename from libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp rename to libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp index e652ee338ca8e..665babf59c259 100644 --- a/libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp @@ -6,26 +6,23 @@ // //===----------------------------------------------------------------------===// -// This test ensures that we can enable the hardened mode on a per-TU basis. +// This test ensures that we can override any hardening mode with the debug mode on a per-TU basis. -// Other hardening modes would additionally trigger the error that they are mutually exclusive. -// REQUIRES: libcpp-hardening-mode=unchecked // `check_assertion.h` is only available starting from C++11. // UNSUPPORTED: c++03 // `check_assertion.h` requires Unix headers. // REQUIRES: has-unix-headers // The ability to set a custom abort message is required to compare the assertion message. // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_HARDENED_MODE=1 +// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG #include #include "check_assertion.h" int main(int, char**) { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); - }(), "Should fire"); + _LIBCPP_ASSERT_INTERNAL(true, "Should not fire"); + TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should fire"); }(), + "Debug-mode assertions should fire"); return 0; } diff --git a/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp new file mode 100644 index 0000000000000..e2b0ea7208118 --- /dev/null +++ b/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// This test ensures that we can override any hardening mode with the extensive hardening mode on a per-TU basis. + +// `check_assertion.h` is only available starting from C++11. +// UNSUPPORTED: c++03 +// `check_assertion.h` requires Unix headers. +// REQUIRES: has-unix-headers +// The ability to set a custom abort message is required to compare the assertion message. +// XFAIL: availability-verbose_abort-missing +// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE + +#include +#include "check_assertion.h" + +int main(int, char**) { + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(true, "Should not fire"); + TEST_LIBCPP_ASSERT_FAILURE( + [] { _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Extensive-mode assertions should fire"); }(), + "Extensive-mode assertions should fire"); + _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should not fire"); + + return 0; +} diff --git a/libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp similarity index 62% rename from libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp rename to libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp index 4f9b236f920db..b38afed17e567 100644 --- a/libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp @@ -6,26 +6,24 @@ // //===----------------------------------------------------------------------===// -// This test ensures that we can enable the safe mode on a per-TU basis. +// This test ensures that we can override any hardening mode with the fast mode on a per-TU basis. -// Other hardening modes would additionally trigger the error that they are mutually exclusive. -// REQUIRES: libcpp-hardening-mode=unchecked // `check_assertion.h` is only available starting from C++11. // UNSUPPORTED: c++03 // `check_assertion.h` requires Unix headers. // REQUIRES: has-unix-headers // The ability to set a custom abort message is required to compare the assertion message. // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_SAFE_MODE=1 +// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST #include #include "check_assertion.h" int main(int, char**) { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); - }(), "Should fire"); + TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Fast-mode assertions should fire"); }(), + "Fast-mode assertions should fire"); + _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Extensive-mode assertions should not fire"); return 0; } diff --git a/libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp similarity index 58% rename from libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp rename to libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp index 161275977166a..65707a9863d07 100644 --- a/libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp @@ -6,14 +6,16 @@ // //===----------------------------------------------------------------------===// -// This test ensures that we can disable the 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 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 +// `check_assertion.h` is only available starting from C++11. +// UNSUPPORTED: c++03 +// `check_assertion.h` requires Unix headers. +// REQUIRES: has-unix-headers +// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE #include +#include "check_assertion.h" int main(int, char**) { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); diff --git a/libcxx/test/libcxx/assertions/modes/safe_and_debug_mutually_exclusive.verify.cpp b/libcxx/test/libcxx/assertions/modes/safe_and_debug_mutually_exclusive.verify.cpp deleted file mode 100644 index 5ef9bab0abe66..0000000000000 --- 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 - -// 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 81d155705f192..0000000000000 --- 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 - -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 578d1123a3e80..0000000000000 --- 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 - -// expected-error@*:* {{_LIBCPP_ENABLE_SAFE_MODE must be set to 0 or 1.}} diff --git a/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp b/libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp index 8c6bd41298605..7bd399fca7e0b 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::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 603be9389a295..fcfb26ff42726 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::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 10337f84468ae..e221e361405ad 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::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 4dcd3033b94b1..e0f102b3cc1f8 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 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 7d0863d0f3a3e..a6471f7389b87 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 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 d65c133564e84..04e933430a7b0 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 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 6d0acddeac7ad..b68b5dece6840 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 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 e74f797eebc35..0c1571f67a53c 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 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 ac8b2a7920bfa..6d0f4eacf44c0 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 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 8baafedf081a0..47a531fb3cf75 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 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 aec3bee2e2dfb..687f8fa8664a6 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 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 1a5542df11318..1f3cae3479a1b 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 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 0138534d6567d..4ed3fab6d22bb 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 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 72114e6e4623b..51718c013ba56 100644 --- a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp @@ -12,7 +12,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 b8191f8df089b..de6aa442c6b3b 100644 --- a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp @@ -16,7 +16,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 8d7b2906c7cbc..7b6a83559f9ee 100644 --- a/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp @@ -17,7 +17,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 728c9fb2415f6..2b2859c1e1940 100644 --- a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp @@ -16,7 +16,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 c07e6e3af8d11..6100ef37a33b1 100644 --- a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp @@ -16,7 +16,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 fa126bfcd775b..8c80821b823d4 100644 --- a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp @@ -17,7 +17,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 5f29e6b2b9545..40c68fd6c0c09 100644 --- a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp @@ -16,7 +16,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 21606acbe253f..8599b53ae30c8 100644 --- a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp @@ -16,7 +16,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 053f9f96b457f..0dedebed4acfc 100644 --- a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp @@ -17,7 +17,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 69cbaf94359c4..d5a3cd9a5c1b3 100644 --- a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp @@ -16,7 +16,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 e88033c0f482f..f8f5feea48aab 100644 --- a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp @@ -16,7 +16,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 0d79d0f9bb0a0..002e5f3962146 100644 --- a/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp @@ -17,7 +17,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 41781f4e407da..e8cde6bf8856c 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 // 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 85d4ec2e34b45..886375e54ca3c 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 // 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 cdd5d76954f20..e03bb28ba1cfb 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 // 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 5583c241823b4..d2e1910b19462 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 a987f77f629cb..44e6d48e9e178 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 // 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 b9f889ac6db4b..44e11d6258977 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 // 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 955d98a4f3939..a225a323d1255 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 // 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 9c6486d768528..d11cf9c2362dd 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 // 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 25ffa46a90ef2..60c08a86d2003 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 2f3ac2b9de16c..6718c231877bc 100644 --- a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // 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 8d67ae32b28e1..e06ec0c4fc42e 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 // 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 451c0a925d1a5..2d877a50781b8 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 // 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 f85968e4fa138..83fb320edf2cf 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 // 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 134562a38d8d1..29903595a2a7f 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 // 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 b8b78fceebbd5..a14459823ff6a 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 c6e67efa03fd7..fa7eb4a54758f 100644 --- a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // 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 bab3fb4688833..95179cdc31aca 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 // 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 e8bad8b0d5124..24b5ff903c10b 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 // 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 6eea40c239f09..c7a7febd09044 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 // 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 cd06bbb545dd5..c6cd8d9f980aa 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 // 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 8a42861a0be07..b88ceb7240c26 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 // 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 8caaf2295c0a1..22bceb8e177e9 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 // 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 bd12344ab4c57..174bddb56d53c 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 // 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 9b5b872bb3596..3ff5a5f4d690f 100644 --- a/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp index 2449a5f250398..360e7a981a0df 100644 --- a/libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp +++ b/libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp @@ -10,7 +10,7 @@ // Make sure that std::span's iterators check for OOB accesses when the debug mode is enabled. // REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators -// UNSUPPORTED: libcpp-hardening-mode=unchecked +// UNSUPPORTED: libcpp-hardening-mode=none #include 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 94cc7d002b8df..c268ae51e79ac 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 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 cf9a88c20c90b..3c800e9f2fdf9 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 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 74d362f7783fa..f1b7d2183625b 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 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 cd40afad7f21e..18ed7ce213b90 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 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 4fbc8ef50fb42..d15b024149775 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 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 5331103ca7672..588123af6499b 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 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 af00fb9b69699..8a74739c79ddf 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 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 c9c72fbc8b0d5..01d5658291f1d 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 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 69312bab89116..4e6587443c6a7 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 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 6b3a59c7142ea..52e4fe9ecc5c7 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 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 e12e0fc7280d1..135f5e5f297f7 100644 --- a/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/assert.deallocate.pass.cpp +++ b/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/assert.deallocate.pass.cpp @@ -14,7 +14,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS diff --git a/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp b/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp index 99b1ad6e6957a..caee61e6a9b05 100644 --- a/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp +++ b/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp @@ -14,7 +14,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS diff --git a/libcxx/test/libcxx/iterators/assert.advance.pass.cpp b/libcxx/test/libcxx/iterators/assert.advance.pass.cpp index 4fe78cc3ff116..b7e6962b443ef 100644 --- a/libcxx/test/libcxx/iterators/assert.advance.pass.cpp +++ b/libcxx/test/libcxx/iterators/assert.advance.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/libcxx/iterators/assert.next.pass.cpp b/libcxx/test/libcxx/iterators/assert.next.pass.cpp index 2bf2e5702b6d0..da4f4ea3150c3 100644 --- a/libcxx/test/libcxx/iterators/assert.next.pass.cpp +++ b/libcxx/test/libcxx/iterators/assert.next.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/libcxx/iterators/assert.prev.pass.cpp b/libcxx/test/libcxx/iterators/assert.prev.pass.cpp index a8600e51eb81d..6a71cad9ef048 100644 --- a/libcxx/test/libcxx/iterators/assert.prev.pass.cpp +++ b/libcxx/test/libcxx/iterators/assert.prev.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp b/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp index 3bded601f77af..095e8a8fef6ef 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 diff --git a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp index 3ae95c8910a92..0dc280bf28182 100644 --- a/libcxx/test/libcxx/odr_signature.hardening.sh.cpp +++ b/libcxx/test/libcxx/odr_signature.hardening.sh.cpp @@ -6,48 +6,43 @@ // //===----------------------------------------------------------------------===// -// TODO: Remove these UNSUPPORTED lines once we change how hardening is enabled to avoid -// mutually exclusive modes being enabled at the same time. -// UNSUPPORTED: libcpp-hardening-mode=hardened -// UNSUPPORTED: libcpp-hardening-mode=safe -// UNSUPPORTED: libcpp-hardening-mode=debug - // TODO: Investigate // XFAIL: msvc // Test that we encode the hardening mode in an ABI tag to avoid ODR violations // when linking TUs that have different values for it. -// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU1 -D_LIBCPP_ENABLE_HARDENED_MODE -o %t.tu1.o -// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -D_LIBCPP_ENABLE_SAFE_MODE -o %t.tu2.o -// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -D_LIBCPP_ENABLE_DEBUG_MODE -o %t.tu3.o -// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -o %t.tu4.o -// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DMAIN -o %t.main.o +// Note that GCC doesn't support `-Wno-macro-redefined`. +// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU1 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -o %t.tu1.o +// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -o %t.tu2.o +// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -o %t.tu3.o +// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -o %t.tu4.o +// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DMAIN -o %t.main.o // RUN: %{cxx} %t.tu1.o %t.tu2.o %t.tu3.o %t.tu4.o %t.main.o %{flags} %{link_flags} -o %t.exe // RUN: %{exec} %t.exe -// hardened mode +// fast hardening mode #ifdef TU1 # include <__config> _LIBCPP_HIDE_FROM_ABI inline int f() { return 1; } int tu1() { return f(); } #endif // TU1 -// safe mode +// extensive hardening mode #ifdef TU2 # include <__config> _LIBCPP_HIDE_FROM_ABI inline int f() { return 2; } int tu2() { return f(); } #endif // TU2 -// debug mode +// debug hardening mode #ifdef TU3 # include <__config> _LIBCPP_HIDE_FROM_ABI inline int f() { return 3; } int tu3() { return f(); } #endif // TU3 -// unchecked mode +// No hardening #ifdef TU4 # include <__config> _LIBCPP_HIDE_FROM_ABI inline int f() { return 4; } diff --git a/libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp b/libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp index dcca2dff79e76..a2b11fb54ed9d 100644 --- a/libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp +++ b/libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp @@ -13,7 +13,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-exceptions -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 a15c5bacadb04..86ee2841f249e 100644 --- a/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp +++ b/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // 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 e72900bdb4eb0..d4a3bbc513c49 100644 --- a/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp +++ b/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // 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 2b26320812466..6d4e541d98906 100644 --- a/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp +++ b/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // REQUIRES: has-unix-headers // XFAIL: availability-verbose_abort-missing diff --git a/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp b/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp index a648e41c78d75..2e9c74bc35978 100644 --- a/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp +++ b/libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // REQUIRES: has-unix-headers // XFAIL: availability-verbose_abort-missing diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/assert.back.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/assert.back.pass.cpp index 9c6d49af7883e..42beb28c47b13 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 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 7a89d06d24741..7a3d3e1661636 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 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 30dc29a951c7b..66432dc099b5f 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 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 2b4072826fd60..41bb48b6f574c 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 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 e75908ee07c13..1033e17961b24 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 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 95701314faf8e..776bba32da184 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 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 8c6d704a684b5..0b4cb9db51c94 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 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 1bdf3af367430..2bab67bdc3edc 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 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 9eb12cbe07bd3..addcae5ec1863 100644 --- a/libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp +++ b/libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // Construct a string_view from an invalid length diff --git a/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp b/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp index 37d1f21cf3082..b38e0585d0312 100644 --- a/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp +++ b/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // Construct a string_view from a null pointer diff --git a/libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp b/libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp index 3dc998a458a12..5064319a0aee1 100644 --- a/libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp +++ b/libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp @@ -9,7 +9,7 @@ // Make sure that std::string_view's iterators check for OOB accesses when the debug mode is enabled. // REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators -// UNSUPPORTED: libcpp-hardening-mode=unchecked +// UNSUPPORTED: libcpp-hardening-mode=none #include 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 0796e7dd36bf0..fe7b3616b5a76 100644 --- a/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception.pass.cpp +++ b/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, no-threads -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // 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 7e2c14ef64d47..f28db8caba949 100644 --- a/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp +++ b/libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, no-threads -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // 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 f9b0891548dd0..58bc4b844eb59 100644 --- a/libcxx/test/libcxx/thread/thread.barrier/assert.arrive.pass.cpp +++ b/libcxx/test/libcxx/thread/thread.barrier/assert.arrive.pass.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: no-threads // UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing diff --git a/libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp b/libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp index 25a2e6a099cd7..3af43bdbe7b13 100644 --- a/libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp +++ b/libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: no-threads // UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing diff --git a/libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp b/libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp index 4a9ccadd7c255..442ae0d962631 100644 --- a/libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp +++ b/libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp @@ -17,7 +17,7 @@ // Make sure that calling arrive_and_wait with a negative value triggers an assertion. // REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 67185b11a4069..1547dd6390d6c 100644 --- a/libcxx/test/libcxx/thread/thread.latch/assert.count_down.pass.cpp +++ b/libcxx/test/libcxx/thread/thread.latch/assert.count_down.pass.cpp @@ -18,7 +18,7 @@ // higher than the internal counter triggers an assertion. // REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 5cd1272d44ff2..b20911e0c3b9f 100644 --- a/libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp +++ b/libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp @@ -17,7 +17,7 @@ // Make sure that calling latch with a negative value triggers an assertion // REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing #include 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 5a3b87814cb3d..91b1e35429088 100644 --- a/libcxx/test/libcxx/thread/thread.semaphore/assert.ctor.pass.cpp +++ b/libcxx/test/libcxx/thread/thread.semaphore/assert.ctor.pass.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: no-threads // UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing diff --git a/libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp b/libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp index b4219d339234c..09b4de3665359 100644 --- a/libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp +++ b/libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: no-threads // UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing diff --git a/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp b/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp index dc5fb946850ac..8c14b84278cb4 100644 --- a/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp +++ b/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // ADDITIONAL_COMPILE_FLAGS: -fno-exceptions diff --git a/libcxx/test/libcxx/utilities/expected/expected.expected/assert.arrow.pass.cpp b/libcxx/test/libcxx/utilities/expected/expected.expected/assert.arrow.pass.cpp index 2ee77234687af..27dcdfe951230 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 4fc3f358389bb..01078ac27e96a 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 7c1f417ea428c..ff574b350cc9e 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 5cc2874a6be80..e5d7ac3eae698 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 9f5f07e6475ea..7bf4844b29b01 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 60c4686511158..2ba5f299bc34e 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 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 ebccf6545e104..f93569979d188 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 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 fdc3d3acc80f2..07e56e73b6f34 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.clamp/assert.ranges_clamp.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.clamp/assert.ranges_clamp.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp index 9dd749cf49619..539e234750e00 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp @@ -108,7 +108,7 @@ constexpr bool test() { return value; }; assert(std::ranges::clamp(3, 2, 4, std::ranges::less{}, projection_function) == 3); -#if !(defined(_LIBCPP_ENABLE_SAFE_MODE) || defined(_LIBCPP_ENABLE_DEBUG_MODE)) +#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_EXTENSIVE && _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG assert(counter <= 3); #endif } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp index bb6ff68a4a85a..b6b6babafba1b 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // 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 eb540d6c6428f..ba55c14bf5590 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.ranges_pop_heap.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.ranges_pop_heap.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // 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 47b4f3bb19329..dbf7b53406951 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 245d163f984c1..3076474765af4 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/ranges_sort_heap.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/ranges_sort_heap.pass.cpp @@ -245,7 +245,7 @@ void test_complexity() { std::ranges::sort_heap(first, last, &MyInt::Comp); LIBCPP_ASSERT(stats.copied == 0); LIBCPP_ASSERT(stats.moved <= 2 * n + n * logn); -#if !_LIBCPP_ENABLE_DEBUG_MODE +#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG LIBCPP_ASSERT(stats.compared <= n * logn); (void)debug_comparisons; #else diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp index c82ad2623ee8b..0a35fad40e89a 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(N)-1); assert(ia[N-1] == 0); assert(std::is_sorted(ia, ia+N, std::greater())); -#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 dd413cfbaa2a9..d3c2814d642a7 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( std::array{0, 1, 2}, std::array{0, 1, 2, 3}, compare_last_digit_counting, std::strong_ordering::less); -#if !_LIBCPP_ENABLE_DEBUG_MODE +#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG assert(compare_invocation_count <= 3); #else assert(compare_invocation_count <= 6); diff --git a/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp b/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp index 12c45f83c13c8..112b687cb17e2 100644 --- a/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp +++ b/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{safe|debug}} +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} // XFAIL: availability-verbose_abort-missing // Make sure that reaching std::unreachable() with assertions enabled triggers an assertion. diff --git a/libcxx/test/support/container_debug_tests.h b/libcxx/test/support/container_debug_tests.h index 07db855e58dc4..c35da37a87da6 100644 --- a/libcxx/test/support/container_debug_tests.h +++ b/libcxx/test/support/container_debug_tests.h @@ -14,7 +14,7 @@ #error This header may only be used for libc++ tests #endif -#if !_LIBCPP_ENABLE_DEBUG_MODE +#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG #error The library must be built with the debug mode enabled in order to use this header #endif diff --git a/libcxx/test/support/test.support/test_check_assertion.pass.cpp b/libcxx/test/support/test.support/test_check_assertion.pass.cpp index 53fd197508c8a..7cf0e0966ce89 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 diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml index 41b3d27d48f7f..c2537618c56be 100644 --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -404,8 +404,8 @@ steps: limit: 2 timeout_in_minutes: 120 - - label: "Hardened mode" - command: "libcxx/utils/ci/run-buildbot generic-hardened-mode" + - label: "Fast hardening mode" + command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-fast" artifact_paths: - "**/test-results.xml" - "**/*.abilist" @@ -422,8 +422,8 @@ steps: limit: 2 timeout_in_minutes: 120 - - label: "Hardened mode with ABI breaks" - command: "libcxx/utils/ci/run-buildbot generic-hardened-mode-with-abi-breaks" + - label: "Fast hardening mode with ABI breaks" + command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-fast-with-abi-breaks" artifact_paths: - "**/test-results.xml" - "**/*.abilist" @@ -440,8 +440,8 @@ steps: limit: 2 timeout_in_minutes: 120 - - label: "Safe mode" - command: "libcxx/utils/ci/run-buildbot generic-safe-mode" + - label: "Extensive hardening mode" + command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-extensive" artifact_paths: - "**/test-results.xml" - "**/*.abilist" @@ -461,8 +461,8 @@ steps: limit: 2 timeout_in_minutes: 120 - - label: "Debug mode" - command: "libcxx/utils/ci/run-buildbot generic-debug-mode" + - label: "Debug hardening mode" + command: "libcxx/utils/ci/run-buildbot generic-hardening-mode-debug" artifact_paths: - "**/test-results.xml" - "**/*.abilist" diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot index c4834330d7e31..fe99388a799be 100755 --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -395,27 +395,27 @@ generic-merged) -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in" check-runtimes ;; -generic-hardened-mode) +generic-hardening-mode-fast) clean - generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode.cmake" + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake" check-runtimes check-abi-list ;; -generic-hardened-mode-with-abi-breaks) +generic-hardening-mode-fast-with-abi-breaks) clean - generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode-with-abi-breaks.cmake" + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake" check-runtimes check-abi-list ;; -generic-safe-mode) +generic-hardening-mode-extensive) clean - generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-safe-mode.cmake" + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake" check-runtimes check-abi-list ;; -generic-debug-mode) +generic-hardening-mode-debug) clean - generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-mode.cmake" + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake" check-runtimes check-abi-list ;; @@ -539,7 +539,7 @@ apple-system-backdeployment-hardened-*) PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}" PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}" PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}" - PARAMS+=";hardening_mode=hardened" + PARAMS+=";hardening_mode=fast" generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \ -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \ diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt index 309bd7c6ca63d..123d06d56e29a 100644 --- a/libcxx/utils/data/ignore_format.txt +++ b/libcxx/utils/data/ignore_format.txt @@ -588,14 +588,6 @@ libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothro libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp libcxx/test/libcxx/assertions/deprecated-link-time-custom-handler.pass.cpp -libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp -libcxx/test/libcxx/assertions/modes/debug.pass.cpp -libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp -libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp -libcxx/test/libcxx/assertions/modes/hardened.pass.cpp -libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp -libcxx/test/libcxx/assertions/modes/safe.pass.cpp -libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp libcxx/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp libcxx/test/libcxx/atomics/atomics.order/memory_order.underlying_type.pass.cpp diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py index 2ead641354e58..23f9ed2f3744b 100644 --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -287,17 +287,18 @@ def getStdFlag(cfg, std): ), Parameter( name="hardening_mode", - choices=["unchecked", "hardened", "safe", "debug"], + choices=["none", "fast", "extensive", "debug"], type=str, - default="unchecked", + default="none", help="Whether to enable one of the hardening modes when compiling the test suite. This is only " "meaningful when running the tests against libc++.", actions=lambda hardening_mode: filter( None, [ - AddCompileFlag("-D_LIBCPP_ENABLE_HARDENED_MODE=1") if hardening_mode == "hardened" else None, - AddCompileFlag("-D_LIBCPP_ENABLE_SAFE_MODE=1") if hardening_mode == "safe" else None, - AddCompileFlag("-D_LIBCPP_ENABLE_DEBUG_MODE=1") if hardening_mode == "debug" else None, + AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE") if hardening_mode == "none" else None, + AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST") if hardening_mode == "fast" else None, + AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE") if hardening_mode == "extensive" else None, + AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG") if hardening_mode == "debug" else None, AddFeature("libcpp-hardening-mode={}".format(hardening_mode)), ], ),