From: Michael Jeanson Date: Wed, 21 Apr 2021 19:11:16 +0000 (-0400) Subject: Tracepoint API namespacing 'TP_ENUM_VALUES' X-Git-Tag: v2.13.0-rc1~52 X-Git-Url: https://git.lttng.org/?p=lttng-ust.git;a=commitdiff_plain;h=4849bc7a9e250ce47d7a3deb0d2327cc4b50422f Tracepoint API namespacing 'TP_ENUM_VALUES' 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: I4f8755f8eddfb2c76dce18fe6193489dbe36aa7f Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index b637b853..268271c4 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -609,7 +609,7 @@ lttng_ust__tracepoints__ptrs_destroy(void) * An example: * * LTTNG_UST_TRACEPOINT_ENUM(someproject_component, enumname, - * TP_ENUM_VALUES( + * LTTNG_UST_TP_ENUM_VALUES( * ctf_enum_value("even", 0) * ctf_enum_value("uneven", 1) * ctf_enum_range("twoto4", 2, 4) @@ -619,7 +619,7 @@ lttng_ust__tracepoints__ptrs_destroy(void) * * Where "someproject_component" is the name of the component this enumeration * belongs to and "enumname" identifies this enumeration. Inside the - * TP_ENUM_VALUES macro is the actual mapping. Each string value can map + * LTTNG_UST_TP_ENUM_VALUES macro is the actual mapping. Each string value can map * to either a single value with ctf_enum_value or a range of values * with ctf_enum_range. * diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 6aa905ba..8ba095bd 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #define __LTTNG_UST_NULL_STRING "(null)" @@ -197,10 +198,15 @@ void __event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PR .options = LTTNG_UST_ENUM_ENTRY_OPTION_IS_AUTO, \ }), -#undef TP_ENUM_VALUES -#define TP_ENUM_VALUES(...) \ +#undef LTTNG_UST_TP_ENUM_VALUES +#define LTTNG_UST_TP_ENUM_VALUES(...) \ __VA_ARGS__ +#if LTTNG_UST_COMPAT_API(0) +# undef TP_ENUM_VALUES +# define TP_ENUM_VALUES LTTNG_UST_TP_ENUM_VALUES +#endif /* #if LTTNG_UST_COMPAT_API(0) */ + #undef LTTNG_UST_TRACEPOINT_ENUM #define LTTNG_UST_TRACEPOINT_ENUM(_provider, _name, _values) \ const struct lttng_ust_enum_entry * const __enum_values__##_provider##_##_name[] = { \ diff --git a/tests/compile/ctf-types/ust_tests_ctf_types.h b/tests/compile/ctf-types/ust_tests_ctf_types.h index 630d0d4e..3721045c 100644 --- a/tests/compile/ctf-types/ust_tests_ctf_types.h +++ b/tests/compile/ctf-types/ust_tests_ctf_types.h @@ -13,7 +13,7 @@ #include LTTNG_UST_TRACEPOINT_ENUM(ust_tests_ctf_types, testenum, - TP_ENUM_VALUES( + LTTNG_UST_TP_ENUM_VALUES( ctf_enum_value("even", 0) ctf_enum_value("uneven", 1) ctf_enum_range("twoto4", 2, 4) @@ -22,7 +22,7 @@ LTTNG_UST_TRACEPOINT_ENUM(ust_tests_ctf_types, testenum, ) LTTNG_UST_TRACEPOINT_ENUM(ust_tests_ctf_types, testenum2, - TP_ENUM_VALUES( + LTTNG_UST_TP_ENUM_VALUES( ctf_enum_value("zero", 0) ctf_enum_value("five", 5) ctf_enum_range("ten_to_twenty", 10, 20) diff --git a/tests/compile/hello.cxx/ust_tests_hello.h b/tests/compile/hello.cxx/ust_tests_hello.h index dfe20f5d..241fb044 100644 --- a/tests/compile/hello.cxx/ust_tests_hello.h +++ b/tests/compile/hello.cxx/ust_tests_hello.h @@ -14,7 +14,7 @@ #include LTTNG_UST_TRACEPOINT_ENUM(ust_tests_hello, my_enum, - TP_ENUM_VALUES( + LTTNG_UST_TP_ENUM_VALUES( ctf_enum_value("zero", 0) ctf_enum_value("one", 1) ctf_enum_auto("two")