On 06/30/2016 03:32 PM, John Arbuckle wrote:
> Add debug macros to the code for easier debugging.
> 
> Signed-off-by: John Arbuckle <programmingk...@gmail.com>
> ---
>  hw/input/hid.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/hw/input/hid.c b/hw/input/hid.c
> index 3e1b46e..efe703e 100644
> --- a/hw/input/hid.c
> +++ b/hw/input/hid.c
> @@ -37,6 +37,13 @@
>  #define RELEASED -1
>  #define PUSHED -2
>  
> +/* #define DEBUG_HID_CODE */
> +#ifdef DEBUG_HID_CODE
> +    #define DEBUG_HID(fmt, ...) printf(fmt, __VA_ARGS__)
> +#else
> +    #define DEBUG_HID(fmt, ...) (void)0
> +#endif

NACK to this approach - it is too prone to bitrot.  Instead, you want to
do something like commit ed79f37d, so that the compiler always compiles
the arguments to printf() even when debugging is disabled (any compiler
too stupid to optimize out dead 'if (0)' code is not worth using for
compiling qemu).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to