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

Richard W.M. Jones rjones at redhat.com
Wed Jul 11 16:24:08 UTC 2007


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.

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070711/50967176/attachment-0001.bin>


More information about the libvir-list mailing list