[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230413153241.7px5x2w6jvkpmes7@treble>
Date: Thu, 13 Apr 2023 08:32:41 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Miroslav Benes <mbenes@...e.cz>
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
On Thu, Apr 13, 2023 at 04:19:10PM +0200, Miroslav Benes wrote:
> > --- 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.
True, maybe we need WARN_INSN_ONCE_PER_FUNC() or so ;-)
--
Josh
Powered by blists - more mailing lists