qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/3] hid.c: Add debug support


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 3/3] hid.c: Add debug support
Date: Fri, 1 Jul 2016 08:44:01 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 06/30/2016 03:32 PM, John Arbuckle wrote:
> Add debug macros to the code for easier debugging.
> 
> Signed-off-by: John Arbuckle <address@hidden>
> ---
>  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

[Prev in Thread] Current Thread [Next in Thread]