Messages in this thread | | | From | Martin Jambor <> | Subject | Re: [PATCH v3 5/6] x86/ftrace: Use text_poke() | Date | Thu, 23 Jan 2020 11:19:58 +0100 |
| |
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
| |