Hi!

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

--
Piotr Domagalski
Poznan Supercomputing and Networking Center

diff --git a/include/OpenThreads/Atomic b/include/OpenThreads/Atomic
index 8b8ac4d..11e49c5 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)
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to