Il 21/10/2013 14:53, Peter Maydell ha scritto:
> Yes, using __sync_swap seems to work OK. Does clang on linux
> require the four-argument __atomic_exchange() or can we just
> make the #ifdef __clang__ come first in the #if ladder?
Please do that (change the ladder), it's definitely a good idea.
>
On 21 October 2013 07:06, Paolo Bonzini wrote:
> Il 20/10/2013 17:20, Peter Maydell ha scritto:
>> CCutil/qemu-thread-posix.o
>> util/qemu-thread-posix.c:351:13: warning: implicit declaration of
>> function '__sync_exchange' is invalid in
>> C99 [-Wimplicit-function-declaration]
>>
Il 20/10/2013 17:20, Peter Maydell ha scritto:
> CCutil/qemu-thread-posix.o
> util/qemu-thread-posix.c:351:13: warning: implicit declaration of
> function '__sync_exchange' is invalid in
> C99 [-Wimplicit-function-declaration]
> if (atomic_xchg(&ev->value, EV_SET) == EV_BUSY) {
On 4 July 2013 16:13, Paolo Bonzini wrote:
> +#ifndef atomic_xchg
> +#ifdef __ATOMIC_SEQ_CST
> +#define atomic_xchg(ptr, i)({ \
> +typeof(*ptr) _new = (i), _old; \
> +__atomic_exchange(ptr, &_new, &_old, __ATOMIC_SEQ_CST); \
> +_ol
We're already using them in several places, but __sync builtins are just
too ugly to type, and do not provide seqcst load/store operations.
Reviewed-by: Richard Henderson
Signed-off-by: Paolo Bonzini
---
docs/atomics.txt | 352 +++
hw/display/