aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/stubs/atomicops.h
diff options
context:
space:
mode:
authorGravatar liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2012-06-05 17:02:25 +0000
committerGravatar liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2012-06-05 17:02:25 +0000
commite7881e8e1295e4e9f71ce74409d98eacaa02db38 (patch)
tree962b0bb1396346b9de0afe650a0a3e714afac138 /src/google/protobuf/stubs/atomicops.h
parentaabd7cf8f858cfeffb2b874176f43d23ac702c22 (diff)
Update atomicops to support new platforms where intptr_t = long.
Fix license headers.
Diffstat (limited to 'src/google/protobuf/stubs/atomicops.h')
-rw-r--r--src/google/protobuf/stubs/atomicops.h73
1 files changed, 49 insertions, 24 deletions
diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h
index b20cc55d..d452a054 100644
--- a/src/google/protobuf/stubs/atomicops.h
+++ b/src/google/protobuf/stubs/atomicops.h
@@ -1,17 +1,20 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
+// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -154,26 +157,48 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
} // namespace google
// Include our platform specific implementation.
-#if defined(_MSC_VER) && \
- (defined(GOOGLE_PROTOBUF_HOST_ARCH_IA32) || \
- defined(GOOGLE_PROTOBUF_HOST_ARCH_X64))
-#include "atomicops_internals_x86_msvc.h"
-#elif defined(__APPLE__) && \
- (defined(GOOGLE_PROTOBUF_HOST_ARCH_IA32) || \
- defined(GOOGLE_PROTOBUF_HOST_ARCH_X64))
-#include "atomicops_internals_x86_macosx.h"
-#elif defined(__GNUC__) && \
- (defined(GOOGLE_PROTOBUF_HOST_ARCH_IA32) || \
- defined(GOOGLE_PROTOBUF_HOST_ARCH_X64))
-#include "atomicops_internals_x86_gcc.h"
-#elif defined(__GNUC__) && defined(GOOGLE_PROTOBUF_HOST_ARCH_ARM)
-#include "atomicops_internals_arm_gcc.h"
-#elif defined(__GNUC__) && defined(GOOGLE_PROTOBUF_HOST_ARCH_MIPS)
-#include "atomicops_internals_mips_gcc.h"
-#else
+#define GOOGLE_PROTOBUF_ATOMICOPS_ERROR \
#error "Atomic operations are not supported on your platform"
+
+// MSVC.
+#if defined(_MSC_VER)
+#if defined(GOOGLE_PROTOBUF_HOST_ARCH_IA32) || \
+ defined(GOOGLE_PROTOBUF_HOST_ARCH_X64)
+#include <google/protobuf/stubs/atomicops_internals_x86_msvc.h>
+#else
+GOOGLE_PROTOBUF_ATOMICOPS_ERROR
+#endif
+
+// Apple.
+#elif defined(GOOGLE_PROTOBUF_OS_APPLE)
+#include <google/protobuf/stubs/atomicops_internals_macosx.h>
+
+// GCC.
+#elif defined(__GNUC__)
+#if defined(GOOGLE_PROTOBUF_HOST_ARCH_IA32) || \
+ defined(GOOGLE_PROTOBUF_HOST_ARCH_X64)
+#include <google/protobuf/stubs/atomicops_internals_x86_gcc.h>
+#elif defined(GOOGLE_PROTOBUF_HOST_ARCH_ARM)
+#include <google/protobuf/stubs/atomicops_internals_arm_gcc.h>
+#elif defined(GOOGLE_PROTOBUF_HOST_ARCH_MIPS)
+#include <google/protobuf/stubs/atomicops_internals_mips_gcc.h>
+#else
+GOOGLE_PROTOBUF_ATOMICOPS_ERROR
#endif
+// Unknown.
+#else
+GOOGLE_PROTOBUF_ATOMICOPS_ERROR
+#endif
+
+// On some platforms we need additional declarations to make AtomicWord
+// compatible with our other Atomic* types.
+#if defined(GOOGLE_PROTOBUF_OS_APPLE)
+#include <google/protobuf/stubs/atomicops_internals_atomicword_compat.h>
+#endif
+
+#undef GOOGLE_PROTOBUF_ATOMICOPS_ERROR
+
#endif // GOOGLE_PROTOBUF_NO_THREADSAFETY
#endif // GOOGLE_PROTOBUF_ATOMICOPS_H_