The exact function is calculated using lcov and g ++

I use Ubuntu 12, g ++ and lcov, the latter is installed with apt-get install lcov .

I have successfully compiled and generated html reports using genhtml . The line coverage information looks good, but many feature counts seem weird. For example, one C ++ class containing only a constructor and a virtual destructor tells lcov that it has 7 functions. So my coverage is only 2/7 if I call both during the session.

Here is a sample output that shows a class with one function that is never called. I canโ€™t decide what this function is:

output example

Can someone decode the changed function name, explain the number of bloated functions and suggest how to solve the problem?

Thanks in advance.

Update

OK, since, in answering my initial question below (see comments), I now offer suggestions on how I can prevent these under the hoods and dtors from damaging the coverage statistics of functions. How can I limit the number of functions to the functions that I wrote?

+4
source share
1 answer

I assume that you are already in a new project, and at a time when you may not have used C ++ 11, but if you do, perhaps this will help:

 class my_class { ... my_class(my_class const &) = delete; ... }; 

It also means that you should have some form of declaration for all possible default constructors that you donโ€™t want to have ... Now, if you use default constructors, you probably need to improve your tests because lcov telling you that you donโ€™t actually test them! Something like this should do:

 my_class a; my_class b(a); my_class c; c = b; 
+1
source

All Articles