[libcxx-commits] [PATCH] D95972: [libc++] Use init_priority(100) when possible

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 3 13:32:16 PST 2021


ldionne created this revision.
ldionne added a reviewer: aaron.ballman.
Herald added a subscriber: jkorous.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Priorities below 101 are reserved for the implementation, so that's what
we should be using here. That is unfortunately only supported on more
recent versions of Clang. See https://reviews.llvm.org/D31413 for details.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95972

Files:
  libcxx/include/__config


Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1440,7 +1440,13 @@
 #endif
 
 #if __has_attribute(init_priority)
-# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101)))
+    // TODO: Remove this once we drop support for building libc++ with old Clangs
+#   if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1200) || \
+       (defined(__apple_build_version__) && __apple_build_version__ < 12000000)
+#     define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101)))
+#   else
+#     define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(100)))
+#   endif
 #else
 # define _LIBCPP_INIT_PRIORITY_MAX
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95972.321214.patch
Type: text/x-patch
Size: 754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210203/bc6b6083/attachment.bin>


More information about the libcxx-commits mailing list