Skip to content

Commit 870827f

Browse files
committed
[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.
1 parent 31e8203 commit 870827f

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

libcxx/include/__debug

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,12 @@
2929

3030
#if _LIBCPP_DEBUG_LEVEL == 0
3131
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
32-
# define _LIBCPP_DEBUG_MODE(...) ((void)0)
3332
# define _LIBCPP_ASSERT_IMPL(x, m) ((void)0)
3433
#elif _LIBCPP_DEBUG_LEVEL == 1
3534
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
36-
# define _LIBCPP_DEBUG_MODE(...) ((void)0)
3735
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
3836
#elif _LIBCPP_DEBUG_LEVEL == 2
3937
# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(x, m)
40-
# define _LIBCPP_DEBUG_MODE(...) __VA_ARGS__
4138
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
4239
#else
4340
# error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2

libcxx/include/__hash_table

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,9 @@ public:
295295
typedef typename _NodeTypes::__node_value_type_pointer pointer;
296296

297297
_LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT : __node_(nullptr) {
298-
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
298+
#if _LIBCPP_DEBUG_LEVEL == 2
299+
__get_db()->__insert_i(this);
300+
#endif
299301
}
300302

301303
#if _LIBCPP_DEBUG_LEVEL == 2
@@ -405,14 +407,18 @@ public:
405407

406408

407409
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {
408-
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
410+
#if _LIBCPP_DEBUG_LEVEL == 2
411+
__get_db()->__insert_i(this);
412+
#endif
409413
}
410414

411415
_LIBCPP_INLINE_VISIBILITY
412416
__hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
413417
: __node_(__x.__node_)
414418
{
415-
_LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x));
419+
#if _LIBCPP_DEBUG_LEVEL == 2
420+
__get_db()->__iterator_copy(this, &__x);
421+
#endif
416422
}
417423

418424
#if _LIBCPP_DEBUG_LEVEL == 2
@@ -518,7 +524,9 @@ public:
518524
typedef typename _NodeTypes::__node_value_type_pointer pointer;
519525

520526
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {
521-
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
527+
#if _LIBCPP_DEBUG_LEVEL == 2
528+
__get_db()->__insert_i(this);
529+
#endif
522530
}
523531

524532
#if _LIBCPP_DEBUG_LEVEL == 2
@@ -650,7 +658,9 @@ public:
650658

651659

652660
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {
653-
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
661+
#if _LIBCPP_DEBUG_LEVEL == 2
662+
__get_db()->__insert_i(this);
663+
#endif
654664
}
655665

656666
_LIBCPP_INLINE_VISIBILITY
@@ -659,7 +669,9 @@ public:
659669
__bucket_(__x.__bucket_),
660670
__bucket_count_(__x.__bucket_count_)
661671
{
662-
_LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x));
672+
#if _LIBCPP_DEBUG_LEVEL == 2
673+
__get_db()->__iterator_copy(this, &__x);
674+
#endif
663675
}
664676

665677
#if _LIBCPP_DEBUG_LEVEL == 2

0 commit comments

Comments
 (0)