[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] qemu/atomic.h: prefix qemu_ to solve <stdatomic.h> collisions
- To: Stefan Hajnoczi <stefanha@xxxxxxxxxx>, qemu-devel@xxxxxxxxxx
- From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
- Date: Tue, 22 Sep 2020 13:35:37 +0200
- Authentication-results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@xxxxxxxxxx
- Cc: Max Filippov <jcmvbkbc@xxxxxxxxx>, Eric Blake <eblake@xxxxxxxxxx>, Peter Lieven <pl@xxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx>, Sagar Karandikar <sagark@xxxxxxxxxxxxxxxxx>, Alberto Garcia <berto@xxxxxxxxxx>, qemu-s390x@xxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, Liu Yuan <namei.unix@xxxxxxxxx>, Jiri Slaby <jslaby@xxxxxxx>, Fam Zheng <fam@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>, Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>, Aurelien Jarno <aurelien@xxxxxxxxxxx>, Max Reitz <mreitz@xxxxxxxxxx>, Halil Pasic <pasic@xxxxxxxxxxxxx>, Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>, Kevin Wolf <kwolf@xxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxx>, Thomas Huth <thuth@xxxxxxxxxx>, John Snow <jsnow@xxxxxxxxxx>, Alistair Francis <Alistair.Francis@xxxxxxx>, Aleksandar Markovic <aleksandar.qemu.devel@xxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, qemu-arm@xxxxxxxxxx, Yuval Shaia <yuval.shaia.ml@xxxxxxxxx>, Aleksandar Rikalo <aleksandar.rikalo@xxxxxxxxxx>, sheepdog@xxxxxxxxxxxxxx, Bastian Koppelmann <kbastian@xxxxxxxxxxxxxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Daniel P. Berrangé <berrange@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Juan Quintela <quintela@xxxxxxxxxx>, qemu-riscv@xxxxxxxxxx, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx>, Stefan Weil <sw@xxxxxxxxxxx>, Matthew Rosato <mjrosato@xxxxxxxxxxxxx>, Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, qemu-block@xxxxxxxxxx, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Laurent Vivier <laurent@xxxxxxxxx>, Hailiang Zhang <zhang.zhanghailiang@xxxxxxxxxx>, Richard Henderson <rth@xxxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, Huacai Chen <chenhc@xxxxxxxxxx>
- Delivery-date: Tue, 22 Sep 2020 11:35:49 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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@xxxxxxxxxx>
> ---
> 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
|