Fix: Reevaluate LTTNG_UST_TRACEPOINT_DEFINE each time tracepoint.h is included
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 21 Feb 2023 19:29:49 +0000 (14:29 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 21 Feb 2023 19:49:07 +0000 (14:49 -0500)
commitfaa633435d42bafa036904265b14df506ddbd6e5
treea50182b58458824be653e5ecbe9f6bb657c66220
parent0b5a6313f8adb238ee6fc9dc92e25d823b99a891
Fix: Reevaluate LTTNG_UST_TRACEPOINT_DEFINE each time tracepoint.h is included

Fix issues with missing symbols in use-cases where tracef.h is included
before defining LTTNG_UST_TRACEPOINT_DEFINE, e.g.:

 #include <lttng/tracef.h>
 #define LTTNG_UST_TRACEPOINT_DEFINE
 #include <provider.h>

It is caused by the fact that tracef.h includes tracepoint.h in a
context which has LTTNG_UST_TRACEPOINT_DEFINE undefined, and this is not
re-evaluated for the following includes.

Fix this by lifting the definition code in tracepoint.h outside of the
header include guards, and #undef the old LTTNG_UST__DEFINE_TRACEPOINT
before re-defining it to its new semantic. Use a new
_LTTNG_UST_TRACEPOINT_DEFINE_ONCE include guard within the
LTTNG_UST_TRACEPOINT_DEFINE defined case to ensure symbols are not
duplicated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0ef720435003a7ca0bfcf29d7bf27866c5ff8678
include/lttng/tracepoint.h
This page took 0.026171 seconds and 4 git commands to generate.