[Libvir] [PATCH] Clean up a warning in remote_internal.c

Jim Meyering jim at meyering.net
Thu Dec 6 12:05:53 UTC 2007


"Richard W.M. Jones" <rjones at redhat.com> wrote:
> After applying this patch, you can compile CVS libvirt with -Werror.
>
> Rich.
>
> --
> Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
> Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
> Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
> England and Wales under Company Registration No. 03798903
> Index: src/remote_internal.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/remote_internal.c,v
> retrieving revision 1.43
> diff -u -r1.43 remote_internal.c
> --- src/remote_internal.c	5 Dec 2007 21:31:07 -0000	1.43
> +++ src/remote_internal.c	6 Dec 2007 11:22:21 -0000
> @@ -2841,7 +2859,12 @@
>
>  static int
>  remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
> -                    virConnectAuthPtr auth, const char *authtype)
> +                    virConnectAuthPtr auth
> +#if !HAVE_SASL && !HAVE_POLKIT
> +                    ATTRIBUTE_UNUSED
> +#endif
> +                    ,
> +                    const char *authtype)

Ugly indeed.
In situations like that, I'd prefer to do something like this:

#if !HAVE_SASL && !HAVE_POLKIT
# define ATTRIBUTE_UNUSED_SOMETIMES ATTRIBUTE_UNUSED
#else
# define ATTRIBUTE_UNUSED_SOMETIMES /* empty */
#endif

Then if you're unlucky enough to have one or two more
affected variables, it doesn't turn into #ifdef hell.

static int
remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
                    virConnectAuthPtr auth, const char *authtype)
                    virConnectAuthPtr auth ATTRIBUTE_UNUSED_SOMETIMES,
                    const char *authtype)




More information about the libvir-list mailing list