qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] qemu/atomic.h: add #ifdef guards for stdatomic.h


From: Alex Bennée
Subject: Re: [PATCH] qemu/atomic.h: add #ifdef guards for stdatomic.h
Date: Fri, 27 Mar 2020 09:51:17 +0000
User-agent: mu4e 1.3.10; emacs 28.0.50

Peter Maydell <address@hidden> writes:

> On Thu, 26 Mar 2020 at 18:05, Paolo Bonzini <address@hidden> wrote:
>>
>> On 26/03/20 18:14, Peter Maydell wrote:
>> >> +#ifndef atomic_fetch_add
>> >>  #define atomic_fetch_add(ptr, n) __atomic_fetch_add(ptr, n, 
>> >> __ATOMIC_SEQ_CST)
>> >>  #define atomic_fetch_sub(ptr, n) __atomic_fetch_sub(ptr, n, 
>> >> __ATOMIC_SEQ_CST)
>> >>  #define atomic_fetch_and(ptr, n) __atomic_fetch_and(ptr, n, 
>> >> __ATOMIC_SEQ_CST)
>> >>  #define atomic_fetch_or(ptr, n)  __atomic_fetch_or(ptr, n, 
>> >> __ATOMIC_SEQ_CST)
>> >>  #define atomic_fetch_xor(ptr, n) __atomic_fetch_xor(ptr, n, 
>> >> __ATOMIC_SEQ_CST)
>> >> +#endif
>> >
>> > This will work around FreeBSD's current implementation in particular,
>> > but I don't think there's anything in the C11 spec that mandates that
>> > atomic_fetch_add() and friends have to be macros and not simply
>> > functions...
>>
>> That's not a problem as long as they are all functions, the macros would
>> simply override the function-based implementation.
>
> Oh yes, so it would. I think I was also vaguely thinking in terms
> of FreeBSD being the leading edge of "one day most or all of our
> hosts will have a full stdatomic.h", so maybe we should shift to
> use-host-stdatomic-by-default, with the use of the gcc __atomic*
> as the fallback at some point ?

At some point but I suspect not right now.

So what's the conclusion for this patch? Are people happy with it as a
sticking plaster I can apply to the bounced testing PR?

-- 
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]