From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
James Clark <james.clark@linaro.org>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Clark Williams <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 1/4] perf tests sw-clock: Mark the volatile tmp variable as __maybe_unused
Date: Tue, 20 Jan 2026 19:08:57 -0300 [thread overview]
Message-ID: <20260120220900.366451-2-acme@kernel.org> (raw)
In-Reply-To: <20260120220900.366451-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.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@redhat.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
next prev parent reply other threads:[~2026-01-20 22:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 22:08 [PATCH 0/4] Fixes for gcc 16.0.1 Arnaldo Carvalho de Melo
2026-01-20 22:08 ` Arnaldo Carvalho de Melo [this message]
2026-01-20 22:08 ` [PATCH 2/4] perf trace: Deal with compiler const checks Arnaldo Carvalho de Melo
2026-01-20 22:08 ` [PATCH 3/4] perf list: Don't write to const memory Arnaldo Carvalho de Melo
2026-01-21 11:25 ` David Laight
2026-01-21 18:40 ` Arnaldo Carvalho de Melo
2026-01-21 18:44 ` Ian Rogers
2026-01-21 22:17 ` David Laight
2026-01-22 1:10 ` Arnaldo Carvalho de Melo
2026-01-22 9:55 ` David Laight
2026-01-20 22:09 ` [PATCH 4/4] perf list: Signal changing const memory is ok Arnaldo Carvalho de Melo
2026-01-20 23:42 ` [PATCH 0/4] Fixes for gcc 16.0.1 Ian Rogers
2026-01-20 23:50 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260120220900.366451-2-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox