Project

General

Profile

Actions

Bug #10703

closed

smatch unreachable code checking needs reworking

Added by John Levon about 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2019-04-09
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage smatch
Gerrit CR:

Description

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.

Actions #1

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.

Actions #2

Updated by Electric Monk almost 3 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 44bf619d328827ce5eca6833fcd5c69f1592e578

commit  44bf619d328827ce5eca6833fcd5c69f1592e578
Author: John Levon <john.levon@joyent.com>
Date:   2019-08-21T07:48:36.000Z

    10703 smatch unreachable code checking needs reworking
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF