[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260120220900.366451-2-acme@kernel.org>
Date: Tue, 20 Jan 2026 19:08:57 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
James Clark <james.clark@...aro.org>,
Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Clark Williams <williams@...hat.com>,
linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH 1/4] perf tests sw-clock: Mark the volatile tmp variable as __maybe_unused
From: Arnaldo Carvalho de Melo <acme@...hat.com>
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;
| ^~~
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/tests/sw-clock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c
index 4a2ad7176fa07be0..b6e46975379cd5ef 100644
--- a/tools/perf/tests/sw-clock.c
+++ b/tools/perf/tests/sw-clock.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <signal.h>
#include <sys/mman.h>
+#include <linux/compiler.h>
#include <linux/string.h>
#include "tests.h"
@@ -28,7 +29,7 @@
static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
{
int i, err = -1;
- volatile int tmp = 0;
+ volatile int tmp __maybe_unused = 0;
u64 total_periods = 0;
int nr_samples = 0;
char sbuf[STRERR_BUFSIZE];
--
2.52.0
Powered by blists - more mailing lists