On 21/11/2012 15:13, Andreas Färber wrote:
Am 21.11.2012 15:05, schrieb KONRAD Frédéric:
On 21/11/2012 14:04, Andreas Färber wrote:
Am 16.11.2012 16:35, schrieb fred.kon...@greensocs.com:
+#define DEBUG_VIRTIO_BUS
+
+#ifdef DEBUG_VIRTIO_BUS
+
+#define DPRINTF(fmt, ...) \
+do { printf("virtio_bus: " fmt , ## __VA_ARGS__); } while (0)
+#else
+#define DPRINTF(fmt, ...) do {} while (0)
+#endif
We recently had a discussion about bitrotting DPRINTF() statements where
I suggested to use if (0) instead of a no-op macro like this that
doesn't reference fmt and the varargs.
I don't understand what you suggested, can you point me to an example ?
I don't have a link at hand, maybe Evgeny does. It was along the lines of:

#define DEBUG_VIRTIO_BUS 0

#define DPRINTF(fmt, ...) if (DEBUG_VIRTIO_BUS) { \
         printf("virtio_bus: " fmt , ## __VA_ARGS__); \
     }

The officially preferred alternative is to use tracepoints. ;)

Cheers,
Andreas

ok, thanks.

Fred

Reply via email to