diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-14 15:36:22 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-14 15:36:22 +0000 |
commit | f9f1cf1323062c4062b42f3196a0b42c4b6cc8b9 (patch) | |
tree | 4a2f3a30a331c986d7b199955c94532eb67268bc /third_party/protobuf | |
parent | e7bff3e6d0f7849fb0066caa8341e95c73efa631 (diff) | |
download | chromium_src-f9f1cf1323062c4062b42f3196a0b42c4b6cc8b9.zip chromium_src-f9f1cf1323062c4062b42f3196a0b42c4b6cc8b9.tar.gz chromium_src-f9f1cf1323062c4062b42f3196a0b42c4b6cc8b9.tar.bz2 |
Update protobuf by cherry-picking upstream r430:
Update protobuf for 64-bit compatibility on Mac OS X.
The system's routines from <libkern/OSAtomic.h> use int64_t as their 64-bit
type. int64_t is a typedef for long long. Google's atomicops.h routines use
Atomic64 as their 64-bit type. Atomic64 is a typedef for intptr_t, which is
in turn a typedef for long. It isn't possible to cast from long* to long long*
with const_cast, reinterpret_cast is needed. This change fixes this problem
the same way Chrome fixed it in https://codereview.chromium.org/6091007 .
protobuf r423 renamed GOOGLE_PROTOBUF_HOST_ARCH_64_BIT to
GOOGLE_PROTOBUF_ARCH_64_BIT, but the change was not made in
atomicops_internals_atomicword_compat.h.
Review URL: https://codereview.chromium.org/11293276
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/protobuf')
3 files changed, 10 insertions, 9 deletions
diff --git a/third_party/protobuf/README.chromium b/third_party/protobuf/README.chromium index 51c2fdc..38b9936 100644 --- a/third_party/protobuf/README.chromium +++ b/third_party/protobuf/README.chromium @@ -19,7 +19,7 @@ A protobuf.gyp file has been added for building with Chromium. This code has been patched to support unknown field retention in protobuf-lite. See r62331 for the patch. -Revision r427 was cherry-picked from upstream. +Revisions r427 and r430 were cherry-picked from upstream. Cherry-pick patch from http://code.google.com/p/protobuf/issues/detail?id=425. diff --git a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h b/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h index 8d9a726..e9d8679 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h +++ b/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h @@ -44,7 +44,7 @@ // On LP64 platforms, AtomicWord and Atomic64 are both always long, // so this problem doesn't occur. -#if !defined(GOOGLE_PROTOBUF_HOST_ARCH_64_BIT) +#if !defined(GOOGLE_PROTOBUF_ARCH_64_BIT) namespace google { namespace protobuf { @@ -117,6 +117,6 @@ inline AtomicWord Release_Load(volatile const AtomicWord* ptr) { } // namespace protobuf } // namespace google -#endif // !defined(GOOGLE_PROTOBUF_HOST_ARCH_64_BIT) +#endif // !defined(GOOGLE_PROTOBUF_ARCH_64_BIT) #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ diff --git a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h b/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h index 9af6d636..f9b7581 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h +++ b/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h @@ -136,7 +136,7 @@ inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, Atomic64 prev_value; do { if (OSAtomicCompareAndSwap64(old_value, new_value, - const_cast<Atomic64*>(ptr))) { + reinterpret_cast<volatile int64_t*>(ptr))) { return old_value; } prev_value = *ptr; @@ -150,18 +150,19 @@ inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, do { old_value = *ptr; } while (!OSAtomicCompareAndSwap64(old_value, new_value, - const_cast<Atomic64*>(ptr))); + reinterpret_cast<volatile int64_t*>(ptr))); return old_value; } inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment) { - return OSAtomicAdd64(increment, const_cast<Atomic64*>(ptr)); + return OSAtomicAdd64(increment, reinterpret_cast<volatile int64_t*>(ptr)); } inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment) { - return OSAtomicAdd64Barrier(increment, const_cast<Atomic64*>(ptr)); + return OSAtomicAdd64Barrier(increment, + reinterpret_cast<volatile int64_t*>(ptr)); } inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, @@ -169,8 +170,8 @@ inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, Atomic64 new_value) { Atomic64 prev_value; do { - if (OSAtomicCompareAndSwap64Barrier(old_value, new_value, - const_cast<Atomic64*>(ptr))) { + if (OSAtomicCompareAndSwap64Barrier( + old_value, new_value, reinterpret_cast<volatile int64_t*>(ptr))) { return old_value; } prev_value = *ptr; |