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

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



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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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