[libcxx] r292190 - Add ABI option to remove recently inlined __shared_count functions from the library.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 16 19:16:26 PST 2017


Author: ericwf
Date: Mon Jan 16 21:16:26 2017
New Revision: 292190

URL: http://llvm.org/viewvc/llvm-project?rev=292190&view=rev
Log:
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"

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/memory
    libcxx/trunk/include/system_error
    libcxx/trunk/src/memory.cpp
    libcxx/trunk/src/system_error.cpp

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=292190&r1=292189&r2=292190&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Jan 16 21:16:26 2017
@@ -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.

Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=292190&r1=292189&r2=292190&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Mon Jan 16 21:16:26 2017
@@ -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;

Modified: libcxx/trunk/include/system_error
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/system_error?rev=292190&r1=292189&r2=292190&view=diff
==============================================================================
--- libcxx/trunk/include/system_error (original)
+++ libcxx/trunk/include/system_error Mon Jan 16 21:16:26 2017
@@ -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

Modified: libcxx/trunk/src/memory.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/memory.cpp?rev=292190&r1=292189&r2=292190&view=diff
==============================================================================
--- libcxx/trunk/src/memory.cpp (original)
+++ libcxx/trunk/src/memory.cpp Mon Jan 16 21:16:26 2017
@@ -35,6 +35,7 @@ __shared_weak_count::~__shared_weak_coun
 {
 }
 
+#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()
         __release_weak();
 }
 
+#endif // _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
+
 void
 __shared_weak_count::__release_weak() _NOEXCEPT
 {

Modified: libcxx/trunk/src/system_error.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/system_error.cpp?rev=292190&r1=292189&r2=292190&view=diff
==============================================================================
--- libcxx/trunk/src/system_error.cpp (original)
+++ libcxx/trunk/src/system_error.cpp Mon Jan 16 21:16:26 2017
@@ -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
 {
 }




More information about the cfe-commits mailing list