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

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



On Fri, Jul 13, 2012 at 11:46:17AM +0200, Michal Privoznik wrote:
> On 13.07.2012 09:50, 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/util/logging.h |   15 ++++++++++++++-
> >  1 file changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/util/logging.h b/src/util/logging.h
> > index 70318d0..2e70af4 100644
> > --- a/src/util/logging.h
> > +++ b/src/util/logging.h
> > @@ -34,8 +34,21 @@
> >  #  define VIR_DEBUG_INT(category, f, l, ...)                            \
> >      virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, __VA_ARGS__)
> >  # else
> > +/**
> > + * virLogEatParam:
> > + *
> > + * Do nothing but eat parameters.
> > + */
> > +static inline void virLogEatParam(const char *category,
> > +                                  const char *funcname,
> > +                                  long long linenr, ...)
> > +{
> > +    category = category;
> > +    funcname = funcname;
> > +    linenr = linenr;
> > +}
> >  #  define VIR_DEBUG_INT(category, f, l, ...)    \
> > -    do { } while (0)
> > +    virLogEatParam(category, f, l, __VA_ARGS__)
> >  # endif /* !ENABLE_DEBUG */
> >  
> >  # define VIR_INFO_INT(category, f, l, ...)                              \
> > 
> 
> Okay, this fixes the issue. However I think virLogEatParam() should be
> implemented in src/util/logging.c and in .h it should be only annotated.

No, the whole point in having it in logging.h, is that it expands to
a no-op when you have debugging disabled.

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


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