From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIzfr-0004hk-Sy for qemu-devel@nongnu.org; Fri, 01 Jul 2016 10:44:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIzfn-0003WI-PS for qemu-devel@nongnu.org; Fri, 01 Jul 2016 10:44:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIzfn-0003WC-H6 for qemu-devel@nongnu.org; Fri, 01 Jul 2016 10:44:03 -0400 References: <1467322340-25602-1-git-send-email-programmingkidx@gmail.com> <1467322340-25602-4-git-send-email-programmingkidx@gmail.com> From: Eric Blake Message-ID: <577681B1.3070007@redhat.com> Date: Fri, 1 Jul 2016 08:44:01 -0600 MIME-Version: 1.0 In-Reply-To: <1467322340-25602-4-git-send-email-programmingkidx@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uN7dOSKOXlXkDjbUc4TqkImlDP88GrPqO" Subject: Re: [Qemu-devel] [PATCH 3/3] hid.c: Add debug support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Arbuckle , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --uN7dOSKOXlXkDjbUc4TqkImlDP88GrPqO From: Eric Blake To: John Arbuckle , qemu-devel@nongnu.org Message-ID: <577681B1.3070007@redhat.com> Subject: Re: [PATCH 3/3] hid.c: Add debug support References: <1467322340-25602-1-git-send-email-programmingkidx@gmail.com> <1467322340-25602-4-git-send-email-programmingkidx@gmail.com> In-Reply-To: <1467322340-25602-4-git-send-email-programmingkidx@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/30/2016 03:32 PM, John Arbuckle wrote: > Add debug macros to the code for easier debugging. >=20 > Signed-off-by: John Arbuckle > --- > hw/input/hid.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) >=20 > 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 > =20 > +/* #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). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --uN7dOSKOXlXkDjbUc4TqkImlDP88GrPqO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXdoGxAAoJEKeha0olJ0NqpWQH/isrZyRlzO6JDYh/SRuE0tzK UhYo1xrm0PVJLelxQflamwoXo2aGxEd0jf8hqBKWGITu3LHAAgfOzq8b0xqgQBbw n4Hh+Dzj9u3jBST9Kpv97Bpvhgri/zq5X3iwwidwP9Bl2DlpAw/9Y34ysyWeBJio ZLo1FLsPD52DlsyyPnuGVXuWapcli1A/4E3KZnpL1Xq3nBnvWvnVajJDFLIfuMWk 8YppuPXUoFEs6H4TsvOjRULof1pPKFhPOfO5PyY7DhQN+lZHLYmpjGeae2lnangt rpIphjloSIv94ybJ7CF6xxReNb1QtClg3ZvYUkdFzVA4p6paWXMMi7isiNIXTPk= =4aCW -----END PGP SIGNATURE----- --uN7dOSKOXlXkDjbUc4TqkImlDP88GrPqO--