[Libvir] [PATCH] If ./configure --enable-debug=yes, print libvirt calls

Daniel Veillard veillard at redhat.com
Wed Jul 11 16:31:05 UTC 2007


On Wed, Jul 11, 2007 at 05:24:08PM +0100, Richard W.M. Jones wrote:
> Daniel Veillard wrote:
> >On Wed, Jul 11, 2007 at 05:06:31PM +0100, Daniel P. Berrange wrote:
> >>On Wed, Jul 11, 2007 at 12:02:26PM -0400, Daniel Veillard wrote:
> >>>On Wed, Jul 11, 2007 at 04:36:23PM +0100, Richard W.M. Jones wrote:
> >>>>This can prove useful if we want to track down problems like the 
> >>>>double-call of domainSuspend.
> >>>>
> >>>>Also attached below is the output of virt-manager when this tracing is 
> >>>>enabled.
> >>>>
> >>>>Note that if --enable-debug is not set, then no extra code is added to 
> >>>>libvirt.
> >>>  I would like this, I have just one thing which worries me, it's the
> >>>vararg macros, I'm not sure how widely it's supported outside of gcc ..
> >>If it doesn't work on non-GCC, then those people can simply not add 
> >>--enable-debug to their configure flags.
> >
> >  Disagree
> >
> >+#define DEBUG0
> >+#define DEBUG(fs,...)
> >+#endif /* !ENABLE_DEBUG */
> >
> >just won't work for them, not all statements are within 
> >#ifdef ENABLE_DEBUG
> >#endif
> >
> >it won't compile even if ENABLE_DEBUG is not defined.
> 
> Am I missing something here?
> 
> For me it does compile with and without --enable-debug=yes, but then of 
> course I'm only using gcc.
> 
> My understanding is that __VA_ARGS__ is the ISO C way of doing varargs 
> in macro definitions.  gcc has its own variation (#define F(args...)) 
> which I deliberately avoided for portability reasons.
> 
> The only odd thing we're doing in the --enable-debug case is using 
> ##__VA_ARGS__, where the "##" swallows the preceeding comma.  I have no 
> idea if this is ISO C or not.  It is mentioned in the CPP info page, but 
> it's not clear if it is standard.  In any case because we have two 
> macros (DEBUG0 and DEBUG) it is trivial to rewrite the patch to avoid this.

  Yeah, I understand I'm being a bit picky, but it's usually easier to 
get fixed at check-in than when someone doing a port hits it (if this
ever happens !)

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list