perf evsel: Add no-libtraceevent stubs for evsel__field() and evsel__common_field()

When building without libtraceevent (NO_LIBTRACEEVENT=1), evsel__field()
and evsel__common_field() are declared but never defined, causing link
errors in any code path that references them.

Add inline stubs that return NULL when HAVE_LIBTRACEEVENT is not defined,
matching the pattern used by other evsel accessor functions.

Cc: Aaron Tomlin <atomlin@atomlin.com>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2026-06-16 16:37:09 -03:00
parent 542e88a4c6
commit e22a422854

View File

@ -397,8 +397,22 @@ struct tep_format_field;
u64 format_field__intval(struct tep_format_field *field, struct perf_sample *sample, bool needs_swap);
#ifdef HAVE_LIBTRACEEVENT
struct tep_format_field *evsel__field(struct evsel *evsel, const char *name);
struct tep_format_field *evsel__common_field(struct evsel *evsel, const char *name);
#else
static inline struct tep_format_field *
evsel__field(struct evsel *evsel __maybe_unused, const char *name __maybe_unused)
{
return NULL;
}
static inline struct tep_format_field *
evsel__common_field(struct evsel *evsel __maybe_unused, const char *name __maybe_unused)
{
return NULL;
}
#endif
bool __evsel__match(const struct evsel *evsel, u32 type, u64 config);