Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf tests sw-clock: Mark the volatile tmp variable as __maybe_unused

As it is just used to waste some cycles, not being used as all, to
silence some compilers.

Noticed with gcc version 16.0.1 20260115 on fedora 44:

tests/sw-clock.c: In function '__test__sw_clock_freq':
tests/sw-clock.c:31:22: error: variable 'tmp' set but not used [-Werror=unused-but-set-variable=]
31 | volatile int tmp = 0;
| ^~~

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+2 -1
+2 -1
tools/perf/tests/sw-clock.c
··· 5 5 #include <stdlib.h> 6 6 #include <signal.h> 7 7 #include <sys/mman.h> 8 + #include <linux/compiler.h> 8 9 #include <linux/string.h> 9 10 10 11 #include "tests.h" ··· 29 28 static int __test__sw_clock_freq(enum perf_sw_ids clock_id) 30 29 { 31 30 int i, err = -1; 32 - volatile int tmp = 0; 31 + volatile int tmp __maybe_unused = 0; 33 32 u64 total_periods = 0; 34 33 int nr_samples = 0; 35 34 char sbuf[STRERR_BUFSIZE];