[ccache] ccache and -ftest-coverage

Kimberley Burchett kim at grassybrook.com
Wed Mar 3 00:18:16 GMT 2004

As of version 2.3, ccache does not handle the gcc flag -ftest-coverage
correctly.  This flag causes gcc to output two extra files in addition
to the object file.  ccache doesn't cache the extra files, so it is
impossible to use ccache when compiling for code coverage testing.

There are three solutions to this that I can see:

1) Disable caching when -ftest-coverage is specified.  I've patched my
local version of ccache to do this, but it's possible to do better.

2) Handle -ftest-coverage as a special case.

3) Make ccache notice when extra files are created with the same prefix
as the output object file, and cache those as well.  I think this is
probably the correct long-term solution, unless people know of
situations where it would cause problems.  I'd make the feature check
for an environment variable listing the extra file extensions that
ccache should look for.  Something like:
    CCACHE_EXTRAFILES="%s.bb %s.bbg"

Has anybody addressed this issue already?  Would people find it useful
if I produced a patch implementing #2 or #3?  If I hear that this would
be useful to other people, it will increase the likelihood that I'll get
around to doing it.

Kimberley Burchett

More information about the ccache mailing list