[PATCH v1 04/18] perf list: Fix -Wdiscarded-qualifiers under C23
From: Shreenidhi Shedi
Date: Sat May 09 2026 - 14:03:35 EST
builtin-list.c:104:31: warning: assignment discards 'const' qualifier
from pointer target type [-Wdiscarded-qualifiers]
104 | else if ((sep = strchr(argv[i], ':')) != NULL) {
glibc >= 2.42 defaults to -std=gnu23, which promotes
-Wdiscarded-qualifiers to an error.
Signed-off-by: Shreenidhi Shedi <yesshedi@xxxxxxxxx>
---
tools/perf/builtin-list.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 58e1ec1654ef..a37f3b8a597c 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -75,7 +75,8 @@ int cmd_list(int argc, const char **argv)
}
for (i = 0; i < argc; ++i) {
- char *sep, *s;
+ const char *sep;
+ char *s;
if (strcmp(argv[i], "tracepoint") == 0)
print_tracepoint_events(NULL, NULL, raw_dump);
--
2.54.0