]> xenbits.xensource.com Git - people/pauldu/xen.git/commitdiff
make {,g}dprintk() a no-op in non-debug builds
authorJan Beulich <jbeulich@suse.com>
Thu, 26 Mar 2015 10:11:13 +0000 (11:11 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 26 Mar 2015 10:11:13 +0000 (11:11 +0100)
As discussed before, code absolutely wanting to get something into the
log should use {,g}printk() instead.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/include/xen/config.h
xen/include/xen/lib.h

index d3d99114c78c2b85d9792b42aab3a48fb1c40c7b..6478a0aafc166958d701b6ce8bdd2cbde2a5cb6b 100644 (file)
 #define MB(_mb)     (_AC(_mb, UL) << 20)
 #define GB(_gb)     (_AC(_gb, UL) << 30)
 
-#ifndef __ASSEMBLY__
-
-#define dprintk(_l, _f, _a...)                              \
-    printk(_l "%s:%d: " _f, __FILE__ , __LINE__ , ## _a )
-#define gdprintk(_l, _f, _a...)                             \
-    printk(XENLOG_GUEST _l "%s:%d:%pv " _f, __FILE__,       \
-           __LINE__, current, ## _a )
-
-#endif /* !__ASSEMBLY__ */
-
 #define __STR(...) #__VA_ARGS__
 #define STR(...) __STR(__VA_ARGS__)
 
index 8d519aaa8bb6436e9493ae0fb110b694102013f0..4258912ed9f4649b758989b782b117a081f9655a 100644 (file)
@@ -88,6 +88,26 @@ extern int printk_ratelimit(void);
 #define gprintk(lvl, fmt, args...) \
     printk(XENLOG_GUEST lvl "%pv " fmt, current, ## args)
 
+#ifdef NDEBUG
+
+static inline void
+__attribute__ ((__format__ (__printf__, 2, 3)))
+dprintk(const char *lvl, const char *fmt, ...) {}
+
+static inline void
+__attribute__ ((__format__ (__printf__, 2, 3)))
+gdprintk(const char *lvl, const char *fmt, ...) {}
+
+#else
+
+#define dprintk(lvl, fmt, args...) \
+    printk(lvl "%s:%d: " fmt, __FILE__, __LINE__, ## args)
+#define gdprintk(lvl, fmt, args...) \
+    printk(XENLOG_GUEST lvl "%s:%d:%pv " fmt, \
+           __FILE__, __LINE__, current, ## args)
+
+#endif
+
 /* vsprintf.c */
 #define sprintf __xen_has_no_sprintf__
 #define vsprintf __xen_has_no_vsprintf__