diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -101,11 +101,16 @@ ${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_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) 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 @@ -898,6 +903,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/libcxx/cmake/caches/Apple.cmake b/libcxx/cmake/caches/Apple.cmake --- a/libcxx/cmake/caches/Apple.cmake +++ b/libcxx/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/libcxx/cmake/caches/Generic-debug-iterators.cmake b/libcxx/cmake/caches/Generic-debug-iterators.cmake deleted file mode 100644 --- a/libcxx/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/libcxx/cmake/caches/Generic-debug-mode.cmake b/libcxx/cmake/caches/Generic-debug-mode.cmake new file mode 100644 --- /dev/null +++ b/libcxx/cmake/caches/Generic-debug-mode.cmake @@ -0,0 +1 @@ +set(LIBCXX_ENABLE_DEBUG_MODE ON) diff --git a/libcxx/cmake/caches/Generic-no-debug.cmake b/libcxx/cmake/caches/Generic-no-debug.cmake deleted file mode 100644 --- a/libcxx/cmake/caches/Generic-no-debug.cmake +++ /dev/null @@ -1 +0,0 @@ -set(LIBCXX_ENABLE_DEBUG_MODE_SUPPORT OFF CACHE BOOL "") diff --git a/libcxx/docs/DesignDocs/DebugMode.rst b/libcxx/docs/DesignDocs/DebugMode.rst --- a/libcxx/docs/DesignDocs/DebugMode.rst +++ b/libcxx/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 hardenning, you should look into enabling :ref:`assertions ` +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 != 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 - 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/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -84,6 +84,13 @@ supported anymore. Please migrate to using the new support for :ref:`assertions ` instead. +- The ``_LIBCPP_DEBUG`` macro is not supported anymore. It will be honoured until + LLVM 17, 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 ----------- @@ -122,3 +129,7 @@ or on a platform that used to be supported by the legacy testing configuration and isn't supported by one of the configurations in ``libcxx/test/configs``, please reach out to the libc++ developers to get your configuration supported officially. + +- 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/libcxx/docs/TestingLibcxx.rst b/libcxx/docs/TestingLibcxx.rst --- a/libcxx/docs/TestingLibcxx.rst +++ b/libcxx/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= - - **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= **Values**: Memory, MemoryWithOrigins, Address, Undefined diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/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/libcxx/include/__algorithm/comp_ref_type.h b/libcxx/include/__algorithm/comp_ref_type.h --- a/libcxx/include/__algorithm/comp_ref_type.h +++ b/libcxx/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/libcxx/include/__algorithm/nth_element.h b/libcxx/include/__algorithm/nth_element.h --- a/libcxx/include/__algorithm/nth_element.h +++ b/libcxx/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/libcxx/include/__algorithm/partial_sort.h b/libcxx/include/__algorithm/partial_sort.h --- a/libcxx/include/__algorithm/partial_sort.h +++ b/libcxx/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/libcxx/include/__algorithm/shuffle.h b/libcxx/include/__algorithm/shuffle.h --- a/libcxx/include/__algorithm/shuffle.h +++ b/libcxx/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/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h --- a/libcxx/include/__algorithm/sort.h +++ b/libcxx/include/__algorithm/sort.h @@ -15,6 +15,7 @@ #include <__algorithm/partial_sort.h> #include <__algorithm/unwrap_iter.h> #include <__config> +#include <__debug> #include <__utility/swap.h> #include diff --git a/libcxx/include/__algorithm/unwrap_iter.h b/libcxx/include/__algorithm/unwrap_iter.h --- a/libcxx/include/__algorithm/unwrap_iter.h +++ b/libcxx/include/__algorithm/unwrap_iter.h @@ -43,7 +43,7 @@ } }; -#if _LIBCPP_DEBUG_LEVEL < 2 +#ifndef _LIBCPP_ENABLE_DEBUG_MODE template struct __unwrap_iter_impl<_Iter, true> { @@ -53,7 +53,7 @@ } }; -#endif // _LIBCPP_DEBUG_LEVEL < 2 +#endif // !_LIBCPP_ENABLE_DEBUG_MODE template > inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR diff --git a/libcxx/include/__assert b/libcxx/include/__assert --- a/libcxx/include/__assert +++ b/libcxx/include/__assert @@ -19,7 +19,7 @@ // This is for backwards compatibility with code that might have been enabling // assertions through the Debug mode previously. -#if _LIBCPP_DEBUG_LEVEL >= 1 +#if defined(_LIBCPP_DEBUG) # ifndef _LIBCPP_ENABLE_ASSERTIONS # define _LIBCPP_ENABLE_ASSERTIONS 1 # endif diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -788,55 +788,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 ). 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/libcxx/include/__config_site.in b/libcxx/include/__config_site.in --- a/libcxx/include/__config_site.in +++ b/libcxx/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/libcxx/include/__debug b/libcxx/include/__debug --- a/libcxx/include/__debug +++ b/libcxx/include/__debug @@ -12,30 +12,50 @@ #include <__assert> #include <__config> -#include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY) -# include -# include -# include +// 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) +# 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()) \ + _VSTD::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) + +#include +#include +#include -#if _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY) +_LIBCPP_BEGIN_NAMESPACE_STD struct _LIBCPP_TYPE_VIS __c_node; @@ -204,12 +224,15 @@ _LIBCPP_FUNC_VIS __libcpp_db* __get_db(); _LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db(); +_LIBCPP_END_NAMESPACE_STD + +#endif // defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_BUILDING_LIBRARY) -#endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY) +_LIBCPP_BEGIN_NAMESPACE_STD template _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 @@ -219,7 +242,7 @@ template _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 diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h --- a/libcxx/include/__format/buffer.h +++ b/libcxx/include/__format/buffer.h @@ -110,11 +110,7 @@ template concept __enable_direct_output = __formatter::__char_type<_CharT> && - (same_as<_OutIt, _CharT*> -#if _LIBCPP_DEBUG_LEVEL < 2 - || same_as<_OutIt, __wrap_iter<_CharT*>> -#endif - ); + (same_as<_OutIt, _CharT*> || same_as<_OutIt, __wrap_iter<_CharT*>>); /// Write policy for directly writing to the underlying output. template diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table --- a/libcxx/include/__hash_table +++ b/libcxx/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 { @@ -360,7 +360,7 @@ {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY explicit __hash_iterator(__next_pointer __node, const void* __c) _NOEXCEPT : __node_(__node) @@ -408,12 +408,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_) @@ -437,7 +437,7 @@ } return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const { @@ -478,7 +478,7 @@ {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY explicit __hash_const_iterator(__next_pointer __node, const void* __c) _NOEXCEPT : __node_(__node) @@ -519,7 +519,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_), @@ -547,7 +547,7 @@ } return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const { @@ -591,7 +591,7 @@ {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY explicit __hash_local_iterator(__next_pointer __node, size_t __bucket, size_t __bucket_count, const void* __c) _NOEXCEPT @@ -657,12 +657,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_), @@ -690,7 +690,7 @@ } return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const { @@ -734,7 +734,7 @@ {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY explicit __hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket, size_t __bucket_count, const void* __c) _NOEXCEPT @@ -1279,7 +1279,7 @@ { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::begin(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return local_iterator(__bucket_list_[__n], __n, bucket_count(), this); #else return local_iterator(__bucket_list_[__n], __n, bucket_count()); @@ -1292,7 +1292,7 @@ { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::end(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return local_iterator(nullptr, __n, bucket_count(), this); #else return local_iterator(nullptr, __n, bucket_count()); @@ -1305,7 +1305,7 @@ { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::cbegin(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this); #else return const_local_iterator(__bucket_list_[__n], __n, bucket_count()); @@ -1318,21 +1318,21 @@ { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::cend(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return const_local_iterator(nullptr, __n, bucket_count(), this); #else return const_local_iterator(nullptr, __n, bucket_count()); #endif } -#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); @@ -1512,7 +1512,7 @@ #endif __deallocate_node(__p1_.first().__next_); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__erase_c(this); #endif } @@ -1556,7 +1556,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_; ) { @@ -1617,7 +1617,7 @@ __u.__p1_.first().__next_ = nullptr; __u.size() = 0; } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -1769,7 +1769,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__p1_.first().__next_, this); #else return iterator(__p1_.first().__next_); @@ -1781,7 +1781,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(nullptr, this); #else return iterator(nullptr); @@ -1793,7 +1793,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return const_iterator(__p1_.first().__next_, this); #else return const_iterator(__p1_.first().__next_); @@ -1805,7 +1805,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return const_iterator(nullptr, this); #else return const_iterator(nullptr); @@ -1914,7 +1914,7 @@ __existing_node = __nd->__ptr(); __inserted = true; } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return pair(iterator(__existing_node, this), __inserted); #else return pair(iterator(__existing_node), __inserted); @@ -2012,7 +2012,7 @@ __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_); __node_insert_multi_perform(__cp, __pn); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__cp->__ptr(), this); #else return iterator(__cp->__ptr()); @@ -2045,7 +2045,7 @@ __cp->__next_ = __np; __pp->__next_ = static_cast<__next_pointer>(__cp); ++size(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(static_cast<__next_pointer>(__cp), this); #else return iterator(static_cast<__next_pointer>(__cp)); @@ -2115,7 +2115,7 @@ __inserted = true; } __done: -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return pair(iterator(__nd, this), __inserted); #else return pair(iterator(__nd), __inserted); @@ -2321,7 +2321,7 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__invalidate_all(this); #endif __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc(); @@ -2392,7 +2392,7 @@ { if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__value_, __k)) -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__nd, this); #else return iterator(__nd); @@ -2423,7 +2423,7 @@ { if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__value_, __k)) -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return const_iterator(__nd, this); #else return const_iterator(__nd); @@ -2480,7 +2480,7 @@ " referring to this container"); _LIBCPP_ASSERT(__p != end(), "unordered container erase(iterator) called with a non-dereferenceable iterator"); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE iterator __r(__np, this); #else iterator __r(__np); @@ -2507,7 +2507,7 @@ erase(__p); } __next_pointer __np = __last.__node_; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator (__np, this); #else return iterator (__np); @@ -2578,7 +2578,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_; ) { @@ -2729,7 +2729,7 @@ if (__u.size() > 0) __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] = __u.__p1_.first().__ptr(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -2763,7 +2763,7 @@ __x.swap(__y); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE template bool @@ -2793,7 +2793,7 @@ return false; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h --- a/libcxx/include/__iterator/wrap_iter.h +++ b/libcxx/include/__iterator/wrap_iter.h @@ -50,12 +50,12 @@ typename enable_if::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()) @@ -135,7 +135,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 iterator_type base() const _NOEXCEPT {return __i;} private: -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __wrap_iter(const void* __p, iterator_type __x) : __i(__x) { diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator --- a/libcxx/include/experimental/iterator +++ b/libcxx/include/experimental/iterator @@ -54,6 +54,7 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__memory/addressof.h> +#include <__string> #include <__utility/forward.h> #include <__utility/move.h> #include diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -298,7 +298,7 @@ __link_pointer __ptr_; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) @@ -328,7 +328,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) @@ -354,7 +354,7 @@ return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const @@ -411,7 +411,7 @@ __link_pointer __ptr_; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) @@ -441,12 +441,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) @@ -472,7 +472,7 @@ return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const { @@ -599,7 +599,7 @@ _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__end_.__next_, this); #else return iterator(__end_.__next_); @@ -608,7 +608,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return const_iterator(__end_.__next_, this); #else return const_iterator(__end_.__next_); @@ -617,7 +617,7 @@ _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__end_as_link(), this); #else return iterator(__end_as_link()); @@ -626,7 +626,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return const_iterator(__end_as_link(), this); #else return const_iterator(__end_as_link()); @@ -681,7 +681,7 @@ _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators() { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__invalidate_all(this); #endif } @@ -726,7 +726,7 @@ template __list_imp<_Tp, _Alloc>::~__list_imp() { clear(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__erase_c(this); #endif } @@ -780,7 +780,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)); @@ -1105,14 +1105,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 @@ -1372,7 +1372,7 @@ insert(__e, __f, __l); else erase(__i, __e); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__invalidate_all(this); #endif } @@ -1389,7 +1389,7 @@ insert(__e, __n, __x); else erase(__i, __e); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__invalidate_all(this); #endif } @@ -1413,7 +1413,7 @@ __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); ++base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__hold.release()->__as_link(), this); #else return iterator(__hold.release()->__as_link()); @@ -1426,7 +1426,7 @@ { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "list::insert(iterator, n, x) called with an iterator not referring to this list"); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE iterator __r(__p.__ptr_, this); #else iterator __r(__p.__ptr_); @@ -1438,7 +1438,7 @@ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __r = iterator(__hold->__as_link(), this); #else __r = iterator(__hold->__as_link()); @@ -1468,7 +1468,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __e = iterator(__prev, this); #else __e = iterator(__prev); @@ -1491,7 +1491,7 @@ { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "list::insert(iterator, range) called with an iterator not referring to this list"); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE iterator __r(__p.__ptr_, this); #else iterator __r(__p.__ptr_); @@ -1503,7 +1503,7 @@ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __r = iterator(__hold.get()->__as_link(), this); #else __r = iterator(__hold.get()->__as_link()); @@ -1533,7 +1533,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __e = iterator(__prev, this); #else __e = iterator(__prev); @@ -1656,7 +1656,7 @@ __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__nl, this); #else return iterator(__nl); @@ -1676,7 +1676,7 @@ __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__nl, this); #else return iterator(__nl); @@ -1694,7 +1694,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_; ) { @@ -1723,7 +1723,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_; ) { @@ -1756,7 +1756,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_; ) { @@ -1774,7 +1774,7 @@ __node_pointer __np = __n->__as_node(); __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); __node_alloc_traits::deallocate(__na, __np, 1); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__r, this); #else return iterator(__r); @@ -1798,7 +1798,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_; ) { @@ -1818,7 +1818,7 @@ __node_alloc_traits::deallocate(__na, __np, 1); } } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(__l.__ptr_, this); #else return iterator(__l.__ptr_); @@ -1839,7 +1839,7 @@ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE iterator __r = iterator(__hold.release()->__as_link(), this); #else iterator __r = iterator(__hold.release()->__as_link()); @@ -1868,7 +1868,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __e = iterator(__prev, this); #else __e = iterator(__prev); @@ -1897,7 +1897,7 @@ __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; __link_pointer __nl = __hold.release()->__as_link(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE iterator __r = iterator(__nl, this); #else iterator __r = iterator(__nl); @@ -1926,7 +1926,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __e = iterator(__prev, this); #else __e = iterator(__prev); @@ -1956,7 +1956,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); @@ -1997,7 +1997,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); @@ -2058,7 +2058,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); @@ -2195,7 +2195,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)); @@ -2319,7 +2319,7 @@ return size() == _VSTD::distance(begin(), end()); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE template bool @@ -2349,7 +2349,7 @@ return false; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE template inline _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/locale b/libcxx/include/locale --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -1461,7 +1461,7 @@ return do_put(__s, __iob, __fl, (unsigned long)__v); const numpunct& __np = use_facet >(__iob.getloc()); typedef typename numpunct::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/libcxx/include/span b/libcxx/include/span --- a/libcxx/include/span +++ b/libcxx/include/span @@ -210,7 +210,7 @@ using const_pointer = const _Tp *; using reference = _Tp &; using const_reference = const _Tp &; -#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) +#if defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) using iterator = pointer; #else using iterator = __wrap_iter; @@ -413,7 +413,7 @@ using const_pointer = const _Tp *; using reference = _Tp &; using const_reference = const _Tp &; -#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) +#if defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) using iterator = pointer; #else using iterator = __wrap_iter; diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -876,7 +876,7 @@ #endif basic_string& operator=(value_type __c); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return iterator(this, __get_pointer());} @@ -902,7 +902,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return const_iterator(__get_pointer() + size());} -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} @@ -1423,14 +1423,14 @@ bool __is_long() const _NOEXCEPT {return bool(__r_.first().__s.__size_ & __short_mask);} -#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_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) { @@ -1783,7 +1783,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators() { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) __get_db()->__invalidate_all(this); #endif @@ -1794,7 +1794,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) @@ -1816,7 +1816,7 @@ } #else (void)__pos; -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE } template @@ -1980,7 +1980,7 @@ { __str.__zero(); _VSTD::__debug_db_insert_c(this); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated() && __is_long()) __get_db()->swap(this, &__str); #endif @@ -1999,7 +1999,7 @@ __str.__zero(); } _VSTD::__debug_db_insert_c(this); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated() && __is_long()) __get_db()->swap(this, &__str); #endif @@ -2226,7 +2226,7 @@ template basic_string<_CharT, _Traits, _Allocator>::~basic_string() { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) __get_db()->__erase_c(this); #endif @@ -3416,7 +3416,7 @@ __is_nothrow_swappable::value) #endif { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) { if (!__is_long()) __get_db()->__invalidate_all(this); @@ -4412,7 +4412,7 @@ } #endif -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE template bool @@ -4446,7 +4446,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/libcxx/include/unordered_map b/libcxx/include/unordered_map --- a/libcxx/include/unordered_map +++ b/libcxx/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: @@ -1694,7 +1694,7 @@ : __table_(_VSTD::move(__u.__table_)) { _VSTD::__debug_db_insert_c(this); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -1713,7 +1713,7 @@ __u.__table_.remove((__i++).__i_)->__value_.__move()); } } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE else __get_db()->swap(this, _VSTD::addressof(__u)); #endif @@ -2292,7 +2292,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_));} @@ -2303,7 +2303,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 }; @@ -2470,7 +2470,7 @@ : __table_(_VSTD::move(__u.__table_)) { _VSTD::__debug_db_insert_c(this); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -2490,7 +2490,7 @@ __u.__table_.remove((__i++).__i_)->__value_.__move()); } } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE else __get_db()->swap(this, _VSTD::addressof(__u)); #endif diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set --- a/libcxx/include/unordered_set +++ b/libcxx/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 }; @@ -1007,7 +1007,7 @@ : __table_(_VSTD::move(__u.__table_)) { _VSTD::__debug_db_insert_c(this); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -1024,7 +1024,7 @@ while (__u.size() != 0) __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_)); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE else __get_db()->swap(this, _VSTD::addressof(__u)); #endif @@ -1485,7 +1485,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);} @@ -1496,7 +1496,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 }; @@ -1648,7 +1648,7 @@ : __table_(_VSTD::move(__u.__table_)) { _VSTD::__debug_db_insert_c(this); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -1665,7 +1665,7 @@ while (__u.size() != 0) __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_)); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE else __get_db()->swap(this, _VSTD::addressof(__u)); #endif diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -411,7 +411,7 @@ ~vector() { __annotate_delete(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__erase_c(this); #endif @@ -655,14 +655,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; @@ -1204,7 +1204,7 @@ : __end_cap_(nullptr, _VSTD::move(__x.__alloc())) { _VSTD::__debug_db_insert_c(this); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__x)); #endif this->__begin_ = __x.__begin_; @@ -1225,7 +1225,7 @@ this->__end_ = __x.__end_; this->__end_cap() = __x.__end_cap(); __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__x)); #endif } @@ -1297,7 +1297,7 @@ this->__end_ = __c.__end_; this->__end_cap() = __c.__end_cap(); __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__c)); #endif } @@ -1400,7 +1400,7 @@ typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return iterator(this, __p); #else return iterator(__p); @@ -1412,7 +1412,7 @@ typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE return const_iterator(this, __p); #else return const_iterator(__p); @@ -1944,7 +1944,7 @@ _VSTD::swap(this->__end_cap(), __x.__end_cap()); _VSTD::__swap_allocator(this->__alloc(), __x.__alloc(), integral_constant()); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->swap(this, _VSTD::addressof(__x)); #endif } @@ -1970,7 +1970,7 @@ return true; } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE template bool @@ -2002,14 +2002,14 @@ return this->__begin_ <= __p && __p < this->__end_; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE template inline _LIBCPP_INLINE_VISIBILITY void vector<_Tp, _Allocator>::__invalidate_all_iterators() { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__invalidate_all(this); #endif } @@ -2019,7 +2019,7 @@ 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/libcxx/lib/abi/CMakeLists.txt b/libcxx/lib/abi/CMakeLists.txt --- a/libcxx/lib/abi/CMakeLists.txt +++ b/libcxx/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_LIBNAME}" @@ -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/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/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/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt --- a/libcxx/test/CMakeLists.txt +++ b/libcxx/test/CMakeLists.txt @@ -100,10 +100,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/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp b/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp --- a/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp +++ b/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp @@ -64,7 +64,7 @@ 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/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp b/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp --- a/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp +++ b/libcxx/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/libcxx/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp b/libcxx/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp --- a/libcxx/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp +++ b/libcxx/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp @@ -12,8 +12,7 @@ // Make sure __debug_less asserts when the comparator is not consistent. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp --- a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp +++ b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp @@ -12,8 +12,7 @@ // __debug_less checks that a comparator actually provides a strict-weak ordering. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/algorithms/nth_element_stability.pass.cpp b/libcxx/test/libcxx/algorithms/nth_element_stability.pass.cpp --- a/libcxx/test/libcxx/algorithms/nth_element_stability.pass.cpp +++ b/libcxx/test/libcxx/algorithms/nth_element_stability.pass.cpp @@ -10,8 +10,7 @@ // Test std::nth_element stability randomization -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/algorithms/partial_sort_stability.pass.cpp b/libcxx/test/libcxx/algorithms/partial_sort_stability.pass.cpp --- a/libcxx/test/libcxx/algorithms/partial_sort_stability.pass.cpp +++ b/libcxx/test/libcxx/algorithms/partial_sort_stability.pass.cpp @@ -10,8 +10,7 @@ // Test std::partial_sort stability randomization -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/algorithms/sort_stability.pass.cpp b/libcxx/test/libcxx/algorithms/sort_stability.pass.cpp --- a/libcxx/test/libcxx/algorithms/sort_stability.pass.cpp +++ b/libcxx/test/libcxx/algorithms/sort_stability.pass.cpp @@ -10,8 +10,7 @@ // Test std::sort stability randomization -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp @@ -10,8 +10,7 @@ // list(list&& c); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp @@ -10,8 +10,7 @@ // template void emplace(const_iterator p, Args&&... args); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator position) with iterator from another container -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator first, const_iterator last); with various invalid iterators -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp @@ -11,8 +11,7 @@ // template // iterator insert(const_iterator position, Iter first, Iter last); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp @@ -10,8 +10,7 @@ // iterator insert(const_iterator position, value_type&& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp @@ -10,8 +10,7 @@ // iterator insert(const_iterator position, size_type n, const value_type& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp @@ -10,8 +10,7 @@ // iterator insert(const_iterator position, const value_type& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp @@ -10,8 +10,7 @@ // void splice(const_iterator position, list& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp @@ -10,8 +10,7 @@ // void splice(const_iterator position, list& x, iterator i); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp @@ -10,8 +10,7 @@ // void splice(const_iterator position, list& x, iterator first, iterator last); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.add.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.add.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.add.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.add.pass.cpp @@ -10,8 +10,7 @@ // Add to iterator out of bounds. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.compare.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.compare.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.compare.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.compare.pass.cpp @@ -10,8 +10,7 @@ // Compare iterators from different containers with <. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.decrement.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.decrement.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.decrement.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.decrement.pass.cpp @@ -10,8 +10,7 @@ // Decrement iterator prior to begin. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.increment.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.index.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.index.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.index.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.index.pass.cpp @@ -10,8 +10,7 @@ // Index iterator out of bounds. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.subtract.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.subtract.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.subtract.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/debug.iterator.subtract.pass.cpp @@ -10,8 +10,7 @@ // Subtract iterators from different containers. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp @@ -10,8 +10,7 @@ // iterator insert(const_iterator p, const value_type& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp @@ -12,8 +12,7 @@ // class = typename enable_if::value>::type> // iterator insert(const_iterator p, P&& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment local_iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp @@ -14,8 +14,7 @@ // void swap(unordered_map& x, unordered_map& y); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator position) with invalid iterators -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator first, const_iterator last); with invalid iterators -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp @@ -10,8 +10,7 @@ // iterator insert(const_iterator p, const value_type& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp @@ -12,8 +12,7 @@ // class = typename enable_if::value>::type> // iterator insert(const_iterator p, P&& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment local_iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp @@ -14,8 +14,7 @@ // void swap(unordered_multimap& x, unordered_multimap& y); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator position) with invalid iterators -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator first, const_iterator last); with invalid iterators -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator position) with invalid iterators -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator first, const_iterator last); with invalid iterators -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp @@ -10,8 +10,7 @@ // iterator insert(const_iterator p, const value_type& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment local_iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp @@ -14,8 +14,7 @@ // void swap(unordered_multiset& x, unordered_multiset& y); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator position) with invalid iterators -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator first, const_iterator last); with first iterator from another container -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp @@ -10,8 +10,7 @@ // iterator insert(const_iterator p, const value_type& x); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment local_iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp --- a/libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp @@ -14,8 +14,7 @@ // void swap(unordered_set& x, unordered_set& y); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/debug/containers.multithread.pass.cpp b/libcxx/test/libcxx/debug/containers.multithread.pass.cpp --- a/libcxx/test/libcxx/debug/containers.multithread.pass.cpp +++ b/libcxx/test/libcxx/debug/containers.multithread.pass.cpp @@ -9,8 +9,7 @@ // UNSUPPORTED: c++11, c++14 // UNSUPPORTED: libcpp-has-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/libcxx/test/libcxx/debug/containers/associative_containers.pass.cpp b/libcxx/test/libcxx/debug/containers/associative_containers.pass.cpp --- a/libcxx/test/libcxx/debug/containers/associative_containers.pass.cpp +++ b/libcxx/test/libcxx/debug/containers/associative_containers.pass.cpp @@ -8,8 +8,7 @@ // UNSUPPORTED: c++11, c++14 -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows // test container debugging diff --git a/libcxx/test/libcxx/debug/containers/sequence_container_iterators.pass.cpp b/libcxx/test/libcxx/debug/containers/sequence_container_iterators.pass.cpp --- a/libcxx/test/libcxx/debug/containers/sequence_container_iterators.pass.cpp +++ b/libcxx/test/libcxx/debug/containers/sequence_container_iterators.pass.cpp @@ -8,8 +8,7 @@ // UNSUPPORTED: c++11, c++14 -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows // test container debugging diff --git a/libcxx/test/libcxx/debug/containers/string.pass.cpp b/libcxx/test/libcxx/debug/containers/string.pass.cpp --- a/libcxx/test/libcxx/debug/containers/string.pass.cpp +++ b/libcxx/test/libcxx/debug/containers/string.pass.cpp @@ -8,8 +8,7 @@ // UNSUPPORTED: c++11, c++14 -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows // test container debugging diff --git a/libcxx/test/libcxx/debug/containers/unord_containers.pass.cpp b/libcxx/test/libcxx/debug/containers/unord_containers.pass.cpp --- a/libcxx/test/libcxx/debug/containers/unord_containers.pass.cpp +++ b/libcxx/test/libcxx/debug/containers/unord_containers.pass.cpp @@ -8,8 +8,7 @@ // UNSUPPORTED: c++11, c++14 -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows // test container debugging diff --git a/libcxx/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp b/libcxx/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp new file mode 100644 --- /dev/null +++ b/libcxx/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/libcxx/test/libcxx/debug/extern-templates.sh.cpp b/libcxx/test/libcxx/debug/extern-templates.sh.cpp --- a/libcxx/test/libcxx/debug/extern-templates.sh.cpp +++ b/libcxx/test/libcxx/debug/extern-templates.sh.cpp @@ -10,7 +10,7 @@ // for members of 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: libcpp-has-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 diff --git a/libcxx/test/libcxx/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp b/libcxx/test/libcxx/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp --- a/libcxx/test/libcxx/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp +++ b/libcxx/test/libcxx/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp @@ -16,6 +16,7 @@ #include #include +#include #include "test_macros.h" diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.add.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.add.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.add.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.add.pass.cpp @@ -10,8 +10,7 @@ // Add to iterator out of bounds. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp @@ -10,8 +10,7 @@ // Compare iterators from different containers with <. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.decrement.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.decrement.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.decrement.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.decrement.pass.cpp @@ -10,8 +10,7 @@ // Decrement iterator prior to begin. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.dereference.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.dereference.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.dereference.pass.cpp @@ -10,8 +10,7 @@ // Dereference non-dereferenceable iterator. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.increment.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.increment.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.increment.pass.cpp @@ -10,8 +10,7 @@ // Increment iterator past end. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.index.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.index.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.index.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.index.pass.cpp @@ -10,8 +10,7 @@ // Index iterator out of bounds. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp @@ -10,8 +10,7 @@ // Subtract iterators from different containers. -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator position) with an iterator from another container -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp @@ -10,8 +10,7 @@ // Call erase(const_iterator first, const_iterator last); with invalid iterators -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp @@ -10,8 +10,7 @@ // iterator insert(const_iterator p, charT c); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows // 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/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp @@ -11,8 +11,7 @@ // template // iterator insert(const_iterator p, InputIterator first, InputIterator last); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp @@ -10,8 +10,7 @@ // iterator insert(const_iterator p, size_type n, charT c); -// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +// UNSUPPORTED: !libcpp-has-debug-mode, c++03, windows #include diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp --- a/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp @@ -79,7 +79,7 @@ assert(ia[0] == static_cast(N)-1); assert(ia[N-1] == 0); assert(std::is_sorted(ia, ia+N, std::greater())); -#ifndef _LIBCPP_DEBUG +#ifndef _LIBCPP_ENABLE_DEBUG_MODE assert(pred.count() <= (N-1)); #endif } diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp +++ b/libcxx/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 // diff --git a/libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp b/libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp --- a/libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp +++ b/libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp @@ -12,9 +12,10 @@ // bool failed() const throw(); +#include #include #include -#include +#include #include "test_macros.h" @@ -25,7 +26,7 @@ my_streambuf() {} int_type sputc(char_type) { return Traits::eof(); } - }; +}; int main(int, char**) { diff --git a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp @@ -9,11 +9,6 @@ // UNSUPPORTED: libcpp-has-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>::grouping() -// XFAIL: LIBCXX-DEBUG-FIXME - // TODO FMT Evaluate gcc-11 status // UNSUPPORTED: gcc-11 diff --git a/libcxx/test/support/container_debug_tests.h b/libcxx/test/support/container_debug_tests.h --- a/libcxx/test/support/container_debug_tests.h +++ b/libcxx/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/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -365,8 +365,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" @@ -409,20 +409,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/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -240,9 +240,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" \ -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in" check-runtimes check-abi-list @@ -340,13 +340,6 @@ -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in" check-runtimes ;; -generic-no-debug) - clean - generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-debug.cmake" \ - -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in" - check-runtimes - check-abi-list -;; generic-no-filesystem) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake" \ diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -179,6 +179,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/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -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++.",