]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf evsel: Add no-libtraceevent stubs for evsel__field() and evsel__common_field()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 16 Jun 2026 19:37:09 +0000 (16:37 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 16 Jun 2026 19:37:09 +0000 (16:37 -0300)
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>
tools/perf/util/evsel.h

index 8009be22cc3f1055dfa7c9a726209ceeb214ded5..b959d4797b14035d30f9f535810055894b75c5eb 100644 (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);