瀏覽代碼

Merge pull request #1261 from gjasny/disable-tls-for-osx-10.6

Disable thread local storage for OSX < 10.7
Adam Cozzette 7 年之前
父節點
當前提交
85ba13c9bf
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/google/protobuf/stubs/platform_macros.h

+ 6 - 0
src/google/protobuf/stubs/platform_macros.h

@@ -99,6 +99,7 @@ GOOGLE_PROTOBUF_PLATFORM_ERROR
 
 
 #if defined(__APPLE__)
 #if defined(__APPLE__)
 #define GOOGLE_PROTOBUF_OS_APPLE
 #define GOOGLE_PROTOBUF_OS_APPLE
+#include <Availability.h>
 #include <TargetConditionals.h>
 #include <TargetConditionals.h>
 #if TARGET_OS_IPHONE
 #if TARGET_OS_IPHONE
 #define GOOGLE_PROTOBUF_OS_IPHONE
 #define GOOGLE_PROTOBUF_OS_IPHONE
@@ -125,4 +126,9 @@ GOOGLE_PROTOBUF_PLATFORM_ERROR
 #define GOOGLE_PROTOBUF_NO_THREADLOCAL
 #define GOOGLE_PROTOBUF_NO_THREADLOCAL
 #endif
 #endif
 
 
+#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+// __thread keyword requires at least 10.7
+#define GOOGLE_PROTOBUF_NO_THREADLOCAL
+#endif
+
 #endif  // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_
 #endif  // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_