From c9f8c1dba06e4ef4f94a84b4ccb4324b20a14e09 Mon Sep 17 00:00:00 2001 From: Josh Watzman Date: Thu, 7 May 2015 09:42:01 -0700 Subject: [PATCH] OS X doesn't support constructor priorities Summary: OS X doesn't support constructor init priorities, at all. AIUI, it's a limitation of their actual binary format and loader, not just a tooling/compiler limitation. This particular usage appears to just be for for logging/bug-finding purposes, so it looks like just removing the priority on OS X isn't the end of the world? Test Plan: g++-4.9 on OS X compiles this file now. Reviewed By: njormrod@fb.com Subscribers: ldbrandy, jdelong, folly-diffs@, yfeldblum, chalfant FB internal diff: D2040557 Signature: t1:2040557:1430975025:73f817b5d19a18dca6b19ba783dbea99192cbc41 --- folly/Singleton.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/folly/Singleton.cpp b/folly/Singleton.cpp index bfd63e57..d389f6ef 100644 --- a/folly/Singleton.cpp +++ b/folly/Singleton.cpp @@ -45,7 +45,12 @@ struct FatalHelper { std::vector leakedSingletons_; }; +#ifdef __APPLE__ +// OS X doesn't support constructor priorities. +FatalHelper fatalHelper; +#else FatalHelper __attribute__ ((__init_priority__ (101))) fatalHelper; +#endif } -- 2.34.1