[libcxx-commits] [PATCH] D154796: [libc++] Recategorize additional instantiations in the dylib as availability macros

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 17 14:45:38 PDT 2023


philnik updated this revision to Diff 551280.
philnik marked 4 inline comments as done.
philnik added a comment.

Address comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154796/new/

https://reviews.llvm.org/D154796

Files:
  libcxx/include/__availability
  libcxx/include/__config
  libcxx/include/fstream
  libcxx/include/sstream
  libcxx/src/ios.instantiations.cpp


Index: libcxx/src/ios.instantiations.cpp
===================================================================
--- libcxx/src/ios.instantiations.cpp
+++ libcxx/src/ios.instantiations.cpp
@@ -31,7 +31,7 @@
 #endif
 
 // Additional instantiations added later. Whether programs rely on these being
-// available is protected by _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1.
+// available is protected by _LIBCPP_AVAILABILITY_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1.
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringbuf<char>;
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream<char>;
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream<char>;
Index: libcxx/include/sstream
===================================================================
--- libcxx/include/sstream
+++ libcxx/include/sstream
@@ -1013,7 +1013,7 @@
     __x.swap(__y);
 }
 
-#if defined(_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1)
+#if defined(_LIBCPP_AVAILABILITY_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1)
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringbuf<char>;
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringstream<char>;
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char>;
Index: libcxx/include/fstream
===================================================================
--- libcxx/include/fstream
+++ libcxx/include/fstream
@@ -1734,7 +1734,7 @@
         this->setstate(ios_base::failbit);
 }
 
-#if defined(_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1)
+#if defined(_LIBCPP_AVAILABILITY_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1)
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ifstream<char>;
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>;
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>;
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -182,11 +182,6 @@
 #  endif
 
 #  if defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_ABI_VERSION >= 2
-// Enable additional explicit instantiations of iostreams components. This
-// reduces the number of weak definitions generated in programs that use
-// iostreams by providing a single strong definition in the shared library.
-#    define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
-
 // Define a key function for `bad_function_call` in the library, to centralize
 // its vtable and typeinfo to libc++ rather than having all other libraries
 // using that class define their own copies.
Index: libcxx/include/__availability
===================================================================
--- libcxx/include/__availability
+++ libcxx/include/__availability
@@ -174,6 +174,11 @@
 // #   define _LIBCPP_AVAILABILITY_HAS_NO_PMR
 #   define _LIBCPP_AVAILABILITY_PMR
 
+// Enable additional explicit instantiations of iostreams components. This
+// reduces the number of weak definitions generated in programs that use
+// iostreams by providing a single strong definition in the shared library.
+#   define _LIBCPP_AVAILABILITY_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
+
 #elif defined(__APPLE__)
 
     // shared_mutex and shared_timed_mutex
@@ -348,6 +353,13 @@
 #    define _LIBCPP_AVAILABILITY_PMR
 #  endif
 
+#  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 120000)   || \
+      (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 150000) || \
+      (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 150000)         || \
+      (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 80000)
+#    define _LIBCPP_AVAILABILITY_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
+#  endif
+
 #else
 
 // ...New vendors can add availability markup here...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154796.551280.patch
Type: text/x-patch
Size: 4154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230817/79c38c67/attachment-0001.bin>


More information about the libcxx-commits mailing list