From: Mathieu Desnoyers Date: Fri, 26 Aug 2011 17:23:59 +0000 (-0400) Subject: tracepoint.h: move code after used prototype declaration X-Git-Tag: v1.9.1~234 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6cdf29f8cd289d763fae461c618975fe43095e8b;p=lttng-ust.git tracepoint.h: move code after used prototype declaration Signed-off-by: Mathieu Desnoyers --- diff --git a/include/ust/tracepoint.h b/include/ust/tracepoint.h index 76645dd6..d793e58c 100644 --- a/include/ust/tracepoint.h +++ b/include/ust/tracepoint.h @@ -45,37 +45,6 @@ struct tracepoint { */ #define tracepoint(name, args...) __trace_##name(args) -/* - * These weak symbols, the constructor, and destructor take care of - * registering only _one_ instance of the tracepoints per shared-ojbect - * (or for the whole main program). - * The dummy tracepoint entry ensures that the start/stop pointers get - * initialized by the linker when no tracepoints are present in a - * shared-object (or main program). - */ -extern struct tracepoint * const __start___tracepoints_ptrs[] - __attribute__((weak, visibility("hidden"))); -extern struct tracepoint * const __stop___tracepoints_ptrs[] - __attribute__((weak, visibility("hidden"))); -int __tracepoint_registered - __attribute__((weak, visibility("hidden"))); - -static void __attribute__((constructor)) __tracepoints__init(void) -{ - if (__tracepoint_registered++) - return; - tracepoint_register_lib(__start___tracepoints_ptrs, - __stop___tracepoints_ptrs - - __start___tracepoints_ptrs); -} - -static void __attribute__((destructor)) __tracepoints__destroy(void) -{ - if (--__tracepoint_registered) - return; - tracepoint_unregister_lib(__start___tracepoints_ptrs); -} - /* * it_func[0] is never NULL because there is at least one element in the array * when the array itself is non NULL. @@ -197,6 +166,36 @@ int tracepoint_register_lib(struct tracepoint * const *tracepoints_start, extern int tracepoint_unregister_lib(struct tracepoint * const *tracepoints_start); +/* + * These weak symbols, the constructor, and destructor take care of + * registering only _one_ instance of the tracepoints per shared-ojbect + * (or for the whole main program). + * The dummy tracepoint entry ensures that the start/stop pointers get + * initialized by the linker when no tracepoints are present in a + * shared-object (or main program). + */ +extern struct tracepoint * const __start___tracepoints_ptrs[] + __attribute__((weak, visibility("hidden"))); +extern struct tracepoint * const __stop___tracepoints_ptrs[] + __attribute__((weak, visibility("hidden"))); +int __tracepoint_registered + __attribute__((weak, visibility("hidden"))); + +static void __attribute__((constructor)) __tracepoints__init(void) +{ + if (__tracepoint_registered++) + return; + tracepoint_register_lib(__start___tracepoints_ptrs, + __stop___tracepoints_ptrs - + __start___tracepoints_ptrs); +} + +static void __attribute__((destructor)) __tracepoints__destroy(void) +{ + if (--__tracepoint_registered) + return; + tracepoint_unregister_lib(__start___tracepoints_ptrs); +} #ifndef TRACEPOINT_EVENT /*