From: Josh Poimboeuf <jpoimboe@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Miroslav Benes <mbenes@suse.cz>
Subject: [PATCH] objtool: Improve rate-limiting for missing __noreturn warnings
Date: Thu, 8 Jun 2023 09:23:32 -0700 [thread overview]
Message-ID: <185b1a78b42776467929ce9e7851e4dbcd0b55d4.1686241345.git.jpoimboe@kernel.org> (raw)
If a function with a lot of call sites is missing __noreturn, it could
result in a lot of duplicate warnings (one for each call site).
Each call site's function is already rate-limited to one warning per
function via WARN_INSN(). Do the same for the callee (the "missing
__noreturn" function itself).
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
tools/objtool/check.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 8936a05f0e5a..bb2ed34cb90e 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4507,9 +4507,13 @@ static int validate_reachable_instructions(struct objtool_file *file)
if (prev_insn && prev_insn->dead_end) {
call_dest = insn_call_dest(prev_insn);
if (call_dest && !ignore_noreturn_call(prev_insn)) {
- WARN_INSN(insn, "%s() is missing a __noreturn annotation",
- call_dest->name);
- warnings++;
+ if (!call_dest->warned) {
+ WARN_INSN(insn, "%s() is missing a __noreturn annotation",
+ call_dest->name);
+ warnings++;
+ call_dest->warned = 1;
+ }
+
continue;
}
}
--
2.40.1
next reply other threads:[~2023-06-08 16:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 16:23 Josh Poimboeuf [this message]
2023-06-08 20:54 ` Josh Poimboeuf
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=185b1a78b42776467929ce9e7851e4dbcd0b55d4.1686241345.git.jpoimboe@kernel.org \
--to=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=peterz@infradead.org \
--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®