From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCgzc-0002iK-8S for qemu-devel@nongnu.org; Wed, 20 Apr 2011 19:39:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCgzb-0000ew-EN for qemu-devel@nongnu.org; Wed, 20 Apr 2011 19:39:32 -0400 Received: from mail-gx0-f173.google.com ([209.85.161.173]:34852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCgzb-0000es-Ax for qemu-devel@nongnu.org; Wed, 20 Apr 2011 19:39:31 -0400 Received: by gxk26 with SMTP id 26so433090gxk.4 for ; Wed, 20 Apr 2011 16:39:30 -0700 (PDT) From: Benjamin Poirier Date: Wed, 20 Apr 2011 19:39:02 -0400 Message-Id: <1303342742-16388-3-git-send-email-benjamin.poirier@gmail.com> In-Reply-To: <1303342742-16388-1-git-send-email-benjamin.poirier@gmail.com> References: <1303342742-16388-1-git-send-email-benjamin.poirier@gmail.com> Subject: [Qemu-devel] [PATCH 3/3] rtl8139: add format attribute to DPRINTF List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org gcc can check the format string for correctness even when debugging output is not enabled. Have to make sure arguments are always available. They are optimized out if unneeded. Signed-off-by: Benjamin Poirier Cc: Igor V. Kovalenko --- hw/rtl8139.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 16ccd1e..15698ce 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -88,7 +88,11 @@ # define DPRINTF(fmt, ...) \ do { fprintf(stderr, "RTL8139: " fmt, ## __VA_ARGS__); } while (0) #else -# define DPRINTF(fmt, ...) do { } while (0) +static inline __attribute__ ((format (printf, 1, 2))) + int DPRINTF(const char *fmt, ...) +{ + return 0; +} #endif /* Symbolic offsets to registers. */ @@ -2201,9 +2205,8 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s) if ((txdw0 & CP_TX_LGSEN) && ip_protocol == IP_PROTO_TCP) { -#if defined (DEBUG_RTL8139) int large_send_mss = (txdw0 >> 16) & CP_TC_LGSEN_MSS_MASK; -#endif + DPRINTF("+++ C+ mode offloaded task TSO MTU=%d IP data %d " "frame data %d specified MSS=%d\n", ETH_MTU, ip_data_len, saved_size - ETH_HLEN, large_send_mss); -- 1.7.4.1