Index: third_party/protobuf/src/google/protobuf/stubs/atomicops.h |
diff --git a/third_party/protobuf/src/google/protobuf/stubs/atomicops.h b/third_party/protobuf/src/google/protobuf/stubs/atomicops.h |
index ae3ba88e5fe09e80894381a8d882c7ec68e47486..31e2b782350f39e80cd7146134800462c2e6f646 100644 |
--- a/third_party/protobuf/src/google/protobuf/stubs/atomicops.h |
+++ b/third_party/protobuf/src/google/protobuf/stubs/atomicops.h |
@@ -1,6 +1,6 @@ |
// Protocol Buffers - Google's data interchange format |
// Copyright 2012 Google Inc. All rights reserved. |
-// http://code.google.com/p/protobuf/ |
+// https://developers.google.com/protocol-buffers/ |
// |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
@@ -56,24 +56,36 @@ |
// Don't include this file for people not concerned about thread safety. |
#ifndef GOOGLE_PROTOBUF_NO_THREAD_SAFETY |
+#include <google/protobuf/stubs/common.h> |
#include <google/protobuf/stubs/platform_macros.h> |
namespace google { |
namespace protobuf { |
namespace internal { |
+#if defined(GOOGLE_PROTOBUF_ARCH_POWER) |
+#if defined(_LP64) || defined(__LP64__) |
+typedef int32 Atomic32; |
+typedef intptr_t Atomic64; |
+#else |
+typedef intptr_t Atomic32; |
+typedef int64 Atomic64; |
+#endif |
+#else |
typedef int32 Atomic32; |
#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT |
// We need to be able to go between Atomic64 and AtomicWord implicitly. This |
// means Atomic64 and AtomicWord should be the same type on 64-bit. |
-#if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) |
+#if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) || defined(GOOGLE_PROTOBUF_ARCH_SPARC) |
// NaCl's intptr_t is not actually 64-bits on 64-bit! |
// http://code.google.com/p/nativeclient/issues/detail?id=1162 |
+// sparcv9's pointer type is 32bits |
typedef int64 Atomic64; |
#else |
typedef intptr_t Atomic64; |
#endif |
#endif |
+#endif |
// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or |
// Atomic64 routines below, depending on your architecture. |
@@ -120,6 +132,9 @@ Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, |
Atomic32 old_value, |
Atomic32 new_value); |
+#if defined(__MINGW32__) && defined(MemoryBarrier) |
+#undef MemoryBarrier |
+#endif |
void MemoryBarrier(); |
void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value); |
void Acquire_Store(volatile Atomic32* ptr, Atomic32 value); |
@@ -158,7 +173,7 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); |
// Include our platform specific implementation. |
#define GOOGLE_PROTOBUF_ATOMICOPS_ERROR \ |
-#error "Atomic operations are not supported on your platform" |
+"Atomic operations are not supported on your platform" |
// ThreadSanitizer, http://clang.llvm.org/docs/ThreadSanitizer.html. |
#if defined(THREAD_SANITIZER) |
@@ -168,9 +183,17 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); |
#if defined(GOOGLE_PROTOBUF_ARCH_IA32) || defined(GOOGLE_PROTOBUF_ARCH_X64) |
#include <google/protobuf/stubs/atomicops_internals_x86_msvc.h> |
#else |
-GOOGLE_PROTOBUF_ATOMICOPS_ERROR |
+#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR |
#endif |
+// Solaris |
+#elif defined(GOOGLE_PROTOBUF_OS_SOLARIS) |
+#include <google/protobuf/stubs/atomicops_internals_solaris.h> |
+ |
+// AIX |
+#elif defined(GOOGLE_PROTOBUF_OS_AIX) |
+#include <google/protobuf/stubs/atomicops_internals_power.h> |
+ |
// Apple. |
#elif defined(GOOGLE_PROTOBUF_OS_APPLE) |
#include <google/protobuf/stubs/atomicops_internals_macosx.h> |
@@ -179,7 +202,7 @@ GOOGLE_PROTOBUF_ATOMICOPS_ERROR |
#elif defined(__GNUC__) |
#if defined(GOOGLE_PROTOBUF_ARCH_IA32) || defined(GOOGLE_PROTOBUF_ARCH_X64) |
#include <google/protobuf/stubs/atomicops_internals_x86_gcc.h> |
-#elif defined(GOOGLE_PROTOBUF_ARCH_ARM) |
+#elif defined(GOOGLE_PROTOBUF_ARCH_ARM) && defined(__linux__) |
#include <google/protobuf/stubs/atomicops_internals_arm_gcc.h> |
#elif defined(GOOGLE_PROTOBUF_ARCH_AARCH64) |
#include <google/protobuf/stubs/atomicops_internals_arm64_gcc.h> |
@@ -187,15 +210,25 @@ GOOGLE_PROTOBUF_ATOMICOPS_ERROR |
#include <google/protobuf/stubs/atomicops_internals_arm_qnx.h> |
#elif defined(GOOGLE_PROTOBUF_ARCH_MIPS) || defined(GOOGLE_PROTOBUF_ARCH_MIPS64) |
#include <google/protobuf/stubs/atomicops_internals_mips_gcc.h> |
-#elif defined(__pnacl__) |
+#elif defined(GOOGLE_PROTOBUF_ARCH_POWER) |
+#include <google/protobuf/stubs/atomicops_internals_power.h> |
+#elif defined(__native_client__) |
#include <google/protobuf/stubs/atomicops_internals_pnacl.h> |
+#elif (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)) |
+#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h> |
+#elif defined(__clang__) |
+#if __has_extension(c_atomic) |
+#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h> |
+#else |
+#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR |
+#endif |
#else |
-GOOGLE_PROTOBUF_ATOMICOPS_ERROR |
+#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR |
#endif |
// Unknown. |
#else |
-GOOGLE_PROTOBUF_ATOMICOPS_ERROR |
+#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR |
#endif |
// On some platforms we need additional declarations to make AtomicWord |