From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
sheepdog@lists.wpkg.org,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Paul Durrant" <paul@xen.org>, "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>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Alberto Garcia" <berto@igalia.com>,
kvm@vger.kernel.org,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Juan Quintela" <quintela@redhat.com>,
"Jiri Slaby" <jslaby@suse.cz>,
"Michael S. Tsirkin" <mst@redhat.com>,
"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>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Liu Yuan" <namei.unix@gmail.com>,
"Richard Henderson" <rth@twiddle.net>,
"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,
xen-devel@lists.xenproject.org, qemu-riscv@nongnu.org,
"Sunil Muthuswamy" <sunilmut@microsoft.com>,
"John Snow" <jsnow@redhat.com>,
"Hailiang Zhang" <zhang.zhanghailiang@huawei.com>,
"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>,
"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH v3] qemu/atomic.h: rename atomic_ to qatomic_
Date: Wed, 23 Sep 2020 16:13:17 +0100 [thread overview]
Message-ID: <20200923151317.GA65166@stefanha-x1.localdomain> (raw)
In-Reply-To: <20200923105646.47864-1-stefanha@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1842 bytes --]
On Wed, Sep 23, 2020 at 11:56:46AM +0100, 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 'q' so that atomic.h
> and <stdatomic.h> can co-exist. I checked /usr/include on my machine and
> searched GitHub for existing "qatomic_" users but there seem to be none.
>
> 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\>%q$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>
> ---
> v3:
> * Use qatomic_ instead of atomic_ [Paolo]
> * The diff of my manual fixups is available here:
> https://vmsplice.net/~stefan/atomic-namespace-pre-fixups-v3.diff
> - Dropping #ifndef qatomic_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
Thanks, applied quickly due to high risk of conflicts:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-09-23 15:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 10:56 [PATCH v3] qemu/atomic.h: rename atomic_ to qatomic_ Stefan Hajnoczi
2020-09-23 12:04 ` Paolo Bonzini
2020-09-23 12:43 ` Philippe Mathieu-Daudé
2020-09-23 13:31 ` no-reply
2020-09-23 15:13 ` Stefan Hajnoczi [this message]
2020-10-02 16:43 ` Matthew Rosato
2020-10-03 8:48 ` 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=20200923151317.GA65166@stefanha-x1.localdomain \
--to=stefanha@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=pbonzini@redhat.com \
--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=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).