From: Benjamin Poirier <benjamin.poirier@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] rtl8139: add format attribute to DPRINTF
Date: Wed, 20 Apr 2011 19:39:02 -0400 [thread overview]
Message-ID: <1303342742-16388-3-git-send-email-benjamin.poirier@gmail.com> (raw)
In-Reply-To: <1303342742-16388-1-git-send-email-benjamin.poirier@gmail.com>
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 <benjamin.poirier@gmail.com>
Cc: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
---
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
next prev parent reply other threads:[~2011-04-20 23:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-20 23:39 [Qemu-devel] [PATCH 1/3] rtl8139: use TARGET_FMT_plx in debug messages Benjamin Poirier
2011-04-20 23:39 ` [Qemu-devel] [PATCH 2/3] rtl8139: use variadic macro for debug statements Benjamin Poirier
2011-04-20 23:39 ` Benjamin Poirier [this message]
2011-04-21 11:16 ` [Qemu-devel] [PATCH 1/3] rtl8139: use TARGET_FMT_plx in debug messages Stefan Hajnoczi
2011-04-25 20:49 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1303342742-16388-3-git-send-email-benjamin.poirier@gmail.com \
--to=benjamin.poirier@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).