Compiled compiler code in code coverage

I am using tools to cover Intel code on Linux with g ++ compiler. For a certain class, the coverage tool shows 2/3 additional features than those actually present in the source code.

What are these additional features? Are they compiler-generated functions?

I am excluding header files from code coverage. My classes are simple with empty ctor and dtor.

I think the following functions are generated by the compiler.

  • Copy constructor
  • Assignment operator
  • Macro (not in my case)
  • Mechanisms for connecting signal slots (for example, in the Qt compiler moc generates them)
+1


a source to share


1 answer


This blog post (related to debugging with GDB) explains why you see "extra" constructors.



gcc generates two different function bodies for the constructor. One of them is regular, which builds the entire facility, including all bases. The other builds everything except the virtual base classes. As it happens, gcc emits both constructors even for classes that have no virtual bases at all.

+1


a source







All Articles