Why does gcov report 0% coverage on a header file for a well used class?

梦想的初衷 提交于 2019-12-01 08:26:47

It looks like I've sorted out the problem. As I expected, it's more of a lack-of-experience issue, than anything.

As it turns out, gcov was only finding a subset of the available tracefiles, and was therefore reporting only part of the total results. Finding and adding the rest of the tracefiles resolved the issue.

For any that are curious, the problematic header file still shows up in the output. In fact, all of the other header files do too, even though they contain no executable code. However, they all show 90+% coverage.

Nicolas

C++ creates implicit destructor even if you haven't created one explicitly. If you don't destroy you object before program end, this implicit destructor never get called. gcov show this by marking a '0' counter on the line of class declaration.

Your header file doesn't contain executed code. Since nothing is executed (there's no executed code in a class declaration), there's nothing to measure, and nothing to cover.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!