From patchwork Wed Apr 20 23:39:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 92333 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 79B14B6EEC for ; Thu, 21 Apr 2011 09:40:16 +1000 (EST) Received: from localhost ([::1]:50067 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCh0F-0003TM-PL for incoming@patchwork.ozlabs.org; Wed, 20 Apr 2011 19:40:11 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=1WjN6Xjs76Vdop0A0X4hUNqY5dJOPHYjDtgmu77IFXE=; b=iWcnMg654PjRO8t9UpIDTK1v5JEpbAEwqEaNg4d+bKW5oVupivYWnLlXiM+WLzwxHN 7Dzy7RTXy0iaGGAW6eysBccWNQszOeXawr0/a8DOUfl4x05MSGC/owqC8f6GzQ1Si3xL QztTnPPXlvHTWmvg8O7LXvNZ0m+yacFPelmMM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=AIp3lr9/RDtYAO/woEYdyrKXZUiG3GQMPqgHaW7yD9qxoYSUcASPBHV+7Y/p1FJsH2 qhnPt+lBY1Aqtzf4tJIZcimH0jJtd29Kxxycki31FLxpZIEkKXxyaWzDytzxj0UkNyS+ ShBG1Rw0n1VeQm0XOhl+Jf6+jsEokporL+JJo= Received: by 10.101.73.2 with SMTP id a2mr4344321anl.71.1303342770875; Wed, 20 Apr 2011 16:39:30 -0700 (PDT) Received: from localhost.localdomain ([216.252.88.8]) by mx.google.com with ESMTPS id w39sm1315630ana.13.2011.04.20.16.39.29 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Apr 2011 16:39:30 -0700 (PDT) From: Benjamin Poirier To: qemu-devel@nongnu.org Date: Wed, 20 Apr 2011 19:39:02 -0400 Message-Id: <1303342742-16388-3-git-send-email-benjamin.poirier@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1303342742-16388-1-git-send-email-benjamin.poirier@gmail.com> References: <1303342742-16388-1-git-send-email-benjamin.poirier@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.173 Subject: [Qemu-devel] [PATCH 3/3] rtl8139: add format attribute to DPRINTF X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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);