[libdispatch-changes] [42] trunk/src/hw_shims.h

source_changes at macosforge.org source_changes at macosforge.org
Sat Sep 26 04:43:05 PDT 2009


Revision: 42
          http://trac.macosforge.org/projects/libdispatch/changeset/42
Author:   robert at fledge.watson.org
Date:     2009-09-26 04:43:02 -0700 (Sat, 26 Sep 2009)
Log Message:
-----------
Cast the results of __sync_lock_test_and_set() back to the original type
passed into dispatch_atomic_xchg() so that the caller isn't doing an
implicit conversion from an integer type to a pointer.  This fixes
errors when using gcc built-in atomics with clang on FreeBSD/i386.

Modified Paths:
--------------
    trunk/src/hw_shims.h

Modified: trunk/src/hw_shims.h
===================================================================
--- trunk/src/hw_shims.h	2009-09-25 18:31:19 UTC (rev 41)
+++ trunk/src/hw_shims.h	2009-09-26 11:43:02 UTC (rev 42)
@@ -39,7 +39,7 @@
 #if 0 && defined(__i386__) || defined(__x86_64__)
 #define dispatch_atomic_xchg(p, n)	({ typeof(*(p)) _r; asm("xchg %0, %1" : "=r" (_r) : "m" (*(p)), "0" (n)); _r; })
 #else
-#define dispatch_atomic_xchg(p, n)	__sync_lock_test_and_set((p), (n))
+#define dispatch_atomic_xchg(p, n)	((typeof(*(p)))__sync_lock_test_and_set((p), (n)))
 #endif
 #define dispatch_atomic_cmpxchg(p, o, n)	__sync_bool_compare_and_swap((p), (o), (n))
 #define dispatch_atomic_inc(p)	__sync_add_and_fetch((p), 1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20090926/d5f4f798/attachment.html>


More information about the libdispatch-changes mailing list