Joel Rosdahl [Fri, 20 Aug 2021 17:56:17 +0000 (19:56 +0200)]
fix(test): Fix .incbin test with newer binutils
The assembler in binutils 2.37 doesn’t want to include /dev/null with
a .incbin directive:
/tmp/ccbGWiew.s: Assembler messages:
/tmp/ccbGWiew.s:4: Error: unable to include `/dev/null'
incbin.s: Assembler messages:
incbin.s:1: Error: unable to include `/dev/null'
Joel Rosdahl [Thu, 19 Aug 2021 18:34:43 +0000 (20:34 +0200)]
build: Improve detection av Ccache version from source repo
When running CMake outside the source repository a plain git command
naturally won’t find the repository. Fix this by pointing git towards
the repository.
Joel Rosdahl [Mon, 16 Aug 2021 06:10:21 +0000 (08:10 +0200)]
feat: Improve statistics summary
The number of statistics counters has become very large, making the
output “ccache -s” hard to overview.
Improvements:
- The -s/--show-stats option now prints a more condensed overview where
the counters representing “uncacheable calls” are summed as
“uncacheable” and “errors” counters. Note: Scripts should use
--print-stats instead of trying to parse the output of --show-stats.
- Added hit rate for direct/preprocessed hits/misses as well.
- Added a new -v/--verbose option, which makes --show-stats and
--show-log-stats show more details.
Joel Rosdahl [Tue, 10 Aug 2021 13:32:07 +0000 (15:32 +0200)]
feat: Make --config-path and --directory affect whole command line
Command line options are processed strictly in order, which means that
ccache -d dir -s
is not the same as
ccache -s -d dir
which is not very intuitive. There are also planned features where is
doesn’t make sense to have to put “non-command options” before the
“command options”.
Improve this by processing command line options in two passes: first
non-command options and then command options (still in order).
Joel Rosdahl [Sun, 8 Aug 2021 08:40:58 +0000 (10:40 +0200)]
refactor: Improve handling of statistics updates and expected events
Ccache uses exceptions for both truly exceptional events (such as I/O
error) and non-exceptional events (such as unsupported compiler
arguments). Regardless of the nature of the event, at most one
statistics counter can be incremented.
Improve this by:
- Using nonstd::expected instead of exceptions internally in the main
code flow. This makes the code easier to reason about.
- Adding support for communicating several statistics counter updates
both for success and failure code paths. This is in preparation for
future improvements of statistics related to secondary storage.
Joel Rosdahl [Sat, 7 Aug 2021 11:12:56 +0000 (13:12 +0200)]
fix: Don’t read let Context read user configuration in unit tests
accd21e4 inadvertently made unit tests populate Context::config from the
environment and the user configuration. Fix this by moving code for
reading config, setting of logging, etc. into a separate method only to
be called by non-test code.
Joel Rosdahl [Sat, 7 Aug 2021 07:00:17 +0000 (09:00 +0200)]
feat(storage): Add support for cache sharding on secondary storage (#912)
This adds support for a shards attribute with a comma-separated list of
names for sharding (partitioning) the cache entries using Rendezvous
hashing, typically to spread the cache over a server cluster. When set,
the storage URL must contain an asterisk (*), which will be replaced by
one of the shard names to form a real URL. A shard name can optionally
have an appended weight within parentheses to indicate how much of the
key space should be associated with that shard. A shard with weight w
will contain w/S of the cache, where S is the sum of all shard weights.
A weight could for instance be set to represent the available memory for
a memory cache on a specific server. The default weight is 1.
will put 55% (3/5.5) of the cache on redis://cache-a.example.com, 18%
(1/5.5) on redis://cache-b.example.com and 27% (1.5/5.5) on
redis://cache-c.example.com.
Joel Rosdahl [Fri, 30 Jul 2021 18:10:50 +0000 (20:10 +0200)]
build: Only probe for faster linker in dev build mode and on x86_64
Using Gold or LLD on less common platforms such as MIPS may not be a
good idea (see e.g.
<https://www.sourceware.org/bugzilla/show_bug.cgi?id=22838>), so be
conservative and only probe for a faster linker on platforms that likely
don’t have toolchain bugs. Also, using a faster linker is in practice
only relevant for dev builds.
Arne Hasselbring [Fri, 30 Jul 2021 18:29:45 +0000 (20:29 +0200)]
fix: Disable preprocessor hits for PCHs with Clang again (#909)
I added this in 3ec58dbcaa1e7903d59dce4c77baff7bc3783269 as I thought
clang only saves the timestamps of included files, so as long as they
are turned off by -Xclang -fno-pch-timestamp, preprocessed hits should be
possible. However, clang also saves the size and possibly a hash of the
un-preprocessed source file, so preprocessed hits don't make much sense.
As long as only the timestamp of a PCH source file changed, e.g. through
git operations, there should still be direct hits.
Joel Rosdahl [Fri, 30 Jul 2021 08:19:35 +0000 (10:19 +0200)]
build: Improve message when pkg-config can’t find libhiredis
pkg_check_modules stops immediately when given the REQUIRED argument so
the nicer error message won’t be reached. Fix this by simply removing
REQUIRED since that will make the configuration step fail in a better
way.
Joel Rosdahl [Wed, 28 Jul 2021 18:15:10 +0000 (20:15 +0200)]
build: Remove “_lib” suffix from ccache_lib and third_party_lib
This means that libthird_party_lib.a will become libthird_party.a which
removes repetition of “lib”. ccache_lib can’t be renamed to just ccache
since that’s the name of the main binary, so that’s renamed to
ccache_framework.