Coverage of templates

Anders Peter Fugmann
Wed Nov 8 21:18:00 GMT 2006


I'm trying to examine the coverage of some template classes, which are
defined (and implemented) in header files.

Compiling test programs that includes the header files with the template
definitions / implementations with '-ftest-coverage -fprofile-arcs' does
not seem to emit basic blocks for template member functions that are not
referenced. Is there a way to instruct gcc to emit basic blocks for
these functions as well, in order to have gcov notice that the member
functions have an executions count of zero?

I have tried almost any flag to have gcc emit the missing basic-blocks:
-O0 -fkeep-inline-function -fno-default-inline -fno-inline

but still the basic blocks for the template member functions seems missing.

Searching the archives found a mail for the same problem, but no answer
was given (

Using gcc version 4.1


More information about the Gcc-help mailing list