[libc++] NFCI: Remove the _LIBCPP_DEBUG_MODE helper macro

It was used inconsistently and the name was pretty confusing, so we might
as well use `#if _LIBCPP_DEBUG_LEVEL == 2` consistently everywhere.
This commit is contained in:
Louis Dionne 2020-10-02 15:07:40 -04:00
parent 31e820378b
commit 870827f652
2 changed files with 18 additions and 9 deletions

View File

@ -29,15 +29,12 @@
#if _LIBCPP_DEBUG_LEVEL == 0
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
# define _LIBCPP_DEBUG_MODE(...) ((void)0)
# define _LIBCPP_ASSERT_IMPL(x, m) ((void)0)
#elif _LIBCPP_DEBUG_LEVEL == 1
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
# define _LIBCPP_DEBUG_MODE(...) ((void)0)
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
#elif _LIBCPP_DEBUG_LEVEL == 2
# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(x, m)
# define _LIBCPP_DEBUG_MODE(...) __VA_ARGS__
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
#else
# error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2

View File

@ -295,7 +295,9 @@ public:
typedef typename _NodeTypes::__node_value_type_pointer pointer;
_LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT : __node_(nullptr) {
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
}
#if _LIBCPP_DEBUG_LEVEL == 2
@ -405,14 +407,18 @@ public:
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
: __node_(__x.__node_)
{
_LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x));
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__iterator_copy(this, &__x);
#endif
}
#if _LIBCPP_DEBUG_LEVEL == 2
@ -518,7 +524,9 @@ public:
typedef typename _NodeTypes::__node_value_type_pointer pointer;
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
}
#if _LIBCPP_DEBUG_LEVEL == 2
@ -650,7 +658,9 @@ public:
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
}
_LIBCPP_INLINE_VISIBILITY
@ -659,7 +669,9 @@ public:
__bucket_(__x.__bucket_),
__bucket_count_(__x.__bucket_count_)
{
_LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x));
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__iterator_copy(this, &__x);
#endif
}
#if _LIBCPP_DEBUG_LEVEL == 2