Mike Gulick [Tue, 24 Jul 2018 19:23:03 +0000 (15:23 -0400)]
process_preprocessed_file: Move gnu_getcwd() out of tight loop
Change process_preprocessed_file from calling getcwd() once per line
in the preprocessed source file to once at the start of the function.
The performance of getcwd() on Mac seems to be terrible compared to
Linux. On a macOS 10.13 build machine, this change improves
process_preprocessed_file runtime on a 10MB preprocessed file from 75
seconds to .75 seconds.
Joel Rosdahl [Fri, 10 Aug 2018 11:25:17 +0000 (13:25 +0200)]
Improve printing of “stats zeroed” statistics
* Refactored how formatting functions work in “ccache -s” output. They
now return a formatted string (or NULL for “don’t print statistics
line at all”) instead of printing the value.
* Added a new format_timestamp function.
* Added STATS_ZEROTIMESTAMP to the common stats_info array instead of
being a special case.
* Let the STATS_ZEROTIMESTAMP value be 0 for new caches so that the
“stats zeroed” statistics line only shows up when “ccache -z” actually
has been called.
Tomasz Miąsko [Wed, 2 May 2018 00:00:00 +0000 (00:00 +0000)]
Avoid TOCTOU issue when deciding if config is valid
Previously, a separate call to access had been used to distinguish
between I/O errors and invalid configuration file. This could lead to
spurious errors if configuration file have been created in-between call
to conf_read and access. Use errno to tell those two cases apart.
Joel Rosdahl [Mon, 23 Apr 2018 20:04:12 +0000 (22:04 +0200)]
Merge branch '3.4-maint'
* 3.4-maint:
Use double when calculating cache thresholds
Add a 32-bit build target, using multilib (-m32)
Convert float config to double, add rounding
Upgrade clang to 5.0, for the Travis docker
Make sure to export ASAN_OPTIONS properly
Add small helper to run all Travis tests
Make sure to call configure with right path
Add a travis-build container, for running locally
Look for -fdebug-prefix-map feature explicitly
Improve the Travis build matrix
Fix log printing of before/after cleanup
Remove irrelevant variable assignment in wipe_dir
win32: Fix CCACHE_COMPILERCHECK=mtime test case
This is not the actual Travis docker container, but it
should be similar enough for doing local verification:
make travis
make travis CC=clang
make travis CC=clang CFLAGS="-fsanitize=address -g" ASAN_OPTIONS="detect_leaks=0"
make travis CC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe"
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.
Put "calculate preprocessor hash" code into "if" block
In a following commit we will execute this code conditionally.
Even though the change is simple, the diff looks rather ugly (unless
when ignoring whitespace differences). Having this step as a separate
commit should make the following commit more clear.
Chose to not factor it out into a separate function because of the
amount of local variables referenced.
Previously if compiler command was an .sh script, win32 version
automatically added an .EXE extension to the command line and
then test case failed. With this change .sh files won't get
appended by an EXE extension and test case successfully runs
Joel Rosdahl [Tue, 13 Mar 2018 14:02:16 +0000 (15:02 +0100)]
Merge branch '3.4-maint'
* 3.4-maint:
Clean up
win32: Silence compiler warnings
cleanup: Improve robustness when multiple cleanups run concurrently
cleanup: Log size before cleaning
Add x_try_unlink utility function
test: Use helper functions instead of custom code
test: Improve error messages from expect_{equal,different}_files
Joel Rosdahl [Mon, 12 Mar 2018 21:25:28 +0000 (22:25 +0100)]
cleanup: Improve robustness when multiple cleanups run concurrently
The file count/size counters are now intentionally subtracted even if
there file to delete has disappeared since the final cache size
calculation will be incorrect if they aren’t. This can happen when there
are several parallel ongoing cleanups of the same subdirectory.
Also removed the “delete sibling files” logic; it’s unnecessary for all
siblings except .stderr since that’s the only file in a result that is
optional. Any other missing file will be detected by
get_file_from_cache.
Joel Rosdahl [Sun, 11 Mar 2018 15:08:37 +0000 (16:08 +0100)]
Merge branch '3.4-maint'
* 3.4-maint:
Update NEWS
Clean up
Support out-of-source builds
Be consistent with “Clang” and “NVCC” names in NEWS
Don’t apply Clang workaround for PCH dependencies for other compilers
Joel Rosdahl [Sun, 4 Mar 2018 09:45:50 +0000 (10:45 +0100)]
Improve man page generation
* Use AsciiDoc’s a2x tool instead of running xsltproc explicitly.
* Stow away ccache.1 in doc.
* Make AsciiDoc literals stand out as bold in the man page. We can now
use properly literals instead of emphasis in the manual.
Allow a pre-computed checksum file for precompiled headers
Having large precompiled header files slows down direct mode off
CCache considerably. Allow CCache to check against a (much smaller)
pre-computed checksum file instead of the precompiled header file
itself. This checksum file will be used in the manifest instead of
the actual precompiled header file.
Note that to make this to work, the build system needs to keep a
checksum file in sync with the precompiled header.
The behavior can be activated by the `pch_external_checksum` option.