[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.21.2304131613490.27633@pobox.suse.cz>
Date: Thu, 13 Apr 2023 16:19:10 +0200 (CEST)
From: Miroslav Benes <mbenes@...e.cz>
To: Josh Poimboeuf <jpoimboe@...nel.org>
cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v2 8/9] objtool: Detect missing __noreturn annotations
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -4485,7 +4485,8 @@ static int validate_sls(struct objtool_file *file)
>
> static int validate_reachable_instructions(struct objtool_file *file)
> {
> - struct instruction *insn;
> + struct instruction *insn, *prev_insn;
> + struct symbol *call_dest;
> int warnings = 0;
>
> if (file->ignore_unreachables)
> @@ -4495,6 +4496,17 @@ static int validate_reachable_instructions(struct objtool_file *file)
> if (insn->visited || ignore_unreachable_insn(file, insn))
> continue;
>
> + prev_insn = prev_insn_same_sec(file, insn);
> + if (prev_insn && prev_insn->dead_end) {
> + call_dest = insn_call_dest(prev_insn);
> + if (call_dest) {
> + WARN_INSN(insn, "%s() is missing a __noreturn annotation",
> + call_dest->name);
> + warnings++;
> + continue;
A nit but this and
> + }
> + }
> +
> WARN_INSN(insn, "unreachable instruction");
> warnings++;
this makes me thinking. Wouldn't it be confusing to anyone that there is
no correspondence between warnings and a number of actual reported
warnings through WARN_INSN()? In the future when there would be a usage
for warnings. It does not really matter now.
Miroslav
Powered by blists - more mailing lists