clang 6.0.0 complains about unused variable if g_autoptr is used to
automatically unlock mutex.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/connect.c | 2 +-
src/util.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/connect.c b/src/connect.c
index c6b85ce..2350736 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -56,7 +56,7 @@ gboolean
virtDBusConnectOpen(virtDBusConnect *connect,
GError **error)
{
- g_autoptr(GMutexLocker) lock = g_mutex_locker_new(&connect->lock);
+ virtDBusUtilAutoLock lock = g_mutex_locker_new(&connect->lock);
if (connect->connection) {
if (virConnectIsAlive(connect->connection))
diff --git a/src/util.h b/src/util.h
index a34f863..4304bac 100644
--- a/src/util.h
+++ b/src/util.h
@@ -6,6 +6,8 @@
#define VIRT_DBUS_ERROR virtDBusErrorQuark()
+#define virtDBusUtilAutoLock g_autoptr(GMutexLocker) G_GNUC_UNUSED
+
typedef enum {
VIRT_DBUS_ERROR_LIBVIRT,
VIRT_DBUS_N_ERRORS /*< skip >*/
--
2.14.3