[libcxx-commits] [libcxx] 870827f - [libc++] NFCI: Remove the _LIBCPP_DEBUG_MODE helper macro
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 2 12:11:38 PDT 2020
Author: Louis Dionne
Date: 2020-10-02T15:11:23-04:00
New Revision: 870827f65222ebb1a9701d4d0e916f315dc692a8
URL: https://github.com/llvm/llvm-project/commit/870827f65222ebb1a9701d4d0e916f315dc692a8
DIFF: https://github.com/llvm/llvm-project/commit/870827f65222ebb1a9701d4d0e916f315dc692a8.diff
LOG: [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.
Added:
Modified:
libcxx/include/__debug
libcxx/include/__hash_table
Removed:
################################################################################
diff --git a/libcxx/include/__debug b/libcxx/include/__debug
index dbf47f6f5307..1829b3279d5a 100644
--- a/libcxx/include/__debug
+++ b/libcxx/include/__debug
@@ -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
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 8836391b2ab7..1feb4bc3582f 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -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
More information about the libcxx-commits
mailing list