summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-12-28 09:50:23 +0000
committerEric Fiselier <eric@efcs.ca>2016-12-28 09:50:23 +0000
commitb9565705bdc917800a4298473be4a69273abe514 (patch)
tree6b5fadb2f86df83f9297bb0671c4cd7886659444 /libcxx/include
parent1a39b86d0f412e5d645b6e05770d5ae821063ca2 (diff)
downloadbcm5719-llvm-b9565705bdc917800a4298473be4a69273abe514.tar.gz
bcm5719-llvm-b9565705bdc917800a4298473be4a69273abe514.zip
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. llvm-svn: 290662
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/__config10
1 files changed, 9 insertions, 1 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 868914d9899..186ee309a88 100644
--- a/libcxx/include/__config
+++ b/libcxx/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 @@ typedef __char32_t char32_t;
#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))
OpenPOWER on IntegriCloud