Add ABI option to remove recently inlined __shared_count functions from the library.

In order to allow inlining of previously out-of-line functions without an ABI break
libc++ provides legacy definitions in the dylib that old programs can
continue to use. Unfortunatly Windows link.exe detects this hack and diagnoses the duplicate
definitions.

This patch disable the duplicate definitions on Windows by adding an ABI option
which disables all "legacy out-of-line symbols"

llvm-svn: 292190
This commit is contained in:
Eric Fiselier 2017-01-17 03:16:26 +00:00
parent c018efd680
commit 11f6045379
5 changed files with 12 additions and 6 deletions

View File

@ -59,8 +59,9 @@
#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
#elif _LIBCPP_ABI_VERSION == 1
#if !defined(_WIN32)
// Enable compiling a definition of error_category() into the libc++ dylib.
#define _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR
// Enable compiling copies of now inline methods into the dylib to support
// applications compiled against older libraries.
#define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
#endif
// Feature macros for disabling pre ABI v1 features. All of these options
// are deprecated.

View File

@ -3750,7 +3750,8 @@ public:
explicit __shared_count(long __refs = 0) _NOEXCEPT
: __shared_owners_(__refs) {}
#ifdef _LIBCPP_BUILDING_MEMORY
#if defined(_LIBCPP_BUILDING_MEMORY) && \
defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
void __add_shared() _NOEXCEPT;
bool __release_shared() _NOEXCEPT;
#else
@ -3787,7 +3788,8 @@ protected:
virtual ~__shared_weak_count();
public:
#ifdef _LIBCPP_BUILDING_MEMORY
#if defined(_LIBCPP_BUILDING_MEMORY) && \
defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
void __add_shared() _NOEXCEPT;
void __add_weak() _NOEXCEPT;
void __release_shared() _NOEXCEPT;

View File

@ -385,7 +385,7 @@ public:
virtual ~error_category() _NOEXCEPT;
#if defined(_LIBCPP_BUILDING_SYSTEM_ERROR) && \
defined(_LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR)
defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
error_category() _NOEXCEPT;
#else
_LIBCPP_ALWAYS_INLINE

View File

@ -35,6 +35,7 @@ __shared_weak_count::~__shared_weak_count()
{
}
#if defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
void
__shared_count::__add_shared() _NOEXCEPT
{
@ -71,6 +72,8 @@ __shared_weak_count::__release_shared() _NOEXCEPT
__release_weak();
}
#endif // _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
void
__shared_weak_count::__release_weak() _NOEXCEPT
{

View File

@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// class error_category
#if defined(_LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR)
#if defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
error_category::error_category() _NOEXCEPT
{
}