lkml.org 
[lkml]   [2020]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3 5/6] x86/ftrace: Use text_poke()
Date
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

\
 
 \ /
  Last update: 2020-01-23 11:20    [W:0.188 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site