[libcxx-commits] [PATCH] D95972: [libc++] Use init_priority(100) when possible
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 5 18:03:47 PDT 2021
ldionne updated this revision to Diff 377407.
ldionne added a comment.
Poke CI, this should be good to go.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95972/new/
https://reviews.llvm.org/D95972
Files:
libcxx/include/__config
libcxx/src/iostream.cpp
Index: libcxx/src/iostream.cpp
===================================================================
--- libcxx/src/iostream.cpp
+++ libcxx/src/iostream.cpp
@@ -73,7 +73,12 @@
#endif
;
+// Hacky way to make the compiler believe that we're inside a system header so
+// it doesn't flag the use of the init_priority attribute with a value that's
+// reserved for the implementation (we're the implementation).
+# 80 "iostream.cpp" 1 3
_LIBCPP_HIDDEN ios_base::Init __start_std_streams _LIBCPP_INIT_PRIORITY_MAX;
+# 82 "iostream.cpp" 2
// On Windows the TLS storage for locales needs to be initialized before we create
// the standard streams, otherwise it may not be alive during program termination
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1330,7 +1330,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__ < 13000000)
+# 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.377407.patch
Type: text/x-patch
Size: 1459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211006/77307c85/attachment-0001.bin>
More information about the libcxx-commits
mailing list