Joel Rosdahl [Mon, 3 Aug 2020 05:04:31 +0000 (07:04 +0200)]
C++-ify logging routines
- Simplified and C++-ified logging code.
- Added Logging::log and Logging::bulk_log functions corresponding to
the old cc_log and cc_bulklog functions. The new functions pass their
arguments to fmt::format.
- Replacements:
* init_log → Logging::init
* cc_log → Logging::log
* cc_bulklog → Logging::bulk_log
* cc_log_argv → Logging::log plus Util::format_argv_for_logging
* cc_dump_debug_log_buffer -> Logging::dump_log
- A legacy cc_log implementation is still available so that logging can
be converted gradually to the new functionality.
Joel Rosdahl [Sat, 1 Aug 2020 14:39:11 +0000 (16:39 +0200)]
Let CCACHE_UMASK apply only to files/directories in the cache directory
Ever since the CCACHE_UMASK setting was added in 75dd382407a36b3ebab36bb1027eb43a07498bec it has applied to all files
created by ccache, including files such as the object files and
executables created when ccache is called for linking. This was
presumably the easy thing to do, but it affects the observable output
from the compiler. There are also two related bugs:
1. CCACHE_UMASK is not used when creating the initial configuration file.
2. CCACHE_UMASK is used when creating the log file.
Fix this by:
- saving the original umask in Context,
- introducing a UmaskScope class,
- using UmaskScope objects to set the original umask when calling the
compiler and when copying result files from the cache, and
- setting the umask after creating the log file but before creating the
initial configuration file.
Joel Rosdahl [Sat, 1 Aug 2020 07:49:45 +0000 (09:49 +0200)]
ResultRetriever: Clear m_dest_data between entries
m_dest_data accidentally keeps its data between result entries so if an
entry has both stderr and dependency file data the stderr data will end
up in the dependency file as well. Fix this by clearing m_dest_data
properly.
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.