From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tczvz-0006mf-IW for qemu-devel@nongnu.org; Mon, 26 Nov 2012 09:45:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tczvv-00076Q-FY for qemu-devel@nongnu.org; Mon, 26 Nov 2012 09:45:19 -0500 Received: from cantor2.suse.de ([195.135.220.15]:48665 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tczvv-00076A-8Z for qemu-devel@nongnu.org; Mon, 26 Nov 2012 09:45:15 -0500 Message-ID: <50B38075.5060401@suse.de> Date: Mon, 26 Nov 2012 15:45:09 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 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> In-Reply-To: <87k3t8qvrg.fsf@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1 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: Anthony Liguori 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 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. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg