gcov coverage on template classes

John (Eljay) Love-Jensen eljay@adobe.com
Thu Feb 26 14:51:00 GMT 2009


Hi Nava,

>So, not in the code. Are you saying template methods are inline by default?

No.  Inline methods defined in a class declaration are inlined by default.

For example:

class Foo
{
public:
  void ThisMethodIsInlinedByDefault() { }
};

Since Foo::ThisMethodIsInlinedByDefault was declared implicitly inline -- by
virtue of being defined in the class declaration -- it is inline by default.

Same rule applies to template classes, as far as I know.

> ok, so there's no way to force the compiler to emit all methods for any
> template class that is instantiated?

Hopefully there is one-or-more -f flags that will control the code emission
that you are looking for.

> The ones I found were: -fkeep-inline-functions -fno-default-inline

Did those resolve your issue?

> are there others which I should be trying?

Perhaps.  I don't know.

> Thanks for your suggestions.

No problem.  :-)

Sincerely,
--Eljay



More information about the Gcc-help mailing list