[libcxx-commits] [libcxx] [libc++] Use __wrap_iter in string_view and array in the unstable ABI (PR #74482)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 14 14:58:35 PDT 2024
PiJoules wrote:
> If it's causing lots of pain, would it be possible to make this opt-in for two releases, then switch it to opt-out (and document that we'll be doing this no later than two releases time)? That'll give folks time to address this issue without being broken today.
>
> To avoid having users need to either modify `__config` or need to maintain an unbounded set of macros, what do you think about flipping the macro? Then users who don't want/can't yet use this only need to add one macro instead of many.
>
> ```c++
> #if defined(_LIBCPP_ABI_BOUNDED_ITERATORS)
> using const_iterator = __bounded_iter<const_pointer>;
> #elif defined(_LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW)
> using const_iterator = __wrap_iter<const_pointer>;
> #else
> using const_iterator = const_pointer;
> #endif
> ```
>
> to
>
> ```c++
> #if defined(_LIBCPP_ABI_BOUNDED_ITERATORS)
> using const_iterator = __bounded_iter<const_pointer>;
> #elif !defined(_LIBCPP_ABI_NO_USE_WRAP_ITER_IN_STD_STRING_VIEW) // macro adds "NO"
> using const_iterator = const_pointer;
> #else
> using const_iterator = __wrap_iter<const_pointer>;
> #endif
> ```
>
> Apologies for not thinking of this when we chatted last week.
Do you have a PR for something like this? I think it would also be nice to have a macro we can set in our build that doesn't involve editing the `__config` file or opting out of `LIBCXX_ABI_VERSION = 2`.
https://github.com/llvm/llvm-project/pull/74482
More information about the libcxx-commits
mailing list