[libcxx-commits] [PATCH] D91565: Guard init_priority attribute within libc++
Zbigniew Sarbinowski via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 16 13:53:25 PST 2020
zibi created this revision.
zibi added a reviewer: ldionne.
zibi added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
zibi requested review of this revision.
Not all platforms support priority attribute. I'm moving conditional definition of this attribute to `include/__config`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D91565
Files:
libcxx/include/__config
libcxx/src/iostream.cpp
Index: libcxx/src/iostream.cpp
===================================================================
--- libcxx/src/iostream.cpp
+++ libcxx/src/iostream.cpp
@@ -77,7 +77,7 @@
#endif
;
-_LIBCPP_HIDDEN ios_base::Init __start_std_streams __attribute__((init_priority(101)));
+_LIBCPP_HIDDEN ios_base::Init __start_std_streams _LIBCPP_INIT_PRIORITY_MAX;
// 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
@@ -1435,6 +1435,15 @@
#define _LIBCPP_HAS_NO_FGETPOS_FSETPOS
#endif
+// Detect if the init_priority attribute is supported.
+// GCC on Apple doesn't support the init priority attribute,same for MSVC z/OS.
+#if (defined(_LIBCPP_COMPILER_GCC) && defined(__APPLE__)) \
+ || defined(_LIBCPP_COMPILER_MSVC) || defined(__MVS__)
+# define _LIBCPP_INIT_PRIORITY_MAX
+#else
+# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101)))
+#endif
+
#endif // __cplusplus
#endif // _LIBCPP_CONFIG
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91565.305589.patch
Type: text/x-patch
Size: 1180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201116/3efebdbb/attachment.bin>
More information about the libcxx-commits
mailing list