diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -48,10 +48,6 @@ include(HandleCompilerRT) # Basic options --------------------------------------------------------------- -option(LIBCXX_ENABLE_ASSERTIONS - "Enable assertions inside the compiled library, and at the same time make it the - default when compiling user code. Note that assertions can be enabled or disabled - by users in their own code regardless of this option." OFF) option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) option(LIBCXX_ENABLE_FILESYSTEM @@ -777,11 +773,6 @@ config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE) config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS) config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) -if (LIBCXX_ENABLE_ASSERTIONS) - config_define(1 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT) -else() - config_define(0 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT) -endif() if (LIBCXX_HARDENING_MODE STREQUAL "hardened") config_define(1 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT) config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT) @@ -792,6 +783,11 @@ config_define(0 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT) config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT) endif() +# TODO(LLVM 18): Remove this after branching for LLVM 17, this is a simple +# courtesy for vendors to be notified about this change. +if (LIBCXX_ENABLE_ASSERTIONS) + message(FATAL_ERROR "LIBCXX_ENABLE_ASSERTIONS has been replaced by LIBCXX_HARDENING_MODE=hardened") +endif() if (LIBCXX_PSTL_CPU_BACKEND STREQUAL "serial") config_define(1 _LIBCPP_PSTL_CPU_BACKEND_SERIAL) diff --git a/libcxx/cmake/caches/AIX.cmake b/libcxx/cmake/caches/AIX.cmake --- a/libcxx/cmake/caches/AIX.cmake +++ b/libcxx/cmake/caches/AIX.cmake @@ -6,7 +6,6 @@ set(CMAKE_AR "/usr/bin/ar" CACHE FILEPATH "") set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") -set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "") set(LIBCXX_ABI_VERSION "1" CACHE STRING "") set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "") set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "") diff --git a/libcxx/cmake/caches/Apple.cmake b/libcxx/cmake/caches/Apple.cmake --- a/libcxx/cmake/caches/Apple.cmake +++ b/libcxx/cmake/caches/Apple.cmake @@ -2,7 +2,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE OFF CACHE BOOL "") set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") -set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "") set(LIBCXX_ABI_VERSION "1" CACHE STRING "") set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "") set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "") diff --git a/libcxx/cmake/caches/FreeBSD.cmake b/libcxx/cmake/caches/FreeBSD.cmake --- a/libcxx/cmake/caches/FreeBSD.cmake +++ b/libcxx/cmake/caches/FreeBSD.cmake @@ -1,7 +1,6 @@ set(CMAKE_BUILD_TYPE Release CACHE STRING "") set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "") -set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "") set(LIBCXX_ABI_VERSION "1" CACHE STRING "") set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "") set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "") diff --git a/libcxx/cmake/caches/Generic-assertions.cmake b/libcxx/cmake/caches/Generic-assertions.cmake deleted file mode 100644 --- a/libcxx/cmake/caches/Generic-assertions.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(LIBCXX_ENABLE_ASSERTIONS ON CACHE BOOL "") -set(LIBCXXABI_ENABLE_ASSERTIONS ON CACHE BOOL "") diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst --- a/libcxx/docs/BuildingLibcxx.rst +++ b/libcxx/docs/BuildingLibcxx.rst @@ -211,15 +211,6 @@ Toggle the installation of the libc++ headers. -.. option:: LIBCXX_ENABLE_ASSERTIONS:BOOL - - **Default**: ``OFF`` - - Build libc++ with assertions enabled in the compiled library, and enable assertions - by default when building user code as well. Assertions can be turned off by users - by defining ``_LIBCPP_ENABLE_ASSERTIONS=0``. For details, see - :ref:`the documentation `. - .. option:: LIBCXX_ENABLE_SHARED:BOOL **Default**: ``ON`` diff --git a/libcxx/docs/HardenedMode.rst b/libcxx/docs/HardenedMode.rst --- a/libcxx/docs/HardenedMode.rst +++ b/libcxx/docs/HardenedMode.rst @@ -20,21 +20,34 @@ checks that may affect the complexity of algorithms. The debug mode is intended to be used for testing, not in production. -Vendors can set the default hardened mode by using the ``LIBCXX_HARDENING_MODE`` -CMake variable. Setting ``LIBCXX_HARDENING_MODE`` to ``hardened`` enables the -hardened mode, and similarly setting the variable to ``debug`` enables the debug -mode. The default value is ``unchecked`` which doesn't enable the hardened mode. -Users can control whether the hardened mode or the debug mode is enabled -on a per translation unit basis by setting the ``_LIBCPP_ENABLE_HARDENED_MODE`` -or ``_LIBCPP_ENABLE_DEBUG_MODE`` macro to ``1``. - -The hardened mode requires ``LIBCXX_ENABLE_ASSERTIONS`` to work. If -``LIBCXX_ENABLE_ASSERTIONS`` was not set explicitly, enabling the hardened mode -(or the debug mode) will implicitly enable ``LIBCXX_ENABLE_ASSERTIONS``. If -``LIBCXX_ENABLE_ASSERTIONS`` was explicitly disabled, this will effectively -disable the hardened mode. - -Enabling the hardened mode (or the debug mode) has no impact on the ABI. +Vendors can set the default hardening mode by using the +``LIBCXX_HARDENING_MODE`` variable at CMake configuration time. Setting +``LIBCXX_HARDENING_MODE`` to ``hardened`` enables the hardened mode, and +similarly setting the variable to ``debug`` enables the debug mode. The default +value is ``unchecked`` which doesn't enable any hardening. + +When hardening is enabled, the compiled library is built with the corresponding +mode enabled, **and** user code will be built with the same mode enabled by +default. If the mode is set to "unchecked" 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_DEBUG_MODE=0|1``) +before including any libc++ header (we recommend passing +``-D_LIBCPP_ENABLE_HARDENED_MODE=X`` or ``-D_LIBCPP_ENABLE_DEBUG_MODE=X`` 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_MODE`` or ``_LIBCPP_ENABLE_DEBUG_MODE`` (if any) will +usually be respected. + +Enabling hardening has no impact on the ABI. Iterator bounds checking ------------------------ diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -88,6 +88,11 @@ Deprecations and Removals ------------------------- +- The "safe" mode is replaced by the hardened mode in this release. The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable is + deprecated and setting it will trigger an error; use ``LIBCXX_HARDENING_MODE`` instead. Similarly, the + ``_LIBCPP_ENABLE_ASSERTIONS`` macro is deprecated and setting it to ``1`` now enables the hardened mode. See + ``libcxx/docs/HardenedMode.rst`` for more details. + - The legacy debug mode has been removed in this release. Setting the macro ``_LIBCPP_ENABLE_DEBUG_MODE`` to ``1`` now enables the new debug mode which is part of hardening (see the "Improvements and New Features" section above). The ``LIBCXX_ENABLE_DEBUG_MODE`` CMake variable has been removed. For additional context, refer to the `Discourse post diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -138,53 +138,32 @@ If you would prefer to not use that flag, then you can replace ``/path/to/include-what-you-use/share/libcxx.imp``` file with the libc++-provided ``libcxx.imp`` file. -.. _assertions-mode: - -Enabling the "safe libc++" mode -=============================== - -Libc++ contains a number of assertions whose goal is to catch undefined behavior in the -library, usually caused by precondition violations. Those assertions do not aim to be -exhaustive -- instead they aim to provide a good balance between safety and performance. -In particular, these assertions do not change the complexity of algorithms. However, they -might, in some cases, interfere with compiler optimizations. - -By default, these assertions are turned off. Vendors can decide to turn them on while building -the compiled library by defining ``LIBCXX_ENABLE_ASSERTIONS=ON`` at CMake configuration time. -When ``LIBCXX_ENABLE_ASSERTIONS`` is used, the compiled library will be built with assertions -enabled, **and** user code will be built with assertions enabled by default. If -``LIBCXX_ENABLE_ASSERTIONS=OFF`` at CMake configure time, the compiled library will not contain -assertions and the default when building user code will be to have assertions disabled. -As a user, you can consult your vendor to know whether assertions are enabled by default. - -Furthermore, independently of any vendor-selected default, users can always control whether -assertions are enabled in their code by defining ``_LIBCPP_ENABLE_ASSERTIONS=0|1`` before -including any libc++ header (we recommend passing ``-D_LIBCPP_ENABLE_ASSERTIONS=X`` to the -compiler). Note that if the compiled library was built by the vendor without assertions, -functions compiled inside the static or shared library won't have assertions enabled even -if the user defines ``_LIBCPP_ENABLE_ASSERTIONS=1`` (the same is true for the inverse case -where the static or shared library was compiled **with** assertions but the user tries to -disable them). However, most of the code in libc++ is in the headers, so the user-selected -value for ``_LIBCPP_ENABLE_ASSERTIONS`` (if any) will usually be respected. - -When an assertion fails, the program is aborted through a special verbose termination function. The -library provides a default function that prints an error message and calls ``std::abort()``. Note -that this function is provided by the static or shared library, so it is only available when deploying -to a platform where the compiled library is sufficiently recent. On older platforms, the program will -terminate in an unspecified unsuccessful manner, but the quality of diagnostics won't be great. +.. _termination-handler: + +Overriding the default termination handler +========================================== + +When the library wants to terminate due to an unforeseen condition (such as a hardening assertion +failure), the program is aborted through a special verbose termination function. The library provides +a default function that prints an error message and calls ``std::abort()``. Note that this function is +provided by the static or shared library, so it is only available when deploying to a platform where +the compiled library is sufficiently recent. On older platforms, the program will terminate in an +unspecified unsuccessful manner, but the quality of diagnostics won't be great. + However, users can also override that mechanism at two different levels. First, the mechanism can be -overridden at compile-time by defining the ``_LIBCPP_VERBOSE_ABORT(format, args...)`` variadic macro. +overridden at compile time by defining the ``_LIBCPP_VERBOSE_ABORT(format, args...)`` variadic macro. When that macro is defined, it will be called with a format string as the first argument, followed by a series of arguments to format using printf-style formatting. Compile-time customization may be -interesting to get precise control over code generation, however it is also inconvenient to use in +useful to get precise control over code generation, however it is also inconvenient to use in some cases. Indeed, compile-time customization of the verbose termination function requires that all translation units be compiled with a consistent definition for ``_LIBCPP_VERBOSE_ABORT`` to avoid ODR violations, which can add complexity in the build system of users. Otherwise, if compile-time customization is not necessary, link-time customization of the handler is also possible, similarly to how replacing ``operator new`` works. This mechanism trades off fine-grained control -over the call site where the termination is initiated in exchange for more ergonomics. Link-time customization -is done by simply defining the following function in exactly one translation unit of your program: +over the call site where the termination is initiated in exchange for better ergonomics. Link-time +customization is done by simply defining the following function in exactly one translation unit of your +program: .. code-block:: cpp @@ -212,7 +191,7 @@ int main() { std::vector v; - int& x = v[0]; // Your termination function will be called here if _LIBCPP_ENABLE_ASSERTIONS=1 + int& x = v[0]; // Your termination function will be called here if hardening is enabled. } Also note that the verbose termination function should never return. Since assertions in libc++ @@ -227,14 +206,20 @@ =========================== Libc++ provides a number of configuration macros which can be used to enable -or disable extended libc++ behavior, including enabling "debug mode" or -thread safety annotations. +or disable extended libc++ behavior, including enabling hardening or thread +safety annotations. **_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS**: This macro is used to enable -Wthread-safety annotations on libc++'s ``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_DEBUG_MODE**: + This macro is used to enable the :ref:`debug mode `. + **_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS**: This macro is used to disable all visibility annotations inside libc++. Defining this macro and then building libc++ with hidden visibility gives a diff --git a/libcxx/include/__assert b/libcxx/include/__assert --- a/libcxx/include/__assert +++ b/libcxx/include/__assert @@ -17,31 +17,21 @@ # pragma GCC system_header #endif -#ifndef _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS_DEFAULT -#endif - -#if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1 -# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1" -#endif +#define _LIBCPP_ASSERT(expression, message) \ + (__builtin_expect(static_cast(expression), 1) \ + ? (void)0 \ + : _LIBCPP_VERBOSE_ABORT( \ + "%s:%d: assertion %s failed: %s\n", __builtin_FILE(), __builtin_LINE(), #expression, message)) -#if _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ASSERT(expression, message) \ - (__builtin_expect(static_cast(expression), 1) \ - ? (void)0 \ - : _LIBCPP_VERBOSE_ABORT( \ - "%s:%d: assertion %s failed: %s\n", __builtin_FILE(), __builtin_LINE(), #expression, message)) // TODO: __builtin_assume can currently inhibit optimizations. Until this has been fixed and we can add // assumptions without a clear optimization intent, disable that to avoid worsening the code generation. // See https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609 for a discussion. -#elif 0 && __has_builtin(__builtin_assume) -# define _LIBCPP_ASSERT(expression, message) \ +#if 0 && __has_builtin(__builtin_assume) +# define _LIBCPP_ASSUME(expression) \ (_LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wassume") \ __builtin_assume(static_cast(expression)) _LIBCPP_DIAGNOSTIC_POP) #else -# define _LIBCPP_ASSERT(expression, message) ((void)0) +# define _LIBCPP_ASSUME(expression) ((void)0) #endif -#define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) - #endif // _LIBCPP___ASSERT diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -208,6 +208,19 @@ // HARDENING { +// TODO(hardening): remove this in LLVM 18. +// This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes) +// equivalent to setting the hardened mode. +# ifdef _LIBCPP_ENABLE_ASSERTIONS +# warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_ENABLE_HARDENED_MODE instead." +# 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_HARDENED_MODE 1 +# 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_DEBUG_MODE`. @@ -245,26 +258,21 @@ // Hardened mode checks. # if _LIBCPP_ENABLE_HARDENED_MODE -// Automatically enable assertions in hardened mode (unless the user explicitly turned them off). -# ifndef _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_ASSERTIONS 1 -# endif - +// TODO(hardening): Once we categorize assertions, only enable the ones that we really want here. +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) // TODO(hardening): more checks to be added here... // Debug mode checks. # elif _LIBCPP_ENABLE_DEBUG_MODE -// Automatically enable assertions in debug mode (unless the user explicitly turned them off). -# ifndef _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_ASSERTIONS 1 -# endif - +// TODO(hardening): Once we categorize assertions, only enable the ones that we really want here. +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) // TODO(hardening): more checks to be added here... // Disable all checks if neither the hardened mode nor the debug mode is enabled. # else +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) // TODO: more checks to be added here... # endif // _LIBCPP_ENABLE_HARDENED_MODE diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in --- a/libcxx/include/__config_site.in +++ b/libcxx/include/__config_site.in @@ -28,7 +28,6 @@ #cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE #cmakedefine _LIBCPP_HAS_NO_LOCALIZATION #cmakedefine _LIBCPP_HAS_NO_WIDE_CHARACTERS -#cmakedefine01 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT // PSTL backends #cmakedefine _LIBCPP_PSTL_CPU_BACKEND_SERIAL diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt --- a/libcxx/test/CMakeLists.txt +++ b/libcxx/test/CMakeLists.txt @@ -24,10 +24,6 @@ serialize_lit_param(enable_rtti False) endif() -if (LIBCXX_ENABLE_ASSERTIONS) - serialize_lit_param(enable_assertions True) -endif() - serialize_lit_param(hardening_mode "\"${LIBCXX_HARDENING_MODE}\"") if (CMAKE_CXX_COMPILER_TARGET) 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 --- 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,8 +10,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #include diff --git a/libcxx/test/libcxx/algorithms/alg.sorting/assert.sort.invalid_comparator.pass.cpp b/libcxx/test/libcxx/algorithms/alg.sorting/assert.sort.invalid_comparator.pass.cpp --- a/libcxx/test/libcxx/algorithms/alg.sorting/assert.sort.invalid_comparator.pass.cpp +++ b/libcxx/test/libcxx/algorithms/alg.sorting/assert.sort.invalid_comparator.pass.cpp @@ -10,8 +10,9 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_LIBCPP_DEBUG_STRICT_WEAK_ORDERING_CHECK +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_STRICT_WEAK_ORDERING_CHECK // When the debug mode is enabled, this test fails because we actually catch on the fly that the comparator is not // a strict-weak ordering before we catch that we'd dereference out-of-bounds inside std::sort, which leads to different // errors than the ones tested below. diff --git a/libcxx/test/libcxx/assertions/assertions_disabled.pass.cpp b/libcxx/test/libcxx/assertions/assertions_disabled.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/assertions/assertions_disabled.pass.cpp +++ /dev/null @@ -1,24 +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 -// -//===----------------------------------------------------------------------===// - -// Test that _LIBCPP_ASSERT doesn't do anything when assertions are disabled. -// We need to use -Wno-macro-redefined because the test suite defines -// _LIBCPP_ENABLE_ASSERTIONS=1 under some configurations. - -// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=0 - -#include - -bool executed_condition = false; -bool f() { executed_condition = true; return false; } - -int main(int, char**) { - _LIBCPP_ASSERT(f(), "message"); // should not execute anything - assert(!executed_condition); // really make sure we did not execute anything at all - return 0; -} diff --git a/libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp b/libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp --- a/libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp +++ b/libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp @@ -13,7 +13,7 @@ // defining _LIBCPP_VERBOSE_ABORT ourselves. Note that this does not have any // deployment target requirements. -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_LIBCPP_VERBOSE_ABORT(...)=my_abort(__VA_ARGS__) +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_VERBOSE_ABORT(...)=my_abort(__VA_ARGS__) #include diff --git a/libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp b/libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp --- a/libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp +++ b/libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp @@ -8,8 +8,6 @@ // Test that we can set a custom verbose termination function at link-time. -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 - // We flag uses of the verbose termination function in older dylibs at compile-time to avoid runtime // failures when back-deploying. // XFAIL: availability-verbose_abort-missing diff --git a/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp b/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp --- a/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp +++ b/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp @@ -8,8 +8,6 @@ // Test that the default verbose termination function aborts the program. -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 - #include #include diff --git a/libcxx/test/libcxx/assertions/deprecated-link-time-custom-handler.pass.cpp b/libcxx/test/libcxx/assertions/deprecated-link-time-custom-handler.pass.cpp --- a/libcxx/test/libcxx/assertions/deprecated-link-time-custom-handler.pass.cpp +++ b/libcxx/test/libcxx/assertions/deprecated-link-time-custom-handler.pass.cpp @@ -11,7 +11,7 @@ // Make sure that we still support _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED for folks // who customize the verbose termination function at link-time in back-deployment environments. -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED // We emit a #warning about the deprecation of this setting, so make sure we don't turn that into an error. // ADDITIONAL_COMPILE_FLAGS: -Wno-error 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 --- 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 @@ -8,9 +8,7 @@ // This test ensures that we can disable the debug mode on a per-TU basis regardless of how the library was built. -// TODO(hardening): currently, explicitly enabling assertions enables all uncategorized assertions and overrides -// disabling the debug mode. -// UNSUPPORTED: libcpp-has-hardened-mode, libcpp-has-assertions +// UNSUPPORTED: libcpp-has-hardened-mode // ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_DEBUG_MODE=0 #include 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 --- 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 @@ -10,10 +10,8 @@ // Hardened mode would additionally trigger the error that hardened and debug modes are mutually exclusive. // UNSUPPORTED: libcpp-has-hardened-mode -// `check_assertion.h` is only available starting from C++11. -// UNSUPPORTED: c++03 -// `check_assertion.h` requires Unix headers. -// REQUIRES: has-unix-headers +// `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 diff --git a/libcxx/test/libcxx/assertions/modes/debug_no_assertions.pass.cpp b/libcxx/test/libcxx/assertions/modes/debug_no_assertions.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/assertions/modes/debug_no_assertions.pass.cpp +++ /dev/null @@ -1,21 +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 -// -//===----------------------------------------------------------------------===// - -// Test that we can override whether assertions are enabled regardless of the hardening mode in use. - -// UNSUPPORTED: !libcpp-has-debug-mode -// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=0 - -#include - -int main(int, char**) { - _LIBCPP_ASSERT_UNCATEGORIZED(true, "Should not fire"); - _LIBCPP_ASSERT_UNCATEGORIZED(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/enabling_assertions_enables_hardened_mode.pass.cpp copy from libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp copy to libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_hardened_mode.pass.cpp --- a/libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_hardened_mode.pass.cpp @@ -6,22 +6,24 @@ // //===----------------------------------------------------------------------===// -// This test ensures that we can enable the debug mode on a per-TU basis regardless of how the library was built. +// TODO(hardening): remove in LLVM 18. +// This test ensures that enabling assertions now enables the hardened mode. -// Hardened mode would additionally trigger the error that hardened and debug modes are mutually exclusive. -// UNSUPPORTED: libcpp-has-hardened-mode -// `check_assertion.h` is only available starting from C++11. -// UNSUPPORTED: c++03 -// `check_assertion.h` requires Unix headers. -// REQUIRES: has-unix-headers +// `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 +// Debug mode is mutually exclusive with hardened mode. +// UNSUPPORTED: libcpp-has-debug-mode +// Ignore the warning about `_LIBCPP_ENABLE_ASSERTIONS` being deprecated. +// ADDITIONAL_COMPILE_FLAGS: -Wno-error -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #include "check_assertion.h" int main(int, char**) { + static_assert(_LIBCPP_ENABLE_HARDENED_MODE == 1, "Hardened mode should be implicitly enabled"); + _LIBCPP_ASSERT_UNCATEGORIZED(true, "Should not fire"); TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_UNCATEGORIZED(false, "Should fire"); diff --git a/libcxx/test/libcxx/assertions/modes/hardened.pass.cpp b/libcxx/test/libcxx/assertions/modes/hardened.pass.cpp --- a/libcxx/test/libcxx/assertions/modes/hardened.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/hardened.pass.cpp @@ -14,6 +14,7 @@ // UNSUPPORTED: c++03 // `check_assertion.h` requires Unix headers. // REQUIRES: has-unix-headers +// XFAIL: availability-verbose_abort-missing #include #include "check_assertion.h" diff --git a/libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp b/libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp --- a/libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp @@ -8,9 +8,7 @@ // This test ensures that we can disable the hardened mode on a per-TU basis regardless of how the library was built. -// TODO(hardening): currently, explicitly enabling assertions enables all uncategorized assertions and overrides -// disabling the hardened mode. -// UNSUPPORTED: libcpp-has-debug-mode, libcpp-has-assertions +// UNSUPPORTED: libcpp-has-debug-mode // ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_HARDENED_MODE=0 #include diff --git a/libcxx/test/libcxx/assertions/modes/hardened_no_assertions.pass.cpp b/libcxx/test/libcxx/assertions/modes/hardened_no_assertions.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/assertions/modes/hardened_no_assertions.pass.cpp +++ /dev/null @@ -1,21 +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 -// -//===----------------------------------------------------------------------===// - -// Test that we can override whether assertions are enabled regardless of the hardening mode in use. - -// UNSUPPORTED: !libcpp-has-hardened-mode -// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=0 - -#include - -int main(int, char**) { - _LIBCPP_ASSERT_UNCATEGORIZED(true, "Should not fire"); - _LIBCPP_ASSERT_UNCATEGORIZED(false, "Also should not fire"); - - return 0; -} diff --git a/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp b/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp --- a/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp @@ -13,12 +13,14 @@ #include +bool executed_condition = false; +bool f() { executed_condition = true; return false; } + int main(int, char**) { - // TODO(hardening): remove the `#if` guard once `_LIBCPP_ENABLE_ASSERTIONS` no longer affects hardening modes. -#if !_LIBCPP_ENABLE_ASSERTIONS _LIBCPP_ASSERT_UNCATEGORIZED(true, "Should not fire"); _LIBCPP_ASSERT_UNCATEGORIZED(false, "Also should not fire"); -#endif + _LIBCPP_ASSERT_UNCATEGORIZED(f(), "Should not execute anything"); + assert(!executed_condition); // Really make sure we did not execute anything. return 0; } diff --git a/libcxx/test/libcxx/assertions/single_expression.sh.cpp b/libcxx/test/libcxx/assertions/single_expression.pass.cpp rename from libcxx/test/libcxx/assertions/single_expression.sh.cpp rename to libcxx/test/libcxx/assertions/single_expression.pass.cpp --- a/libcxx/test/libcxx/assertions/single_expression.sh.cpp +++ b/libcxx/test/libcxx/assertions/single_expression.pass.cpp @@ -6,17 +6,9 @@ // //===----------------------------------------------------------------------===// -// Make sure that _LIBCPP_ASSERT is a single expression. This is useful so we can use -// it in places that require an expression, such as in a constructor initializer list. - -// RUN: %{build} -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=1 -// RUN: %{run} - -// RUN: %{build} -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=0 -// RUN: %{run} - -// RUN: %{build} -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=0 -D_LIBCPP_ASSERTIONS_DISABLE_ASSUME -// RUN: %{run} +// Make sure that `_LIBCPP_ASSERT` and `_LIBCPP_ASSUME` are each a single expression. +// This is useful so we can use them in places that require an expression, such as +// in a constructor initializer list. #include <__assert> #include @@ -27,7 +19,14 @@ return _LIBCPP_ASSERT(true, "message"); } +void g() { + int i = (_LIBCPP_ASSUME(true), 3); + assert(i == 3); + return _LIBCPP_ASSUME(true); +} + int main(int, char**) { f(); + g(); return 0; } 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // 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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +16,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +17,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +16,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +16,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +17,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +16,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +16,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +17,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +16,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +16,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +17,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +19,8 @@ // Check that we ensure that `[it, sent)` is a valid range. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +16,8 @@ // dynamic_extent version. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +14,8 @@ // Check that we ensure `other.size() == Extent`. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +14,8 @@ // Check that we ensure `size(r) == Extent`. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +14,8 @@ // Make sure that accessing a span out-of-bounds triggers an assertion. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +14,8 @@ // Make sure that accessing a span out-of-bounds triggers an assertion. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +14,8 @@ // Make sure that accessing a span out-of-bounds triggers an assertion. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +14,8 @@ // Make sure that creating a sub-span with an incorrect number of elements triggers an assertion. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +14,8 @@ // Make sure that creating a sub-span with an incorrect number of elements triggers an assertion. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +22,8 @@ // Make sure that creating a sub-span with an incorrect number of elements triggers an assertion. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #include diff --git a/libcxx/test/libcxx/debug/debug.assertions-enabled.compile.pass.cpp b/libcxx/test/libcxx/debug/debug.assertions-enabled.compile.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/debug/debug.assertions-enabled.compile.pass.cpp +++ /dev/null @@ -1,17 +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 assertions are enabled by default when the debug mode is enabled. - -// REQUIRES: libcpp-has-legacy-debug-mode - -#include - -#if !defined(_LIBCPP_ENABLE_ASSERTIONS) || _LIBCPP_ENABLE_ASSERTIONS == 0 -# error "Assertions should be enabled automatically when the debug mode is enabled" -#endif 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 --- 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,9 +14,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 - // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS #include 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 --- 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,9 +14,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 - // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS #include diff --git a/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/assert.iterator.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/assert.iterator.pass.cpp --- a/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/assert.iterator.pass.cpp +++ b/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/assert.iterator.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/libcxx/iterators/assert.advance.pass.cpp b/libcxx/test/libcxx/iterators/assert.advance.pass.cpp --- a/libcxx/test/libcxx/iterators/assert.advance.pass.cpp +++ b/libcxx/test/libcxx/iterators/assert.advance.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/libcxx/iterators/assert.next.pass.cpp b/libcxx/test/libcxx/iterators/assert.next.pass.cpp --- a/libcxx/test/libcxx/iterators/assert.next.pass.cpp +++ b/libcxx/test/libcxx/iterators/assert.next.pass.cpp @@ -7,9 +7,8 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03, !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/libcxx/iterators/assert.prev.pass.cpp b/libcxx/test/libcxx/iterators/assert.prev.pass.cpp --- a/libcxx/test/libcxx/iterators/assert.prev.pass.cpp +++ b/libcxx/test/libcxx/iterators/assert.prev.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp b/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp --- a/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp +++ b/libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp @@ -13,8 +13,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include 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 --- 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,8 +13,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-exceptions +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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 @@ -7,8 +7,9 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, !libcpp-has-legacy-debug-mode -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 +// UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode +// 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 --- 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 @@ -7,8 +7,9 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, !libcpp-has-legacy-debug-mode -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 +// UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode +// 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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +12,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- a/libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp +++ b/libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp @@ -9,8 +9,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // Construct a string_view from an invalid length // constexpr basic_string_view( const _CharT* s, size_type len ) 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 --- a/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp +++ b/libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp @@ -7,11 +7,9 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers -// UNSUPPORTED: c++11, c++14 - -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // Construct a string_view from a null pointer // constexpr basic_string_view( const CharT* s ); 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, no-threads +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, no-threads +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // 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 --- 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,8 +17,8 @@ // Make sure that calling arrive_and_wait with a negative value triggers an assertion. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +18,8 @@ // higher than the internal counter triggers an assertion. // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- a/libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp +++ b/libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp @@ -17,8 +17,8 @@ // Make sure that calling latch with a negative value triggers an assertion // REQUIRES: has-unix-headers +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include 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 --- a/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp +++ b/libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp @@ -6,12 +6,11 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 - // REQUIRES: has-unix-headers +// UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -fno-exceptions -D_LIBCPP_ENABLE_ASSERTIONS=1 - +// ADDITIONAL_COMPILE_FLAGS: -fno-exceptions // ADDITIONAL_COMPILE_FLAGS: -Wno-private-header #include <__utility/exception_guard.h> 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // constexpr const T* operator->() const noexcept; // constexpr T* operator->() 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // constexpr const T& operator*() const & noexcept; // constexpr T& operator*() & 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // constexpr const E& error() const & noexcept; // constexpr E& error() & 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // constexpr const E& error() const & noexcept; // constexpr E& error() & 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 --- 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,8 +15,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #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 --- 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,8 +13,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // 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 --- 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,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.conversion.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/assert.conversion.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.conversion.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/extents/assert.conversion.pass.cpp @@ -6,8 +6,8 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp @@ -6,8 +6,8 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp @@ -6,8 +6,8 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp @@ -6,8 +6,8 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // Test construction from span: // diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.obs.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/assert.obs.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.obs.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/extents/assert.obs.pass.cpp @@ -6,8 +6,8 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.conversion.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/assert.conversion.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.conversion.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_left/assert.conversion.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.stride.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/assert.stride.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.stride.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_left/assert.stride.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.conversion.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/assert.conversion.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.conversion.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_right/assert.conversion.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.stride.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/assert.stride.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.stride.pass.cpp +++ b/libcxx/test/std/containers/views/mdspan/layout_right/assert.stride.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // 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 --- a/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp +++ b/libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp @@ -6,11 +6,10 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - // REQUIRES: has-unix-headers +// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 // Make sure that reaching std::unreachable() with assertions enabled triggers an assertion. diff --git a/libcxx/test/support/test.support/test_check_assertion.pass.cpp b/libcxx/test/support/test.support/test_check_assertion.pass.cpp --- a/libcxx/test/support/test.support/test_check_assertion.pass.cpp +++ b/libcxx/test/support/test.support/test_check_assertion.pass.cpp @@ -8,8 +8,8 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03 +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 #include #include diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -468,24 +468,6 @@ limit: 2 timeout_in_minutes: 120 - - label: "Assertions enabled" - command: "libcxx/utils/ci/run-buildbot generic-assertions" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - label: "Hardened mode" command: "libcxx/utils/ci/run-buildbot generic-hardened-mode" artifact_paths: @@ -929,8 +911,8 @@ limit: 2 timeout_in_minutes: 120 - - label: "Apple back-deployment with assertions enabled" - command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-assertions-11.0" + - label: "Apple back-deployment with hardening enabled" + command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-hardened-11.0" artifact_paths: - "**/test-results.xml" - "**/*.abilist" diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -382,12 +382,6 @@ -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in" check-runtimes ;; -generic-assertions) - clean - generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-assertions.cmake" - check-runtimes - check-abi-list -;; generic-hardened-mode) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode.cmake" @@ -495,7 +489,7 @@ # TODO: It would be better to run the tests against the fake-installed version of libc++ instead xcrun --sdk macosx ninja -vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist ;; -apple-system-backdeployment-assertions-*) +apple-system-backdeployment-hardened-*) clean if [[ "${OSX_ROOTS}" == "" ]]; then @@ -506,7 +500,7 @@ curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}" fi - DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-assertions-}" + DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-hardened-}" # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib, # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the @@ -521,7 +515,7 @@ 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+=";enable_assertions=True" + PARAMS+=";hardening_mode=hardened" generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \ -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \ diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -283,18 +283,6 @@ help="Whether to enable tests that take longer to run. This can be useful when running on a very slow device.", actions=lambda enabled: [] if not enabled else [AddFeature("long_tests")], ), - Parameter( - name="enable_assertions", - choices=[True, False], - type=bool, - default=False, - help="Whether to enable assertions when compiling the test suite. This is only meaningful when " - "running the tests against libc++.", - actions=lambda assertions: [] if not assertions else [ - AddCompileFlag("-D_LIBCPP_ENABLE_ASSERTIONS=1"), - AddFeature("libcpp-has-assertions"), - ], - ), Parameter( name="hardening_mode", choices=["unchecked", "hardened", "debug"],