mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [tip: objtool/core] tools/objtool: Copy the __cleanup unused variable fix for older clang
@ 2025-11-10 12:09 tip-bot2 for Borislav Petkov (AMD)
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Borislav Petkov (AMD) @ 2025-11-10 12:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Nathan Chancellor, Borislav Petkov (AMD), x86, linux-kernel

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     249092174caa3fe9fb8f7914991a8c0de484bcf8
Gitweb:        https://git.kernel.org/tip/249092174caa3fe9fb8f7914991a8c0de484bcf8
Author:        Borislav Petkov (AMD) <bp@alien8.de>
AuthorDate:    Sat, 01 Nov 2025 13:37:51 +01:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Mon, 10 Nov 2025 12:46:08 +01:00

tools/objtool: Copy the __cleanup unused variable fix for older clang

Copy from

  54da6a092431 ("locking: Introduce __cleanup() based infrastructure")

the bits which mark the variable with a cleanup attribute unused so that my
clang 15 can dispose of it properly instead of warning that it is unused which
then fails the build due to -Werror.

Suggested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20251031114919.GBaQSiPxZrziOs3RCW@fat_crate.local
---
 tools/objtool/include/objtool/warn.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h
index e88322d..a1e3927 100644
--- a/tools/objtool/include/objtool/warn.h
+++ b/tools/objtool/include/objtool/warn.h
@@ -107,6 +107,15 @@ extern int indent;
 
 static inline void unindent(int *unused) { indent--; }
 
+/*
+ * Clang prior to 17 is being silly and considers many __cleanup() variables
+ * as unused (because they are, their sole purpose is to go out of scope).
+ *
+ * https://github.com/llvm/llvm-project/commit/877210faa447f4cc7db87812f8ed80e398fedd61
+ */
+#undef __cleanup
+#define __cleanup(func) __maybe_unused __attribute__((__cleanup__(func)))
+
 #define __dbg(format, ...)						\
 	fprintf(stderr,							\
 		"DEBUG: %s%s" format "\n",				\
@@ -127,7 +136,7 @@ static inline void unindent(int *unused) { indent--; }
 })
 
 #define dbg_indent(args...)						\
-	int __attribute__((cleanup(unindent))) __dummy_##__COUNTER__;	\
+	int __cleanup(unindent) __dummy_##__COUNTER__;			\
 	__dbg_indent(args);						\
 	indent++
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-10 12:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-10 12:09 [tip: objtool/core] tools/objtool: Copy the __cleanup unused variable fix for older clang tip-bot2 for Borislav Petkov (AMD)

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®