qemu/atomic.h: rename atomic_ to qatomic_
commitd73415a315471ac0b127ed3fad45c8ec5d711de1
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 23 Sep 2020 10:56:46 +0000 (23 11:56 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 23 Sep 2020 15:07:44 +0000 (23 16:07 +0100)
treebae20b3a39968fdfb4340b1a39b533333a8e6fd0
parented7db34b5aedba4487fd949b2e545eef954f093e
qemu/atomic.h: rename atomic_ to qatomic_

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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
133 files changed:
accel/kvm/kvm-all.c
accel/tcg/atomic_template.h
accel/tcg/cpu-exec.c
accel/tcg/cputlb.c
accel/tcg/tcg-all.c
accel/tcg/translate-all.c
audio/jackaudio.c
block.c
block/block-backend.c
block/io.c
block/nfs.c
block/sheepdog.c
block/throttle-groups.c
block/throttle.c
blockdev.c
blockjob.c
contrib/libvhost-user/libvhost-user.c
cpus-common.c
docs/devel/atomics.rst
docs/devel/lockcnt.txt
docs/devel/rcu.txt
dump/dump.c
exec.c
hw/core/cpu.c
hw/display/qxl.c
hw/hyperv/hyperv.c
hw/hyperv/vmbus.c
hw/i386/xen/xen-hvm.c
hw/intc/rx_icu.c
hw/intc/sifive_plic.c
hw/misc/edu.c
hw/net/virtio-net.c
hw/rdma/rdma_backend.c
hw/rdma/rdma_rm.c
hw/rdma/vmw/pvrdma_dev_ring.c
hw/s390x/s390-pci-bus.c
hw/s390x/virtio-ccw.c
hw/virtio/vhost.c
hw/virtio/virtio-mmio.c
hw/virtio/virtio-pci.c
hw/virtio/virtio.c
hw/xtensa/pic_cpu.c
include/block/aio-wait.h
include/block/aio.h
include/exec/cpu_ldst.h
include/exec/exec-all.h
include/exec/log.h
include/exec/memory.h
include/exec/ram_addr.h
include/exec/ramlist.h
include/exec/tb-lookup.h
include/hw/core/cpu.h
include/qemu/atomic.h
include/qemu/atomic128.h
include/qemu/bitops.h
include/qemu/coroutine.h
include/qemu/log.h
include/qemu/queue.h
include/qemu/rcu.h
include/qemu/rcu_queue.h
include/qemu/seqlock.h
include/qemu/stats64.h
include/qemu/thread.h
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h
iothread.c
linux-user/hppa/cpu_loop.c
linux-user/qemu.h
linux-user/signal.c
migration/colo-failover.c
migration/migration.c
migration/multifd.c
migration/postcopy-ram.c
migration/rdma.c
monitor/hmp.c
monitor/misc.c
monitor/monitor.c
qemu-nbd.c
qga/commands.c
qom/object.c
scripts/kernel-doc
scsi/qemu-pr-helper.c
softmmu/cpu-throttle.c
softmmu/cpus.c
softmmu/memory.c
softmmu/vl.c
target/arm/mte_helper.c
target/hppa/op_helper.c
target/i386/mem_helper.c
target/i386/whpx-all.c
target/riscv/cpu_helper.c
target/s390x/mem_helper.c
target/xtensa/exc_helper.c
target/xtensa/op_helper.c
tcg/aarch64/tcg-target.c.inc
tcg/i386/tcg-target.h
tcg/mips/tcg-target.c.inc
tcg/ppc/tcg-target.c.inc
tcg/s390/tcg-target.h
tcg/sparc/tcg-target.c.inc
tcg/tcg.c
tcg/tci.c
tcg/tci/tcg-target.h
tests/atomic64-bench.c
tests/atomic_add-bench.c
tests/iothread.c
tests/qht-bench.c
tests/rcutorture.c
tests/test-aio-multithread.c
tests/test-logging.c
tests/test-rcu-list.c
tests/test-thread-pool.c
util/aio-posix.c
util/aio-wait.c
util/aio-win32.c
util/async.c
util/atomic64.c
util/bitmap.c
util/cacheinfo.c
util/fdmon-epoll.c
util/fdmon-io_uring.c
util/lockcnt.c
util/log.c
util/qemu-coroutine-lock.c
util/qemu-coroutine-sleep.c
util/qemu-coroutine.c
util/qemu-sockets.c
util/qemu-thread-posix.c
util/qemu-thread-win32.c
util/qemu-timer.c
util/qht.c
util/qsp.c
util/rcu.c
util/stats64.c