3 #define __has_builtin(x) 0
6 #define __has_feature(x) 0
9 * Swap macro that enforces a happens-before relationship with a corresponding
12 #if __has_builtin(__c11_atomic_exchange)
13 #define ATOMIC_SWAP(addr, val)\
14 __c11_atomic_exchange(reinterpret_cast<_Atomic(__typeof__(val))*>(addr), val, __ATOMIC_ACQ_REL)
15 #elif __has_builtin(__sync_swap)
16 #define ATOMIC_SWAP(addr, val)\
17 __sync_swap(addr, val)
19 #define ATOMIC_SWAP(addr, val)\
20 __sync_lock_test_and_set(addr, val)
23 #if __has_builtin(__c11_atomic_load)
24 #define ATOMIC_LOAD(addr)\
25 __c11_atomic_load(reinterpret_cast<_Atomic(__typeof__(*addr))*>(addr), __ATOMIC_ACQUIRE)
27 #define ATOMIC_LOAD(addr)\
28 (__sync_synchronize(), *addr)