[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 01/12] qemu/atomic.h: add #ifdef guards for stdatomic.h
From: |
Alex Bennée |
Subject: |
[PULL v2 01/12] qemu/atomic.h: add #ifdef guards for stdatomic.h |
Date: |
Fri, 27 Mar 2020 18:13:09 +0000 |
Deep inside the FreeBSD netmap headers we end up including stdatomic.h
which clashes with qemu's atomic functions which are modelled along
the C11 standard. To avoid a massive rename lets just ifdef around the
problem.
Signed-off-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index f9cd24c8994..ff72db51154 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -208,11 +208,14 @@
/* Provide shorter names for GCC atomic builtins, return old value */
#define atomic_fetch_inc(ptr) __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST)
#define atomic_fetch_dec(ptr) __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST)
+
+#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
#define atomic_inc_fetch(ptr) __atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
#define atomic_dec_fetch(ptr) __atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST)
@@ -392,11 +395,14 @@
/* Provide shorter names for GCC atomic builtins. */
#define atomic_fetch_inc(ptr) __sync_fetch_and_add(ptr, 1)
#define atomic_fetch_dec(ptr) __sync_fetch_and_add(ptr, -1)
+
+#ifndef atomic_fetch_add
#define atomic_fetch_add(ptr, n) __sync_fetch_and_add(ptr, n)
#define atomic_fetch_sub(ptr, n) __sync_fetch_and_sub(ptr, n)
#define atomic_fetch_and(ptr, n) __sync_fetch_and_and(ptr, n)
#define atomic_fetch_or(ptr, n) __sync_fetch_and_or(ptr, n)
#define atomic_fetch_xor(ptr, n) __sync_fetch_and_xor(ptr, n)
+#endif
#define atomic_inc_fetch(ptr) __sync_add_and_fetch(ptr, 1)
#define atomic_dec_fetch(ptr) __sync_add_and_fetch(ptr, -1)
--
2.20.1
- [PULL v2 for 5.0 00/12] testing updates (+ one mttcg change), Alex Bennée, 2020/03/27
- [PULL v2 01/12] qemu/atomic.h: add #ifdef guards for stdatomic.h,
Alex Bennée <=
- [PULL v2 03/12] tests/vm: move vga setup, Alex Bennée, 2020/03/27
- [PULL v2 02/12] tests/vm: write raw console log, Alex Bennée, 2020/03/27
- [PULL v2 04/12] tests/vm: update FreeBSD to 12.1, Alex Bennée, 2020/03/27
- [PULL v2 05/12] tests/vm: update NetBSD to 9.0, Alex Bennée, 2020/03/27
- [PULL v2 07/12] configure: disable MTTCG for MIPS guests, Alex Bennée, 2020/03/27
- [PULL v2 09/12] tests/docker: Install gcrypt devel package in Debian image, Alex Bennée, 2020/03/27
- [PULL v2 06/12] tests/vm: fix basevm config, Alex Bennée, 2020/03/27
- [PULL v2 08/12] tests/docker: Keep package list sorted, Alex Bennée, 2020/03/27
- [PULL v2 10/12] tests/docker: Use Python3 PyYAML in the Fedora image, Alex Bennée, 2020/03/27
- [PULL v2 12/12] .travis.yml: Add a KVM-only s390x job, Alex Bennée, 2020/03/27