summaryrefslogtreecommitdiffstats
path: root/include/qemu
diff options
context:
space:
mode:
authorRichard Henderson2016-10-24 18:49:25 +0200
committerRichard Henderson2016-10-26 17:28:46 +0200
commitd1a9f2d12fcfc942924956fbe321aedf4226ccb7 (patch)
treeb0005ecb7c36300f1398a1c1f4c2198a008d5862 /include/qemu
parentMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-10-25' into ... (diff)
downloadqemu-d1a9f2d12fcfc942924956fbe321aedf4226ccb7.tar.gz
qemu-d1a9f2d12fcfc942924956fbe321aedf4226ccb7.tar.xz
qemu-d1a9f2d12fcfc942924956fbe321aedf4226ccb7.zip
atomics: Add parameters to macros
Making these functional rather than object macros will prevent later problems with complex macro expansion. Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/atomic.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index c09fce704f..94be1d0196 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -335,11 +335,11 @@
/* 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)
-#define atomic_fetch_add __sync_fetch_and_add
-#define atomic_fetch_sub __sync_fetch_and_sub
-#define atomic_fetch_and __sync_fetch_and_and
-#define atomic_fetch_or __sync_fetch_and_or
-#define atomic_cmpxchg __sync_val_compare_and_swap
+#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_cmpxchg(ptr, old, new) __sync_val_compare_and_swap(ptr, old, new)
/* And even shorter names that return void. */
#define atomic_inc(ptr) ((void) __sync_fetch_and_add(ptr, 1))