Fix FOLLY_TLS under macosx and clang
authorFrancis Ma <fma@fb.com>
Thu, 28 Jan 2016 00:33:36 +0000 (16:33 -0800)
committerfacebook-github-bot-0 <folly-bot@fb.com>
Thu, 28 Jan 2016 03:20:29 +0000 (19:20 -0800)
Summary: Only include guard iphone simulator and iphone devices for folly_tls

Reviewed By: ldemailly

Differential Revision: D2872383

fb-gh-sync-id: 00fb8c1ee03a97037e92d20aeda75f2435d71f5a

folly/Portability.h

index f4893a543c3a06a82933f768c73c62fc356d5d83..0e9c471b1f13ff1bf7fc55f03cbcafb743df80fe 100644 (file)
@@ -223,9 +223,7 @@ namespace std { typedef ::max_align_t max_align_t; }
  * the semantics are the same
  * (but remember __thread has different semantics when using emutls (ex. apple))
  */
-#if defined(__APPLE__)
-#undef FOLLY_TLS
-#elif defined(_MSC_VER)
+#if defined(_MSC_VER)
 # define FOLLY_TLS __declspec(thread)
 #elif defined(__GNUC__) || defined(__clang__)
 # define FOLLY_TLS __thread
@@ -233,6 +231,10 @@ namespace std { typedef ::max_align_t max_align_t; }
 # error cannot define platform specific thread local storage
 #endif
 
+#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
+#undef FOLLY_TLS
+#endif
+
 // Define to 1 if you have the `preadv' and `pwritev' functions, respectively
 #if !defined(FOLLY_HAVE_PREADV) && !defined(FOLLY_HAVE_PWRITEV)
 # if defined(__GLIBC_PREREQ)