www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15327] New: -cov should not mark `assert(0)` (and ideally


          Issue ID: 15327
           Summary: -cov should not mark `assert(0)` (and ideally paths
                    leading unconditionally to it) as uncovered
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

`assert(0)` is almost always used as a "waveguide terminator" to mark paths
that, if ever reached, mean there's a bug in the code. Consequently, the
`assert(0)` lines and all paths leading to them cannot and should not ever be

Currently such lines are marked with 0000000 and gratuitously degrade the
coverage ratio of legitimate code.

A simple fix would be to not mark `assert(0)` lines as uncovered (also
`assert(false)` etc). That would be enough to close this issue. A more
sophisticated approach would also do the same with code leading up to the

Nov 13 2015