]> git.ipfire.org Git - thirdparty/ccache.git/commit
Proof of concept for "depend mode"
authorGeert Kloosterman <geert.kloosterman@brightcomputing.com>
Wed, 4 Apr 2018 21:05:11 +0000 (23:05 +0200)
committerGeert Kloosterman <geert.kloosterman@brightcomputing.com>
Wed, 4 Apr 2018 21:30:57 +0000 (23:30 +0200)
commitcf48b7dfd54e5c8afdbd54c22bc4f980610d949f
tree2a822e2be534c5688a4e7c9c5d0456aea6ef4ab8
parentb0e3ead43fafdc35eb99d16f33dd39ed6ac8048b
Proof of concept for "depend mode"

Use the compiler's dependency output to get the list of source files,
and do not run the preprocessor to get the object hash.  Instead base
the object hash on the checksums of the individual files, which we
already collect within direct mode.

In short, on a direct cache miss, immediately run the actual
compiler (with -MD/-MMD). Get the include files from the .d file and
calculate their hashes. Use these hashes for both the manifest file
and to create the object hash.

This is currently in a working but still proof of concept state:
 - the -MD/-MMD flags are not added dynamically, but are required to
   be already present.
 - some code could be cleaner
 - there are still a few FIXME comments left
 - there are only a few integration tests
 - the documentation has not been updated yet

Some notes on this commit:
 - added new function `object_hash_from_depfile()`, which borrows some
   code from `use_relative_paths_in_depfile()`.
 - `remember_include_file()` has an additional param to update the hash
   used for depend mode
 - Because in depend mode we do not know the object hash in advance, we
   cannot create temporary files based on the object hash anymore within
   `to_cache()`.  The new temporary files for stdout and stderr are not
   necessarily on the same file system, and we cannot use
   `move_file_to_cache_same_fs()` anymore.  Removed the latter to
   prevent "unused function" warnings.
src/ccache.c
test/run
test/suites/depend.bash [new file with mode: 0644]