]> git.proxmox.com Git - mirror_qemu.git/commitdiff
rtl8139: add format attribute to DPRINTF
authorBenjamin Poirier <benjamin.poirier@gmail.com>
Wed, 20 Apr 2011 23:39:02 +0000 (19:39 -0400)
committerAurelien Jarno <aurelien@aurel32.net>
Mon, 25 Apr 2011 20:17:56 +0000 (22:17 +0200)
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>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
hw/rtl8139.c

index 13b14e4e106b69ec98461fdd03388bed07731f3b..cbf667a301241909855eac0904b54b2918007d6e 100644 (file)
 #  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);