[libc++] Make the Debug mode a configuration-time only option
The debug mode has been broken pretty much ever since it was shipped
because it was possible to enable the debug mode in user code without
actually enabling it in the dylib, leading to ODR violations that
caused various kinds of failures.
This commit makes the debug mode a knob that is configured when
building the library and which can't be changed afterwards. This is
less flexible for users, however it will actually work as intended
and it will allow us, in the future, to add various kinds of checks
that do not assume the same ABI as the normal library. Furthermore,
this will make the debug mode more robust, which means that vendors
might be more tempted to support it properly, which hasn't been the
case with the current debug mode.
This patch shouldn't break any user code, except folks who are building
against a library that doesn't have the debug mode enabled and who try
to enable the debug mode in their code. Such users will get a compile-time
error explaining that this configuration isn't supported anymore.
In the future, we should further increase the granularity of the debug
mode checks so that we can cherry-pick which checks to enable, like we
do for unspecified behavior randomization.
Differential Revision: https://reviews.llvm.org/D122941
NOKEYCHECK=True
GitOrigin-RevId: f3966eaf869b7bdd9113ab9d5b78469eb0f5f028
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c36b8e6..829e414 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,11 +68,11 @@
${ENABLE_FILESYSTEM_DEFAULT})
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
option(LIBCXX_ENABLE_PARALLEL_ALGORITHMS "Enable the parallel algorithms library. This requires the PSTL to be available." OFF)
-option(LIBCXX_ENABLE_DEBUG_MODE_SUPPORT
- "Whether to include support for libc++'s debugging mode in the library.
- By default, this is turned on. If you turn it off and try to enable the
- debug mode when compiling a program against libc++, it will fail to link
- since the required support isn't provided in the library." ON)
+option(LIBCXX_ENABLE_DEBUG_MODE
+ "Whether to build libc++ with the debug mode enabled.
+ By default, this is turned off. Turning it on results in a different ABI (additional
+ symbols but also potentially different layouts of types), and one should not mix code
+ built against a dylib that has debug mode and code built against a regular dylib." OFF)
option(LIBCXX_ENABLE_RANDOM_DEVICE
"Whether to include support for std::random_device in the library. Disabling
this can be useful when building the library for platforms that don't have
@@ -210,6 +210,13 @@
option(LIBCXX_EXTRA_SITE_DEFINES "Extra defines to add into __config_site")
option(LIBCXX_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
+cmake_dependent_option(LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS
+ "Whether to include the old Debug mode symbols in the compiled library. This
+ is provided for backwards compatibility since the compiled library used to
+ always contain those symbols, regardless of whether the library was built
+ with the debug mode enabled." ON
+ "LIBCXX_ABI_VERSION EQUAL 1" OFF) # Always OFF in ABI version != 1
+
# ABI Library options ---------------------------------------------------------
if (LIBCXX_TARGETING_MSVC)
set(LIBCXX_DEFAULT_ABI_LIBRARY "vcruntime")
@@ -854,6 +861,7 @@
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)
+config_define_if(LIBCXX_ENABLE_DEBUG_MODE _LIBCPP_ENABLE_DEBUG_MODE)
if (LIBCXX_ENABLE_ASSERTIONS)
config_define(1 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT)
else()
diff --git a/cmake/caches/Apple.cmake b/cmake/caches/Apple.cmake
index 4581d4d..db567bd 100644
--- a/cmake/caches/Apple.cmake
+++ b/cmake/caches/Apple.cmake
@@ -9,7 +9,7 @@
set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "")
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
set(LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT ON CACHE BOOL "")
-set(LIBCXX_ENABLE_DEBUG_MODE_SUPPORT OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS OFF CACHE BOOL "")
set(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS ON CACHE BOOL "")
set(LIBCXX_ENABLE_INCOMPLETE_FEATURES OFF CACHE BOOL "")
diff --git a/cmake/caches/Generic-debug-iterators.cmake b/cmake/caches/Generic-debug-iterators.cmake
deleted file mode 100644
index a43f27c..0000000
--- a/cmake/caches/Generic-debug-iterators.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-set(LIBCXX_TEST_PARAMS "debug_level=1" CACHE STRING "")
-set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
diff --git a/cmake/caches/Generic-debug-mode.cmake b/cmake/caches/Generic-debug-mode.cmake
new file mode 100644
index 0000000..1908da9
--- /dev/null
+++ b/cmake/caches/Generic-debug-mode.cmake
@@ -0,0 +1 @@
+set(LIBCXX_ENABLE_DEBUG_MODE ON CACHE BOOL "")
diff --git a/cmake/caches/Generic-no-debug.cmake b/cmake/caches/Generic-no-debug.cmake
deleted file mode 100644
index a62760f..0000000
--- a/cmake/caches/Generic-no-debug.cmake
+++ /dev/null
@@ -1 +0,0 @@
-set(LIBCXX_ENABLE_DEBUG_MODE_SUPPORT OFF CACHE BOOL "")
diff --git a/docs/DesignDocs/DebugMode.rst b/docs/DesignDocs/DebugMode.rst
index b792251..9d0e78e 100644
--- a/docs/DesignDocs/DebugMode.rst
+++ b/docs/DesignDocs/DebugMode.rst
@@ -12,35 +12,33 @@
Libc++ provides a debug mode that enables special debugging checks meant to detect
incorrect usage of the standard library. These checks are disabled by default, but
-they can be enabled using the ``_LIBCPP_DEBUG`` macro.
+they can be enabled by vendors when building the library by using ``LIBCXX_ENABLE_DEBUG_MODE``.
-Note that using the debug mode discussed in this document requires that the library
-has been compiled with support for the debug mode (see ``LIBCXX_ENABLE_DEBUG_MODE_SUPPORT``).
+Since the debug mode has ABI implications, users should compile their whole program,
+including any dependent libraries, against a Standard library configured identically
+with respect to the debug mode. In other words, they should not mix code built against
+a Standard library with the debug mode enabled with code built against a Standard library
+where the debug mode is disabled.
-Also note that while the debug mode has no effect on libc++'s ABI, it does have broad ODR
-implications. Users should compile their whole program at the same debugging level.
+Furthermore, users should not rely on a stable ABI being provided when the debug mode is
+enabled -- we reserve the right to change the ABI at any time. If you need a stable ABI
+and still want some level of hardening, you should look into enabling :ref:`assertions <assertions-mode>`
+instead.
-The various levels of checking provided by the debug mode follow.
+The debug mode provides various checks to aid application debugging.
-No debugging checks (``_LIBCPP_DEBUG`` not defined)
----------------------------------------------------
-When ``_LIBCPP_DEBUG`` is not defined, there are no debugging checks performed by
-the library. This is the default.
-
-Comparator consistency checks (``_LIBCPP_DEBUG == 1``)
-------------------------------------------------------
+Comparator consistency checks
+-----------------------------
Libc++ provides some checks for the consistency of comparators passed to algorithms. Specifically,
many algorithms such as ``binary_search``, ``merge``, ``next_permutation``, and ``sort``, wrap the
user-provided comparator to assert that `!comp(y, x)` whenever `comp(x, y)`. This can cause the
user-provided comparator to be evaluated up to twice as many times as it would be without the
debug mode, and causes the library to violate some of the Standard's complexity clauses.
-Iterator debugging checks (``_LIBCPP_DEBUG == 1``)
---------------------------------------------------
-Defining ``_LIBCPP_DEBUG`` to ``1`` enables "iterator debugging", which provides
-additional assertions about the validity of iterators used by the program.
-
-The following containers and classes support iterator debugging:
+Iterator debugging checks
+-------------------------
+The library contains various assertions to check the validity of iterators used
+by the program. The following containers and classes support iterator debugging:
- ``std::string``
- ``std::vector<T>`` (``T != bool``)
@@ -53,34 +51,11 @@
The remaining containers do not currently support iterator debugging.
Patches welcome.
-Randomizing Unspecified Behavior (``_LIBCPP_DEBUG == 1``)
----------------------------------------------------------
-This also enables the randomization of unspecified behavior, for
-example, for equal elements in ``std::sort`` or randomizing both parts of
-the partition after ``std::nth_element`` call. This effort helps you to migrate
-to potential future faster versions of these algorithms and deflake your tests
-which depend on such behavior. To fix the seed, use
-``_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY_SEED=seed`` definition.
-
-Handling Assertion Failures
-===========================
-When a debug assertion fails the assertion handler is called via the
-``std::__libcpp_debug_function`` function pointer. It is possible to override
-this function pointer using a different handler function. Libc++ provides a
-the default handler, ``std::__libcpp_abort_debug_handler``, which aborts the
-program. The handler may not return. Libc++ can be changed to use a custom
-assertion handler as follows.
-
-.. code-block:: cpp
-
- #define _LIBCPP_DEBUG 1
- #include <string>
- void my_handler(std::__libcpp_debug_info const&);
- int main(int, char**) {
- std::__libcpp_debug_function = &my_handler;
-
- std::string::iterator bad_it;
- std::string str("hello world");
- str.insert(bad_it, '!'); // causes debug assertion
- // control flow doesn't return
- }
+Randomizing unspecified behavior
+--------------------------------
+The library supports the randomization of unspecified behavior. For example, randomizing
+the relative order of equal elements in ``std::sort`` or randomizing both parts of the
+partition after calling ``std::nth_element``. This effort helps migrating to potential
+future faster versions of these algorithms that might not have the exact same behavior.
+In particular, it makes it easier to deflake tests that depend on unspecified behavior.
+A seed can be used to make such failures reproducible: use ``_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY_SEED=seed``.
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index c21d1f9..cb4691f 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -113,6 +113,13 @@
- ``vector<bool>::const_reference``, ``vector<bool>::const_iterator::reference``
and ``bitset::const_reference`` are now aliases for `bool` in the unstable ABI.
+- The ``_LIBCPP_DEBUG`` macro is not supported anymore. It will be honoured until
+ LLVM 16, and then it will be an error to define that macro. To enable basic
+ assertions (previously ``_LIBCPP_DEBUG=0``), please use ``_LIBCPP_ENABLE_ASSERTIONS=1``.
+ To enable the debug mode (previously ``_LIBCPP_DEBUG=1|2``), please ensure that
+ the library has been built with support for the debug mode, and it will be
+ enabled automatically (no need to define ``_LIBCPP_DEBUG``).
+
ABI Changes
-----------
@@ -168,3 +175,7 @@
configuration and isn't supported by one of the configurations in ``libcxx/test/configs``,
``libcxxabi/test/configs`` or ``libunwind/test/configs``, please move to one of those
configurations or define your own.
+
+- The ``LIBCXX_ENABLE_DEBUG_MODE_SUPPORT`` CMake configuration is not supported anymore. If you
+ were disabling support for the debug mode with that flag, please use ``LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS=OFF``
+ instead.
diff --git a/docs/TestingLibcxx.rst b/docs/TestingLibcxx.rst
index b5c7ae8..04ed531 100644
--- a/docs/TestingLibcxx.rst
+++ b/docs/TestingLibcxx.rst
@@ -158,13 +158,6 @@
still be used to specify the path of the library to link to and run against,
respectively.
-.. option:: debug_level=<level>
-
- **Values**: 0, 1
-
- Enable the use of debug mode. Level 0 enables assertions and level 1 enables
- assertions and debugging of iterator misuse.
-
.. option:: use_sanitizer=<sanitizer name>
**Values**: Memory, MemoryWithOrigins, Address, Undefined
diff --git a/docs/UsingLibcxx.rst b/docs/UsingLibcxx.rst
index 0d7e3a9..1f46f0a 100644
--- a/docs/UsingLibcxx.rst
+++ b/docs/UsingLibcxx.rst
@@ -214,9 +214,6 @@
or disable extended libc++ behavior, including enabling "debug mode" or
thread safety annotations.
-**_LIBCPP_DEBUG**:
- See :ref:`using-debug-mode` for more information.
-
**_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
diff --git a/include/__algorithm/comp_ref_type.h b/include/__algorithm/comp_ref_type.h
index c94c963..4719871 100644
--- a/include/__algorithm/comp_ref_type.h
+++ b/include/__algorithm/comp_ref_type.h
@@ -68,7 +68,7 @@
struct __comp_ref_type {
// Pass the comparator by lvalue reference. Or in debug mode, using a
// debugging wrapper that stores a reference.
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
typedef __debug_less<_Comp> type;
#else
typedef _Comp& type;
diff --git a/include/__algorithm/nth_element.h b/include/__algorithm/nth_element.h
index 0f9f66d..60b9280 100644
--- a/include/__algorithm/nth_element.h
+++ b/include/__algorithm/nth_element.h
@@ -13,6 +13,7 @@
#include <__algorithm/comp_ref_type.h>
#include <__algorithm/sort.h>
#include <__config>
+#include <__debug>
#include <__iterator/iterator_traits.h>
#include <__utility/swap.h>
diff --git a/include/__algorithm/partial_sort.h b/include/__algorithm/partial_sort.h
index 8adf5b2..3870c0c 100644
--- a/include/__algorithm/partial_sort.h
+++ b/include/__algorithm/partial_sort.h
@@ -15,6 +15,7 @@
#include <__algorithm/sift_down.h>
#include <__algorithm/sort_heap.h>
#include <__config>
+#include <__debug>
#include <__iterator/iterator_traits.h>
#include <__utility/swap.h>
diff --git a/include/__algorithm/shuffle.h b/include/__algorithm/shuffle.h
index 647aa3f..6c6ff56 100644
--- a/include/__algorithm/shuffle.h
+++ b/include/__algorithm/shuffle.h
@@ -10,6 +10,7 @@
#define _LIBCPP___ALGORITHM_SHUFFLE_H
#include <__config>
+#include <__debug>
#include <__iterator/iterator_traits.h>
#include <__random/uniform_int_distribution.h>
#include <__utility/swap.h>
diff --git a/include/__algorithm/sort.h b/include/__algorithm/sort.h
index b5eaf75..6b92503 100644
--- a/include/__algorithm/sort.h
+++ b/include/__algorithm/sort.h
@@ -16,6 +16,7 @@
#include <__algorithm/unwrap_iter.h>
#include <__bits>
#include <__config>
+#include <__debug>
#include <__functional/operations.h>
#include <__utility/swap.h>
#include <climits>
diff --git a/include/__algorithm/unwrap_iter.h b/include/__algorithm/unwrap_iter.h
index 2edf16b..7261ff4 100644
--- a/include/__algorithm/unwrap_iter.h
+++ b/include/__algorithm/unwrap_iter.h
@@ -43,7 +43,7 @@
}
};
-#if _LIBCPP_DEBUG_LEVEL < 2
+#ifndef _LIBCPP_ENABLE_DEBUG_MODE
template <class _Iter>
struct __unwrap_iter_impl<_Iter, true> {
@@ -53,7 +53,7 @@
}
};
-#endif // _LIBCPP_DEBUG_LEVEL < 2
+#endif // !_LIBCPP_ENABLE_DEBUG_MODE
template<class _Iter, class _Impl = __unwrap_iter_impl<_Iter> >
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
diff --git a/include/__assert b/include/__assert
index a9096d9..84ddcd2 100644
--- a/include/__assert
+++ b/include/__assert
@@ -19,7 +19,15 @@
// This is for backwards compatibility with code that might have been enabling
// assertions through the Debug mode previously.
-#if _LIBCPP_DEBUG_LEVEL >= 1
+// TODO: In LLVM 16, make it an error to define _LIBCPP_DEBUG
+#if defined(_LIBCPP_DEBUG)
+# ifndef _LIBCPP_ENABLE_ASSERTIONS
+# define _LIBCPP_ENABLE_ASSERTIONS 1
+# endif
+#endif
+
+// Automatically enable assertions when the debug mode is enabled.
+#if defined(_LIBCPP_ENABLE_DEBUG_MODE)
# ifndef _LIBCPP_ENABLE_ASSERTIONS
# define _LIBCPP_ENABLE_ASSERTIONS 1
# endif
diff --git a/include/__config b/include/__config
index 31a31b1..050704c 100644
--- a/include/__config
+++ b/include/__config
@@ -792,55 +792,14 @@
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif // _LIBCPP_CXX03_LANG
-// _LIBCPP_DEBUG potential values:
-// - undefined: No assertions. This is the default.
-// - 0: Basic assertions
-// - 1: Basic assertions + iterator validity checks + unspecified behavior randomization.
-# if !defined(_LIBCPP_DEBUG)
-# define _LIBCPP_DEBUG_LEVEL 0
-# elif _LIBCPP_DEBUG == 0
-# define _LIBCPP_DEBUG_LEVEL 1
-# elif _LIBCPP_DEBUG == 1
-# define _LIBCPP_DEBUG_LEVEL 2
-# else
-# error Supported values for _LIBCPP_DEBUG are 0 and 1
-# endif
-
-# if _LIBCPP_DEBUG_LEVEL >= 2 && !defined(_LIBCPP_CXX03_LANG)
-# define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
-# endif
-
-# if defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
-# if defined(_LIBCPP_CXX03_LANG)
-# error Support for unspecified stability is only for C++11 and higher
-# endif
-# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \
- do { \
- if (!__builtin_is_constant_evaluated()) \
- _VSTD::shuffle(__first, __last, __libcpp_debug_randomizer()); \
- } while (false)
-# else
-# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \
- do { \
- } while (false)
-# endif
-
// Libc++ allows disabling extern template instantiation declarations by
// means of users defining _LIBCPP_DISABLE_EXTERN_TEMPLATE.
//
-// Furthermore, when the Debug mode is enabled, we disable extern declarations
-// when building user code because we don't want to use the functions compiled
-// in the library, which might not have had the debug mode enabled when built.
-// However, some extern declarations need to be used, because code correctness
-// depends on it (several instances in <locale>). Those special declarations
-// are declared with _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE, which is enabled
-// even when the debug mode is enabled.
+// TODO: Remove _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE, which is not needed
+// since the Debug mode is a configuration-time property.
#if defined(_LIBCPP_DISABLE_EXTERN_TEMPLATE)
# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */
# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) /* nothing */
-#elif _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_BUILDING_LIBRARY)
-# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */
-# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__;
#else
# define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__;
diff --git a/include/__config_site.in b/include/__config_site.in
index 38f654a..c615575 100644
--- a/include/__config_site.in
+++ b/include/__config_site.in
@@ -33,6 +33,7 @@
#cmakedefine _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
#cmakedefine _LIBCPP_HAS_NO_INCOMPLETE_RANGES
#cmakedefine01 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT
+#cmakedefine _LIBCPP_ENABLE_DEBUG_MODE
// __USE_MINGW_ANSI_STDIO gets redefined on MinGW
#ifdef __clang__
diff --git a/include/__debug b/include/__debug
index 39539af..4037106 100644
--- a/include/__debug
+++ b/include/__debug
@@ -18,23 +18,44 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY)
-# include <cstddef>
-# include <cstdio>
-# include <cstdlib>
+// Catch invalid uses of the legacy _LIBCPP_DEBUG toggle.
+#if defined(_LIBCPP_DEBUG) && _LIBCPP_DEBUG != 0 && !defined(_LIBCPP_ENABLE_DEBUG_MODE)
+# error "Enabling the debug mode now requires having configured the library with support for the debug mode"
#endif
-#if _LIBCPP_DEBUG_LEVEL == 0 || _LIBCPP_DEBUG_LEVEL == 1
-# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
-#elif _LIBCPP_DEBUG_LEVEL == 2
+#if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
+# define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
+#endif
+
+// TODO: Define this as a function instead
+#if defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
+# if defined(_LIBCPP_CXX03_LANG)
+# error Support for unspecified stability is only for C++11 and higher
+# endif
+# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \
+ do { \
+ if (!__builtin_is_constant_evaluated()) \
+ std::shuffle(__first, __last, __libcpp_debug_randomizer()); \
+ } while (false)
+#else
+# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \
+ do { \
+ } while (false)
+#endif
+
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(::std::__libcpp_is_constant_evaluated() || (x), m)
#else
-# error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2
+# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
#endif
-_LIBCPP_BEGIN_NAMESPACE_STD
+#if defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_BUILDING_LIBRARY)
-#if _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_TYPE_VIS __c_node;
@@ -203,12 +224,15 @@
_LIBCPP_FUNC_VIS __libcpp_db* __get_db();
_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
+_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
+#endif // defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_BUILDING_LIBRARY)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_c(_Tp* __c) {
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__insert_c(__c);
#else
@@ -218,7 +242,7 @@
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_i(_Tp* __i) {
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__insert_i(__i);
#else
@@ -228,7 +252,7 @@
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase_c(_Tp* __c) {
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__erase_c(__c);
#else
@@ -238,7 +262,7 @@
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap(_Tp* __lhs, _Tp* __rhs) {
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->swap(__lhs, __rhs);
#else
@@ -249,7 +273,7 @@
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_invalidate_all(_Tp* __c) {
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__invalidate_all(__c);
#else
diff --git a/include/__format/buffer.h b/include/__format/buffer.h
index 55cde00..d9b0806 100644
--- a/include/__format/buffer.h
+++ b/include/__format/buffer.h
@@ -119,7 +119,7 @@
template <class _OutIt, class _CharT>
concept __enable_direct_output = __formatter::__char_type<_CharT> &&
(same_as<_OutIt, _CharT*>
-#if _LIBCPP_DEBUG_LEVEL < 2
+#ifndef _LIBCPP_ENABLE_DEBUG_MODE
|| same_as<_OutIt, __wrap_iter<_CharT*>>
#endif
);
diff --git a/include/__hash_table b/include/__hash_table
index eaef97a..be28a03 100644
--- a/include/__hash_table
+++ b/include/__hash_table
@@ -294,7 +294,7 @@
_VSTD::__debug_db_insert_i(this);
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__hash_iterator(const __hash_iterator& __i)
: __node_(__i.__node_)
@@ -318,7 +318,7 @@
}
return *this;
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {
@@ -365,7 +365,7 @@
: __node_(__node)
{
(void)__c;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
}
@@ -404,12 +404,12 @@
__hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
: __node_(__x.__node_)
{
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__iterator_copy(this, _VSTD::addressof(__x));
#endif
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator(const __hash_const_iterator& __i)
: __node_(__i.__node_)
@@ -433,7 +433,7 @@
}
return *this;
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {
@@ -479,7 +479,7 @@
: __node_(__node)
{
(void)__c;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
}
@@ -511,7 +511,7 @@
_VSTD::__debug_db_insert_i(this);
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator(const __hash_local_iterator& __i)
: __node_(__i.__node_),
@@ -539,7 +539,7 @@
}
return *this;
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {
@@ -591,7 +591,7 @@
__bucket_count_(__bucket_count)
{
(void)__c;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
if (__node_ != nullptr)
@@ -639,12 +639,12 @@
__bucket_(__x.__bucket_),
__bucket_count_(__x.__bucket_count_)
{
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__iterator_copy(this, _VSTD::addressof(__x));
#endif
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator(const __hash_const_local_iterator& __i)
: __node_(__i.__node_),
@@ -672,7 +672,7 @@
}
return *this;
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {
@@ -724,7 +724,7 @@
__bucket_count_(__bucket_count)
{
(void)__c;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
if (__node_ != nullptr)
@@ -1281,14 +1281,14 @@
return const_local_iterator(nullptr, __n, bucket_count(), this);
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const;
bool __decrementable(const const_iterator* __i) const;
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
void __rehash(size_type __n);
@@ -1510,7 +1510,7 @@
while (__np != nullptr)
{
__next_pointer __next = __np->__next_;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; )
{
@@ -2480,7 +2480,7 @@
__pn->__next_ = __cn->__next_;
__cn->__next_ = nullptr;
--size();
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __dp = __c->end_; __dp != __c->beg_; )
{
@@ -2663,7 +2663,7 @@
__x.swap(__y);
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Hash, class _Equal, class _Alloc>
bool
@@ -2693,7 +2693,7 @@
return false;
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/__iterator/wrap_iter.h b/include/__iterator/wrap_iter.h
index a3f42ca..f780048 100644
--- a/include/__iterator/wrap_iter.h
+++ b/include/__iterator/wrap_iter.h
@@ -50,12 +50,12 @@
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = nullptr) _NOEXCEPT
: __i(__u.base())
{
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__iterator_copy(this, _VSTD::addressof(__u));
#endif
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
__wrap_iter(const __wrap_iter& __x)
: __i(__x.base())
@@ -139,7 +139,7 @@
explicit __wrap_iter(const void* __p, iterator_type __x) _NOEXCEPT : __i(__x)
{
(void)__p;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__insert_ic(this, __p);
#endif
diff --git a/include/list b/include/list
index bcca7f0..45ccfec 100644
--- a/include/list
+++ b/include/list
@@ -304,7 +304,7 @@
: __ptr_(__p)
{
(void)__c;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
}
@@ -325,7 +325,7 @@
_VSTD::__debug_db_insert_i(this);
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__list_iterator(const __list_iterator& __p)
@@ -351,7 +351,7 @@
return *this;
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const
@@ -413,7 +413,7 @@
: __ptr_(__p)
{
(void)__c;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
}
@@ -436,12 +436,12 @@
__list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
: __ptr_(__p.__ptr_)
{
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__iterator_copy(this, _VSTD::addressof(__p));
#endif
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator(const __list_const_iterator& __p)
@@ -467,7 +467,7 @@
return *this;
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const
{
@@ -750,7 +750,7 @@
else
__c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
__c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
@@ -1075,14 +1075,14 @@
return __hold_pointer(__p, __node_destructor(__na, 1));
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const;
bool __decrementable(const const_iterator* __i) const;
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
_LIBCPP_INLINE_VISIBILITY
@@ -1624,7 +1624,7 @@
__link_pointer __n = base::__end_.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; )
{
@@ -1653,7 +1653,7 @@
__link_pointer __n = base::__end_.__prev_;
base::__unlink_nodes(__n, __n);
--base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; )
{
@@ -1686,7 +1686,7 @@
__link_pointer __r = __n->__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __ip = __c->end_; __ip != __c->beg_; )
{
@@ -1724,7 +1724,7 @@
__link_pointer __n = __f.__ptr_;
++__f;
--base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; )
{
@@ -1862,7 +1862,7 @@
__link_nodes(__p.__ptr_, __f, __l);
base::__sz() += __c.__sz();
__c.__sz() = 0;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (_VSTD::addressof(__c) != this) {
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
@@ -1903,7 +1903,7 @@
__link_nodes(__p.__ptr_, __f, __f);
--__c.__sz();
++base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (_VSTD::addressof(__c) != this) {
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
@@ -1964,7 +1964,7 @@
}
base::__unlink_nodes(__first, __last);
__link_nodes(__p.__ptr_, __first, __last);
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (_VSTD::addressof(__c) != this) {
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
@@ -2101,7 +2101,7 @@
++__f1;
}
splice(__e1, __c);
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
__c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
@@ -2225,7 +2225,7 @@
return size() == _VSTD::distance(begin(), end());
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Alloc>
bool
@@ -2255,7 +2255,7 @@
return false;
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
diff --git a/include/locale b/include/locale
index 3bed47c..c350605 100644
--- a/include/locale
+++ b/include/locale
@@ -1461,7 +1461,7 @@
return do_put(__s, __iob, __fl, (unsigned long)__v);
const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc());
typedef typename numpunct<char_type>::string_type string_type;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
string_type __tmp(__v ? __np.truename() : __np.falsename());
string_type __nm = _VSTD::move(__tmp);
#else
diff --git a/include/span b/include/span
index e65af79..38b2ae1 100644
--- a/include/span
+++ b/include/span
@@ -197,7 +197,7 @@
is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>;
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
+#if defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
# define _LIBCPP_SPAN_USE_POINTER_ITERATOR
#endif
diff --git a/include/string b/include/string
index 86370e5..65ce145 100644
--- a/include/string
+++ b/include/string
@@ -1450,14 +1450,14 @@
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __clear_and_shrink() _NOEXCEPT;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const;
bool __decrementable(const const_iterator* __i) const;
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
template<class _Alloc>
@@ -1840,7 +1840,7 @@
void
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)
{
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated()) {
__c_node* __c = __get_db()->__find_c_and_lock(this);
if (__c)
@@ -1862,7 +1862,7 @@
}
#else
(void)__pos;
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
}
template <class _CharT, class _Traits, class _Allocator>
@@ -4595,7 +4595,7 @@
}
#endif
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
template<class _CharT, class _Traits, class _Allocator>
bool
@@ -4629,7 +4629,7 @@
return data() <= __p && __p < data() + size();
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
#if _LIBCPP_STD_VER > 11
// Literal suffixes for basic_string [basic.string.literals]
diff --git a/include/unordered_map b/include/unordered_map
index 16b843b..c1cd7f4 100644
--- a/include/unordered_map
+++ b/include/unordered_map
@@ -1512,7 +1512,7 @@
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));}
@@ -1523,7 +1523,7 @@
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
@@ -2288,7 +2288,7 @@
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));}
@@ -2299,7 +2299,7 @@
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
};
diff --git a/include/unordered_set b/include/unordered_set
index 890475f..a74116d 100644
--- a/include/unordered_set
+++ b/include/unordered_set
@@ -843,7 +843,7 @@
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(__i);}
@@ -854,7 +854,7 @@
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(__i, __n);}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
};
@@ -1481,7 +1481,7 @@
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(__i);}
@@ -1492,7 +1492,7 @@
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(__i, __n);}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
};
diff --git a/include/vector b/include/vector
index e522c1a..19c6349 100644
--- a/include/vector
+++ b/include/vector
@@ -634,14 +634,14 @@
bool __invariants() const;
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const;
bool __decrementable(const const_iterator* __i) const;
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
pointer __begin_ = nullptr;
@@ -1898,7 +1898,7 @@
return true;
}
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Allocator>
bool
@@ -1930,13 +1930,13 @@
return this->__begin_ <= __p && __p < this->__end_;
}
-#endif // _LIBCPP_DEBUG_LEVEL == 2
+#endif // _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) {
-#if _LIBCPP_DEBUG_LEVEL == 2
+#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; ) {
--__p;
diff --git a/lib/abi/CMakeLists.txt b/lib/abi/CMakeLists.txt
index a06678a..e0f52c6 100644
--- a/lib/abi/CMakeLists.txt
+++ b/lib/abi/CMakeLists.txt
@@ -55,6 +55,11 @@
else()
set(triple "${LLVM_DEFAULT_TARGET_TRIPLE}")
endif()
+if (LIBCXX_ENABLE_DEBUG_MODE OR LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS)
+ set(has_debug_symbols ON)
+else()
+ set(has_debug_symbols OFF)
+endif()
cxx_abi_list_identifier(abi_list_identifier
"${triple}"
"${LIBCXX_CXX_ABI}"
@@ -62,7 +67,7 @@
"${LIBCXX_ABI_UNSTABLE}"
"${LIBCXX_ENABLE_EXCEPTIONS}"
"${LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS}"
- "${LIBCXX_ENABLE_DEBUG_MODE_SUPPORT}"
+ "${has_debug_symbols}"
"${LIBCXX_ENABLE_INCOMPLETE_FEATURES}"
)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 570464f..d303499 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -64,7 +64,7 @@
vector.cpp
)
-if (LIBCXX_ENABLE_DEBUG_MODE_SUPPORT)
+if (LIBCXX_ENABLE_DEBUG_MODE OR LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS)
list(APPEND LIBCXX_SOURCES
debug.cpp
legacy_debug_handler.cpp
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 6a398e4..b85f726 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -101,10 +101,6 @@
serialize_lit_param(enable_rtti False)
endif()
-if (NOT LIBCXX_ENABLE_DEBUG_MODE_SUPPORT)
- serialize_lit_param(enable_debug_tests False)
-endif()
-
if (LIBCXX_ENABLE_ASSERTIONS)
serialize_lit_param(enable_assertions True)
endif()
diff --git a/test/libcxx/algorithms/alg.modifying.operations/copy.pass.cpp b/test/libcxx/algorithms/alg.modifying.operations/copy.pass.cpp
index b710f5a..eddf8be 100644
--- a/test/libcxx/algorithms/alg.modifying.operations/copy.pass.cpp
+++ b/test/libcxx/algorithms/alg.modifying.operations/copy.pass.cpp
@@ -7,7 +7,10 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// UNSUPPORTED: debug_level=1
+
+// When the debug mode is enabled, we don't unwrap iterators in std::copy
+// so we don't get this optimization.
+// UNSUPPORTED: libcpp-has-debug-mode
// <algorithm>
@@ -59,7 +62,9 @@
return *this;
}
- friend constexpr NotIncrementableIt operator+(const NotIncrementableIt& it, ptrdiff_t size) { return it.i + size; }
+ friend constexpr NotIncrementableIt operator+(const NotIncrementableIt& it, difference_type size) { return it.i + size; }
+ friend constexpr difference_type operator-(const NotIncrementableIt& x, const NotIncrementableIt& y) { return x.i - y.i; }
+ friend constexpr NotIncrementableIt operator-(const NotIncrementableIt& x, difference_type size) { return NotIncrementableIt(x.i - size); }
};
static_assert(std::__is_cpp17_contiguous_iterator<NotIncrementableIt<S>>::value);
diff --git a/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp b/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp
index fcabbb9..a878508 100644
--- a/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp
+++ b/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp
@@ -64,7 +64,7 @@
std::make_heap(v.begin(), v.end());
assert(stats.copied == 0);
assert(stats.moved == 153'486);
-#ifndef _LIBCPP_DEBUG
+#ifndef _LIBCPP_ENABLE_DEBUG_MODE
assert(stats.compared == 188'285);
#endif
diff --git a/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp b/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp
index dbf808a..0ed37a2 100644
--- a/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp
+++ b/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp
@@ -65,7 +65,7 @@
std::sort_heap(v.begin(), v.end());
assert(stats.copied == 0);
assert(stats.moved == 1'764'997);
-#ifndef _LIBCPP_DEBUG
+#ifndef _LIBCPP_ENABLE_DEBUG_MODE
assert(stats.compared == 1'534'701);
#endif
diff --git a/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp b/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp
index 6d1e96a..4f7d479 100644
--- a/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp
+++ b/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp
@@ -13,8 +13,7 @@
// Make sure __debug_less asserts when the comparator is not consistent.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <algorithm>
#include <iterator>
diff --git a/test/libcxx/algorithms/debug_less.pass.cpp b/test/libcxx/algorithms/debug_less.pass.cpp
index 6caad3a..89f12e5 100644
--- a/test/libcxx/algorithms/debug_less.pass.cpp
+++ b/test/libcxx/algorithms/debug_less.pass.cpp
@@ -13,8 +13,7 @@
// __debug_less checks that a comparator actually provides a strict-weak ordering.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <algorithm>
#include <cassert>
diff --git a/test/libcxx/algorithms/nth_element_stability.pass.cpp b/test/libcxx/algorithms/nth_element_stability.pass.cpp
index 2383f83..4913a70 100644
--- a/test/libcxx/algorithms/nth_element_stability.pass.cpp
+++ b/test/libcxx/algorithms/nth_element_stability.pass.cpp
@@ -10,8 +10,8 @@
// Test std::nth_element stability randomization
-// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: c++03
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
#include <algorithm>
#include <array>
diff --git a/test/libcxx/algorithms/partial_sort_stability.pass.cpp b/test/libcxx/algorithms/partial_sort_stability.pass.cpp
index 674cb30..8aa91bd 100644
--- a/test/libcxx/algorithms/partial_sort_stability.pass.cpp
+++ b/test/libcxx/algorithms/partial_sort_stability.pass.cpp
@@ -10,8 +10,8 @@
// Test std::partial_sort stability randomization
-// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: c++03
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
#include <algorithm>
#include <array>
diff --git a/test/libcxx/algorithms/sort_stability.pass.cpp b/test/libcxx/algorithms/sort_stability.pass.cpp
index 8b3ec2b..664ea70 100644
--- a/test/libcxx/algorithms/sort_stability.pass.cpp
+++ b/test/libcxx/algorithms/sort_stability.pass.cpp
@@ -10,8 +10,8 @@
// Test std::sort stability randomization
-// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: c++03
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
#include <algorithm>
#include <array>
diff --git a/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp b/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp
index 518d44d..d444204 100644
--- a/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp
@@ -11,8 +11,7 @@
// list(list&& c);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp
index ab2b257..ce1eb67 100644
--- a/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp
@@ -11,8 +11,7 @@
// template <class... Args> void emplace(const_iterator p, Args&&... args);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp
index 843dcff..f389ef4 100644
--- a/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator position) with iterator from another container
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp
index 583dfa1..78b8b09 100644
--- a/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with various invalid iterators
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp
index 218a964..7cf1c5d 100644
--- a/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp
@@ -12,8 +12,7 @@
// iterator insert(const_iterator position, Iter first, Iter last);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp
index 880cbcf..71ba4e5 100644
--- a/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp
@@ -11,8 +11,7 @@
// iterator insert(const_iterator position, value_type&& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp
index bc791b9..e3907fa 100644
--- a/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp
@@ -11,8 +11,7 @@
// iterator insert(const_iterator position, size_type n, const value_type& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp
index 363c5c1..ce260c6 100644
--- a/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp
@@ -11,8 +11,7 @@
// iterator insert(const_iterator position, const value_type& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp
index 0ced467..6d3fb65 100644
--- a/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp
@@ -11,8 +11,7 @@
// void splice(const_iterator position, list& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp
index c9163a4..6ac7a69 100644
--- a/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp
@@ -11,8 +11,7 @@
// void splice(const_iterator position, list<T,Allocator>& x, iterator i);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp
index 1f7a523..ec318f4 100644
--- a/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp
@@ -11,8 +11,7 @@
// void splice(const_iterator position, list& x, iterator first, iterator last);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>
diff --git a/test/libcxx/containers/sequences/vector/debug.iterator.add.pass.cpp b/test/libcxx/containers/sequences/vector/debug.iterator.add.pass.cpp
index 929be18..9e80a7e 100644
--- a/test/libcxx/containers/sequences/vector/debug.iterator.add.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/debug.iterator.add.pass.cpp
@@ -11,8 +11,7 @@
// Add to iterator out of bounds.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
#include <cassert>
diff --git a/test/libcxx/containers/sequences/vector/debug.iterator.compare.pass.cpp b/test/libcxx/containers/sequences/vector/debug.iterator.compare.pass.cpp
index b59f095..669c349 100644
--- a/test/libcxx/containers/sequences/vector/debug.iterator.compare.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/debug.iterator.compare.pass.cpp
@@ -11,8 +11,7 @@
// Compare iterators from different containers with <.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
diff --git a/test/libcxx/containers/sequences/vector/debug.iterator.decrement.pass.cpp b/test/libcxx/containers/sequences/vector/debug.iterator.decrement.pass.cpp
index f847764..c7f65d1 100644
--- a/test/libcxx/containers/sequences/vector/debug.iterator.decrement.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/debug.iterator.decrement.pass.cpp
@@ -11,8 +11,7 @@
// Decrement iterator prior to begin.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
#include <cassert>
diff --git a/test/libcxx/containers/sequences/vector/debug.iterator.dereference.pass.cpp b/test/libcxx/containers/sequences/vector/debug.iterator.dereference.pass.cpp
index 203656f..e421e55 100644
--- a/test/libcxx/containers/sequences/vector/debug.iterator.dereference.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/debug.iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
diff --git a/test/libcxx/containers/sequences/vector/debug.iterator.increment.pass.cpp b/test/libcxx/containers/sequences/vector/debug.iterator.increment.pass.cpp
index b950aa2..83dcce1 100644
--- a/test/libcxx/containers/sequences/vector/debug.iterator.increment.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/debug.iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
#include <cassert>
diff --git a/test/libcxx/containers/sequences/vector/debug.iterator.index.pass.cpp b/test/libcxx/containers/sequences/vector/debug.iterator.index.pass.cpp
index 409002d..ff43d08 100644
--- a/test/libcxx/containers/sequences/vector/debug.iterator.index.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/debug.iterator.index.pass.cpp
@@ -11,8 +11,7 @@
// Index iterator out of bounds.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
#include <cassert>
diff --git a/test/libcxx/containers/sequences/vector/debug.iterator.subtract.pass.cpp b/test/libcxx/containers/sequences/vector/debug.iterator.subtract.pass.cpp
index 5378de0..a5b35ce 100644
--- a/test/libcxx/containers/sequences/vector/debug.iterator.subtract.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/debug.iterator.subtract.pass.cpp
@@ -11,8 +11,7 @@
// Subtract iterators from different containers.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
diff --git a/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp b/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp
index 8317c9f..a3fe411 100644
--- a/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp
@@ -11,8 +11,7 @@
// iterator insert(const_iterator p, const value_type& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp b/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp
index af78854..4646ff5 100644
--- a/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp
@@ -13,8 +13,7 @@
// iterator insert(const_iterator p, P&& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp b/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp
index 3427758..f08f5b1 100644
--- a/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <string>
diff --git a/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp b/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp
index 91e6f7e..bb2055f 100644
--- a/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <cassert>
diff --git a/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp b/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp
index c38082c..1a5a93c 100644
--- a/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <string>
diff --git a/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp b/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp
index 15dfca6..6b33131 100644
--- a/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment local_iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <string>
diff --git a/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp b/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp
index 012b545..c639b92 100644
--- a/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp
@@ -15,8 +15,7 @@
// void swap(unordered_map& x, unordered_map& y);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp b/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp
index 3a9318f..d106dea 100644
--- a/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator position) with invalid iterators
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp b/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp
index f5f3e6b..5035aab 100644
--- a/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with invalid iterators
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp b/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp
index 1ba4b30..ce3b3dd 100644
--- a/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp
@@ -11,8 +11,7 @@
// iterator insert(const_iterator p, const value_type& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp b/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp
index 3895c4e..5a24242 100644
--- a/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp
@@ -13,8 +13,7 @@
// iterator insert(const_iterator p, P&& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp b/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp
index b5a869d..05990a0 100644
--- a/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp b/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp
index bd8a5af..f84726e 100644
--- a/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <cassert>
diff --git a/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp b/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp
index bf8ebc9..d1d6e37 100644
--- a/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <string>
diff --git a/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp b/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp
index 2df1eb2..2a97328 100644
--- a/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment local_iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <cassert>
diff --git a/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp b/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp
index 2ea1946..29efbe2 100644
--- a/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp
@@ -15,8 +15,7 @@
// void swap(unordered_multimap& x, unordered_multimap& y);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp b/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp
index 31d9616..1b29719 100644
--- a/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator position) with invalid iterators
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp b/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp
index 89142fa..85879e0 100644
--- a/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with invalid iterators
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
diff --git a/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp b/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp
index 190d085..7d477e3 100644
--- a/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator position) with invalid iterators
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp b/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp
index 921bc16..f229b99 100644
--- a/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with invalid iterators
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp b/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp
index 7337f02..50e0d8a 100644
--- a/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp
@@ -11,8 +11,7 @@
// iterator insert(const_iterator p, const value_type& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp b/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp
index 0557e50..a7fdff7 100644
--- a/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp b/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp
index a1e6d9a..9ca0d4a 100644
--- a/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
#include <cassert>
diff --git a/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp b/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp
index efe486a..0b4bc9e 100644
--- a/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp b/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp
index 6e2df71..8f82dfb 100644
--- a/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment local_iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
#include <cassert>
diff --git a/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp b/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp
index c66b460..476eb59 100644
--- a/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp
+++ b/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp
@@ -15,8 +15,7 @@
// void swap(unordered_multiset& x, unordered_multiset& y);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp b/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp
index 6bae742..1f3f5ad 100644
--- a/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp
+++ b/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator position) with invalid iterators
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp b/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp
index 0fa5d7b..542d382 100644
--- a/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp
+++ b/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with first iterator from another container
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp b/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp
index ef44883..b452a8d 100644
--- a/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp
+++ b/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp
@@ -11,8 +11,7 @@
// iterator insert(const_iterator p, const value_type& x);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp b/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp
index 64011f5..2e8c0c2 100644
--- a/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp
+++ b/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp b/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp
index e8da843..a858aa8 100644
--- a/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp
+++ b/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
#include <cassert>
diff --git a/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp b/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp
index 5043a89..30582d9 100644
--- a/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp
+++ b/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp b/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp
index e1042d3..022b66e 100644
--- a/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp
+++ b/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment local_iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
#include <cassert>
diff --git a/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp b/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp
index 4d72199..afcaded 100644
--- a/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp
+++ b/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp
@@ -15,8 +15,7 @@
// void swap(unordered_set& x, unordered_set& y);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
diff --git a/test/libcxx/debug/containers.multithread.pass.cpp b/test/libcxx/debug/containers.multithread.pass.cpp
index e8f87b1..a389c31 100644
--- a/test/libcxx/debug/containers.multithread.pass.cpp
+++ b/test/libcxx/debug/containers.multithread.pass.cpp
@@ -9,8 +9,7 @@
// UNSUPPORTED: c++11, c++14
// UNSUPPORTED: no-threads
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
// test multithreaded container debugging
diff --git a/test/libcxx/debug/containers/associative_containers.pass.cpp b/test/libcxx/debug/containers/associative_containers.pass.cpp
index 8a07efe..00471ce 100644
--- a/test/libcxx/debug/containers/associative_containers.pass.cpp
+++ b/test/libcxx/debug/containers/associative_containers.pass.cpp
@@ -7,8 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03, c++11, c++14
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03, c++11, c++14
// test container debugging
diff --git a/test/libcxx/debug/containers/sequence_container_iterators.pass.cpp b/test/libcxx/debug/containers/sequence_container_iterators.pass.cpp
index e98c18b..c9a9fbc 100644
--- a/test/libcxx/debug/containers/sequence_container_iterators.pass.cpp
+++ b/test/libcxx/debug/containers/sequence_container_iterators.pass.cpp
@@ -7,8 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03, c++11, c++14
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03, c++11, c++14
// test container debugging
diff --git a/test/libcxx/debug/containers/string.pass.cpp b/test/libcxx/debug/containers/string.pass.cpp
index ba54643..fc6cc42 100644
--- a/test/libcxx/debug/containers/string.pass.cpp
+++ b/test/libcxx/debug/containers/string.pass.cpp
@@ -7,8 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03, c++11, c++14
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03, c++11, c++14
// test container debugging
diff --git a/test/libcxx/debug/containers/unord_containers.pass.cpp b/test/libcxx/debug/containers/unord_containers.pass.cpp
index 70a6e92..19a2124 100644
--- a/test/libcxx/debug/containers/unord_containers.pass.cpp
+++ b/test/libcxx/debug/containers/unord_containers.pass.cpp
@@ -7,8 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03, c++11, c++14
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03, c++11, c++14
// test container debugging
diff --git a/test/libcxx/debug/debug.assertions-enabled.compile.pass.cpp b/test/libcxx/debug/debug.assertions-enabled.compile.pass.cpp
new file mode 100644
index 0000000..037805b
--- /dev/null
+++ b/test/libcxx/debug/debug.assertions-enabled.compile.pass.cpp
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+// 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-debug-mode
+
+#include <version>
+
+#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/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp b/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp
new file mode 100644
index 0000000..ac265c9
--- /dev/null
+++ b/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This test ensures that we issue an error if we try to enable the debug mode with
+// a library that was not built with support for the debug mode.
+
+// REQUIRES: !libcpp-has-debug-mode
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+
+// This test fails when modules are enabled because we fail to build module 'std' instead of
+// issuing the preprocessor error.
+// UNSUPPORTED: modules-build
+
+#include <__debug>
+
+// expected-error@*:* {{Enabling the debug mode now requires having configured the library with support for the debug mode}}
diff --git a/test/libcxx/debug/extern-templates.sh.cpp b/test/libcxx/debug/extern-templates.sh.cpp
index 774f675..612da5e 100644
--- a/test/libcxx/debug/extern-templates.sh.cpp
+++ b/test/libcxx/debug/extern-templates.sh.cpp
@@ -10,7 +10,7 @@
// for members of <locale> even when the debug mode is enabled, which is
// necessary for correctness. See https://llvm.org/D94718 for details.
-// UNSUPPORTED: libcxx-no-debug-mode
+// UNSUPPORTED: !libcpp-has-debug-mode
// UNSUPPORTED: no-localization
// UNSUPPORTED: cant-build-shared-library
@@ -23,8 +23,8 @@
// XFAIL: LIBCXX-AIX-FIXME
-// RUN: %{cxx} %{flags} %{compile_flags} %s %{link_flags} -fPIC -DTU1 -D_LIBCPP_DEBUG=1 -fvisibility=hidden -shared -o %t.lib
-// RUN: cd %T && %{cxx} %{flags} %{compile_flags} %s ./%basename_t.tmp.lib %{link_flags} -DTU2 -D_LIBCPP_DEBUG=1 -fvisibility=hidden -o %t.exe
+// RUN: %{cxx} %{flags} %{compile_flags} %s %{link_flags} -fPIC -DTU1 -fvisibility=hidden -shared -o %t.lib
+// RUN: cd %T && %{cxx} %{flags} %{compile_flags} %s ./%basename_t.tmp.lib %{link_flags} -DTU2 -fvisibility=hidden -o %t.exe
// RUN: %{exec} %t.exe
#include <cassert>
diff --git a/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp b/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp
index f1f81c6..af767d0 100644
--- a/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp
+++ b/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
-// UNSUPPORTED: c++03, c++11, c++14, c++17, libcxx-no-debug-mode, libcpp-has-no-incomplete-ranges
+// UNSUPPORTED: c++03, c++11, c++14, c++17, !libcpp-has-debug-mode, libcpp-has-no-incomplete-ranges
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1
// <ranges>
diff --git a/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp b/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp
index 4907d3c..5ea72a8 100644
--- a/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp
+++ b/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
-// UNSUPPORTED: c++03, c++11, c++14, c++17, libcxx-no-debug-mode, libcpp-has-no-incomplete-ranges
+// UNSUPPORTED: c++03, c++11, c++14, c++17, !libcpp-has-debug-mode, libcpp-has-no-incomplete-ranges
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1
// <ranges>
diff --git a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.add.pass.cpp b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.add.pass.cpp
index 53c1613..6d97ea1 100644
--- a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.add.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.add.pass.cpp
@@ -11,8 +11,7 @@
// Add to iterator out of bounds.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
#include <cassert>
diff --git a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp
index c34e3fd..025cd18 100644
--- a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp
@@ -11,8 +11,7 @@
// Compare iterators from different containers with <.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
diff --git a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.decrement.pass.cpp b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.decrement.pass.cpp
index b36bbff..548a62b 100644
--- a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.decrement.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.decrement.pass.cpp
@@ -11,8 +11,7 @@
// Decrement iterator prior to begin.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
#include <cassert>
diff --git a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.dereference.pass.cpp b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.dereference.pass.cpp
index 6a9e7d6..fccf98c 100644
--- a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.dereference.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.dereference.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
diff --git a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.increment.pass.cpp b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.increment.pass.cpp
index 96f6002..73366f2 100644
--- a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.increment.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.increment.pass.cpp
@@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
#include <cassert>
diff --git a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.index.pass.cpp b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.index.pass.cpp
index 9528f51..f1b4e56 100644
--- a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.index.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.index.pass.cpp
@@ -11,8 +11,7 @@
// Index iterator out of bounds.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
#include <cassert>
diff --git a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp
index 4cf6bcc..74b4048 100644
--- a/test/libcxx/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp
@@ -11,8 +11,7 @@
// Subtract iterators from different containers.
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
diff --git a/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp
index 07b2537..1844dd3 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator position) with an iterator from another container
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
diff --git a/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp
index 0606f12..8afe65b 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp
@@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with invalid iterators
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
diff --git a/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp
index 4decaa4..7e0e236 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp
@@ -11,8 +11,7 @@
// iterator insert(const_iterator p, charT c);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
// TODO: Since string::insert(iter, char) is intantiated in the dylib, this test doesn't
// actually work if the dylib hasn't been built with debug assertions enabled.
diff --git a/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp
index a95fa8c..0bd4b43 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp
@@ -12,8 +12,7 @@
// iterator insert(const_iterator p, InputIterator first, InputIterator last);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
diff --git a/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp
index d251dfc..0f4d087 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp
@@ -11,8 +11,7 @@
// iterator insert(const_iterator p, size_type n, charT c);
// REQUIRES: has-unix-headers
-// UNSUPPORTED: libcxx-no-debug-mode, c++03
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
+// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
diff --git a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
index 1711568..0d572fc 100644
--- a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
@@ -79,7 +79,7 @@
assert(ia[0] == static_cast<int>(N)-1);
assert(ia[N-1] == 0);
assert(std::is_sorted(ia, ia+N, std::greater<value_type>()));
-#ifndef _LIBCPP_DEBUG
+#ifndef _LIBCPP_ENABLE_DEBUG_MODE
assert(pred.count() <= (N-1));
#endif
}
diff --git a/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
index 5555e11..b1341ee 100644
--- a/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
+++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
@@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: LIBCXX-DEBUG-FIXME
-
// UNSUPPORTED: c++03
// <filesystem>
diff --git a/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp b/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp
index 504ebc3..6a6846b 100644
--- a/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp
+++ b/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp
@@ -9,11 +9,6 @@
// UNSUPPORTED: no-localization
// UNSUPPORTED: libcpp-has-no-incomplete-format
-// The issue is caused in __format_spec::__determine_grouping().
-// There a string iterator is modified. The string is returned
-// from the dylib's use_facet<numpunct<_CharT>>::grouping()
-// XFAIL: LIBCXX-DEBUG-FIXME
-
// TODO FMT Evaluate gcc-11 status
// UNSUPPORTED: gcc-11
diff --git a/test/support/container_debug_tests.h b/test/support/container_debug_tests.h
index fc0d60f..0a11ac8 100644
--- a/test/support/container_debug_tests.h
+++ b/test/support/container_debug_tests.h
@@ -14,8 +14,8 @@
#error This header may only be used for libc++ tests
#endif
-#ifndef _LIBCPP_DEBUG
-#error _LIBCPP_DEBUG must be defined before including this header
+#ifndef _LIBCPP_ENABLE_DEBUG_MODE
+#error The library must be built with the debug mode enabled in order to use this header
#endif
#include <__debug>
diff --git a/utils/ci/buildkite-pipeline.yml b/utils/ci/buildkite-pipeline.yml
index d3db1e1..9404750 100644
--- a/utils/ci/buildkite-pipeline.yml
+++ b/utils/ci/buildkite-pipeline.yml
@@ -379,8 +379,8 @@
limit: 2
timeout_in_minutes: 120
- - label: "Debug iterators"
- command: "libcxx/utils/ci/run-buildbot generic-debug-iterators"
+ - label: "Debug mode"
+ command: "libcxx/utils/ci/run-buildbot generic-debug-mode"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
@@ -423,20 +423,6 @@
limit: 2
timeout_in_minutes: 120
- - label: "No debug mode"
- command: "libcxx/utils/ci/run-buildbot generic-no-debug"
- artifact_paths:
- - "**/test-results.xml"
- - "**/*.abilist"
- agents:
- queue: "libcxx-builders"
- os: "linux"
- retry:
- automatic:
- - exit_status: -1 # Agent was lost
- limit: 2
- timeout_in_minutes: 120
-
- label: "No filesystem"
command: "libcxx/utils/ci/run-buildbot generic-no-filesystem"
artifact_paths:
diff --git a/utils/ci/run-buildbot b/utils/ci/run-buildbot
index 49cfde4..2e4d9b5 100755
--- a/utils/ci/run-buildbot
+++ b/utils/ci/run-buildbot
@@ -233,9 +233,9 @@
check-runtimes
check-abi-list
;;
-generic-debug-iterators)
+generic-debug-mode)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-iterators.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-mode.cmake"
check-runtimes
check-abi-list
;;
@@ -329,12 +329,6 @@
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-threads.cmake"
check-runtimes
;;
-generic-no-debug)
- clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-debug.cmake"
- check-runtimes
- check-abi-list
-;;
generic-no-filesystem)
clean
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake"
diff --git a/utils/libcxx/test/features.py b/utils/libcxx/test/features.py
index 20fdbe9..d7e4c84 100644
--- a/utils/libcxx/test/features.py
+++ b/utils/libcxx/test/features.py
@@ -191,6 +191,7 @@
'_LIBCPP_HAS_NO_INCOMPLETE_FORMAT': 'libcpp-has-no-incomplete-format',
'_LIBCPP_HAS_NO_INCOMPLETE_RANGES': 'libcpp-has-no-incomplete-ranges',
'_LIBCPP_HAS_NO_UNICODE': 'libcpp-has-no-unicode',
+ '_LIBCPP_ENABLE_DEBUG_MODE': 'libcpp-has-debug-mode',
}
for macro, feature in macros.items():
DEFAULT_FEATURES.append(
diff --git a/utils/libcxx/test/params.py b/utils/libcxx/test/params.py
index 2c18aba..2f537f1 100644
--- a/utils/libcxx/test/params.py
+++ b/utils/libcxx/test/params.py
@@ -126,15 +126,6 @@
[AddCompileFlag('-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER')]
),
- Parameter(name='debug_level', choices=['', '0', '1'], type=str, default='',
- help="The debugging level to enable in the test suite.",
- actions=lambda debugLevel: [] if debugLevel == '' else filter(None, [
- AddFeature('debug_level={}'.format(debugLevel)),
- AddCompileFlag('-Wno-macro-redefined'),
- AddCompileFlag('-D_LIBCPP_DEBUG={}'.format(debugLevel)),
- AddFeature('LIBCXX-DEBUG-FIXME') if debugLevel == '1' else None
- ])),
-
Parameter(name='use_sanitizer', choices=['', 'Address', 'Undefined', 'Memory', 'MemoryWithOrigins', 'Thread', 'DataFlow', 'Leaks'], type=str, default='',
help="An optional sanitizer to enable when building and running the test suite.",
actions=lambda sanitizer: filter(None, [
@@ -177,12 +168,6 @@
AddFeature('long_tests')
]),
- Parameter(name='enable_debug_tests', choices=[True, False], type=bool, default=True,
- help="Whether to enable tests that exercise the libc++ debugging mode.",
- actions=lambda enabled: [] if enabled else [
- AddFeature('libcxx-no-debug-mode')
- ]),
-
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++.",