[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 54/66] add a header file for atomic operations
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 54/66] add a header file for atomic operations |
Date: |
Mon, 21 Oct 2013 14:53:54 +0100 |
On 21 October 2013 07:06, Paolo Bonzini <address@hidden> wrote:
> Il 20/10/2013 17:20, Peter Maydell ha scritto:
>> CC util/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) {
>> ^
>> /Users/pm215/src/qemu/include/qemu/atomic.h:179:32: note: expanded
>> from macro 'atomic_xchg'
>> #define atomic_xchg(ptr, i) __sync_exchange(ptr, i)
>> ^
>
> That's a typo/thinko, it should be __sync_swap according to the
> documentation.
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?
http://libcxx.llvm.org/atomic_design_a.html suggests llvm/clang's
__atomic_exchange() is three argument on all platforms, ie this
isn't just a macos weirdness.
-- PMM