RESOLVED FIXED 142524
GCC: CRASH() should be annotated with NORETURN
https://bugs.webkit.org/show_bug.cgi?id=142524
Summary GCC: CRASH() should be annotated with NORETURN
Michael Catanzaro
Reported 2015-03-09 19:37:32 PDT
When I used CRASH() at the end of a function I'm working on, I got this warning: warning: control reaches end of non-void function [-Wreturn-type] At first I thought GCC was extremely dumb here, but it turns out that our CRASH() function only gets the noreturn attribute when complied with Clang or MSVC. It should be used with GCC too. I noticed two side-effects of this change, which are simple enough to fix in the same patch: * With that attribute added, GCC will warn that WTFCrash and WTFCrashWithSecurityImplication do return, because it's not smart enough to detect calling the null pointer as a noreturn. Easiest fix is to use __builtin_trap like we already do for Clang. * jsc.cpp intentionally uses a return at the end of a noreturn function to avoid a compiler diagnostic, which now triggers a warning from GCC. The #ifdef here was previously #if !COMPILER(CLANG) && !COMPILER(MSVC) so it must have been added just for GCC, so I've removed it.
Attachments
Mark CRASH() as noreturn when compiling with GCC (3.44 KB, patch)
2015-03-09 19:44 PDT, Michael Catanzaro
no flags
Michael Catanzaro
Comment 1 2015-03-09 19:44:25 PDT
Created attachment 248313 [details] Mark CRASH() as noreturn when compiling with GCC
WebKit Commit Bot
Comment 2 2015-03-10 09:02:21 PDT
Comment on attachment 248313 [details] Mark CRASH() as noreturn when compiling with GCC Clearing flags on attachment: 248313 Committed r181326: <http://trac.webkit.org/changeset/181326>
WebKit Commit Bot
Comment 3 2015-03-10 09:02:27 PDT
All reviewed patches have been landed. Closing bug.
Csaba Osztrogonác
Comment 4 2015-03-12 10:50:50 PDT
(In reply to comment #2) > Comment on attachment 248313 [details] > Mark CRASH() as noreturn when compiling with GCC > > Clearing flags on attachment: 248313 > > Committed r181326: <http://trac.webkit.org/changeset/181326> It caused a regression on AArch64 Linux, see bug142629 for details.
Note You need to log in before you can comment on or make changes to this bug.