[PATCH] D31413: [libc++] Use __attribute__((init_priority(101))) to ensure streams get initialized early

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 20:01:20 PDT 2017


EricWF created this revision.

This patch fixes http://llvm.org/PR28954 using the `init_priority` attribute. All supported compilers accept this attribute, including clang-cl.
I'm only putting this up for review because IDK how to write a test for it.

Can anybody suggest a way to test this?


https://reviews.llvm.org/D31413

Files:
  src/iostream.cpp


Index: src/iostream.cpp
===================================================================
--- src/iostream.cpp
+++ src/iostream.cpp
@@ -73,7 +73,7 @@
 #endif
 ;
 
-ios_base::Init __start_std_streams;
+ios_base::Init __start_std_streams __attribute__((init_priority(101)));
 
 ios_base::Init::Init()
 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31413.93205.patch
Type: text/x-patch
Size: 304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170328/d81b7ee2/attachment.bin>


More information about the cfe-commits mailing list