[libcxx-commits] [libcxx] [libc++][hardening] Categorize assertions related to strict weak ordering (PR #77405)
Konstantin Varlamov via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 8 19:25:04 PST 2024
================
@@ -53,10 +53,9 @@ struct __debug_less {
_LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI void __do_compare_assert(long, _LHS&, _RHS&) {}
};
-// Pass the comparator by lvalue reference. Or in debug mode, using a
-// debugging wrapper that stores a reference.
-#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
-template <class _Comp>
+// Pass the comparator by lvalue reference. Or in the extensive hardening mode and above, using a debugging wrapper that
+// stores a reference.
+#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE || _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
----------------
var-const wrote:
This is unfortunate and breaks the elegant separation between assertion categories and hardening modes to some extent. However, even if the assertion is a no-op, I'm not sure we can allow the potential extra overhead of the comparator wrapper in the unchecked or fast modes (keeping in mind that not all builds are optimized).
https://github.com/llvm/llvm-project/pull/77405
More information about the libcxx-commits
mailing list