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 ? > diff --git a/src/util/logging.h b/src/util/logging.h > index 70318d0..b96a115 100644 > --- a/src/util/logging.h > +++ b/src/util/logging.h > @@ -35,7 +35,7 @@ > virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, __VA_ARGS__) > # else > # define VIR_DEBUG_INT(category, f, l, ...) \ > - do { } while (0) > + virEatParam((void*)category, f, l, __VA_ARGS__) > # endif /* !ENABLE_DEBUG */ > > # define VIR_INFO_INT(category, f, l, ...) \ > @@ -142,4 +142,5 @@ extern void virLogVMessage(const char *category, int priority, > va_list vargs) ATTRIBUTE_FMT_PRINTF(6, 0); > extern int virLogSetBufferSize(int size); > extern void virLogEmergencyDumpAll(int signum); > +void virEatParam(void *unused, ...); Oh and rename it to: s/virEatParam/virLogEatParam/ Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list