[dbus PATCH 2/2] util: Introduce virtDBusUtilAutoLock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



clang 6.0.0 complains about unused variable if g_autoptr is used to
automatically unlock mutex.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux