From 3b8802c5aade1363b8c283c6fc6cef7332cf7c29 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 6 Sep 2012 10:52:28 +0000 Subject: [PATCH] From Piotr Domagalski, "Currently, code using OpenSceneGraph doesn't build with clang due to the way __sync_bool_compare_and_swap() is used in OpenThreads/Atomic header file. I tested it with clang 3.1 and it seems that clang is enforcing the use of the same type for all parameters in this builtin. Looking at the function declaration [1] bool __sync_bool_compare_and_swap (type *ptr, type oldval type newval, ...) it seems to be doing the right thing: here the same type is used for *ptr, oldval and newval. [1] http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html#g_t_005f_005fsync-Builtins " --- include/OpenThreads/Atomic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/OpenThreads/Atomic b/include/OpenThreads/Atomic index 8b8ac4de3..ba6723354 100644 --- a/include/OpenThreads/Atomic +++ b/include/OpenThreads/Atomic @@ -241,7 +241,7 @@ _OPENTHREADS_ATOMIC_INLINE 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_MIPOSPRO_BUILTINS) return __compare_and_swap((unsigned long*)&_ptr, (unsigned long)ptrOld, (unsigned long)ptrNew); #elif defined(_OPENTHREADS_ATOMIC_USE_SUN)