+#include LTTNG_UST_TRACEPOINT_INCLUDE
+
+#undef lttng_ust__get_dynamic_len
+
+/*
+ * Stage 5.1 of tracepoint event generation.
+ *
+ * Create probe signature
+ */
+
+/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
+#include <lttng/ust-tracepoint-event-reset.h>
+
+#undef LTTNG_UST_TP_ARGS
+#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
+
+#define LTTNG_UST__TP_EXTRACT_STRING2(...) #__VA_ARGS__
+
+#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
+#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
+static const char __tp_event_signature___##_provider##___##_name[] = \
+ LTTNG_UST__TP_EXTRACT_STRING2(_args);
+
+#include LTTNG_UST_TRACEPOINT_INCLUDE
+
+#undef LTTNG_UST__TP_EXTRACT_STRING2
+
+/*
+ * Stage 6 of tracepoint event generation.
+ *
+ * Tracepoint loglevel mapping definition generation. We generate a
+ * symbol for each mapping for a provider/event to ensure at most a 1 to
+ * 1 mapping between events and loglevels. If the symbol is repeated,
+ * the compiler will complain.
+ */
+
+/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
+#include <lttng/ust-tracepoint-event-reset.h>
+
+/*
+ * Declare _loglevel___##__provider##___##__name as non-static, with
+ * hidden visibility for c++ handling of weakref. We do a weakref to the
+ * symbol in a later stage, which requires that the symbol is not
+ * mangled.
+ */
+#ifdef __cplusplus
+#define LTTNG_UST_TP_EXTERN_C extern "C"
+#else
+#define LTTNG_UST_TP_EXTERN_C
+#endif
+
+#undef LTTNG_UST_TRACEPOINT_LOGLEVEL
+#define LTTNG_UST_TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \
+static const int _loglevel_value___##__provider##___##__name = __loglevel; \
+LTTNG_UST_TP_EXTERN_C const int * const _loglevel___##__provider##___##__name \
+ __attribute__((visibility("hidden"))) = \
+ &_loglevel_value___##__provider##___##__name;
+
+#include LTTNG_UST_TRACEPOINT_INCLUDE
+
+#undef LTTNG_UST_TP_EXTERN_C
+
+/*
+ * Stage 6.1 of tracepoint event generation.
+ *
+ * Tracepoint UML URI info.
+ */
+
+/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
+#include <lttng/ust-tracepoint-event-reset.h>
+
+/*
+ * Declare _model_emf_uri___##__provider##___##__name as non-static,
+ * with hidden visibility for c++ handling of weakref. We do a weakref
+ * to the symbol in a later stage, which requires that the symbol is not
+ * mangled.
+ */
+#ifdef __cplusplus
+#define LTTNG_UST_TP_EXTERN_C extern "C"
+#else
+#define LTTNG_UST_TP_EXTERN_C
+#endif
+
+#undef LTTNG_UST_TRACEPOINT_MODEL_EMF_URI
+#define LTTNG_UST_TRACEPOINT_MODEL_EMF_URI(__provider, __name, __uri) \
+LTTNG_UST_TP_EXTERN_C const char * const _model_emf_uri___##__provider##___##__name \
+ __attribute__((visibility("hidden"))) = __uri; \
+
+#include LTTNG_UST_TRACEPOINT_INCLUDE
+
+#undef LTTNG_UST_TP_EXTERN_C
+
+/*
+ * Stage 7.0 of tracepoint event generation.
+ *
+ * Declare toplevel descriptor for the whole probe.
+ * Unlike C, C++ does not allow tentative definitions. Therefore, we
+ * need to explicitly declare the variable with "extern", using hidden
+ * visibility to keep this symbol from being exported to the global
+ * symbol table.
+ */
+
+extern const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)
+ __attribute__((visibility("hidden")));
+
+/*
+ * Stage 7.1 of tracepoint event generation.
+ *
+ * Create events description structures. We use a weakref because
+ * loglevels are optional. If not declared, the event will point to
+ * a loglevel that contains NULL.
+ *
+ * C++ requires that const objects have a user-declared default
+ * constructor. However, in both C++ and C, weakref cannot be
+ * initialized because it causes the weakref attribute to be ignored.
+ * Therefore, the loglevel and model_emf_uri pointers are not const
+ * to ensure C++ compilers default-initialize them.
+ */
+
+/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
+#include <lttng/ust-tracepoint-event-reset.h>
+
+#undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
+#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
+static const int * \
+ __ref_loglevel___##_provider##___##_name \
+ __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \
+static const char * \
+ __ref_model_emf_uri___##_provider##___##_name \
+ __attribute__((weakref ("_model_emf_uri___" #_provider "___" #_name)));\
+static const struct lttng_ust_event_desc lttng_ust__event_desc___##_provider##_##_name = { \
+ .struct_size = sizeof(struct lttng_ust_event_desc), \
+ .event_name = #_name, \
+ .probe_desc = &__probe_desc___##_provider, \
+ .probe_callback = (void (*)(void)) <tng_ust__event_probe__##_provider##___##_template, \
+ .fields = lttng_ust__event_fields___##_provider##___##_template, \
+ .nr_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_template) - 1, \
+ .loglevel = &__ref_loglevel___##_provider##___##_name, \
+ .signature = __tp_event_signature___##_provider##___##_template, \
+ .model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name, \
+};
+
+#include LTTNG_UST_TRACEPOINT_INCLUDE
+
+/*
+ * Stage 7.2 of tracepoint event generation.
+ *
+ * Create array of events.
+ */
+
+/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
+#include <lttng/ust-tracepoint-event-reset.h>
+
+#undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
+#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
+ <tng_ust__event_desc___##_provider##_##_name,
+
+static const struct lttng_ust_event_desc * const LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)[] = {
+#include LTTNG_UST_TRACEPOINT_INCLUDE
+ NULL, /* Dummy, C99 forbids 0-len array. */
+};