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:48:59 +0000 (14:48 -0500)
commitbe2ca8b563bab81be15cbce7b9f52422369f79f7
treed89590d6b3120ecbbc16b6ac33d2232db6a05340
parentf8d4203387f7c85af6a0e77404fd9ebf5622909f
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.025747 seconds and 4 git commands to generate.