From: Michael Jeanson Date: Tue, 30 Mar 2021 19:10:57 +0000 (-0400) Subject: cleanup: function attribute 'format' X-Git-Tag: v2.13.0-rc1~171 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4199ddc7eb37386241633a0dd65a5305ec97cb15;p=lttng-ust.git cleanup: function attribute 'format' Function attributes should be located after the declaration. Change-Id: I1c1622b3102f4a9d2fc5df35b5dfc290abac48aa Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/doc/examples/demo-tracef/demo-vtracef.c b/doc/examples/demo-tracef/demo-vtracef.c index dc094ce4..8fe8bb36 100644 --- a/doc/examples/demo-tracef/demo-vtracef.c +++ b/doc/examples/demo-tracef/demo-vtracef.c @@ -11,7 +11,10 @@ #include -__attribute__((format(printf, 1, 2))) +static +void print_debug(const char* msg, ...) + __attribute__((format(printf, 1, 2))); +static void print_debug(const char* msg, ...) { va_list ap; diff --git a/doc/examples/demo-tracelog/demo-vtracelog.c b/doc/examples/demo-tracelog/demo-vtracelog.c index eed8677c..c396a300 100644 --- a/doc/examples/demo-tracelog/demo-vtracelog.c +++ b/doc/examples/demo-tracelog/demo-vtracelog.c @@ -11,7 +11,10 @@ #include -__attribute__((format(printf, 1, 2))) +static +void print_err(const char* msg, ...) + __attribute__((format(printf, 1, 2))); +static void print_err(const char* msg, ...) { va_list ap; diff --git a/include/lttng/tracef.h b/include/lttng/tracef.h index 2b57ca8c..1b455063 100644 --- a/include/lttng/tracef.h +++ b/include/lttng/tracef.h @@ -14,12 +14,12 @@ extern "C" { #endif extern -__attribute__((format(printf, 1, 2))) -void _lttng_ust_tracef(const char *fmt, ...); +void _lttng_ust_tracef(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); extern -__attribute__((format(printf, 1, 0))) -void _lttng_ust_vtracef(const char *fmt, va_list ap); +void _lttng_ust_vtracef(const char *fmt, va_list ap) + __attribute__((format(printf, 1, 0))); #define tracef(fmt, ...) \ do { \ diff --git a/include/lttng/tracelog.h b/include/lttng/tracelog.h index e80f2381..336911f4 100644 --- a/include/lttng/tracelog.h +++ b/include/lttng/tracelog.h @@ -14,12 +14,14 @@ extern "C" { #endif #define TP_TRACELOG_CB_TEMPLATE(level) \ - __attribute__ ((format(printf, 4, 5))) \ extern void _lttng_ust_tracelog_##level(const char *file, \ - int line, const char *func, const char *fmt, ...); \ - __attribute__ ((format(printf, 4, 0))) \ + int line, const char *func, const char *fmt, ...) \ + __attribute__ ((format(printf, 4, 5))); \ + \ extern void _lttng_ust_vtracelog_##level(const char *file, \ - int line, const char *func, const char *fmt, va_list ap); + int line, const char *func, const char *fmt, \ + va_list ap) \ + __attribute__ ((format(printf, 4, 0))); TP_TRACELOG_CB_TEMPLATE(TRACE_EMERG); TP_TRACELOG_CB_TEMPLATE(TRACE_ALERT); diff --git a/liblttng-ust/tracef.c b/liblttng-ust/tracef.c index 0ce6d11f..f9f8274d 100644 --- a/liblttng-ust/tracef.c +++ b/liblttng-ust/tracef.c @@ -12,7 +12,10 @@ #define TRACEPOINT_DEFINE #include "lttng-ust-tracef-provider.h" -static inline __attribute__((always_inline, format(printf, 1, 0))) +static inline +void __lttng_ust_vtracef(const char *fmt, va_list ap) + __attribute__((always_inline, format(printf, 1, 0))); +static inline void __lttng_ust_vtracef(const char *fmt, va_list ap) { char *msg; @@ -28,15 +31,15 @@ end: return; } -__attribute__((format(printf, 1, 0))) -void _lttng_ust_vtracef(const char *fmt, va_list ap); +void _lttng_ust_vtracef(const char *fmt, va_list ap) + __attribute__((format(printf, 1, 0))); void _lttng_ust_vtracef(const char *fmt, va_list ap) { __lttng_ust_vtracef(fmt, ap); } -__attribute__((format(printf, 1, 2))) -void _lttng_ust_tracef(const char *fmt, ...); +void _lttng_ust_tracef(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); void _lttng_ust_tracef(const char *fmt, ...) { va_list ap; diff --git a/liblttng-ust/tracelog.c b/liblttng-ust/tracelog.c index 1f18853f..307e0fce 100644 --- a/liblttng-ust/tracelog.c +++ b/liblttng-ust/tracelog.c @@ -13,7 +13,13 @@ #include "lttng-ust-tracelog-provider.h" #define TRACELOG_CB(level) \ - static inline __attribute__((always_inline, format(printf, 4, 0))) \ + static inline \ + void __lttng_ust_vtracelog_##level(const char *file, \ + int line, const char *func, \ + const char *fmt, va_list ap) \ + __attribute__((always_inline, format(printf, 4, 0))); \ + \ + static inline \ void __lttng_ust_vtracelog_##level(const char *file, \ int line, const char *func, \ const char *fmt, va_list ap) \ @@ -32,7 +38,11 @@ return; \ } \ \ - __attribute__ ((format(printf, 4, 0))) \ + void _lttng_ust_vtracelog_##level(const char *file, \ + int line, const char *func, \ + const char *fmt, va_list ap) \ + __attribute__ ((format(printf, 4, 0))); \ + \ void _lttng_ust_vtracelog_##level(const char *file, \ int line, const char *func, \ const char *fmt, va_list ap) \ @@ -40,7 +50,11 @@ __lttng_ust_vtracelog_##level(file, line, func, fmt, ap); \ } \ \ - __attribute__ ((format(printf, 4, 5))) \ + void _lttng_ust_tracelog_##level(const char *file, \ + int line, const char *func, \ + const char *fmt, ...) \ + __attribute__ ((format(printf, 4, 5))); \ + \ void _lttng_ust_tracelog_##level(const char *file, \ int line, const char *func, \ const char *fmt, ...) \