Joel Rosdahl [Mon, 27 Jul 2020 18:56:45 +0000 (20:56 +0200)]
Fix build with Clang 10
Clang 10 says “error: explicitly defaulted move constructor is
implicitly deleted [...] note: move constructor of 'TemporaryFile' is
implicitly deleted because base class 'NonCopyable' has a deleted move
constructor”, so we’ll just have to do without NonCopyable. The effect
will be the same in pracice due to the “Fd fd” member not being
copyable.
The argument adds another mechanism to control contents of cache directory. And
is based on the LRU tracking behaviour.
As of now there is no way for ccache to eliminate files which were
are no longer needed. As a result these files stay and are kept around until
either max_files/max_size is reached.
If a particular project is being built regularly but for some reason is allowed
to grow in size, then under such circumstances using the LRU mechanism to control
cache size, lends as perfect solution.
The argument takes a parameter N and performs a cleanup.
While performing cleanup the oldest file in ccache can
only be N seconds old. However this cleanup will not take max_files and
max_old into consideration
Joel Rosdahl [Sat, 25 Jul 2020 18:29:44 +0000 (20:29 +0200)]
Let ResultRetriever collect and operate on the full dependency data
When rewriting the dependency target (#592) the target can in theory
span chunk boundaries, so let ResultRetriever collect and operate on the
full data, just like the stderr output.
Joel Rosdahl [Sat, 25 Jul 2020 13:56:29 +0000 (15:56 +0200)]
Introduce and use TemporaryFile class
In addition to improving code clarity, this fixes a bug where the
fallback code for “-fdiagnostics-color” tried to operate on a closed
file descriptor.
Joel Rosdahl [Fri, 24 Jul 2020 18:18:22 +0000 (20:18 +0200)]
Look for the correct phrase when detecting unsupported GCC color option
The implementation from #596 uses the spelling “command-line” instead of
“command line” (which is what is actually emitted by GCC and specified
in #224).
Joel Rosdahl [Tue, 14 Jul 2020 13:08:22 +0000 (15:08 +0200)]
Probe assembler for supported -m* flags
Since CMake uses the assembler executable for compiling assembler source
code it’s not quite correct to probe the C++ compiler (nor the C
compiler) since it may not be the same as the assembler.
Joel Rosdahl [Mon, 13 Jul 2020 11:39:45 +0000 (13:39 +0200)]
Remove dependency on std::regex
std::regex is not available for GCC 4.8. It’s also a bit bloated. The
reason for not using POSIX regex functionality is that it’s not
available in MinGW.
Joel Rosdahl [Wed, 8 Jul 2020 07:54:50 +0000 (09:54 +0200)]
Remove short read optimization from #551
I don’t feel confident about assuming that a short read for a file means
EOF in all situations. For instance, it looks like short reads can
happen of an NFS file system mounted with the “intr” option, and it can
also happen if a file entry actually is a named pipe.
Joel Rosdahl [Sat, 4 Jul 2020 11:52:16 +0000 (13:52 +0200)]
Refactor result code into a Result::Reader/Writer classes
Introduced a Result::Reader class which remove knowledge about what to
do with the individual file parts of a result. That’s instead defined by
a Result::Reader::Consumer instance passed to Result::Reader::read. This
means a ResultFileMap is no longer used and that the consumer is free to
write data whereever it wants.
The new ResultRetriever class implements retrieval by writing to local
files like before, except that the stderr data is written directly to
STDERR_FILENO instead of landing in a temporary file.
The new ResultDumper class implements “ccache --dump-result”.
Also introduced a Result::Writer class, mostly for symmetry with the
Result::Reader class.
Joel Rosdahl [Sun, 5 Jul 2020 19:00:47 +0000 (21:00 +0200)]
Tweak ci/build script
- Removed redundant “exit 0” command again.
- Removed now obsolete and misleading comments.
- If JOBS is set to the empty string then detect the number of CPUs instead
of running a limitless number of jobs.
Joel Rosdahl [Sun, 5 Jul 2020 18:35:05 +0000 (20:35 +0200)]
Use a known and set TERM variable to stabilize color_diagnostics tests
On some distributions TERM is unset when run via Docker which failed
color_diagnostics tests since ccache doesn’t enable color output if TERM
is unset. Fix this by using a known TERM value.
Joel Rosdahl [Sun, 5 Jul 2020 18:34:54 +0000 (20:34 +0200)]
Skip “Directory is not hashed if using -gz[=zlib]” tests for GCC 6
The GCC 6 (tested with GCC 6.3) preprocessor includes the current
working directory in the preprocessed output if run with -gz, which
means that there won’t be cache hits between directories, thus failing
the “Directory is not hashed if using -gz[=zlib]” tests. Fix this by
skipping the test if the preprocessor behaves that way.
Joel Rosdahl [Wed, 24 Jun 2020 07:26:23 +0000 (09:26 +0200)]
Fix color_diagnostics test failure if CCACHE_DIR is set in shell rc file
If the user sets CCACHE_DIR in a shell startup file then that value will
override the one from the test suite, thus making changes in cache
statistics invisible which triggers failures.
Joel Rosdahl [Tue, 23 Jun 2020 19:57:26 +0000 (21:57 +0200)]
Rename generated Version.cpp to version.cpp
The convention is to use capitalized filenames for source files that
implement classes and namespaces and lowercase filenames for source
files that do not.