From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Laurent Vivier <lvivier@redhat.com>,
Thomas Huth <thuth@redhat.com>,
qemu-block@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
Bandan Das <bsd@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Juan Quintela <quintela@redhat.com>, Peter Lieven <pl@kamp.de>,
Yuval Shaia <yuval.shaia.ml@gmail.com>,
Max Reitz <mreitz@redhat.com>,
Daniel Brodsky <dnbrdsky@gmail.com>,
Alexander Bulekov <alxndr@bu.edu>,
Alex Williamson <alex.williamson@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [PULL 2/4] lockable: fix __COUNTER__ macro to be referenced properly
Date: Fri, 1 May 2020 09:28:04 +0100 [thread overview]
Message-ID: <20200501082806.205696-3-stefanha@redhat.com> (raw)
In-Reply-To: <20200501082806.205696-1-stefanha@redhat.com>
From: Daniel Brodsky <dnbrdsky@gmail.com>
- __COUNTER__ doesn't work with ## concat
- replaced ## with glue() macro so __COUNTER__ is evaluated
Fixes: 3284c3ddc4
Signed-off-by: Daniel Brodsky <dnbrdsky@gmail.com>
Message-id: 20200404042108.389635-2-dnbrdsky@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
include/qemu/lockable.h | 7 ++++---
include/qemu/rcu.h | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h
index 1aeb2cb1a6..b620023141 100644
--- a/include/qemu/lockable.h
+++ b/include/qemu/lockable.h
@@ -152,7 +152,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuLockable, qemu_lockable_auto_unlock)
* }
*/
#define WITH_QEMU_LOCK_GUARD(x) \
- WITH_QEMU_LOCK_GUARD_((x), qemu_lockable_auto##__COUNTER__)
+ WITH_QEMU_LOCK_GUARD_((x), glue(qemu_lockable_auto, __COUNTER__))
/**
* QEMU_LOCK_GUARD - Lock an object until the end of the scope
@@ -169,8 +169,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuLockable, qemu_lockable_auto_unlock)
* return; <-- mutex is automatically unlocked
* }
*/
-#define QEMU_LOCK_GUARD(x) \
- g_autoptr(QemuLockable) qemu_lockable_auto##__COUNTER__ = \
+#define QEMU_LOCK_GUARD(x) \
+ g_autoptr(QemuLockable) \
+ glue(qemu_lockable_auto, __COUNTER__) G_GNUC_UNUSED = \
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.3
next prev parent reply other threads:[~2020-05-01 8:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-01 8:28 [PULL 0/4] Block patches Stefan Hajnoczi
2020-05-01 8:28 ` [PULL 1/4] fuzz: select fuzz target using executable name Stefan Hajnoczi
2020-05-01 8:28 ` Stefan Hajnoczi [this message]
2020-05-01 8:28 ` [PULL 3/4] lockable: replaced locks with lock guard macros where appropriate Stefan Hajnoczi
2020-05-01 8:28 ` [PULL 4/4] lockable: Replace locks with lock guard macros Stefan Hajnoczi
2020-05-01 9:02 ` [PULL 0/4] Block patches no-reply
2020-05-01 9:32 ` Peter Maydell
2020-05-01 15:23 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200501082806.205696-3-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=alxndr@bu.edu \
--cc=armbru@redhat.com \
--cc=bsd@redhat.com \
--cc=dgilbert@redhat.com \
--cc=dnbrdsky@gmail.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=ronniesahlberg@gmail.com \
--cc=thuth@redhat.com \
--cc=yuval.shaia.ml@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).