]> git.ipfire.org Git - thirdparty/ccache.git/commit
Handle missing .gcno file gracefully
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 1 Oct 2020 11:00:30 +0000 (13:00 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 1 Oct 2020 11:00:30 +0000 (13:00 +0200)
commit6abd78b5ec7cdfeedff36454b07a8dbff312b554
tree91890915345f52cdb4dfb9c716e94da5d1c3d8c7
parent3f77bbd2654297900fa15b2d09811c67542893c8
Handle missing .gcno file gracefully

GCC ≥9 has changed behavior for -ftest-coverage and --coverage in
combination with -fprofile-dir=dir:

- Without -fprofile-dir=dir the file is placed next to the object file
  but with a “.gcno” extension.
- With -fprofile-dir=dir the file is also place next to the object file
  (i.e. not in the specified profile directory) but the same style of
  name as used for “.gcda” files (full pathname with slashes replaced
  with hash characters).

Fix this by:

- Checking if the expected (GCC <9) .gcno file is present. If not, fall
  back to running the compiler and increment the “unsupported option”
  counter.
- Making sure to perform the above check before copying the object file
  to the cache so that a later ccache invocation won’t believe that
  there is a result in the cache.
- Improving the copy_file routine to not create the destination file
  until it knows that there is a source file to copy from.

Fixes #674.
src/ccache.c
src/util.c