Message ID | 1472757707-11885-2-git-send-email-andrew.cooper3@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
>>> On 01.09.16 at 21:21, <andrew.cooper3@citrix.com> wrote: > --- a/xen/include/xen/lib.h > +++ b/xen/include/xen/lib.h > @@ -68,8 +68,10 @@ extern void debugtrace_dump(void); > extern void debugtrace_printk(const char *fmt, ...) > __attribute__ ((format (printf, 1, 2))); > #else > -#define debugtrace_dump() ((void)0) > -#define debugtrace_printk(_f, ...) ((void)0) > +static inline void debugtrace_dump(void) {}; > +static inline void > + __attribute__ ((format (printf, 1, 2))) > +debugtrace_printk(const char *fmt, ...) {}; > #endif With the stray semicolons dropped, and provided this (at least a little surprisingly) doesn't cause any other fallout with DEBUG_TRACE_DUMP defined, Acked-by: Jan Beulich <jbeulich@suse.com> Jan
On 02/09/16 08:57, Jan Beulich wrote: >>>> On 01.09.16 at 21:21, <andrew.cooper3@citrix.com> wrote: >> --- a/xen/include/xen/lib.h >> +++ b/xen/include/xen/lib.h >> @@ -68,8 +68,10 @@ extern void debugtrace_dump(void); >> extern void debugtrace_printk(const char *fmt, ...) >> __attribute__ ((format (printf, 1, 2))); >> #else >> -#define debugtrace_dump() ((void)0) >> -#define debugtrace_printk(_f, ...) ((void)0) >> +static inline void debugtrace_dump(void) {}; >> +static inline void >> + __attribute__ ((format (printf, 1, 2))) >> +debugtrace_printk(const char *fmt, ...) {}; >> #endif > With the stray semicolons dropped Oh yes of course. > and provided this (at least a little surprisingly) doesn't cause any other fallout with > DEBUG_TRACE_DUMP defined, I don't know what you mean by this. We strictly only change the non-defined case, and that compiles fine on all architectures. ~Andrew > Acked-by: Jan Beulich <jbeulich@suse.com> > > Jan > > >
>>> On 02.09.16 at 12:00, <andrew.cooper3@citrix.com> wrote: > On 02/09/16 08:57, Jan Beulich wrote: >>>>> On 01.09.16 at 21:21, <andrew.cooper3@citrix.com> wrote: >>> --- a/xen/include/xen/lib.h >>> +++ b/xen/include/xen/lib.h >>> @@ -68,8 +68,10 @@ extern void debugtrace_dump(void); >>> extern void debugtrace_printk(const char *fmt, ...) >>> __attribute__ ((format (printf, 1, 2))); >>> #else >>> -#define debugtrace_dump() ((void)0) >>> -#define debugtrace_printk(_f, ...) ((void)0) >>> +static inline void debugtrace_dump(void) {}; >>> +static inline void >>> + __attribute__ ((format (printf, 1, 2))) >>> +debugtrace_printk(const char *fmt, ...) {}; >>> #endif >> With the stray semicolons dropped > > Oh yes of course. > >> and provided this (at least a little surprisingly) doesn't cause any other fallout with >> DEBUG_TRACE_DUMP defined, > > I don't know what you mean by this. We strictly only change the > non-defined case, Oh, sorry. > and that compiles fine on all architectures. Good. Jan
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index d04864e..0008d63 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -68,8 +68,10 @@ extern void debugtrace_dump(void); extern void debugtrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); #else -#define debugtrace_dump() ((void)0) -#define debugtrace_printk(_f, ...) ((void)0) +static inline void debugtrace_dump(void) {}; +static inline void + __attribute__ ((format (printf, 1, 2))) +debugtrace_printk(const char *fmt, ...) {}; #endif /* Allows us to use '%p' as general-purpose machine-word format char. */
This allows printf format checking to be performed, and for debugtrace_printk() to evaluate its arguments, even if debugtrace is disabled at compile time. No intended change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- CC: Jan Beulich <JBeulich@suse.com> CC: Tim Deegan <tim@xen.org> CC: George Dunlap <george.dunlap@eu.citrix.com> --- xen/include/xen/lib.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)