smatch unreachable code checking needs reworking
The reasons are lost in the fogs of time (that is, last year), but for some reason, we have an
explicit list of no_return functions in smatch_data/. A quick test seems to indicate that it's at
least partly not necessary, because smatch does understand noreturn attribute.
Furthermore, we have "unreachable" globally disabled right now. I just ran smatch against
usr/src/lib and only got a few complaints. If we can, we should re-enable this check except
where we explicitly need to disable it.
Updated by John Levon about 3 years ago
One annoyance here is that lex itself adds a non-noreturn exit() prototype. So all lex C users may need to disable the unreachable check (along with other checks that would otherwise be silenced).
This still seems preferable to explicitly listing exit() in noreturn, probably. Or if we do we can at least comment as to why.
Updated by Electric Monk almost 3 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit 44bf619d328827ce5eca6833fcd5c69f1592e578 Author: John Levon <email@example.com> Date: 2019-08-21T07:48:36.000Z 10703 smatch unreachable code checking needs reworking Reviewed by: Toomas Soome <firstname.lastname@example.org> Reviewed by: Yuri Pankov <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>