Fix ABI incompatible C++03 nullptr_t
In C++03 libc++ emulates nullptr_t using a class, and #define's nullptr.
However this makes nullptr_t mangle differently between C++03 and C++11.
This breaks any function ABI which takes nullptr_t.
Thanfully Clang provides __nullptr in all dialects. This patch adds
an ABI option to switch to using __nullptr in C++03. In a perfect world
I would like to turn this on by default, since it's just ABI breaking fix
to an ABI breaking bug.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290662 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config
index 868914d..186ee30 100644
--- a/include/__config
+++ b/include/__config
@@ -48,6 +48,10 @@
#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+// Don't use a nullptr_t simulation type in C++03 and use theh C++11 nullptr
+// provided under the alternate keyword __nullptr, which changes the mangling
+// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
+#define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR
#elif _LIBCPP_ABI_VERSION == 1
// Feature macros for disabling pre ABI v1 features. All of these options
// are deprecated.
@@ -266,7 +270,11 @@
#endif
#if !(__has_feature(cxx_nullptr))
-#define _LIBCPP_HAS_NO_NULLPTR
+# if __has_extension(cxx_nullptr) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
+# define nullptr __nullptr
+# else
+# define _LIBCPP_HAS_NO_NULLPTR
+# endif
#endif
#if !(__has_feature(cxx_rvalue_references))