diff mbox series

[2/3] qemu/atomic: Use macros for CONFIG_ATOMIC64

Message ID 20210712155918.1422519-3-richard.henderson@linaro.org
State Superseded
Headers show
Series Atomic cleanup + clang-12 build fix | expand

Commit Message

Richard Henderson July 12, 2021, 3:59 p.m. UTC
Clang warnings about questionable atomic usage get localized
to the inline function in atomic.h.  By using a macro, we get
the full traceback to the original use that caused the warning.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 include/qemu/atomic.h | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

-- 
2.25.1

Comments

Philippe Mathieu-Daudé July 12, 2021, 4:29 p.m. UTC | #1
On 7/12/21 5:59 PM, Richard Henderson wrote:
> Clang warnings about questionable atomic usage get localized

> to the inline function in atomic.h.  By using a macro, we get

> the full traceback to the original use that caused the warning.

> 

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  include/qemu/atomic.h | 25 +++++--------------------

>  1 file changed, 5 insertions(+), 20 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index c5d6df6bf8..bf89855209 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -273,26 +273,11 @@ 
 
 /* Abstractions to access atomically (i.e. "once") i64/u64 variables */
 #ifdef CONFIG_ATOMIC64
-static inline int64_t qatomic_read_i64(const int64_t *ptr)
-{
-    /* use __nocheck because sizeof(void *) might be < sizeof(u64) */
-    return qatomic_read__nocheck(ptr);
-}
-
-static inline uint64_t qatomic_read_u64(const uint64_t *ptr)
-{
-    return qatomic_read__nocheck(ptr);
-}
-
-static inline void qatomic_set_i64(int64_t *ptr, int64_t val)
-{
-    qatomic_set__nocheck(ptr, val);
-}
-
-static inline void qatomic_set_u64(uint64_t *ptr, uint64_t val)
-{
-    qatomic_set__nocheck(ptr, val);
-}
+/* Use __nocheck because sizeof(void *) might be < sizeof(u64) */
+#define qatomic_read_i64  qatomic_read__nocheck
+#define qatomic_read_u64  qatomic_read__nocheck
+#define qatomic_set_i64   qatomic_set__nocheck
+#define qatomic_set_u64   qatomic_set__nocheck
 
 static inline void qatomic64_init(void)
 {