From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Td1yk-0001hP-0w for qemu-devel@nongnu.org; Mon, 26 Nov 2012 11:56:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Td1yf-0000iR-7E for qemu-devel@nongnu.org; Mon, 26 Nov 2012 11:56:17 -0500 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:46082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Td1ye-0000hi-JJ for qemu-devel@nongnu.org; Mon, 26 Nov 2012 11:56:13 -0500 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 26 Nov 2012 22:26:06 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qAQGu3aY59113584 for ; Mon, 26 Nov 2012 22:26:04 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qAQMPs4f023561 for ; Tue, 27 Nov 2012 09:25:54 +1100 From: Anthony Liguori In-Reply-To: <50B38075.5060401@suse.de> References: <1353595852-30776-1-git-send-email-fred.konrad@greensocs.com> <1353595852-30776-2-git-send-email-fred.konrad@greensocs.com> <87k3t8qvrg.fsf@codemonkey.ws> <50B38075.5060401@suse.de> Date: Mon, 26 Nov 2012 10:55:53 -0600 Message-ID: <87a9u4pali.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH v2 1/3] virtio-bus : Introduce VirtioBus. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?utf-8?Q?F=C3=A4rber?= Cc: peter.maydell@linaro.org, e.voevodin@samsung.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, stefanha@redhat.com, cornelia.huck@de.ibm.com, fred.konrad@greensocs.com Andreas F=C3=A4rber writes: > Am 26.11.2012 15:33, schrieb Anthony Liguori: >> fred.konrad@greensocs.com writes: >>> +#define DEBUG_VIRTIO_BUS 1 >>> + >>> +#define DPRINTF(fmt, ...) if (DEBUG_VIRTIO_BUS) { = \ >>> + printf("virtio_bus: " fmt , ## __VA_ARGS__= ); \ >>> + } >>=20 >> #ifdef DEBUG_VIRTIO_BUS >> #define DPRINTF(fmt, ...) ... >> #else >> #define DPRINTF(fmt, ...) do { } while (0) >> #endif >>=20 >> You're leaving a dangling if clause which can do very strange things if >> used before an else statement. > > If you look at the change history, this was a change in a reaction to me > pointing to a proposal by Samsung. I see your point with the else > statement, that can be circumvented by adding else {}. The reason is to > avoid DPRINTF()s bitrotting because your "do { } while (0)" performs no > compile-tests on "fmt, ..." arguments. This is a well-used idiom in QEMU. We shouldn't try to change idioms in random patch series. If you want to change the way we do DPRINTF(), it should be done globally in its own series. Regards, Anthony Liguori > > Andreas > > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3= =BCrnberg