[libcxx-commits] [libcxx] Lower std::string's alignment requirement from 16 to 8. (PR #68749)

Martijn Vels via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 10 16:15:46 PDT 2023


================
@@ -167,6 +167,11 @@
 // The implementation moved to the header, but we still export the symbols from
 // the dylib for backwards compatibility.
 #    define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
+// Same memory by providing the allocator more freedom to allocate the most
+// efficient size class by dropping the alignment requirements for std::string's
+// pointer from 16 to 8. This changes the output of std::string::max_size,
+// which makes it ABI breaking
----------------
martijnvels wrote:

It is unlikely to "really" break users, in a previous change we saw automated tests failing because 'dynamic libraries'. Theoretically it could cause ODR if you have (inlined / weak) code with different constexpr max_size() compiled in?

But yeah, I think "it should be fine", but I am always a bit.... uncomfortable with these of language lawyer questions :)

https://github.com/llvm/llvm-project/pull/68749


More information about the libcxx-commits mailing list