[libvirt] [PATCH] build: avoid compiler warning

Eric Blake eblake at redhat.com
Tue Apr 20 14:31:25 UTC 2010


According to GCC, ATTRIBUTE_UNUSED means that an attribute _might_
be unused, not _must_ be unused.  Therefore, it is easier to
blindly mark a variable, than to try and do preprocessor limiting
of when we know it is unused.

* src/remote/remote_driver.c (remoteAuthenticate): Mark attribute
as potentially unused.
Reported by Gustovo Morozowski.
---

> I am trying to build 0.8.0 for windows using Fedora 12 [1], the
> compile is breaking with the message -
> 
> It seems 'in_open' is not used when both SASL and POLKIT are disabled.

Thanks for the report.  This would fix it, but I'd like to hear from
others whether my patch is okay, or whether we need a more complex
patch that uses #if to limit when the attribute is applied.

 src/remote/remote_driver.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index e3df27b..44d8c26 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6475,12 +6475,9 @@ done:
 /*----------------------------------------------------------------------*/

 static int
-remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
-                    virConnectAuthPtr auth
-#if !HAVE_SASL && !HAVE_POLKIT
-                    ATTRIBUTE_UNUSED
-#endif
-                    ,
+remoteAuthenticate (virConnectPtr conn, struct private_data *priv,
+                    int in_open ATTRIBUTE_UNUSED,
+                    virConnectAuthPtr auth ATTRIBUTE_UNUSED,
                     const char *authtype)
 {
     struct remote_auth_list_ret ret;
-- 
1.6.6.1




More information about the libvir-list mailing list