From 465a0d0493a126c09d0bf469369b8410d4bf73a9 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 30 Mar 2021 15:29:42 -0400 Subject: [PATCH] cleanup: function attribute 'constructor' Function attributes should be located after the declaration. Change-Id: Ie3ef444bf150824b3a57e8485417f019cecc61be Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- include/lttng/tracepoint.h | 10 ++++++---- include/lttng/ust-libc-wrapper.h | 3 ++- include/lttng/ust-tracepoint-event.h | 5 +++-- liblttng-ust-ctl/ustctl.c | 5 ++++- liblttng-ust-dl/lttng-ust-dl.c | 5 ++++- liblttng-ust-libc-wrapper/lttng-ust-malloc.c | 1 - liblttng-ust/lttng-ust-comm.c | 6 +++++- liblttng-ust/lttng-ust-urcu.c | 3 ++- 8 files changed, 26 insertions(+), 12 deletions(-) diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 02d2cf13..d4733e05 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -346,8 +346,9 @@ __tracepoint__init_urcu_sym(void) } #endif -static void lttng_ust_notrace __attribute__((constructor)) -__tracepoints__init(void); +static void +__tracepoints__init(void) + lttng_ust_notrace __attribute__((constructor)); static void __tracepoints__init(void) { @@ -459,8 +460,9 @@ extern struct lttng_ust_tracepoint * const __stop___tracepoints_ptrs[] __lttng_ust_variable_attribute_no_sanitize_address = \ &__tracepoint_##_provider##___##_name; -static void lttng_ust_notrace __attribute__((constructor)) -__tracepoints__ptrs_init(void); +static void +__tracepoints__ptrs_init(void) + lttng_ust_notrace __attribute__((constructor)); static void __tracepoints__ptrs_init(void) { diff --git a/include/lttng/ust-libc-wrapper.h b/include/lttng/ust-libc-wrapper.h index 685ebfbd..2eaf5dc6 100644 --- a/include/lttng/ust-libc-wrapper.h +++ b/include/lttng/ust-libc-wrapper.h @@ -20,6 +20,7 @@ * function in liblttng-ust that is overridden by the one in * liblttng-ust-wrapper-libc when it's preloaded. */ -void lttng_ust_libc_wrapper_malloc_init(void); +void lttng_ust_libc_wrapper_malloc_init(void) + __attribute__((constructor)); #endif diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index a5026733..f4d3d285 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -1061,8 +1061,9 @@ static int _TP_COMBINE_TOKENS(__probe_register_refcount___, TRACEPOINT_PROVIDER) /* Reset all macros within TRACEPOINT_EVENT */ #include -static void lttng_ust_notrace __attribute__((constructor)) -_TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void); +static void +_TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) + lttng_ust_notrace __attribute__((constructor)); static void _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) { diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 9acce7a9..ecfed8c7 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -2900,7 +2900,10 @@ int ustctl_counter_clear(struct ustctl_daemon_counter *counter, return counter->ops->counter_clear(counter->counter, dimension_indexes); } -static __attribute__((constructor)) +static +void ustctl_init(void) + __attribute__((constructor)); +static void ustctl_init(void) { ust_err_init(); diff --git a/liblttng-ust-dl/lttng-ust-dl.c b/liblttng-ust-dl/lttng-ust-dl.c index 657c27cc..1394ce19 100644 --- a/liblttng-ust-dl/lttng-ust-dl.c +++ b/liblttng-ust-dl/lttng-ust-dl.c @@ -34,7 +34,10 @@ static void *(*__lttng_ust_plibc_dlmopen)(Lmid_t nsid, const char *filename, #endif static int (*__lttng_ust_plibc_dlclose)(void *handle); -static __attribute__((constructor)) +static +void _lttng_ust_dl_init(void) + __attribute__((constructor)); +static void _lttng_ust_dl_init(void) { ust_err_init(); diff --git a/liblttng-ust-libc-wrapper/lttng-ust-malloc.c b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c index e4f9c356..f8c7aa8b 100644 --- a/liblttng-ust-libc-wrapper/lttng-ust-malloc.c +++ b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c @@ -420,7 +420,6 @@ void lttng_ust_fixup_malloc_nesting_tls(void) asm volatile ("" : : "m" (URCU_TLS(malloc_nesting))); } -__attribute__((constructor)) void lttng_ust_libc_wrapper_malloc_init(void) { /* Initialization already done */ diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 7e587499..69ccd99d 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -2067,7 +2067,11 @@ void lttng_ust_libc_wrapper_malloc_init(void) * sessiond monitoring thread: monitor presence of global and per-user * sessiond by polling the application common named pipe. */ -void __attribute__((constructor)) lttng_ust_init(void) +static +void lttng_ust_init(void) + __attribute__((constructor)); +static +void lttng_ust_init(void) { struct timespec constructor_timeout; sigset_t sig_all_blocked, orig_parent_mask; diff --git a/liblttng-ust/lttng-ust-urcu.c b/liblttng-ust/lttng-ust-urcu.c index 5103aa8f..4381fd1c 100644 --- a/liblttng-ust/lttng-ust-urcu.c +++ b/liblttng-ust/lttng-ust-urcu.c @@ -93,7 +93,8 @@ enum membarrier_cmd { }; static -void __attribute__((constructor)) _lttng_ust_urcu_init(void); +void _lttng_ust_urcu_init(void) + __attribute__((constructor)); static void __attribute__((destructor)) lttng_ust_urcu_exit(void); -- 2.34.1