All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: fix __COUNTER__ macro to be referenced properly
@ 2020-03-19 16:19 dnbrdsky
  2020-03-19 16:19 ` [PATCH] lockable: replaced locks with lock guard macros where appropriate dnbrdsky
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: dnbrdsky @ 2020-03-19 16:19 UTC (permalink / raw)
  To: stefanha; +Cc: danbrodsky, open list:All patches CC here

From: danbrodsky <dnbrdsky@gmail.com>

- __COUNTER__ doesn't work with ## concat
- replaced ## with glue() macro so __COUNTER__ is evaluated

Signed-off-by: danbrodsky <dnbrdsky@gmail.com>
---
 include/qemu/lockable.h | 2 +-
 include/qemu/rcu.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h
index 1aeb2cb1a6..a9258f2c2c 100644
--- a/include/qemu/lockable.h
+++ b/include/qemu/lockable.h
@@ -170,7 +170,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuLockable, qemu_lockable_auto_unlock)
  *   }
  */
 #define QEMU_LOCK_GUARD(x) \
-    g_autoptr(QemuLockable) qemu_lockable_auto##__COUNTER__ = \
+    g_autoptr(QemuLockable) glue(qemu_lockable_auto, __COUNTER__) = \
             qemu_lockable_auto_lock(QEMU_MAKE_LOCKABLE((x)))
 
 #endif
diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index 9c82683e37..570aa603eb 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -170,7 +170,7 @@ static inline void rcu_read_auto_unlock(RCUReadAuto *r)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(RCUReadAuto, rcu_read_auto_unlock)
 
 #define WITH_RCU_READ_LOCK_GUARD() \
-    WITH_RCU_READ_LOCK_GUARD_(_rcu_read_auto##__COUNTER__)
+    WITH_RCU_READ_LOCK_GUARD_(glue(_rcu_read_auto, __COUNTER__))
 
 #define WITH_RCU_READ_LOCK_GUARD_(var) \
     for (g_autoptr(RCUReadAuto) var = rcu_read_auto_lock(); \
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-03-20 11:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 16:19 [PATCH] misc: fix __COUNTER__ macro to be referenced properly dnbrdsky
2020-03-19 16:19 ` [PATCH] lockable: replaced locks with lock guard macros where appropriate dnbrdsky
2020-03-19 19:31   ` no-reply
2020-03-19 20:53     ` Eric Blake
2020-03-19 19:39   ` no-reply
2020-03-19 20:50     ` Eric Blake
2020-03-19 19:41   ` no-reply
2020-03-19 20:48   ` Eric Blake
2020-03-19 22:11     ` Daniel Brodsky
2020-03-19 20:35 ` [PATCH] misc: fix __COUNTER__ macro to be referenced properly Eric Blake
2020-03-20 11:09 ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.