[libcxx-commits] [PATCH] D118950: [libc++] Remove usage of `_LIBCPP_DEBUG` in `__comp_ref_type` and replace with `_LIBCPP_DEBUG_LEVEL`

Jordan Rupprecht via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 10 09:04:31 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd6b1448809e4: [libc++] Remove usage of `_LIBCPP_DEBUG` in `__comp_ref_type` and replace with… (authored by rupprecht).

Changed prior to commit:
  https://reviews.llvm.org/D118950?vs=405811&id=407563#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118950/new/

https://reviews.llvm.org/D118950

Files:
  libcxx/include/__algorithm/comp_ref_type.h


Index: libcxx/include/__algorithm/comp_ref_type.h
===================================================================
--- libcxx/include/__algorithm/comp_ref_type.h
+++ libcxx/include/__algorithm/comp_ref_type.h
@@ -10,11 +10,8 @@
 #define _LIBCPP___ALGORITHM_COMP_REF_TYPE_H
 
 #include <__config>
-
-#ifdef _LIBCPP_DEBUG
-#  include <__debug>
-#  include <__utility/declval.h>
-#endif
+#include <__debug>
+#include <__utility/declval.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -22,8 +19,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#ifdef _LIBCPP_DEBUG
-
 template <class _Compare>
 struct __debug_less
 {
@@ -59,6 +54,8 @@
     __do_compare_assert(int, _LHS & __l, _RHS & __r) {
         _LIBCPP_ASSERT(!__comp_(__l, __r),
             "Comparator does not induce a strict weak ordering");
+        (void)__l;
+        (void)__r;
     }
 
     template <class _LHS, class _RHS>
@@ -67,13 +64,11 @@
     void __do_compare_assert(long, _LHS &, _RHS &) {}
 };
 
-#endif // _LIBCPP_DEBUG
-
 template <class _Comp>
 struct __comp_ref_type {
   // Pass the comparator by lvalue reference. Or in debug mode, using a
   // debugging wrapper that stores a reference.
-#ifndef _LIBCPP_DEBUG
+#if _LIBCPP_DEBUG_LEVEL == 0
   typedef _Comp& type;
 #else
   typedef __debug_less<_Comp> type;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118950.407563.patch
Type: text/x-patch
Size: 1321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220210/6cafd9a4/attachment-0001.bin>


More information about the libcxx-commits mailing list