[libvirt] [PATCHv2] fix failure when building with --disable-debug

Eric Blake eblake at redhat.com
Wed Jul 11 14:36:10 UTC 2012


On 07/11/2012 04:40 AM, Hu Tao wrote:
> When building with --disable-debug, VIR_DEBUG expands to a nop.
> But parameters to VIR_DEBUG can be variables that are passed only
> to VIR_DEBUG. In the case the building system complains about unused
> variables.
> ---
>  cfg.mk             |    2 ++
>  src/util/logging.h |    8 +++++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)

>  # else
> +/**
> + * virLogEatParam:
> + *
> + * Do nothing but eat parameters.
> + */
> +static inline void virLogEatParam(void *unused ATTRIBUTE_UNUSED, ...) {}

Can't we do:

static inline void virLogEatParam(void *dummy, ...) { dummy = dummy; }

to avoid even needing the ATTRIBUTE_UNUSED, and the syntax check exemption?

>  #  define VIR_DEBUG_INT(category, f, l, ...)    \
> -    do { } while (0)
> +    virLogEatParam((void*)category, f, l, __VA_ARGS__)

Any reason we have to use a cast, instead of just creating our eat
function with the correct type parameter in the first place?

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120711/99fb98c8/attachment-0001.sig>


More information about the libvir-list mailing list