On Wed, Jul 11, 2012 at 10:45:17AM +0100, Daniel P. Berrange wrote:
On Wed, Jul 11, 2012 at 05:05:24PM +0800, 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.
> ---
> src/libvirt_private.syms | 1 +
> src/util/logging.c | 15 +++++++++++++++
> src/util/logging.h | 3 ++-
> 3 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index b173590..48c4df7 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -739,6 +739,7 @@ virLockManagerRelease;
>
>
> # logging.h
> +virEatParam;
> virLogDefineFilter;
> virLogDefineOutput;
> virLogEmergencyDumpAll;
> diff --git a/src/util/logging.c b/src/util/logging.c
> index f8233cd..999dd01 100644
> --- a/src/util/logging.c
> +++ b/src/util/logging.c
> @@ -1262,3 +1262,18 @@ void virLogSetFromEnv(void) {
> if (debugEnv && *debugEnv)
> virLogParseOutputs(debugEnv);
> }
> +
> +/**
> + * virEatParam:
> + *
> + * Do nothing but eat parameters. See VIR_DEBUG_INT.
> + *
> + * Currently only VIR_DEBUG_INT uses this function, which could
> + * have been defined right before VIR_DEBUG_INT, but it makes
> + * `make syntax-check' unhappy about ATTRIBUTE_UNUSED appearing
> + * in .h file.
> + */
> +void virEatParam(void *unused ATTRIBUTE_UNUSED, ...)
> +{
> + /* do nothing */
> +}
Could you in fact put this in logging.h and mark it 'inline' so
the compiler does away with it entirely, but still thinks the
params are used ?
but `make syntax-check' will fail.
--
Thanks,
Hu Tao