From: Nathan Chancellor <nathan@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
Petr Mladek <pmladek@suse.com>,
Joe Lawrence <joe.lawrence@redhat.com>,
x86@kernel.org
Subject: Re: [PATCH] tools/objtool: Copy the __cleanup unused variable fix for older clang
Date: Sat, 1 Nov 2025 12:43:29 -0400 [thread overview]
Message-ID: <20251101164329.GA3250327@ax162> (raw)
In-Reply-To: <20251101124432.GBaQYAsK3mcvrB9cqm@fat_crate.local>
On Sat, Nov 01, 2025 at 01:44:32PM +0100, Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
> Date: Sat, 1 Nov 2025 13:37:51 +0100
>
> 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>
> Link: https://lore.kernel.org/r/20251031114919.GBaQSiPxZrziOs3RCW@fat_crate.local
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> 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 e88322d97573..a1e3927d8e7c 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++
>
> --
> 2.51.0
>
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
prev parent reply other threads:[~2025-11-01 16:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 9:52 [tip: objtool/core] objtool/klp: Add --debug option to show cloning decisions tip-bot2 for Josh Poimboeuf
2025-10-31 11:49 ` Borislav Petkov
2025-10-31 14:09 ` Nathan Chancellor
2025-10-31 14:21 ` Borislav Petkov
2025-10-31 16:11 ` Josh Poimboeuf
2025-10-31 20:25 ` Nathan Chancellor
2025-11-01 12:44 ` [PATCH] tools/objtool: Copy the __cleanup unused variable fix for older clang Borislav Petkov
2025-11-01 16:43 ` Nathan Chancellor [this message]
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=20251101164329.GA3250327@ax162 \
--to=nathan@kernel.org \
--cc=bp@alien8.de \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®