netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] socket: SOCK_DEBUG type checking
@ 2008-03-21 14:51 Stephen Hemminger
  2008-03-21 22:56 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2008-03-21 14:51 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Use the inline trick (same as pr_debug) to get checking
of debug statements even if no code is generated.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/include/net/sock.h	2008-03-20 20:25:04.000000000 -0700
+++ b/include/net/sock.h	2008-03-20 20:28:48.000000000 -0700
@@ -70,7 +70,11 @@
 #define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \
 					printk(KERN_DEBUG msg); } while (0)
 #else
-#define SOCK_DEBUG(sk, msg...) do { } while (0)
+/* Validate arguments and do nothing */
+static void inline int __attribute__ ((format (printf, 2, 3)))
+SOCK_DEBUG(struct sock *sk, const char *msg, ...)
+{
+}
 #endif
 
 /* This is the per-socket lock.  The spinlock provides a synchronization

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-22  0:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-21 14:51 [PATCH] socket: SOCK_DEBUG type checking Stephen Hemminger
2008-03-21 22:56 ` David Miller
2008-03-22  0:17   ` Stephen Hemminger

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).