[libcxx-commits] [PATCH] D154997: [libc++][hardening] Deprecate `_LIBCPP_ENABLE_ASSERTIONS`.
Nico Weber via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 9 12:19:22 PDT 2023
thakis added a comment.
In D154997#4572972 <https://reviews.llvm.org/D154997#4572972>, @thakis wrote:
> We are currently shipping the old _LIBCPP_ENABLE_ASSERTION mode. Is there a list of checks that we'll lose when we switch to this new hardened mode?
I tried looking at this, here's what I came up with: https://bugs.chromium.org/p/chromium/issues/detail?id=1465186#c3
In summary, if I understood correctly, most asserts got replaced with _LIBCPP_ASSERT_UNCATEGORIZED() which is disabled in hardened mode.
So to get what we had, we want to ship debug mode. However, debug mode also enables __debug_less and __debug_three_way_comp, and it comes with an ominous comment in __config that says that debug mode "may affect the complexity of algorithms" (which we don't want, and which I think currently also doesn't happen), and it sounds like it's something you don't consider to be shippable.
Maybe `_LIBCPP_ASSERT_UNCATEGORIZED` and friends could only be defined if they aren't already defined, then we could map all of them to `_LIBCPP_ASSERT` and not define `_LIBCPP_ENABLE_DEBUG_MODE`? Then I think we'd have what we used to have and what we currently ship.
Does that sound correct?
(For example, one thing that the old asserts caught and that our tests verify libc++ catches but which isn't caught in hardened mode is `string_view(ptr, -1)`.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154997/new/
https://reviews.llvm.org/D154997
More information about the libcxx-commits
mailing list