Gcov: Counting lines of source code (untested files) as gcov does

Fredrik Johansson frejo221@gmail.com
Fri Jul 21 13:27:00 GMT 2006


Apparently I forgot to CC this to the list last time, so here is a new attempt!

> Fredrik, if you can modify the source: if any line in a source file
> is touched, you'll get a .da file.  So you could add a dummy routine
> to each file and call them all at startup.  That will be an easier
> project than trying to write a new .bb/.bbg reader.
>

In that case I guess I wouldn't need any "dummy routine" either, just
include the code from a testfile that I know is beeing run, and I have
one TestMain.cpp or something that loads the testsuit and such. That
would work, wouldn't it? I'm at home now so I don't have the code in
front of me, but an included file that isn't used get 0% coverage,
right?

But anyway, I would really really hate to have to alter the main code
base. I'm hired over the summer to alter the build system, and if I
came and told the other developers to make changes to their other
components I think that would discorage them to use gcov at all, which
is the opposite to what I'm hired to do :)

It's not possible to "trick" gcov (or create a version of gcov that
can be tricked) that there is a .da file but that no lines have been
executed or something like that (the line count is done by reading the
.bb anyway, right?)?

Thanks!

Regards,
Fredrik



More information about the Gcc mailing list