aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/stubs/atomicops.h
diff options
context:
space:
mode:
authorGravatar pliard@google.com <pliard@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2012-07-17 15:51:05 +0000
committerGravatar pliard@google.com <pliard@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2012-07-17 15:51:05 +0000
commitdaced74d777e6b0add8166a07de3f549cb4ca46c (patch)
treea8000d23d18fd74c91680148fc0ba35f09e65412 /src/google/protobuf/stubs/atomicops.h
parentd0e03932c1890c70fa7625a27cd8c237e142a27e (diff)
Add support for NaCl in atomicops.
This does additionally a significant cleanup in platform_macros.h (initially pulled from v8). It implemented some subtleties that we don't use like the HOST/TARGET arch distinction. Changes related to NaCl support come from Chromium's build/build_config.h. BUG=392
Diffstat (limited to 'src/google/protobuf/stubs/atomicops.h')
-rw-r--r--src/google/protobuf/stubs/atomicops.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h
index d452a054..13156820 100644
--- a/src/google/protobuf/stubs/atomicops.h
+++ b/src/google/protobuf/stubs/atomicops.h
@@ -63,12 +63,12 @@ namespace protobuf {
namespace internal {
typedef int32 Atomic32;
-#ifdef GOOGLE_PROTOBUF_HOST_ARCH_64_BIT
+#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(__APPLE__)
-// MacOS is an exception to the implicit conversion rule above,
-// because it uses long for intptr_t.
+#if defined(GOOGLE_PROTOBUF_OS_NACL)
+// NaCl's intptr_t is not actually 64-bits on 64-bit!
+// http://code.google.com/p/nativeclient/issues/detail?id=1162
typedef int64 Atomic64;
#else
typedef intptr_t Atomic64;
@@ -130,7 +130,7 @@ Atomic32 Acquire_Load(volatile const Atomic32* ptr);
Atomic32 Release_Load(volatile const Atomic32* ptr);
// 64-bit atomic operations (only available on 64-bit processors).
-#ifdef GOOGLE_PROTOBUF_HOST_ARCH_64_BIT
+#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT
Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
Atomic64 old_value,
Atomic64 new_value);
@@ -150,7 +150,7 @@ void Release_Store(volatile Atomic64* ptr, Atomic64 value);
Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
Atomic64 Acquire_Load(volatile const Atomic64* ptr);
Atomic64 Release_Load(volatile const Atomic64* ptr);
-#endif // GOOGLE_PROTOBUF_HOST_ARCH_64_BIT
+#endif // GOOGLE_PROTOBUF_ARCH_64_BIT
} // namespace internal
} // namespace protobuf
@@ -162,8 +162,7 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
// MSVC.
#if defined(_MSC_VER)
-#if defined(GOOGLE_PROTOBUF_HOST_ARCH_IA32) || \
- defined(GOOGLE_PROTOBUF_HOST_ARCH_X64)
+#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
@@ -175,12 +174,11 @@ GOOGLE_PROTOBUF_ATOMICOPS_ERROR
// GCC.
#elif defined(__GNUC__)
-#if defined(GOOGLE_PROTOBUF_HOST_ARCH_IA32) || \
- defined(GOOGLE_PROTOBUF_HOST_ARCH_X64)
+#if defined(GOOGLE_PROTOBUF_ARCH_IA32) || defined(GOOGLE_PROTOBUF_ARCH_X64)
#include <google/protobuf/stubs/atomicops_internals_x86_gcc.h>
-#elif defined(GOOGLE_PROTOBUF_HOST_ARCH_ARM)
+#elif defined(GOOGLE_PROTOBUF_ARCH_ARM)
#include <google/protobuf/stubs/atomicops_internals_arm_gcc.h>
-#elif defined(GOOGLE_PROTOBUF_HOST_ARCH_MIPS)
+#elif defined(GOOGLE_PROTOBUF_ARCH_MIPS)
#include <google/protobuf/stubs/atomicops_internals_mips_gcc.h>
#else
GOOGLE_PROTOBUF_ATOMICOPS_ERROR