All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH] qemu/atomic.h: add #ifdef guards for stdatomic.h
Date: Fri, 27 Mar 2020 06:35:28 -0700	[thread overview]
Message-ID: <e10f27f8-a47f-2ebe-5cab-0c4eae43667c@linaro.org> (raw)
In-Reply-To: <87y2rmm8h6.fsf@linaro.org>

On 3/27/20 2:51 AM, Alex Bennée wrote:
> 
> Peter Maydell <peter.maydell@linaro.org> writes:
> 
>> On Thu, 26 Mar 2020 at 18:05, Paolo Bonzini <pbonzini@redhat.com> 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?
> 

I guess I'm happy with it.  Have a
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


  reply	other threads:[~2020-03-27 13:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 17:01 [PATCH] qemu/atomic.h: add #ifdef guards for stdatomic.h Alex Bennée
2020-03-26 17:14 ` Peter Maydell
2020-03-26 17:32   ` Alex Bennée
2020-03-26 18:05   ` Paolo Bonzini
2020-03-26 20:19     ` Peter Maydell
2020-03-27  9:51       ` Alex Bennée
2020-03-27 13:35         ` Richard Henderson [this message]
2020-03-26 19:58 ` Richard Henderson
2020-03-26 20:05   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e10f27f8-a47f-2ebe-5cab-0c4eae43667c@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.