From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmPUs-0001X1-BV for qemu-devel@nongnu.org; Mon, 19 May 2014 11:29:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmPUl-0003wc-PE for qemu-devel@nongnu.org; Mon, 19 May 2014 11:29:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmPUl-0003wI-I8 for qemu-devel@nongnu.org; Mon, 19 May 2014 11:28:55 -0400 Message-ID: <537A2334.70207@redhat.com> Date: Mon, 19 May 2014 09:28:52 -0600 From: Eric Blake MIME-Version: 1.0 References: <1400367823-32610-1-git-send-email-marc.mari.barcelo@gmail.com> <1400367823-32610-2-git-send-email-marc.mari.barcelo@gmail.com> In-Reply-To: <1400367823-32610-2-git-send-email-marc.mari.barcelo@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="H5eucx6QMScGvnG5mA3o3R1gFjJqnj9Q3" Subject: Re: [Qemu-devel] [PATCH v3 01/16] include/qemu-common.h: Add QEMU_DPRINTF macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?TWFyYyBNYXLDrQ==?= , qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Peter Crosthwaite , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --H5eucx6QMScGvnG5mA3o3R1gFjJqnj9Q3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/17/2014 05:03 PM, Marc Mar=C3=AD wrote: > Create this macro to let debug macros to have the same format through t= he > codebase and use regular ifs instead of ifdef. >=20 > Signed-off-by: Marc Mar=C3=AD > --- > include/qemu-common.h | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/include/qemu-common.h b/include/qemu-common.h > index 3f3fd60..acdcf08 100644 > --- a/include/qemu-common.h > +++ b/include/qemu-common.h > @@ -463,3 +463,10 @@ int parse_debug_env(const char *name, int max, int= initial); > const char *qemu_ether_ntoa(const MACAddr *mac); > =20 > #endif > + > +#define QEMU_DPRINTF(cond,pfx,fmt,...) \ Style: space after comma: #define QEMU_DPRINTF(cond, pfx, fmt, ...) \ > + do { \ Up to you if you want to align \ rather than putting them flush to each line (I don't know if there is a prevalent style in the codebase). > + if (cond) { \ > + fprintf(stderr, pfx": %s:"fmt, __func__, ## __VA_ARGS__); = \ Style: spaces between string concatenation: pfx ": %s:" fmt This definition requires that pfx and fmt be constant strings to allow string concatenation. Might it be better to allow for non-constants, by splitting it into two actions, as in: fprintf(stderr, "%s: %s:", pfx, __func__); fprintf(stderr, fmt, ## __VA_ARGS__); --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --H5eucx6QMScGvnG5mA3o3R1gFjJqnj9Q3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTeiM0AAoJEKeha0olJ0NqdaAIAJrAFVIsWTUfuC5L2729Ln+3 5NkXL3hBHm/LZEH4/367vg0HpIcHIKrKnSDfLyURFRc8oVrsIp1I0JJnOdlw+EjL Cf0Aux6aN35lghB+6ChPWogaoIgw8k4Pg7Ia4bIuqCPNOORL6YFgA++0BW3pNa6y H695/Jr3920nZttOkrw9UaOGs3/l2iS65rPmkQ3la3/ylKINhWG4yxv8OrRqoe4B Wyuwt/cuz7pTHsdUG8F1J0nQYKQAd/yuW1kOA3G9Is3/0cKWAqC9jWD8PrKBo0HB 3PzYzU8KNsqVtYqOIME+546hUJzM3wwhto29jmBHTWZj4iybfz/klH6daopvwoA= =0icF -----END PGP SIGNATURE----- --H5eucx6QMScGvnG5mA3o3R1gFjJqnj9Q3--