| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The idea of this is to make a proper C++ API while at the same time
implementing most of the old legacy args API. This makes it possible to
refactor call sites gradually instead of in a series of large
refactoring steps.
Given that “struct args* args” is replaced with “Args args”, the
following types of legacy API usage can be kept without source changes:
1. The args_* functions can be used as is.
2. args->argv[i] still works for read access.
Things that aren’t emulated:
1. args->argc (use args.size() instead).
2. args->argv to access the underlying char* array (use
args.to_argv().data() instead).
3. Mutating the args->argv[i] string in place (don’t do that).
In other words, code that uses args_foo(args, ...) and args->argv[i] can
easily be converted to args.bar(...) and args[i] (with std::string
arguments instead of char*) at will and in arbitrarily small steps.
|
|
|
| |
These changes enable building on Oracle Solaris 11.4 for both i386 and sparc.
|
| |
|
| |
|
| |
|
|
|
|
| |
(cherry picked from commit f7f2333b46bcb2a0cbb323c144d59cc5abb267f6)
|
|
|
|
|
|
| |
It should have been removed in c181fdd9.
Fixes #569.
|
|
|
|
| |
I don’t consider explicit reformatting to be an error.
|
|
|
| |
Also print only diff to stdout and fix tabs.
|
|
|
|
|
|
|
|
|
| |
There is no need to generate a unique temporary name in x_unlink since
we don’t care whether the temporary file is clobbered on NFS. The
previous usage of tmp_string() was not quite correct since the returned
string is supposed to be passed to mkstemp, not used as is.
(cherry picked from commit e7776305184c9338ee97334078153f298f6cfea7)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When hard link mode is enabled, ccache ≥3.6 unlinks the output file
before writing to it as a workaround for a bug in Clang (#331). This
unfortunately means that /dev/null will be removed when building as root
(don’t do that, BTW) with hard link mode enabled and /dev/null as the
the output file. A similar problem exists if the dependency file is
/dev/null, regardless of hard link mode.
Fix this by not unlinking the output file if it’s /dev/null and by not
copying files to /dev/null at all. (There is no need to handle other
non-regular output files since /dev/null is the only allowed non-regular
output file.)
Fixes #564.
(cherry picked from commit 9a794689a8ba47e79c96d6c370976448b756973c)
|
| |
|
| |
|
| |
|
|
|
|
| |
(cherry picked from commit ec65f9f88cf75cbd9f04d88c4a3345fb60911975)
|
|
|
|
| |
(cherry picked from commit 21fc81c11966d674c3b3cfe30ccf3cdff7f6dfee)
|
|
|
|
| |
(cherry picked from commit fc8182ae95af0f46fc8f71ab29e91534636325b7)
|
| |
|
|
|
|
|
|
| |
No need to remove via another temporary file.
(cherry picked from commit c74b625aaa46db85797a691c81f129834c7fd82e)
|
| |
|
|
|
|
|
|
| |
Acquiring a .lock.lock file does not make lock breaking significantly
safer; there is still a race condition. Simplify it by simply deleting
the lockfile when breaking and try to acquire it again.
|
|
|
|
|
|
|
|
|
|
| |
Instead of emulating the POSIX version, use the native Windows file API
to create a lockfile. This should mitigate several problems with the old
implementation.
Hopefully fixes #537.
(cherry picked from commit 53b9fdd6272896bb4a2dc42c9680d4030f86b33c)
|
|
|
|
| |
(cherry picked from commit 41ffc7ec009237da51040c6059b1bcd7903af30d)
|
|
|
|
|
| |
This can now be done due to no longer using realpath in
make_relative_path (e8444a38).
|
|
|
|
|
| |
Previously the version of a master-based development build was something
like 3.7.1+NNN_gSHORTHASH which is a bit misleading.
|
|
|
|
| |
Also remove file writing logic from `stats_update_size()` and
delete unused declaration of `stats_timestamp()`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Avoid one extra read call after the final bytes are read
If read returns less then the requested number of bytes, the file is at
EOF. This can be used in all places where a read is done, but it makes extra
impact in read_file where if the buffer is made one byte bigger than needed,
EOF can be detected before a unnecessary memory reallocation is done.
* Use write instead of fwrite to write the result file
This avoids the caching in stdio where a write is split into two (at least on
my system): first a small 4k one and then one with the remaining 60k.
|
|
|
|
|
| |
hash_source_code_string will, in read_file, stat the file to get the file
size. But when called from verify_result, the file size is already known so by
using this size the number of stat calls in a normal run can be cut in half.
|
|
|
|
| |
Regression in dcf6ab3f349a33974b31ce2e7c06a2085149ab4a.
|
| |
|
|
|
| |
Two fileclone tests rely on the output.
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- uninitvar:src/ccache.cpp:3422: Uninitialized variable: ctx
- redundantInitialization:src/legacy_util.cpp:1067: Redundant initialization
for 'q'. The initialized value is overwritten before it is read.
- constVariable:src/stats.cpp:429: Variable 'ctx' can be declared with const
- variableScope:src/Util.cpp:404: The scope of the variable 'right' can be
reduced.
|
| |
| |
| |
| | |
to function taking std::string.
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current working directory (CWD) can come from two sources: Either
the return value of getcwd(3) (“actual CWD” below) or the environment
variable $PWD (“apparent CWD” below). The former is returned by e.g.
$(CURDIR) in Makefiles and by “pwd -P” and is always in normalized form
(no “.” or “..” parts or extra slashes). The latter is returned by “echo
$PWD” or “pwd” and can potentially be in unnormalized form on some
systems.
The actual CWD and apparent CWD may also differ if there are symlinks in
the path. Absolute paths to files given to ccache can therefore be based
on either of these CWD forms. When computing relative paths under the
base directory the CWD needs be in normalized form for the algorithm to
be reasonably simple.
2df269a3 solved a bug with an unnormalized apparent CWD by using
realpath(3) for normalization. Using realpath also makes the algorithm
correct in the presence of symlinks. It however also means that all
symlinks (both in CWD and in command line arguments) are dereferenced.
The downside of this is that if either of the symlink targets contain
specific names (such as build ID, date, username or similar) then the
relative paths will also contain those specific path names, leading to
cache misses.
Solve this by:
- Performing normalization without using realpath, i.e. without
expanding symlinks.
- Computing a relative path based on normalized CWD and normalized path.
- Checking whether the relative path resolves to the same i-node as the
original path. If it does, use it, otherwise just use the original
path (and take a potential cache miss).
- Doing the above calculation both for the actual and the apparent CWD
and choose the best one.
This solves the problem that PR #491 intended to address in a better
way.
|
|
|
|
| |
Now basedir with backslashes or forward slashes should work.
|
| |
|
| |
|
| |
|
| |
|
| |
|