forked from OSchip/llvm-project
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
This commit is contained in:
parent
1a39b86d0f
commit
b9565705bd
|
@ -48,6 +48,10 @@
|
||||||
#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
|
#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
|
||||||
#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
|
#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
|
||||||
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
|
#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
|
#elif _LIBCPP_ABI_VERSION == 1
|
||||||
// Feature macros for disabling pre ABI v1 features. All of these options
|
// Feature macros for disabling pre ABI v1 features. All of these options
|
||||||
// are deprecated.
|
// are deprecated.
|
||||||
|
@ -266,7 +270,11 @@ typedef __char32_t char32_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(__has_feature(cxx_nullptr))
|
#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
|
#endif
|
||||||
|
|
||||||
#if !(__has_feature(cxx_rvalue_references))
|
#if !(__has_feature(cxx_rvalue_references))
|
||||||
|
|
Loading…
Reference in New Issue