]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
libperf: Use 'extern' in LIBPERF_API visibility macro
authorArnaldo Carvalho de Melo <acme@kernel.org>
Thu, 4 Dec 2025 16:11:49 +0000 (13:11 -0300)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 5 Dec 2025 18:31:32 +0000 (10:31 -0800)
Use 'extern' on LIBPERF_API to address this issue that started appearing
with gcc 15, first seen in ubuntu 25.10:

  evlist.c: In function 'perf_evlist__purge':
  evlist.c:202:17: error: implicit declaration of function 'perf_evsel__delete'; did you mean 'perf_evsel__exit'? [-Wimplicit-function-declaration]
    202 |                 perf_evsel__delete(pos);
        |                 ^~~~~~~~~~~~~~~~~~
        |                 perf_evsel__exit
  evlist.c:202:17: error: nested extern declaration of 'perf_evsel__delete' [-Werror=nested-externs]
  evlist.c: In function 'perf_evlist__open':
  evlist.c:261:23: error: implicit declaration of function 'perf_evsel__open'; did you mean 'perf_evsel__exit'? [-Wimplicit-function-declaration]
    261 |                 err = perf_evsel__open(evsel, evsel->cpus, evsel->threads);
        |                       ^~~~~~~~~~~~~~~~
        |                       perf_evsel__exit
  evlist.c:261:23: error: nested extern declaration of 'perf_evsel__open' [-Werror=nested-externs]

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/lib/perf/include/perf/core.h

index a3f6d68edad762408d0d73c473d0da24894256d6..06cc132d88cf34367d8671b10643e50c2d0c1013 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdarg.h>
 
 #ifndef LIBPERF_API
-#define LIBPERF_API __attribute__((visibility("default")))
+#define LIBPERF_API extern __attribute__((visibility("default")))
 #endif
 
 enum libperf_print_level {