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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 8 12:09:39 PDT 2021


ldionne created this revision.
Herald added subscribers: arichardson, mgorny.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

We only support Clangs that implement nullptr as an extension in C++03 mode,
and we don't support GCC in C++03 mode. Hence, we can technically drop our
emulation for std::nullptr_t in C++03 mode. Doing that is technically an ABI
break since it changes the mangling for std::nullptr_t. However:

(1) The only affected users are those compiling in C++03 mode that have std::nullptr_t

  as part of their ABI, which should be reasonably rare.

(2) Those users already have a lingering problem in that their code will be incompatible

  in C++03 and C++11 modes because of that very ABI break. Hence, the only users that
  could really be inconvenienced about this change is those that planned on compiling
  in C++03 mode forever - for other users, we're just breaking them now instead of
  letting them break themselves later on when they try to upgrade to C++11.

(3) The ABI break will cause a linker error since the mangling changed, and will

  not result in an obscure runtime error.

Concretely, the motivation for making this change is to make our own ABI consistent
in C++03 and C++11 modes and to remove complexity around the definition of nullptr.

Furthermore, we could investigate making nullptr a keyword in C++03 mode as a Clang
extension -- I don't think that would break anyone, since libc++ already defines
nullptr as a macro to something else. Only users that do not use libc++ and compile
in C++03 mode could potentially be broken by that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109459

Files:
  libcxx/docs/ReleaseNotes.rst
  libcxx/include/CMakeLists.txt
  libcxx/include/__config
  libcxx/include/__debug
  libcxx/include/__memory/auto_ptr.h
  libcxx/include/__nullptr
  libcxx/include/__support/win32/locale_win32.h
  libcxx/include/cstddef
  libcxx/include/stddef.h
  libcxx/test/std/language.support/support.types/nullptr_t.pass.cpp
  libcxx/utils/generate_private_header_tests.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109459.371414.patch
Type: text/x-patch
Size: 7737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210908/6c0bf2ce/attachment.bin>


More information about the libcxx-commits mailing list