Joel Rosdahl [Fri, 7 Jul 2023 13:44:28 +0000 (15:44 +0200)]
chore: Remove now unused Hash::HashType distinction
After 561be2085df94b3c35dd803e56668e6feafc93b7 hash debugging will never
be enabled for a Hash instance that hashes binary data, so remove the
now unused Hash::HashType enum and related code.
Joel Rosdahl [Wed, 21 Jun 2023 19:22:44 +0000 (21:22 +0200)]
feat: Let ignore_options/CCACHE_IGNOREOPTIONS also skip option
The ignore_options (CCACHE_IGNOREOPTIONS) configuration makes ccache
exclude matching compiler options from the input hash. This commit also
makes ccache skip matching compiler options from any special processing,
similar to how --ccache-skip works.
Joel Rosdahl [Tue, 6 Jun 2023 19:42:12 +0000 (21:42 +0200)]
fix: Don't pass -v to the preprocessor
The -v option tells the compiler to print various diagnostics to stdout,
including randomly generated filenames. When ccache calls the
preprocessor and -v is on the command line, the random information will
become part of the input hash, making the preprocessor mode always
produce cache misses.
Fix this by only passing -v when compiling, not preprocessing.
Rafael Kitover [Tue, 23 May 2023 21:42:12 +0000 (21:42 +0000)]
fix: Quiet cmake warning for extracted timestamps
For zstd and hiredis downloaded from the Internet, set cmake policy
CMP0135 to NEW to set the timestamps of extracted archive members to the
time of extraction to suppress the cmake dev warning on newer versions
of cmake.
Check that the policy exists so that this works on older versions of
cmake.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Joel Rosdahl [Mon, 22 May 2023 17:58:41 +0000 (19:58 +0200)]
fix: Fix undefined behavior in util::read_file_part for zero count
If util::read_file_part's count argument is 0 (which can currently only
happen in unit tests), we'll do &result[0] where result is
default-initialized std::unique_ptr<uint8_t[]>. This is not allowed even
though we won't actually dereference the pointer. Found by compiling
with -D_GLIBCXX_ASSERTIONS.
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.
Joel Rosdahl [Mon, 17 Apr 2023 16:08:24 +0000 (18:08 +0200)]
fix: Find Ccache version from lightweight Git tag
Ccache calculates its version from a matching Git tag by using the "git
describe" command, which only considers annotated tags. All ccache tags
are annotated. However, when running a GitHub action job for a tag the
local Git repository is (at least by default) a shallow clone with the
tag being converted to a lightweight tag. This makes "git describe" not
see the tag.
Fix this by adding --tags to "git describe" to make it consider
lightweight tags as well.
Joel Rosdahl [Mon, 17 Apr 2023 06:26:13 +0000 (08:26 +0200)]
ci: Disable Windows 64-bit MSBuild jobs for now
The Windows VS2019 64-bit MSBuild and Windows VS2022 64-bit MSBuild
GitHub actions jobs have started failing on master due to some changes
in the CI environment. See issue #1278.
Tobias Hieta [Tue, 28 Mar 2023 19:45:37 +0000 (21:45 +0200)]
feat: Don't treat /Zi as unsupported for clang-cl (#1266)
For MSVC /Zi is unsupported since it writes a additional
.pdb file per each .obj file and it creates some messy
interaction with ccache. But for clang-cl /Zi is actually
treated as /Z7 and only embeds the debug info in the .obj
file so it makes sense to allow this flag when compiling
with clang-cl.
Joel Rosdahl [Wed, 8 Mar 2023 07:10:27 +0000 (08:10 +0100)]
feat: Support overriding MSVC /Z* options
MSVC options /Zi and /ZI are too hard since they produce separate PDB
files. /Z7 is OK, but if the command line contains /Zi or /ZI followed
by /Z7, MSVC will use the latter (with a warning) but ccache will still
consider the command line too hard.
This commit makes ccache understand that only the last /Z* option will
be used and thus accepts the command line if the last /Z* option is /Z7.
Joel Rosdahl [Thu, 2 Mar 2023 17:14:49 +0000 (18:14 +0100)]
feat: Improve cache size presentation and specification
Aligned how cache size is presented (in "ccache --show-stats", "ccache
--show-compression", "ccache --recompress", debug logs, etc.) and
specified (in configuration files, "ccache --max-size" and "ccache
--trim-max-size"). The size units are now formatted according to the
type of size unit prefix used for the max_size/CCACHE_MAXSIZE setting: a
decimal size unit prefix (k/M/G/T with or without B for bytes) in
max_size means using decimal size unit prefix for presented sizes, and
similar for binary size unit prefixes (Ki/Mi/Gi/Ti with or without B for
bytes). If no unit is specified, GiB is assumed, . For example, "ccache -M
10" means 10 GiB.
Also aligned how cache sizes are calculated. Now all sizes are computed
as "apparent size", i.e., rounded up to the disk block size. This means
that the cache size in "--show-stats" and the sizes presented in
"--show-compression" and "--recompress" now match.