[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ri6d0baqxtd.fsf@suse.cz>
Date: Thu, 23 Jan 2020 11:19:58 +0100
From: Martin Jambor <mjambor@...e.cz>
To: Josh Poimboeuf <jpoimboe@...hat.com>,
Miroslav Benes <mbenes@...e.cz>
Cc: Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
Joe Lawrence <joe.lawrence@...hat.com>,
Jessica Yu <jeyu@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org, mhiramat@...nel.org,
bristot@...hat.com, jbaron@...mai.com,
torvalds@...ux-foundation.org, tglx@...utronix.de,
mingo@...nel.org, namit@...are.com, hpa@...or.com, luto@...nel.org,
ard.biesheuvel@...aro.org, live-patching@...r.kernel.org,
Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()
Hello,
On Wed, Jan 22 2020, Josh Poimboeuf wrote:
> Global noreturns are already a pain today. There's no way for objtool
> to know whether GCC considered a function to be noreturn,
You should be able to get a good idea with -Wsuggest-attribute=noreturn:
$ cat a.c
int __attribute__((noreturn)) my_abort (void)
{
__builtin_abort ();
}
int foo (void)
{
return my_abort ();
}
int bar (int flag)
{
if (flag)
foo ();
return 4;
}
$ gcc -S -O2 -Wsuggest-attribute=noreturn a.c
a.c: In function ‘foo’:
a.c:6:5: warning: function might be candidate for attribute ‘noreturn’ [-Wsuggest-attribute=noreturn]
6 | int foo (void)
| ^~~
GCC 9 and newer even have -fdiagnostics-format=json if you are into that
kind of thing.
Hope this helps a little,
Martin
Powered by blists - more mailing lists