On 6/12/19 1:03 PM, Alex Bennée wrote:
> 
> Ramon Fried <rfried....@gmail.com> writes:
> 
>> defining CADENCE_GEM_ERR_DEBUG causes compilation
>> errors, fix that.
> 
> It would be worth doing something like:
> 
> #ifdef CADENCE_GEM_ERR_DEBUG
> #define CADENCE_GEM_GATE 1
> #else
> #define CADENCE_GEM_GATE 0
> #endif
> 
> #define DB_PRINT(...) do { \
>     if (CADENCE_GEM_GATE) { \
>         fprintf(stderr,  ": %s: ", __func__); \
>         fprintf(stderr, ## __VA_ARGS__); \
>     } \
> } while (0)
> 
> So these format strings don't go stale in and only get detected on
> --debug builds.
> 
> While your at it I suspect the fprintf debug would be better of as:
> 
>   qemu_log("%s: " fmt, __func__, ## args);

Indeed, or even see if it is worth converting to full-on trace points
for dynamic control of whether to catch these things without having to
recompile debug on or off.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to