qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: John Arbuckle <programmingkidx@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/3] hid.c: Add debug support
Date: Fri, 1 Jul 2016 08:44:01 -0600	[thread overview]
Message-ID: <577681B1.3070007@redhat.com> (raw)
In-Reply-To: <1467322340-25602-4-git-send-email-programmingkidx@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]

On 06/30/2016 03:32 PM, John Arbuckle wrote:
> Add debug macros to the code for easier debugging.
> 
> Signed-off-by: John Arbuckle <programmingkidx@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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-07-01 14:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 21:32 [Qemu-devel] [PATCH 0/3] Switch USB HID to QKeyCode John Arbuckle
2016-06-30 21:32 ` [Qemu-devel] [PATCH 1/3] usb-keys.h: initial commit John Arbuckle
2016-06-30 21:32 ` [Qemu-devel] [PATCH 2/3] hid.c: convert to QKeyCode John Arbuckle
2016-06-30 21:32 ` [Qemu-devel] [PATCH 3/3] hid.c: Add debug support John Arbuckle
2016-07-01 14:44   ` Eric Blake [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-03-25 16:10 Programmingkid
2016-03-26  6:48 ` Alex Bennée
2016-03-27 14:30   ` Programmingkid
2016-03-27 17:59     ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=577681B1.3070007@redhat.com \
    --to=eblake@redhat.com \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).