Skip to content

Commit 9aca97d

Browse files
committedJan 2, 2017
Introduce _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR ABI option.
Currently libc++ compiles a special version of error_category() into the dylib. This definition is no longer needed, and doesn't work on Windows due to dllimport/dllexport semantics. For those reasons this patch introduces an option to disable/enable this definition. By default the definition is provided in ABI v1 except on windows. This patch also addresses D28210. llvm-svn: 290840
1 parent 5d25843 commit 9aca97d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed
 

‎libcxx/include/__config

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
5454
#define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR
5555
#elif _LIBCPP_ABI_VERSION == 1
56+
#if !defined(_WIN32)
57+
// Enable compiling a definition of error_category() into the libc++ dylib.
58+
#define _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR
59+
#endif
5660
// Feature macros for disabling pre ABI v1 features. All of these options
5761
// are deprecated.
5862
#if defined(__FreeBSD__)

‎libcxx/include/system_error

+2-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,8 @@ class _LIBCPP_TYPE_VIS error_category
384384
public:
385385
virtual ~error_category() _NOEXCEPT;
386386

387-
#ifdef _LIBCPP_BUILDING_SYSTEM_ERROR
387+
#if defined(_LIBCPP_BUILDING_SYSTEM_ERROR) && \
388+
defined(_LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR)
388389
error_category() _NOEXCEPT;
389390
#else
390391
_LIBCPP_ALWAYS_INLINE

‎libcxx/src/system_error.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2929

3030
// class error_category
3131

32+
#if defined(_LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR)
3233
error_category::error_category() _NOEXCEPT
3334
{
3435
}
36+
#endif
3537

3638
error_category::~error_category() _NOEXCEPT
3739
{

0 commit comments

Comments
 (0)