]> git.ipfire.org Git - thirdparty/ccache.git/commit
fix: Improve handling of .gcno files
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 3 Apr 2022 06:59:46 +0000 (08:59 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 3 Apr 2022 07:06:17 +0000 (09:06 +0200)
commit492f3e4ab3f06694cf7cc86ead49fc7876080cc6
treedb231d457370742aa181e27753caef043dccacd4
parent836f76e9c02acc00925f0b3ed2ba9ae9d379b823
fix: Improve handling of .gcno files

When support for caching a compilation with coverage (producing a .gcno
file), the commit[1] made sure to avoid rewriting the input path to
relative with the motivation “also make sure to use the source file
path, since this is in the notes”. However, this seems to be unnecessary
since a relative input file path will be written as is to the .gcno, not
the absolute path. This is the case for at least GCC 4.7+ and Clang
3.6+. Fix this by potentially converting the input path to relative even
when generating coverage.

When investigating the above issue, I noticed that GCC 9+ includes the
current working directory (CWD) in the .gcno file. This means that we
have include the CWD in the hash when compiling with
-ftest-coverage/--coverage in order to replicate what the compiler would
produce. Since this makes it impossible get cache hits when compiling in
different directories, a new gcno_cwd sloppiness has been added for
opting out of hashing the CWD, with the tradeoff of potentially getting
an incorrect directory in the .gcno file.

[1]: 02d3f078bd2495b8db2264ae0b2c692b4c5ba1bd

Fixes #1032.
doc/MANUAL.adoc
src/Config.cpp
src/argprocessing.cpp
src/ccache.cpp
src/core/Sloppiness.hpp
test/suites/profiling.bash
unittest/test_Config.cpp