[libcxx-commits] [PATCH] D109459: [libc++][ABI BREAK] Remove the C++03 emulation for std::nullptr_t

Duncan P. N. Exon Smith via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 29 12:56:42 PST 2021


dexonsmith added a subscriber: rjmccall.
dexonsmith added a comment.

In D109459#3043589 <https://reviews.llvm.org/D109459#3043589>, @ldionne wrote:

> @dexonsmith has had useful views on ABI changes in the past, I'm curious to have his opinion on this change, since I'm still ambivalent.

I missed this before!

> TL;DR: Today, `std::nullptr_t` is a different type in C++03 and C++11, which means that the ABI breaks between C++03 and C++11. This patch breaks the ABI in C++03 mode once, right now, to reconcile the C++03 and C++11 ABIs and remove some convolution from libc++. My hunch is that this will not affect too many people and hence it's reasonable. Remember that `nullptr` is a C++11 construct, so it would have to be someone compiling their code in C++03 mode *and* using our `nullptr` extension, *and* leaking `nullptr_t` in their ABI. Do you have an opinion?

This feels relatively safe to me for the reasons given, but hard to be sure. One option would be to change behaviour behind a vendor+user macro combo for a couple of releases to test (vendors and/or users could revert to behaviour as-is today if/when necessary), then drop the configurations once there’s more confidence. I’m not sure it’s worth the trouble though.

@rjmccall, any thoughts from you?

Re clang/libc++ behaviour, if you wanted to continue providing the extension but take an ABI break, I think you could have clang expose a `__nullptr_type__` in C++03 that it mangled like the C++11 `nullptr_t` and then add a typedef for it in libc++ to expose it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109459/new/

https://reviews.llvm.org/D109459



More information about the libcxx-commits mailing list