From: Jan Beulich Date: Thu, 26 Mar 2015 10:11:13 +0000 (+0100) Subject: make {,g}dprintk() a no-op in non-debug builds X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3525 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=28fbff96c1db99b3e48755049d577e9274dd9791;p=xen.git make {,g}dprintk() a no-op in non-debug builds As discussed before, code absolutely wanting to get something into the log should use {,g}printk() instead. Signed-off-by: Jan Beulich Acked-by: Ian Campbell Reviewed-by: Andrew Cooper --- diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h index d3d99114c7..6478a0aafc 100644 --- a/xen/include/xen/config.h +++ b/xen/include/xen/config.h @@ -72,16 +72,6 @@ #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__) diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 8d519aaa8b..4258912ed9 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -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__