Skip to content

Commit 157bbe6

Browse files
committed
[libc++] Remove the ability to use the std::nullptr_t emulation in C++03 mode
Back in https://reviews.llvm.org/D109459, we stopped using the C++03 emulation for std::nullptr_t by default, which was an ABI break. We still left a knob for users to turn it back on if they were broken by the change, with a note that we would remove that knob after one release. The time has now come to remove the knob and clean up the std::nullptr_t emulation. Differential Revision: https://reviews.llvm.org/D114786
1 parent d730336 commit 157bbe6

File tree

13 files changed

+14
-112
lines changed

13 files changed

+14
-112
lines changed

libcxx/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@ API Changes
4444
ABI Changes
4545
-----------
4646

47+
- The ``_LIBCPP_ABI_USE_CXX03_NULLPTR_EMULATION`` macro controlling whether we use an
48+
emulation for ``std::nullptr_t`` in C++03 mode has been removed. After this change,
49+
``_LIBCPP_ABI_USE_CXX03_NULLPTR_EMULATION`` will not be honoured anymore and there
50+
will be no way to opt back into the C++03 emulation of ``std::nullptr_t``.
51+
4752
Build System Changes
4853
--------------------

libcxx/include/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ set(files
276276
__memory/voidify.h
277277
__mutex_base
278278
__node_handle
279-
__nullptr
280279
__numeric/accumulate.h
281280
__numeric/adjacent_difference.h
282281
__numeric/exclusive_scan.h

libcxx/include/__config

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -138,23 +138,6 @@
138138
# endif
139139
#endif
140140

141-
// By default, don't use a nullptr_t emulation type in C++03.
142-
//
143-
// This is technically an ABI break from previous releases, however it is
144-
// very unlikely to impact anyone. If a user is impacted by this break,
145-
// they can return to using the C++03 nullptr emulation by defining
146-
// _LIBCPP_ABI_USE_CXX03_NULLPTR_EMULATION.
147-
//
148-
// This switch will be removed entirely in favour of never providing a
149-
// C++03 emulation after one release.
150-
//
151-
// IMPORTANT: IF YOU ARE READING THIS AND YOU TURN THIS MACRO ON, PLEASE LEAVE
152-
// A COMMENT ON https://reviews.llvm.org/D109459 OR YOU WILL BE BROKEN
153-
// IN THE FUTURE WHEN WE REMOVE THE ABILITY TO USE THE C++03 EMULATION.
154-
#ifndef _LIBCPP_ABI_USE_CXX03_NULLPTR_EMULATION
155-
# define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR
156-
#endif
157-
158141
#if defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_ABI_VERSION >= 2
159142
// Enable additional explicit instantiations of iostreams components. This
160143
// reduces the number of weak definitions generated in programs that use
@@ -534,12 +517,8 @@ typedef __char32_t char32_t;
534517
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
535518
#endif
536519

537-
#if !(__has_feature(cxx_nullptr))
538-
# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
539-
# define nullptr __nullptr
540-
# else
541-
# define _LIBCPP_HAS_NO_NULLPTR
542-
# endif
520+
#ifdef _LIBCPP_CXX03_LANG
521+
# define nullptr __nullptr
543522
#endif
544523

545524
// Objective-C++ features (opt-in)

libcxx/include/__debug

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
# pragma GCC system_header
1919
#endif
2020

21-
#if defined(_LIBCPP_HAS_NO_NULLPTR)
22-
# include <cstddef>
23-
#endif
24-
2521
#if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY)
2622
# include <cstddef>
2723
# include <cstdio>

libcxx/include/__format/formatter_pointer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <__format/formatter_integral.h>
2121
#include <__format/parser_std_format_spec.h>
2222
#include <__iterator/access.h>
23-
#include <__nullptr>
2423
#include <cstdint>
2524

2625
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

libcxx/include/__memory/auto_ptr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#define _LIBCPP___MEMORY_AUTO_PTR_H
1212

1313
#include <__config>
14-
#include <__nullptr>
1514

1615
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1716
# pragma GCC system_header

libcxx/include/__nullptr

Lines changed: 0 additions & 61 deletions
This file was deleted.

libcxx/include/__support/win32/locale_win32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
1212

1313
#include <__config>
14-
#include <__nullptr>
14+
#include <cstddef>
1515
#include <locale.h> // _locale_t
1616
#include <stdio.h>
1717

libcxx/include/cstddef

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,16 @@ Types:
3434
*/
3535

3636
#include <__config>
37+
#include <stddef.h>
3738
#include <version>
3839

3940
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
4041
# pragma GCC system_header
4142
#endif
4243

43-
// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
44-
#include_next <stddef.h>
45-
#include <__nullptr>
46-
4744
_LIBCPP_BEGIN_NAMESPACE_STD
4845

46+
using ::nullptr_t;
4947
using ::ptrdiff_t _LIBCPP_USING_IF_EXISTS;
5048
using ::size_t _LIBCPP_USING_IF_EXISTS;
5149

libcxx/include/module.modulemap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,6 @@ module std [system] {
990990
module __mbstate_t { private header "__mbstate_t.h" export * }
991991
module __mutex_base { private header "__mutex_base" export * }
992992
module __node_handle { private header "__node_handle" export * }
993-
module __nullptr { header "__nullptr" export * }
994993
module __split_buffer { private header "__split_buffer" export * }
995994
module __std_stream { private header "__std_stream" export * }
996995
module __string { private header "__string" export * }

0 commit comments

Comments
 (0)