Re: [PATCH] Clean up a warning in remote_internal.c

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

 



"Richard W.M. Jones" <rjones@xxxxxxxxxx> 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)

--
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]