[libcxx-commits] [libcxx] [libc++][hardening] Categorize assertions related to strict weak ordering (PR #77405)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 9 14:23:38 PST 2024
================
@@ -50,15 +50,17 @@ struct __debug_three_way_comp {
__expected = _Order::greater;
if (__o == _Order::greater)
__expected = _Order::less;
- _LIBCPP_ASSERT_UNCATEGORIZED(__comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering");
(void)__l;
(void)__r;
}
};
-// 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
+// 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 || \
----------------
ldionne wrote:
@danlark1 @var-const I am not certain about this decision:
- Extensive mode -> turn on `__debug_less`
- Debug mode -> also turn on the 100-or-less algorithm checking
I feel like real-world experience might help us tell whether this is the right split. @danlark1 do you have any insight? Other options would be:
- Extensive mode -> turn on the 100-or-less algorithm checking
- Debug mode -> also turn on `__debug_less`
or
- Extensive mode -> nothing
- Debug mode -> turn on both
For example, I know that Chromium is using the Extensive mode (probably still via the Safe mode enablement). @nico Would you expect Chrome in production to use `__debug_less`, the 100-or-less algorithm, both or neither?
https://github.com/llvm/llvm-project/pull/77405
More information about the libcxx-commits
mailing list