From: "Jan Beulich" Subject: =?utf-8?b?W1BBVENIIDIvMl0gbWFrZSB7LGd9ZHByaW50aygp?= =?utf-8?q?_a_no=E2=80=91op_in_non=E2=80=91debug_builds?= Date: Fri, 20 Mar 2015 15:13:11 +0000 Message-ID: <550C4717020000780006C1C5@mail.emea.novell.com> References: <550C44F1020000780006C1A5@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part1F2B4B17.1__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YYybn-0005HX-KW for xen-devel@lists.xenproject.org; Fri, 20 Mar 2015 15:13:11 +0000 In-Reply-To: <550C44F1020000780006C1A5@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Ian Campbell , Keir Fraser , Ian Jackson , Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part1F2B4B17.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline As discussed before, code absolutely wanting to get something into the log should use {,g}printk() instead. Signed-off-by: Jan Beulich --- 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) =20 -#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__) =20 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -87,6 +87,26 @@ extern int printk_ratelimit(void); #define gprintk(lvl, fmt, args...) \ printk(XENLOG_GUEST lvl "%pv " fmt, current, ## args) =20 +#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__ --=__Part1F2B4B17.1__= Content-Type: text/plain; name="dprintk.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="dprintk.patch" make {,g}dprintk() a no-op in non-debug builds=0A=0AAs discussed before, = code absolutely wanting to get something into the=0Alog should use = {,g}printk() instead.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/include/xen/config.h=0A+++ b/xen/include/xen/config.h=0A@@ = -72,16 +72,6 @@=0A #define MB(_mb) (_AC(_mb, UL) << 20)=0A #define = GB(_gb) (_AC(_gb, UL) << 30)=0A =0A-#ifndef __ASSEMBLY__=0A-=0A-#define= dprintk(_l, _f, _a...) \=0A- printk(_l = "%s:%d: " _f, __FILE__ , __LINE__ , ## _a )=0A-#define gdprintk(_l, _f, = _a...) \=0A- printk(XENLOG_GUEST _l = "%s:%d:%pv " _f, __FILE__, \=0A- __LINE__, current, ## _a = )=0A-=0A-#endif /* !__ASSEMBLY__ */=0A-=0A #define __STR(...) #__VA_ARGS__= =0A #define STR(...) __STR(__VA_ARGS__)=0A =0A--- a/xen/include/xen/lib.h= =0A+++ b/xen/include/xen/lib.h=0A@@ -87,6 +87,26 @@ extern int printk_ratel= imit(void);=0A #define gprintk(lvl, fmt, args...) \=0A printk(XENLOG_GU= EST lvl "%pv " fmt, current, ## args)=0A =0A+#ifdef NDEBUG=0A+=0A+static = inline void=0A+__attribute__ ((__format__ (__printf__, 2, 3)))=0A+dprintk(c= onst char *lvl, const char *fmt, ...) {}=0A+=0A+static inline void=0A+__att= ribute__ ((__format__ (__printf__, 2, 3)))=0A+gdprintk(const char *lvl, = const char *fmt, ...) {}=0A+=0A+#else=0A+=0A+#define dprintk(lvl, fmt, = args...) \=0A+ printk(lvl "%s:%d: " fmt, __FILE__, __LINE__, ## = args)=0A+#define gdprintk(lvl, fmt, args...) \=0A+ printk(XENLOG_GUEST = lvl "%s:%d:%pv " fmt, \=0A+ __FILE__, __LINE__, current, ## = args)=0A+=0A+#endif=0A+=0A /* vsprintf.c */=0A #define sprintf __xen_has_no= _sprintf__=0A #define vsprintf __xen_has_no_vsprintf__=0A --=__Part1F2B4B17.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part1F2B4B17.1__=--