Coverage suppression merged into GCC
A few days ago I
pushed
support for coverage suppression in GCC. Sometimes we write very
defensive guards, especially in debug builds (like asserts), that are
intended to never trigger because they signal a logic bug
elsewhere. It’s hard to argue that defensive code and asserts isn’t
excellent, but they paradoxically introduce a problem for coverage
since we now introduce decisions and code paths that will never be
exercised. The new #pragma suppress_coverage and
__attribute__((suppress_coverage)) address this problem. GCC could
already ignore files for coverage (with
-fprofile-filter-files
and
-fprofile-exclude-files),
but this is more granular.