Unused inline header functions don't contribute to a files uncovered code

Jan 19, 2016 at 8:21 PM
When running OpenCppCoverage against an inline header library, total test coverage is currently only calculated based on which functions were called and not the totality of code within the header file.
Coordinator
Jan 28, 2016 at 8:12 PM
Hello,
inline void Test1() {}
inline void Test2() {}
void Test3() {}

int main()
{
    if (false)
    {
        Test1();    
    }
    return 0;
}
Test1 and Test3 are marked as uncovered, but Test2 is neither marked as covered neither as uncovered.

OpenCppCoverage uses the same technique as a debugger (It adds a breakpoint to each line).
So, if you are not able to put a breakpoint in a function, this function will also be ignored by OpenCppCoverage.
As you noticed, not called inline functions are ignored.

You have the same kind of issue with template function.

I tried to disable inline functions with /Ob0, but it does not change anything.
I have no real workaround. You can try to use INLINE macro, but this is probably not a solution for you and it does not work for the template methods.
#ifdef NDEBUG
    #define INLINE inline
#else
    #define INLINE
#endif
OpenCppCoverage
Marked as answer by OpenCppCoverage on 3/30/2016 at 3:50 AM