[libcxx-commits] [libcxx] [libcxx] adds opt out mechanism for using __wrap_iter for array and s… (PR #84226)
Christopher Di Bella via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 6 12:16:43 PST 2024
https://github.com/cjdb created https://github.com/llvm/llvm-project/pull/84226
…tring_view
`__config` was unconditionally opting users into this change, and to opt out required either a manual edit of the header, or getting users to manually define each unstable ABI macro they want to support. This patch strikes a middle-ground by adding an opt-out mechanism.
>From 373c7cc0131d350a2b063c550d16e7e64ac9afca Mon Sep 17 00:00:00 2001
From: Christopher Di Bella <cjdb at google.com>
Date: Wed, 6 Mar 2024 20:08:00 +0000
Subject: [PATCH] [libcxx] adds opt out mechanism for using __wrap_iter for
array and string_view
`__config` was unconditionally opting users into this change, and to opt
out required either a manual edit of the header, or getting users to
manually define each unstable ABI macro they want to support. This patch
strikes a middle-ground by adding an opt-out mechanism.
---
libcxx/docs/ReleaseNotes/19.rst | 3 +++
libcxx/include/__config | 10 ++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index 04f16610f8117e..955cadaa914439 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -49,6 +49,9 @@ Improvements and New Features
-----------------------------
- The performance of growing ``std::vector`` has been improved for trivially relocatable types.
+- ``std::array`` and ``std::string_view`` are no longer pointers in the unstable ABI by default, and
+ can be reverted to raw pointers by defining the macros ``_LIBCPP_ABI_NO_USE_WRAP_ITER_IN_STD_ARRAY``
+ and ``_LIBCPP_ABI_NO_USE_WRAP_ITER_IN_STD_STRING_VIEW``.
Deprecations and Removals
-------------------------
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 3a438e85a7b819..70f15cce54a309 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -178,8 +178,14 @@
// pointers, which prevents people from relying on a non-portable implementation
// detail. This is especially useful because enabling bounded iterators hardening
// requires code not to make these assumptions.
-# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY
-# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
+
+# if !defined(_LIBCPP_ABI_NO_USE_WRAP_ITER_IN_STD_ARRAY)
+# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY
+# endif
+
+# if !defined(_LIBCPP_ABI_NO_USE_WRAP_ITER_IN_STD_STRING_VIEW)
+# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
+# endif
# elif _LIBCPP_ABI_VERSION == 1
# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))
// Enable compiling copies of now inline methods into the dylib to support
More information about the libcxx-commits
mailing list