[libcxx-commits] [libcxx] [libc++][hardening] Categorize assertions that produce incorrect results (PR #77183)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 9 13:50:01 PST 2024


================
@@ -283,6 +283,14 @@
 // - `_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR` -- checks any operations that exchange nodes between containers to make sure
 //   the containers have compatible allocators.
 //
+// - `_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN` -- checks that the given argument is within the domain of valid arguments
----------------
ldionne wrote:

Thanks for the writeup, this is really useful. Naming this is indeed really tricky. Some suggestions:

- `_LIBCPP_ASSERT_CANT_MEET_POSTCONDITIONS`
- `_LIBCPP_ASSERT_CONSEQUENCES_UNKNOWN`
- `_LIBCPP_ASSERT_CONSEQUENCES_OUTSIDE_LIBRARY`

None of those is really pretty, but that's some food for thought. I think the unifying theme here is that the assertion is about times when you can't meet your postconditions, not about a "fallback category". The documentation should probably be updated not to give the impression that this is a fallback category.

https://github.com/llvm/llvm-project/pull/77183


More information about the libcxx-commits mailing list