This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Wrong coverage on header files with static inline functions

The device has some memory mapped peripherals and we have our HAL written as header files with static inline functions that provide access to these peripherals. The unit tests run on the simulator and "COVERAGE GCOV * DETAILS" is used in the .ini file for the simulator to generate gcov style coverage files. The tests are compiled with -O0 and debug information. Keil version is 5.33 with a flex license, compiler is 6.15.

The problem is that the .gcov files provide coverage information only on functions that are used by the unit tests. The rest of the functions in are not even considered for coverage (marked as "-:" in the .gcov file).

This is a huge problem because you will see a misleading 100% coverage for a file in which only one function is actually tested (called). 

Example (code is blurred since I am not sure if I can share it externally):

The function on line 642 is not tested, the function on line 648 is covered by a unit test. The resulting coverage report correctly shows the lines from the covered function as covered does not show that the lines for the uncovered function are not covered. 

Resulting .gcov file contents:

Same info in Keil's debug view:

Can you help me find a solution for this ? Perhaps I am missing something obvious?