*/
#include <stdio.h>
+#include <stdlib.h>
#include <urcu/compiler.h>
#include <lttng/ust-events.h>
#include <lttng/ringbuffer-config.h>
#define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
__tracepoint_provider_mismatch_##_provider();
-static __attribute__((unused))
+static inline
void _TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void)
{
#include TRACEPOINT_INCLUDE
{
int ret;
+ /*
+ * __tracepoint_provider_check_ ## TRACEPOINT_PROVIDER() is a
+ * static inline function that ensures every probe PROVIDER
+ * argument match the provider within which they appear. It
+ * calls empty static inline functions, and therefore has no
+ * runtime effect. However, if it detects an error, a linker
+ * error will appear.
+ */
+ _TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)();
ret = ltt_probe_register(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
- assert(!ret);
+ if (ret) {
+ fprintf(stderr, "LTTng-UST: Error (%d) while registering tracepoint probe. Duplicate registration of tracepoint probes having the same name is not allowed.\n", ret);
+ abort();
+ }
}
static void __attribute__((destructor))