[Libvir] [PATCH] Check calls to printf-like functions (and some fixes)

Richard W.M. Jones rjones at redhat.com
Mon Mar 12 17:32:38 UTC 2007

Daniel P. Berrange wrote:
> On Mon, Mar 12, 2007 at 05:16:52PM +0000, Richard W.M. Jones wrote:
>> * Fix qemudDebug when debug not enabled
> Its not clear what was broken about the existing code ?
> This chunk:
>>  #ifdef ENABLE_DEBUG
>>  #define qemudDebug(...) qemudLog(QEMUD_DEBUG, __VA_ARGS__)
>>  #else
>> -#define qemudDebug(fmt, ...) do { } while(0);
>> +#define qemudDebug(fmt, ...)
>>  #endif
> Will break / silently change code semantics, if qemudDebug is used in
> situations like
>    if (foo)
>      qemudDebug("blah")
>    wizz()

I mean this code _looks_ incorrect even if it actually isn't because of 
the extra ';' in the macro.

If I type this into emacs and hit [tab] a few times I get:

     if (foo)

so people are at least getting what they'd expect ...

Anyway, I've just manually checked all calls to qemudDebug to see if any 
omit the trailing ';', and none do.


More information about the libvir-list mailing list