diff mbox

[v8,01/37] atomics: Add parameters to macros

Message ID 1477330788-14996-2-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson Oct. 24, 2016, 5:39 p.m. UTC
Making these functional rather than object macros will
prevent later problems with complex macro expansion.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 include/qemu/atomic.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Emilio Cota Oct. 24, 2016, 6:13 p.m. UTC | #1
On Mon, Oct 24, 2016 at 10:39:12 -0700, Richard Henderson wrote:
> Making these functional rather than object macros will
> prevent later problems with complex macro expansion.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Reviewed-by: Emilio G. Cota <cota@braap.org>

		E.
diff mbox

Patch

diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index c09fce7..94be1d0 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))