Description
Proposal
Add __unsafe_memcpy
/__unsafe_memset
(and possibly others) to ptrcheck.h a la:
uint8_t* __unsafe_indexable __unsafe_memcpy(uint8_t* __unsafe_indexable dst, uint8_t* __unsafe_indexable src, size_t size) {
memcpy(__unsafe_forge_bidi_indexable(uint8_t*, dst, size),
__unsafe_forge_bidi_indexable(uint8_t*, src, size),
size);
}
Could also be a macro, I suppose :)
The general pattern I've been going with as part of adoption is to get everything building with -fbounds-safety by marking nearly everything ABI-changing as __unsafe_indexable
. This makes it easier to make localized improvements while still being able to build and run tests.
They'd still be clearly marked as unsafe, and so they'd be easily searchable/identifiable.
This also makes #pragma clang abi_ptr_attr set(unsafe_indexable)
more attainable, and easier to adopt on per-line, per-function, per-TU granularities.
This request is mostly an adoption/ergonomics proposal, and as mentioned in discord, a temporary workaround exists to put these unsafe functions in a local header for adoption.