summaryrefslogtreecommitdiff
path: root/src/ccache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* refactor: Improve calculate_result_and_manifest_key parametersJoel Rosdahl2023-04-191-12/+12
| | | | | As suggested by clang-tidy (readability-suspicious-call-argument,-warnings-as-errors).
* fix: Don't add additional depend mode options after Clang -- optionJoel Rosdahl2023-04-171-1/+3
| | | | | | | | | | | | | With the depend mode enabled, ccache executes the original command line verbatim, potentially with the addition of a few extra options. However, for clang or clang-cl it is not possible to simply append the additional options to the end of the original command line since there may be a "--" option to indicate the end of options. Fix this by inserting the additional options directly after the compiler instead of at the end. Fixes #1273.
* feat: Make it possible to disable ccache for a certain source code fileJoel Rosdahl2023-03-071-0/+23
|
* refactor: Use util::BitSet for hash_source_code_fileJoel Rosdahl2023-03-071-6/+6
|
* refactor: Use util::BitSet for core::SloppinessJoel Rosdahl2023-03-051-7/+7
|
* feat: Add support for setting per-compilation config on command lineJoel Rosdahl2023-02-201-58/+71
| | | | Closes #1035.
* fix: Log config and command line before finding compilerJoel Rosdahl2023-02-091-16/+18
| | | | | | | | If the compiler can't be found then ccache exits early and doesn't print the config and command line to the log. This makes it harder to debug problems with finding the compiler, like issue #1249. Improve this by logging "safe things" before searching for the compiler.
* fix: Cache path relativization in preprocessed outputJoel Rosdahl2023-01-291-3/+14
| | | | | | | | | | | | | | After PR #1033 and [1], a stat call is made each time a note about an include file is found in the preprocessed output. Such calls are very performant on Linux (and therefore unnoticed until now), but apparently costly on Windows. Fix this by caching the calculation of relative paths in process_preprocessed_file. [1]: 9a05332915d2808f4713437006b3f7c812d9fd74 Closes #1245.
* fix: Only use original umask when retrieving resultJoel Rosdahl2022-12-231-2/+1
| | | | | | | This fixes a problem where the original umask would be used when storing a remote cache result in the local cache in from_cache. Fixes #1235.
* fix: Fix matching of base directory for MSVCJoel Rosdahl2022-12-231-2/+3
| | | | | | The base directory will now match case-insensitively with absolute paths in preprocessed output, or from /showIncludes in the depend mode case, when compiling with MSVC.
* fix: Improve fix for local/remote cache misses in depend modeJoel Rosdahl2022-12-201-2/+18
|
* fix: Fix reporting of local/remote cache misses in depend modeJoel Rosdahl2022-12-131-0/+5
|
* refactor: Remove empty if clauseJoel Rosdahl2022-11-101-4/+5
| | | | This is to please CodeQL's "Futile condition" check.
* feat: Include I_MPI_CC/I_MPI_CXX in the input hashJoel Rosdahl2022-11-051-0/+6
| | | | | | | | | | The I_MPI_CC and I_MPI_CXX variables affect which underlying compiler ICC uses. Reference: <https://www.intel.com/content/www/us/en/develop/documentation/ mpi-developer-reference-windows/top/environment-variable-reference/ compilation-environment-variables.html>. Closes #1210.
* fix: Hash variables that affect Clang version on macOSJoel Rosdahl2022-11-031-2/+8
| | | | Fixes #1205.
* chore: Improve logging of file read failuresJoel Rosdahl2022-11-021-4/+8
|
* fix: Handle -MD/-MMD when compiling assembler fileJoel Rosdahl2022-10-191-27/+46
| | | | | | | | | | When compiling an assembler file, -MD and -MMD don't produce any dependency file, so don't expect one. Also, make sure to fall back to running the real compiler in case an expected output file is missing instead of exiting with an error. Fixes #1189.
* refactor: Avoid an extra data copy when rewriting stdoutJoel Rosdahl2022-10-161-4/+6
|
* refactor: Rename ShowIncludesParser to MsvcShowIncludesOutputJoel Rosdahl2022-10-161-4/+4
| | | | | | | I think that this is more in line with what the namespace represents. I also renamed ShowIncludesParser::tokenize to MsvcShowIncludesOutput::get_includes since it's not returning generic tokens but specifically includes files.
* doc: Tweak manual and comments related to /showIncludesJoel Rosdahl2022-10-161-1/+1
|
* feat: Support auto depend mode for MSVC without /showIncludes (#1176)Orgad Shaneh2022-10-151-2/+8
| | | | If MSVC is executed *without* /showIncludes, and ccache is configured with depend mode, add /showIncludes and strip the extra output from stdout.
* feat: Support depend mode for MSVC (#992)Orgad Shaneh2022-10-121-9/+47
| | | | | | | | | Based on -showIncludes, which prints included files on stdout with a certain text prefix. Otherwise pretty similar to depend mode handling for GCC. This makes MSVC building way faster. Co-authored-by: Luboš Luňák <l.lunak@centrum.cz>
* refactor: Store compiler output as bytesJoel Rosdahl2022-10-051-24/+28
| | | | As discussed in #1173.
* fix: Retain line CRLF in compiler output on Windows (#1173)Orgad Shaneh2022-10-051-4/+7
| | | | | When the cached data is read, the output to fd is binary (Util::send_to_fd), so in order to maintain the original line endings, the output must be stored as binary too.
* Revert "feat: Support auto depend mode for MSVC without /showIncludes (#1158)"Joel Rosdahl2022-10-051-55/+9
| | | | | | This reverts commit 8b65880b5ad817156b58c58b5133aafc99b0a264. See <https://github.com/ccache/ccache/pull/1158#issuecomment-1268748557>.
* feat: Support auto depend mode for MSVC without /showIncludes (#1158)Orgad Shaneh2022-10-051-9/+55
| | | Co-authored-by: Luboš Luňák <l.lunak@centrum.cz>
* fix: Capture MSVC stdout/stderr when running from Visual Studio (#1170)Orgad Shaneh2022-10-051-0/+6
|
* feat: Improve handling of -frandom-seed and description of sloppinessJoel Rosdahl2022-10-041-4/+1
| | | | | | I should not be necessary to distinguish between existence and non-existence of -frandom-seed if random_seed sloppiness is requested, so don't hash the "-frandom-seed=" part either.
* feat: Add sloppiness for -frandom-seed (#1168)Raihaan Shouhell2022-10-041-0/+9
|
* fix: Don't increment preprocessed_cache_miss in recache modeJoel Rosdahl2022-10-021-1/+3
|
* refactor: Extract code for retrieving manifest to a functionJoel Rosdahl2022-09-281-40/+54
|
* feat: Implement "remote only" modeJoel Rosdahl2022-09-281-4/+8
| | | | Closes #1010.
* chore: Rename primary/secondary storage to local/remote storageJoel Rosdahl2022-09-271-14/+14
| | | | | | | | | | | | | | | | | There is a feature request to be able not to use a local cache at all, only a network cache. With such a feature, the names "primary storage" and "secondary storage" make less sense since ccache would be operating in "secondary only" mode, but then that storage would of course become the primary (and only). Let's rename "primary storage" to "local storage" and "secondary storage" to "remote storage" – operating in "remote only" mode then makes sense. One of the original motivations to call networked storage "secondary" is that the file storage can be used for local file systems as well, making such storage "not quite remote", but in practice I guess the file storage backend used primarily for network file systems.
* chore: Rename primary/secondary config to config/system configJoel Rosdahl2022-09-271-2/+2
|
* feat: Use subsecond timestamps for include file checkJoel Rosdahl2022-09-211-6/+2
| | | | | | | | | | To avoid a race condition, ccache disables the direct mode if an include file has a too new mtime or ctime. Previously this check used one second resolution timestamps, which meant that a generated include file often would disable direct mode hits for up to one second. Now ccache uses timestamps with subsecond resolution (nanoseconds on Linux), so the direct mode will in practice no longer have to be disabled for generated include files.
* refactor: Use util::TimePoint for timestampsJoel Rosdahl2022-09-211-15/+12
|
* feat: Merge local manifest with fetched remote manifestJoel Rosdahl2022-09-211-0/+10
| | | | | | | | | | | | | | | | | | | | With read-only secondary storage, it can happen that primary storage has a manifest named M with a result entry R1, while secondary storage also has a manifest M but with result R2. On a compilation that matches R2, ccache will first succeed to look up M in primary storage, fail to find R2 and then get M from secondary storage where R2 can be found. Since M already exists locally, ccache will simply return the cache hit but not store knowledge of R2 locally. On a rebuild of R2, ccache therefore needs to fetch from secondary storage again. The improvement brought by this commit is that ccache now merges the manifests from primary and secondary storage and stores the merged version in primary storage. In other words, ccache setups with read-only secondary storage will be able to accumulate local header file combinations and seamlessly combine them with changes from secondary storage. Closes #1049.
* refactor: Extract timestamp logic from ManifestJoel Rosdahl2022-09-211-3/+21
|
* refactor: Improve Storage::get API to be able to return multiple timesJoel Rosdahl2022-09-211-37/+18
|
* refactor(storage): Pass cache entries via memory instead of filesJoel Rosdahl2022-09-211-113/+49
|
* fix: Make sure that temporary files always have .tmp. in the nameJoel Rosdahl2022-09-211-4/+3
| | | | | PrimaryStorage::clean_dir relies on being able to classify temporary files from the filename.
* chore: Simplify cache entry reading and writingJoel Rosdahl2022-09-211-65/+34
| | | | | | | | | | | | | | | | Cache entries are now fully read into memory before (de)compressing, checksumming and parsing, instead of streaming data like before. While this increases memory usage when working with large object files, it also simplifies the code a lot. Another motivation for this change is that cache entry data is not streamed from secondary storage anyway, and it makes sense to keep the architecture simple and similar for primary and secondary storage code paths. The cache entry format has modified so that the checksum covers the potentially compressed payload (plus the header), not the uncompressed payload (plus the header) like before. The checksum is now also stored in an uncompressed epilogue. Since the cache entry format has been changed, the input hash has been changed as well.
* refactor: Let core::CacheEntryDataWriter work with util::BytesJoel Rosdahl2022-09-211-2/+2
|
* refactor: Use memory buffers instead of streams for manifestsJoel Rosdahl2022-09-211-2/+8
| | | | | This is part of a larger refactoring effort with the goal of simplifying how cache entries are read and processed.
* refactor: Use memory buffers instead of streams for resultsJoel Rosdahl2022-09-211-39/+77
| | | | | | | | | | - Result objects now only know and care about the result payload part of a result cache entry. - Result object are no longer tightly coupled with the primary storage implementation. This is part of a larger refactoring effort with the goal of simplifying how cache entries are read and processed.
* refactor: Pass Config instead of Context to Result::WriterJoel Rosdahl2022-09-061-1/+1
|
* refactor: Split calculate_result_and_manifest_key functionJoel Rosdahl2022-08-301-328/+360
|
* feat: Add support for Clang "--" optionJoel Rosdahl2022-08-281-0/+4
| | | | Closes #1149.
* chore: Tweak code format and commentJoel Rosdahl2022-08-281-5/+4
|
* feat: Add support for caching assembler listing filesJoel Rosdahl2022-08-281-0/+39
| | | | Closes #1090.