D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15327 - -cov should not mark `assert(0)` (and ideally paths leading unconditionally to it) as uncovered
Summary: -cov should not mark `assert(0)` (and ideally paths leading unconditionally t...
Status: RESOLVED DUPLICATE of issue 14855
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-13 13:28 UTC by Andrei Alexandrescu
Modified: 2015-11-13 14:41 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2015-11-13 13:28:57 UTC
`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 covered.

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 `assert(0)`.
Comment 1 Jonathan M Davis 2015-11-13 14:41:08 UTC

*** This issue has been marked as a duplicate of issue 14855 ***