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

[libvirt] [PATCH] debug: Annotate some variables as unused



as they are not used with debugging turned off.
---
 daemon/stream.c                    |    4 +-
 src/locking/lock_driver_nop.c      |    6 ++--
 src/lxc/lxc_container.c            |    2 +-
 src/lxc/lxc_driver.c               |    2 +-
 src/node_device/node_device_udev.c |    2 +-
 src/qemu/qemu_migration.c          |    2 +-
 src/rpc/virnettlscontext.c         |    5 ++-
 src/util/command.c                 |    9 +++++--
 src/util/virpidfile.c              |    2 +-
 src/vbox/vbox_tmpl.c               |   37 +++++++++++++++++++++--------------
 10 files changed, 41 insertions(+), 30 deletions(-)

diff --git a/daemon/stream.c b/daemon/stream.c
index e3214c2..7df9952 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -94,7 +94,7 @@ daemonStreamUpdateEvents(daemonClientStream *stream)
  * fast stream, but slow client
  */
 static void
-daemonStreamMessageFinished(virNetMessagePtr msg,
+daemonStreamMessageFinished(virNetMessagePtr msg ATTRIBUTE_UNUSED,
                             void *opaque)
 {
     daemonClientStream *stream = opaque;
@@ -244,7 +244,7 @@ cleanup:
  * -1 on fatal client error
  */
 static int
-daemonStreamFilter(virNetServerClientPtr client,
+daemonStreamFilter(virNetServerClientPtr client ATTRIBUTE_UNUSED,
                    virNetMessagePtr msg,
                    void *opaque)
 {
diff --git a/src/locking/lock_driver_nop.c b/src/locking/lock_driver_nop.c
index 4f35afa..570b7e7 100644
--- a/src/locking/lock_driver_nop.c
+++ b/src/locking/lock_driver_nop.c
@@ -27,9 +27,9 @@
 #include "uuid.h"
 
 
-static int virLockManagerNopInit(unsigned int version,
-                                 const char *configFile,
-                                 unsigned int flags)
+static int virLockManagerNopInit(unsigned int version ATTRIBUTE_UNUSED,
+                                 const char *configFile ATTRIBUTE_UNUSED,
+                                 unsigned int flags ATTRIBUTE_UNUSED)
 {
     VIR_DEBUG("version=%u configFile=%s flags=%x",
               version, NULLSTR(configFile), flags);
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 6991aec..787df9a 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1245,7 +1245,7 @@ int lxcContainerAvailable(int features)
     cpid = clone(lxcContainerDummyChild, childStack, flags, NULL);
     VIR_FREE(stack);
     if (cpid < 0) {
-        char ebuf[1024];
+        char ebuf[1024] ATTRIBUTE_UNUSED;
         VIR_DEBUG("clone call returned %s, container support is not enabled",
               virStrerror(errno, ebuf, sizeof ebuf));
         return -1;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 6cf7203..4b62600 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2165,7 +2165,7 @@ static int lxcStartup(int privileged)
 
     rc = virCgroupForDriver("lxc", &lxc_driver->cgroup, privileged, 1);
     if (rc < 0) {
-        char buf[1024];
+        char buf[1024] ATTRIBUTE_UNUSED;
         VIR_DEBUG("Unable to create cgroup for LXC driver: %s",
                   virStrerror(-rc, buf, sizeof(buf)));
         /* Don't abort startup. We will explicitly report to
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 08ef856..9112c96 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -703,7 +703,7 @@ out:
 }
 
 
-static int udevGetSCSIType(virNodeDeviceDefPtr def,
+static int udevGetSCSIType(virNodeDeviceDefPtr def ATTRIBUTE_UNUSED,
                            unsigned int type, char **typestring)
 {
     int ret = 0;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 0a5a13d..ef48d65 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1829,7 +1829,7 @@ cleanup:
  * instead of client app context & also adding in tunnel
  * handling */
 static int doPeer2PeerMigrate2(struct qemud_driver *driver,
-                               virConnectPtr sconn,
+                               virConnectPtr sconn ATTRIBUTE_UNUSED,
                                virConnectPtr dconn,
                                virDomainObjPtr vm,
                                const char *dconnuri,
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index e6123f9..971fb80 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -96,7 +96,8 @@ virNetTLSContextCheckCertFile(const char *type, const char *file, bool allowMiss
 }
 
 
-static void virNetTLSLog(int level, const char *str) {
+static void virNetTLSLog(int level ATTRIBUTE_UNUSED,
+                         const char *str ATTRIBUTE_UNUSED) {
     VIR_DEBUG("%d %s", level, str);
 }
 
@@ -490,7 +491,7 @@ static int virNetTLSContextCheckCertPair(gnutls_x509_crt_t cert,
 
 static gnutls_x509_crt_t virNetTLSContextLoadCertFromFile(const char *certFile,
                                                           bool isServer,
-                                                          bool isCA)
+                                                          bool isCA ATTRIBUTE_UNUSED)
 {
     gnutls_datum_t data;
     gnutls_x509_crt_t cert = NULL;
diff --git a/src/util/command.c b/src/util/command.c
index d390478..699ba2d 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -1686,7 +1686,8 @@ virCommandProcessIO(virCommandPtr cmd)
                 } else {
                     inoff += done;
                     if (inoff == inlen) {
-                        int tmpfd = infd;
+                        int tmpfd ATTRIBUTE_UNUSED;
+                        tmpfd = infd;
                         if (VIR_CLOSE(infd) < 0)
                             VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
                     }
@@ -1877,7 +1878,8 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
             VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
     }
     if (cmd->outbuf == &outbuf) {
-        int tmpfd = cmd->outfd;
+        int tmpfd ATTRIBUTE_UNUSED;
+        tmpfd = cmd->outfd;
         if (VIR_CLOSE(cmd->outfd) < 0)
             VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
         cmd->outfdptr = NULL;
@@ -1885,7 +1887,8 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
         VIR_FREE(outbuf);
     }
     if (cmd->errbuf == &errbuf) {
-        int tmpfd = cmd->errfd;
+        int tmpfd ATTRIBUTE_UNUSED;
+        tmpfd = cmd->errfd;
         if (VIR_CLOSE(cmd->errfd) < 0)
             VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
         cmd->errfdptr = NULL;
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 8206e1a..1fd6318 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -351,7 +351,7 @@ int virPidFileAcquirePath(const char *path,
          * one that now exists on the filesystem
          */
         if (stat(path, &a) < 0) {
-            char ebuf[1024];
+            char ebuf[1024] ATTRIBUTE_UNUSED;
             VIR_DEBUG("Pid file '%s' disappeared: %s",
                       path, virStrerror(errno, ebuf, sizeof ebuf));
             VIR_FORCE_CLOSE(fd);
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 0e4364f..b483d0f 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -6447,7 +6447,7 @@ cleanup:
 
 /* Functions needed for Callbacks */
 static nsresult PR_COM_METHOD
-vboxCallbackOnMachineStateChange(IVirtualBoxCallback *pThis,
+vboxCallbackOnMachineStateChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
                                  PRUnichar *machineId, PRUint32 state)
 {
     virDomainPtr dom = NULL;
@@ -6521,7 +6521,7 @@ vboxCallbackOnMachineStateChange(IVirtualBoxCallback *pThis,
 }
 
 static nsresult PR_COM_METHOD
-vboxCallbackOnMachineDataChange(IVirtualBoxCallback *pThis,
+vboxCallbackOnMachineDataChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
                                 PRUnichar *machineId)
 {
     VIR_DEBUG("IVirtualBoxCallback: %p", pThis);
@@ -6531,11 +6531,11 @@ vboxCallbackOnMachineDataChange(IVirtualBoxCallback *pThis,
 }
 
 static nsresult PR_COM_METHOD
-vboxCallbackOnExtraDataCanChange(IVirtualBoxCallback *pThis,
+vboxCallbackOnExtraDataCanChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
                                  PRUnichar *machineId, PRUnichar *key,
                                  PRUnichar *value,
                                  PRUnichar **error ATTRIBUTE_UNUSED,
-                                 PRBool *allowChange)
+                                 PRBool *allowChange ATTRIBUTE_UNUSED)
 {
     VIR_DEBUG("IVirtualBoxCallback: %p, allowChange: %s", pThis, *allowChange ? "true" : "false");
     DEBUGPRUnichar("machineId", machineId);
@@ -6546,7 +6546,8 @@ vboxCallbackOnExtraDataCanChange(IVirtualBoxCallback *pThis,
 }
 
 static nsresult PR_COM_METHOD
-vboxCallbackOnExtraDataChange(IVirtualBoxCallback *pThis, PRUnichar *machineId,
+vboxCallbackOnExtraDataChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
+                              PRUnichar *machineId,
                               PRUnichar *key, PRUnichar *value)
 {
     VIR_DEBUG("IVirtualBoxCallback: %p", pThis);
@@ -6559,8 +6560,10 @@ vboxCallbackOnExtraDataChange(IVirtualBoxCallback *pThis, PRUnichar *machineId,
 
 # if VBOX_API_VERSION < 3001
 static nsresult PR_COM_METHOD
-vboxCallbackOnMediaRegistered(IVirtualBoxCallback *pThis, PRUnichar *mediaId,
-                              PRUint32 mediaType, PRBool registered)
+vboxCallbackOnMediaRegistered(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
+                              PRUnichar *mediaId,
+                              PRUint32 mediaType ATTRIBUTE_UNUSED,
+                              PRBool registered ATTRIBUTE_UNUSED)
 {
     VIR_DEBUG("IVirtualBoxCallback: %p, registered: %s", pThis, registered ? "true" : "false");
     VIR_DEBUG("mediaType: %d", mediaType);
@@ -6572,7 +6575,7 @@ vboxCallbackOnMediaRegistered(IVirtualBoxCallback *pThis, PRUnichar *mediaId,
 # endif /* VBOX_API_VERSION >= 3001 */
 
 static nsresult PR_COM_METHOD
-vboxCallbackOnMachineRegistered(IVirtualBoxCallback *pThis,
+vboxCallbackOnMachineRegistered(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
                                 PRUnichar *machineId, PRBool registered)
 {
     virDomainPtr dom = NULL;
@@ -6631,8 +6634,9 @@ vboxCallbackOnMachineRegistered(IVirtualBoxCallback *pThis,
 }
 
 static nsresult PR_COM_METHOD
-vboxCallbackOnSessionStateChange(IVirtualBoxCallback *pThis,
-                                 PRUnichar *machineId, PRUint32 state)
+vboxCallbackOnSessionStateChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
+                                 PRUnichar *machineId,
+                                 PRUint32 state ATTRIBUTE_UNUSED)
 {
     VIR_DEBUG("IVirtualBoxCallback: %p, state: %d", pThis, state);
     DEBUGPRUnichar("machineId", machineId);
@@ -6641,7 +6645,8 @@ vboxCallbackOnSessionStateChange(IVirtualBoxCallback *pThis,
 }
 
 static nsresult PR_COM_METHOD
-vboxCallbackOnSnapshotTaken(IVirtualBoxCallback *pThis, PRUnichar *machineId,
+vboxCallbackOnSnapshotTaken(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
+                            PRUnichar *machineId,
                             PRUnichar *snapshotId)
 {
     VIR_DEBUG("IVirtualBoxCallback: %p", pThis);
@@ -6652,7 +6657,8 @@ vboxCallbackOnSnapshotTaken(IVirtualBoxCallback *pThis, PRUnichar *machineId,
 }
 
 static nsresult PR_COM_METHOD
-vboxCallbackOnSnapshotDiscarded(IVirtualBoxCallback *pThis, PRUnichar *machineId,
+vboxCallbackOnSnapshotDiscarded(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
+                                PRUnichar *machineId,
                                 PRUnichar *snapshotId)
 {
     VIR_DEBUG("IVirtualBoxCallback: %p", pThis);
@@ -6663,7 +6669,8 @@ vboxCallbackOnSnapshotDiscarded(IVirtualBoxCallback *pThis, PRUnichar *machineId
 }
 
 static nsresult PR_COM_METHOD
-vboxCallbackOnSnapshotChange(IVirtualBoxCallback *pThis, PRUnichar *machineId,
+vboxCallbackOnSnapshotChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
+                             PRUnichar *machineId,
                              PRUnichar *snapshotId)
 {
     VIR_DEBUG("IVirtualBoxCallback: %p", pThis);
@@ -6674,7 +6681,7 @@ vboxCallbackOnSnapshotChange(IVirtualBoxCallback *pThis, PRUnichar *machineId,
 }
 
 static nsresult PR_COM_METHOD
-vboxCallbackOnGuestPropertyChange(IVirtualBoxCallback *pThis,
+vboxCallbackOnGuestPropertyChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
                                   PRUnichar *machineId, PRUnichar *name,
                                   PRUnichar *value, PRUnichar *flags)
 {
@@ -6688,7 +6695,7 @@ vboxCallbackOnGuestPropertyChange(IVirtualBoxCallback *pThis,
 }
 
 static nsresult PR_COM_METHOD
-vboxCallbackAddRef(nsISupports *pThis)
+vboxCallbackAddRef(nsISupports *pThis ATTRIBUTE_UNUSED)
 {
     nsresult c;
 
-- 
1.7.3.4


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