BullseyeCoverage Up Contents Search

Measurements Show 0% Coverage for Inline Functions

Symptoms

BullseyeCoverage shows 0% function coverage for some or all inline (and template) functions, even though some or all of the inline functions were called. Measurements for non-inline functions are correct.

Cause

You built some of your source files with coverage build disabled or with some sources excluded. The compiler is not expanding some or all inline functions. They are compiled only once, when coverage build is disabled. Subsequently the compiler uses a function call to the previously compiled code, ignoring the code instrumented by BullseyeCoverage.

Resolution

Rebuild with coverage build enabled and all inline functions instrumented. If you cannot instrument all inline functions, you may get better results by setting compiler optimizations to favor inline function expansion.

More Information

With Microsoft C++, BullseyeCoverage attempts to alleviate this problem by enabling inline function expansion.

With GCC and Clang, BullseyeCoverage attempts to alleviate this problem by suppressing compiler options that disable inline function expansion.

WIth IAR C/C++, BullseyeCoverage attempts to alleviate this problem by suppressing the compiler option --no_inline.

Updated: 5 Aug 2024