Files
buildroot/package/pahole/0004-dwarves-Fix-clang-warning-about-unused-variable.patch
Florian Larysch c69868315d package/pahole: fix build on modern toolchains
When building pahole using a modern GCC (e.g. when building
host-pahole), discarded-qualifiers and unused-but-set-variable warnings
are produced. In builds that don't set CMAKE_BUILD_TYPE=Release, -Werror
gets set and causes a build failure.

Fix this by backporting an unreleased upstream patch (for
discarded-qualifiers) and adding another pending one for
unused-but-set-variable (and, arguably, a correctness issue).

Fixes: https://autobuild.buildroot.org/results/ba7/ba79fb9d08b2c6ec573b79fdbb6b4880bf603a57

Signed-off-by: Florian Larysch <fl@n621.de>
Signed-off-by: Julien Olivain <ju.o@free.fr>
(cherry picked from commit 8419f0f0c7)
[Thomas: backport to v1.28]
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
2026-07-24 16:01:10 +02:00

46 lines
1.7 KiB
Diff

From 06350d14776a77e16ea5064030fea63bbdd22f27 Mon Sep 17 00:00:00 2001
From: Alan Maguire <alan.maguire@oracle.com>
Date: Fri, 28 Feb 2025 12:24:29 +0000
Subject: [PATCH] dwarves: Fix clang warning about unused variable
With dwarves CI, clang builds give a legit warning:
/build/dwarves_fprintf.c:2102:9: error: variable 'printed' set but not used [-Werror,-Wunused-but-set-variable]
2102 | size_t printed = fprintf(fp, "namespace %s {\n", namespace__name(space));
| ^
1 error generated.
And in fact we accumulate values in printed but never use it
for the return value. Add the printed count to the final fprintf().
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Yonghong Song <yonghong.song@linux.dev>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Song Liu <song@kernel.org>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Jiri Olsa <olsajiri@gmail.com>
Link: https://lore.kernel.org/dwarves/20250401092435.1619617-3-alan.maguire@oracle.com/
Upstream: https://github.com/acmel/dwarves/commit/06350d14776a77e16ea5064030fea63bbdd22f27
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
---
dwarves_fprintf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c
index c3e7f3c0..4407fd14 100644
--- a/dwarves_fprintf.c
+++ b/dwarves_fprintf.c
@@ -2110,7 +2110,7 @@ static size_t namespace__fprintf(const struct tag *tag, const struct cu *cu,
printed += fprintf(fp, "\n\n");
}
- return fprintf(fp, "%.*s}", conf->indent, tabs);
+ return printed + fprintf(fp, "%.*s}", conf->indent, tabs);
}
size_t tag__fprintf(struct tag *tag, const struct cu *cu,