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:If it doesn't work on non-GCC, then those people can simply not add --enable-debug to their configure flags.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 ..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
Description: S/MIME Cryptographic Signature