This introduces:
- _LIBCPP_ASSERT_VALID_INPUT_RANGE;
- _LIBCPP_ASSERT_VALID_CONTAINER_ACCESS;
- _LIBCPP_ASSERT_VALID_ITERATOR_ACCESS;
- _LIBCPP_ASSERT_VALID_ALLOCATOR;
- _LIBCPP_ASSERT_INTERNAL.
Paths
| Differential D155349
[libc++][hardening] Categorize most assertions inside the container classes. ClosedPublic Authored by var-const on Jul 14 2023, 5:01 PM.
Details
Summary This introduces:
Diff Detail
Event TimelineComment Actions Thanks for working on this! In general LGMT. Some remarks regarding the naming; I know it seems a bit like bike shedding, but IMO we should have good names. Once we expose these names to users it will be a lot harder to change them. I feel some names are quite "short" and make it hard to use similar tests in the future with a consistent name.
Comment Actions
Just to clarify, the intent is that those names are private. Users should only toggle the high-level options _LIBCPP_ENABLE_HARDENED_MODE and _LIBCPP_ENABLE_DEBUG_MODE. We specifically didn't want to lock ourselves into these categories if we wanted to change them later on. This looks pretty good to me, with a few comments. The categories make sense to me, and I think we'll learn more about how we want to categorize stuff going forward (but since this isn't public, we can adjust as we learn more).
Comment Actions
That was not clear to me from the patch. When this is not a "user flag" I feel less strongly about picking the best name. Thanks for the clarification @ldionne.
var-const added inline comments.
This revision is now accepted and ready to land.Jul 19 2023, 12:22 PM Comment Actions I didn't do another review, but my concerns have been addressed. Since Louis is happy, I'm happy too.
Closed by commit rG4122db1fbdeb: [libc++][hardening] Categorize most assertions inside the container classes. (authored by varconst <varconsteq@gmail.com>). · Explain WhyJul 20 2023, 10:15 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 542139 libcxx/include/__config
libcxx/include/__expected/expected.h
libcxx/include/__functional/function.h
libcxx/include/__iterator/bounded_iter.h
libcxx/include/__mdspan/extents.h
libcxx/include/__tree
libcxx/include/array
libcxx/include/deque
libcxx/include/list
libcxx/include/map
libcxx/include/optional
libcxx/include/span
libcxx/include/string
libcxx/include/string_view
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/include/vector
|
You should make it clear that this is "internal documentation". Maybe something like: