From Ulrich Hertlein, "as discussed on osg-users there is an issue with clang++ on OS X and iOS that results in

the following error:

Users/stephan/Documents/Projekte/cefix/cefix/ios/../../libs/ios/include/OpenThreads/Atomic:244:48:
error: cannot initialize a parameter of type 'void *' with an lvalue of
type 'const void *const'
   return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew);

This can be solved by a cast to '(void*)ptrOld'.  This should be benign since both
'ptrOld' and 'ptrNew' are only read and the cast is in fact in place for all other
implementations as well.

On OS X the cast compiles cleanly on both g++ (i686-apple-darwin11-llvm-g++-4.2 (GCC)
4.2.1) and clang++ (Apple clang version 3.1 (tags/Apple/clang-318.0.54)).
"
This commit is contained in:
Robert Osfield 2012-03-23 10:24:50 +00:00
parent 5fc6f0a796
commit 1227f3f620

View File

@ -143,7 +143,7 @@ bool
AtomicPtr::assign(void* ptrNew, const void* const ptrOld)
{
#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew);
return __sync_bool_compare_and_swap(&_ptr, (void*)ptrOld, ptrNew);
#elif defined(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
return ptrOld == InterlockedCompareExchangePointer((PVOID volatile*)&_ptr, (PVOID)ptrNew, (PVOID)ptrOld);
#elif defined(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)