From: Michael Jeanson Date: Tue, 20 Apr 2021 15:13:42 +0000 (-0400) Subject: Tracepoint API namespacing '_TP_COMBINE_TOKENS' X-Git-Tag: v2.13.0-rc1~69 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=aec5037bcf606e1649e3b3ff2a6374e8434a3e2b;p=lttng-ust.git Tracepoint API namespacing '_TP_COMBINE_TOKENS' The ABI bump gives us the opportunity to namespace all public symbols under the 'lttng_ust_' prefix. Namespace all API symbols and macros under 'lttng_ust_' / 'LTTNG_UST_' and add compat macros to keep compatibility with the previous API. Change-Id: Ife2aa364f3a5f60b248b93a00854694eb351b8c8 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 199c8d43..dd6a84c2 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -71,18 +71,18 @@ extern "C" { * fine too). * Each tuple is also separated by a comma. */ -#define __TP_COMBINE_TOKENS(_tokena, _tokenb) \ +#define LTTNG_UST___TP_COMBINE_TOKENS(_tokena, _tokenb) \ _tokena##_tokenb -#define _TP_COMBINE_TOKENS(_tokena, _tokenb) \ - __TP_COMBINE_TOKENS(_tokena, _tokenb) -#define __TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \ +#define LTTNG_UST__TP_COMBINE_TOKENS(_tokena, _tokenb) \ + LTTNG_UST___TP_COMBINE_TOKENS(_tokena, _tokenb) +#define LTTNG_UST___TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \ _tokena##_tokenb##_tokenc -#define _TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \ - __TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) -#define __TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \ +#define LTTNG_UST__TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \ + LTTNG_UST___TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) +#define LTTNG_UST___TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \ _tokena##_tokenb##_tokenc##_tokend -#define _TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \ - __TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) +#define LTTNG_UST__TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \ + LTTNG_UST___TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) /* * _TP_EXVAR* extract the var names. @@ -147,10 +147,10 @@ extern "C" { /* Preprocessor trick to count arguments. Inspired from sdt.h. */ #define _TP_NARGS(...) __TP_NARGS(__VA_ARGS__, 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) #define __TP_NARGS(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, N, ...) N -#define _TP_PROTO_N(N, ...) _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXPROTO, N)(__VA_ARGS__)) -#define _TP_VAR_N(N, ...) _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXVAR, N)(__VA_ARGS__)) -#define _TP_DATA_PROTO_N(N, ...) _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXDATA_PROTO, N)(__VA_ARGS__)) -#define _TP_DATA_VAR_N(N, ...) _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXDATA_VAR, N)(__VA_ARGS__)) +#define _TP_PROTO_N(N, ...) _TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(_TP_EXPROTO, N)(__VA_ARGS__)) +#define _TP_VAR_N(N, ...) _TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(_TP_EXVAR, N)(__VA_ARGS__)) +#define _TP_DATA_PROTO_N(N, ...) _TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(_TP_EXDATA_PROTO, N)(__VA_ARGS__)) +#define _TP_DATA_VAR_N(N, ...) _TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(_TP_EXDATA_VAR, N)(__VA_ARGS__)) #define _TP_ARGS_PROTO(...) _TP_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) #define _TP_ARGS_VAR(...) _TP_VAR_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) #define _TP_ARGS_DATA_PROTO(...) _TP_DATA_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 7a7c0799..e844891f 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -73,10 +73,10 @@ #include static inline -void _TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_mismatch_, TRACEPOINT_PROVIDER)(void) +void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_mismatch_, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; static inline -void _TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_mismatch_, TRACEPOINT_PROVIDER)(void) +void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_mismatch_, TRACEPOINT_PROVIDER)(void) { } @@ -89,10 +89,10 @@ void _TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_mismatch_, TRACEPOINT_PROV lttng_ust_tracepoint_provider_mismatch_##_provider(); static inline -void _TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void) +void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; static inline -void _TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void) +void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void) { #include TRACEPOINT_INCLUDE } @@ -1022,7 +1022,7 @@ LTTNG_UST_TP_EXTERN_C const char * const _model_emf_uri___##__provider##___##__n * symbol table. */ -extern const struct lttng_ust_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER) +extern const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER) __attribute__((visibility("hidden"))); /* @@ -1077,7 +1077,7 @@ static const struct lttng_ust_event_desc __event_desc___##_provider##_##_name = #define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ &__event_desc___##_provider##_##_name, -static const struct lttng_ust_event_desc * const _TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = { +static const struct lttng_ust_event_desc * const LTTNG_UST__TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = { #include TRACEPOINT_INCLUDE NULL, /* Dummy, C99 forbids 0-len array. */ }; @@ -1089,17 +1089,17 @@ static const struct lttng_ust_event_desc * const _TP_COMBINE_TOKENS(__event_desc * Create a toplevel descriptor for the whole probe. */ -const struct lttng_ust_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER) = { +const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER) = { .struct_size = sizeof(struct lttng_ust_probe_desc), .provider_name = __tp_stringify(TRACEPOINT_PROVIDER), - .event_desc = _TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER), - .nr_events = _TP_ARRAY_SIZE(_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)) - 1, + .event_desc = LTTNG_UST__TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER), + .nr_events = _TP_ARRAY_SIZE(LTTNG_UST__TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)) - 1, .major = LTTNG_UST_PROVIDER_MAJOR, .minor = LTTNG_UST_PROVIDER_MINOR, }; -static int _TP_COMBINE_TOKENS(__probe_register_refcount___, TRACEPOINT_PROVIDER); -static struct lttng_ust_registered_probe *_TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER); +static int LTTNG_UST__TP_COMBINE_TOKENS(__probe_register_refcount___, TRACEPOINT_PROVIDER); +static struct lttng_ust_registered_probe *LTTNG_UST__TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER); /* * Stage 9 of tracepoint event generation. @@ -1115,14 +1115,14 @@ static struct lttng_ust_registered_probe *_TP_COMBINE_TOKENS(__lttng_ust_probe_r /* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */ #include static void -_TP_COMBINE_TOKENS(__lttng_ust_events_init__, TRACEPOINT_PROVIDER)(void) +LTTNG_UST__TP_COMBINE_TOKENS(__lttng_ust_events_init__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace __attribute__((constructor)); static void -_TP_COMBINE_TOKENS(__lttng_ust_events_init__, TRACEPOINT_PROVIDER)(void) +LTTNG_UST__TP_COMBINE_TOKENS(__lttng_ust_events_init__, TRACEPOINT_PROVIDER)(void) { struct lttng_ust_registered_probe *reg_probe; - if (_TP_COMBINE_TOKENS(__probe_register_refcount___, + if (LTTNG_UST__TP_COMBINE_TOKENS(__probe_register_refcount___, TRACEPOINT_PROVIDER)++) { return; } @@ -1134,29 +1134,29 @@ _TP_COMBINE_TOKENS(__lttng_ust_events_init__, TRACEPOINT_PROVIDER)(void) * runtime effect. However, if it detects an error, a linker * error will appear. */ - _TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, TRACEPOINT_PROVIDER)(); - assert(!_TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER)); - reg_probe = lttng_ust_probe_register(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER)); + LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, TRACEPOINT_PROVIDER)(); + assert(!LTTNG_UST__TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER)); + reg_probe = lttng_ust_probe_register(<TNG_UST__TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER)); if (!reg_probe) { fprintf(stderr, "LTTng-UST: Error while registering tracepoint probe.\n"); abort(); } - _TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER) = reg_probe; + LTTNG_UST__TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER) = reg_probe; } static void -_TP_COMBINE_TOKENS(__lttng_ust_events_exit__, TRACEPOINT_PROVIDER)(void) +LTTNG_UST__TP_COMBINE_TOKENS(__lttng_ust_events_exit__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace __attribute__((destructor)); static void -_TP_COMBINE_TOKENS(__lttng_ust_events_exit__, TRACEPOINT_PROVIDER)(void) +LTTNG_UST__TP_COMBINE_TOKENS(__lttng_ust_events_exit__, TRACEPOINT_PROVIDER)(void) { - if (--_TP_COMBINE_TOKENS(__probe_register_refcount___, + if (--LTTNG_UST__TP_COMBINE_TOKENS(__probe_register_refcount___, TRACEPOINT_PROVIDER)) { return; } - lttng_ust_probe_unregister(_TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER)); - _TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER) = NULL; + lttng_ust_probe_unregister(LTTNG_UST__TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER)); + LTTNG_UST__TP_COMBINE_TOKENS(__lttng_ust_probe_register_cookie___, TRACEPOINT_PROVIDER) = NULL; } -int _TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_, TRACEPOINT_PROVIDER) +int LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_, TRACEPOINT_PROVIDER) __attribute__((visibility("default")));