From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
sheepdog@lists.wpkg.org, kvm@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Yuval Shaia" <yuval.shaia.ml@gmail.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Alistair Francis" <Alistair.Francis@wdc.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Huacai Chen" <chenhc@lemote.com>, "Jiri Slaby" <jslaby@suse.cz>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Alberto Garcia" <berto@igalia.com>,
"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Juan Quintela" <quintela@redhat.com>,
"Paul Durrant" <paul@xen.org>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
"Anthony Perard" <anthony.perard@citrix.com>,
"Liu Yuan" <namei.unix@gmail.com>,
"Richard Henderson" <rth@twiddle.net>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Thomas Huth" <thuth@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Stefan Weil" <sw@weilnetz.de>, "Peter Lieven" <pl@kamp.de>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
qemu-s390x@nongnu.org, qemu-arm@nongnu.org,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-riscv@nongnu.org,
"Sunil Muthuswamy" <sunilmut@microsoft.com>,
"John Snow" <jsnow@redhat.com>,
"Hailiang Zhang" <zhang.zhanghailiang@huawei.com>,
xen-devel@lists.xenproject.org, "Kevin Wolf" <kwolf@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-block@nongnu.org,
"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
"Cornelia Huck" <cohuck@redhat.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Max Reitz" <mreitz@redhat.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH v2] qemu/atomic.h: prefix qemu_ to solve <stdatomic.h> collisions
Date: Tue, 22 Sep 2020 13:35:37 +0200 [thread overview]
Message-ID: <33631340-e3e3-b10f-4f9a-0e1b295d79ef@redhat.com> (raw)
In-Reply-To: <20200922085838.230505-1-stefanha@redhat.com>
On 22/09/20 10:58, Stefan Hajnoczi wrote:
> clang's C11 atomic_fetch_*() functions only take a C11 atomic type
> pointer argument. QEMU uses direct types (int, etc) and this causes a
> compiler error when a QEMU code calls these functions in a source file
> that also included <stdatomic.h> via a system header file:
>
> $ CC=clang CXX=clang++ ./configure ... && make
> ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
>
> Avoid using atomic_*() names in QEMU's atomic.h since that namespace is
> used by <stdatomic.h>. Prefix QEMU's APIs with qemu_ so that atomic.h
> and <stdatomic.h> can co-exist.
>
> This patch was generated using:
>
> $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \
> sort -u >/tmp/changed_identifiers
> $ for identifier in $(</tmp/changed_identifiers); do
> sed -i "s%\<$identifier\>%qemu_$identifier%g" \
> $(git grep -I -l "\<$identifier\>")
> done
>
> I manually fixed line-wrap issues and misaligned rST tables.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> v2:
> * The diff of my manual fixups is available here:
> https://vmsplice.net/~stefan/atomic-namespace-pre-fixups.diff
> - Dropping #ifndef qemu_atomic_fetch_add in atomic.h
> - atomic_##X(haddr, val) glue macros not caught by grep
> - Keep atomic_add-bench name
> - C preprocessor backslash-newline ('\') column alignment
> - Line wrapping
> * Use grep -I to avoid accidentally modifying binary files (RISC-V
> OpenSBI ELFs) [Eric Blake]
> * Tweak .gitorder to show atomic.h changes first [Eric Blake]
> * Update grep commands in commit description so reviewers can reproduce
> mechanical changes [Eric Blake]
I think the reviews crossed, are you going to respin using a qatomic_
prefix?
Paolo
next prev parent reply other threads:[~2020-09-22 11:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 8:58 [PATCH v2] qemu/atomic.h: prefix qemu_ to solve <stdatomic.h> collisions Stefan Hajnoczi
2020-09-22 9:30 ` no-reply
2020-09-22 11:35 ` Paolo Bonzini [this message]
2020-09-23 9:15 ` Stefan Hajnoczi
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=33631340-e3e3-b10f-4f9a-0e1b295d79ef@redhat.com \
--to=pbonzini@redhat.com \
--cc=Alistair.Francis@wdc.com \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=anthony.perard@citrix.com \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=berto@igalia.com \
--cc=borntraeger@de.ibm.com \
--cc=chenhc@lemote.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=fam@euphon.net \
--cc=jasowang@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=jslaby@suse.cz \
--cc=jsnow@redhat.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=laurent@vivier.eu \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=namei.unix@gmail.com \
--cc=palmer@dabbelt.com \
--cc=pasic@linux.ibm.com \
--cc=paul@xen.org \
--cc=peter.maydell@linaro.org \
--cc=pl@kamp.de \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@twiddle.net \
--cc=sagark@eecs.berkeley.edu \
--cc=sheepdog@lists.wpkg.org \
--cc=sstabellini@kernel.org \
--cc=stefanha@redhat.com \
--cc=sunilmut@microsoft.com \
--cc=sw@weilnetz.de \
--cc=thuth@redhat.com \
--cc=xen-devel@lists.xenproject.org \
--cc=ysato@users.sourceforge.jp \
--cc=yuval.shaia.ml@gmail.com \
--cc=zhang.zhanghailiang@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).