[PATCH] Introduce _LIBCPP_ABI_UNSTABLE to libc++

Marshall Clow mclow.lists at gmail.com
Wed Dec 17 14:17:23 PST 2014


Hi chandlerc, EricWF, joerg,

First step towards letting vendors manage ABI changes in libc++.

Introduce the _LIBCPP_ABI_UNSTABLE macro, which turns on all the ABI changes.

Introduce the _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT macro, which controls the layout of std::string objects.  This is a synonym for the _LIBCPP_ALTERNATE_STRING_LAYOUT macro.

http://reviews.llvm.org/D6712

Files:
  include/__config
  include/string

Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -581,6 +581,13 @@
 #define __has_builtin(__x) 0
 #endif
 
+#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
+#endif
+#ifdef _LIBCPP_ABI_UNSTABLE
+#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
+#endif
+
 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
 #   define _LIBCPP_EXPLICIT explicit
 #else
Index: include/string
===================================================================
--- include/string
+++ include/string
@@ -1185,7 +1185,7 @@
 #pragma warning( pop )
 #endif // _LIBCPP_MSVC
 
-#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
 
 template <class _CharT, size_t = sizeof(_CharT)>
 struct __padding
@@ -1198,7 +1198,7 @@
 {
 };
 
-#endif  // _LIBCPP_ALTERNATE_STRING_LAYOUT
+#endif  // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
 
 template<class _CharT, class _Traits, class _Allocator>
 class _LIBCPP_TYPE_VIS_ONLY basic_string
@@ -1234,7 +1234,7 @@
 
 private:
 
-#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
 
     struct __long
     {
@@ -1294,7 +1294,7 @@
         value_type __data_[__min_cap];
     };
 
-#endif  // _LIBCPP_ALTERNATE_STRING_LAYOUT
+#endif  // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
 
     union __ulx{__long __lx; __short __lxx;};
 
@@ -1680,7 +1680,7 @@
     const allocator_type& __alloc() const _NOEXCEPT
         {return __r_.second();}
 
-#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
 
     _LIBCPP_INLINE_VISIBILITY
     void __set_short_size(size_type __s) _NOEXCEPT
@@ -1698,7 +1698,7 @@
         {return __r_.first().__s.__size_;}
 #   endif
 
-#else  // _LIBCPP_ALTERNATE_STRING_LAYOUT
+#else  // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
 
     _LIBCPP_INLINE_VISIBILITY
     void __set_short_size(size_type __s) _NOEXCEPT
@@ -1716,7 +1716,7 @@
         {return __r_.first().__s.__size_ >> 1;}
 #   endif
 
-#endif  // _LIBCPP_ALTERNATE_STRING_LAYOUT
+#endif  // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
 
     _LIBCPP_INLINE_VISIBILITY
     void __set_long_size(size_type __s) _NOEXCEPT

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6712.17412.patch
Type: text/x-patch
Size: 2219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141217/d99384c7/attachment.bin>


More information about the cfe-commits mailing list