mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scripts/sorttable: Mark long_size as __maybe_unused
@ 2026-09-01  1:46 Nathan Chancellor
  2026-09-04 19:34 ` Nicolas Schier
  2026-09-09  6:11 ` Nicolas Schier
  0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2026-09-01  1:46 UTC (permalink / raw)
  To: Steven Rostedt, Nicolas Schier
  Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, linux-kernel,
	linux-kbuild, llvm, stable, Nathan Chancellor

When building in a kernel tree prior to commit b055f4c431e3 ("sorttable:
Move ELF parsing into scripts/elf-parse.[ch]") with clang-23 or newer,
which implements a new warning under -Wunused-but-set-variable for
static global variable, there is a warning from sorttable because
long_size is unused when MCOUNT_SORT_ENABLED is not set:

  scripts/sorttable.c:452:12: error: variable 'long_size' set but not used [-Werror,-Wunused-but-set-global]
    452 | static int long_size;
        |            ^

Mark long_size as __maybe_unused to avoid inserting more ugly #ifdef
directives while insuring the warning does not reappear, as the
aforementioned change does not alter the uses of long_size, so it
appears to be coincidence that the warning disappears after this
refactoring.

Cc: stable@vger.kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
This is breaking our builds on stable:

  https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/33143924291

There was a previous patch sent for this issue

  https://lore.kernel.org/20260603191708.27241-1-beakthoven@gmail.com/

but it was marked as stable only. I think this should be taken via
mainline and backported the normal way, as it appears to be coincidence
that the warning is not present in mainline. It does not look like
scripts/sorttable.c has a formal owner according to MAINTAINERS so this
could either go through one of Steve's trees or the kbuild tree.
---
 scripts/sorttable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/sorttable.c b/scripts/sorttable.c
index d8dc2a1b7c31..d7b50581c732 100644
--- a/scripts/sorttable.c
+++ b/scripts/sorttable.c
@@ -116,7 +116,7 @@ static inline void *get_index(void *start, int entsize, int index)
 }
 
 static int extable_ent_size;
-static int long_size;
+static int long_size __maybe_unused;
 
 #define ERRSTR_MAXSZ	256
 

---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260831-sorttable-long_size-unused-but-set-global-262c0873a1a9

Best regards,
--  
Cheers,
Nathan


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-09  6:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01  1:46 [PATCH] scripts/sorttable: Mark long_size as __maybe_unused Nathan Chancellor
2026-09-04 19:34 ` Nicolas Schier
2026-09-08 23:37   ` Nathan Chancellor
2026-09-09  6:11 ` Nicolas Schier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®