| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
Closes #1035.
|
| | |
|
| |
|
|
|
|
|
| |
Including a timestamp in the filenames makes it easier to compare two
builds without having to save previous debug files before the second
build. It also makes sure debug files won't be overwritten if an object
file is compiled several times during one build.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Using
mode_t mask = umask(0);
umask(mask);
to retrieve the current umask isn't thread-safe. This messed up file
permissions when recompressing the cache.
Fix this by caching the last set value and always using
Util::{get,set}_umask to get and set the umask.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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.
As noted by Michael Kruse in #815.
|
| |
|
|
|
|
|
|
|
|
|
| |
- The Counters class has been moved to core::StatisticsCounters.
- Functionality in the Statistics namespace has been split into:
- core::StatsLog: Knows about “stats log” format.
- core::Statistics: Knows about properties of statistics fields and
how to present them.
- storage::primary::PrimaryStorage: Knows how to store and update
statistics in the primary storage backend.
- storage::primary::StatsFile: Knows about the “stats file” format.
|
| | |
|
| |
|
|
| |
This is the next step after a57f70eda32e99221de56f5499079b4f00dc2bc5.
|
| | |
|
| | |
|
| |
|
|
| |
This is the code that deals with retrieving and storing cache entries.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unless when compiling a preprocessed file directly, ccache creates a
temporary file to store the output of the preprocessor, registers the
file for removal at program exit, renames the file to one with a .i/.ii
extension and then registers that file for removal as well. This works
by chance in practice as long as mkstemp() returns something with low
probability of being reused, but as discussed in #736 it risks failing
when mkstemp() doesn’t behave that way.
Fix this by creating the new name (with the needed extension) using a
hard link so that the original file will outlive the new file, thus
blocking another ccache process from creating a file with the same name
again. To make the new temporary file outlive the old file, also delete
pending temporary files in LIFO order.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fmtlib can detect format string errors at compile time if (1) applying
FMT_STRING to the format string literal and (2) compiling for C++14 or
higher.
Requirement 1 is implemented by introducing a LOG macro which applies
FMT_STRING to the first argument and calls Logging::log (if logging is
enabled). Also added are a companion LOG_RAW macro (since C++11 requires
at least one argument for the “...” part in variadic macros) and a
BULK_LOG macro which calls Logging::bulk_log (if logging is enabled).
Requirement 2 is implemented by setting CMAKE_CXX_STANDARD to 14 for one
CI build with a known C++14-capable compiler. We can’t set it to 14 by
default since we still want the code to be buildable with C++11
compilers.
This will catch errors such as the one fixed by PR #691.
|
| |
|
|
|
|
| |
This makes ccache choose an appropriate cache level structure
automatically based on a maximum number of files per directory,
currently hardcoded to 2000.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
This is in preparation for two things:
1. Storing cache statistics (except size/files bookkeeping) on level 2
instead of level 1, thus making “cache_dir_levels = 1” invalid.
2. Implementing automatic choice of cache levels based on the number of
files in the cache.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
Perform flushing of statistics counters (potentially triggering cache
cleanup) and log files in a finalizer inside cache_compilation instead
of in Conxtext’s destructor. This moves somewhat complex logic from
Context into the main ccache code.
As a side effect of this, stats_flush and stats_flush_to_file are
superfluous.
|
| |
|
|
| |
Fixes #656.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Closes #578.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The inode cache is a process shared cache that maps from device, inode,
size, mtime and ctime to saved hash results. The cache is stored
persistently in a single file that is mapped into shared memory by
running processes, allowing computed hash values to be reused both
within and between builds.
The chosen technical solution works for Linux and might work on other POSIX
platforms, but is not meant to be supported on non-POSIX platforms
such as Windows.
Use 'ccache -o inode_cache=true/false' to activate/deactivate the cache.
|
| |
|
|
|
|
|
|
|
|
| |
* Added a SignalHandler class which encapsulates parts related to signal
handling.
* Moved data referenced by the exit functions to Context (compiler PID,
pending temporary files and pending debug log files).
* Let the Context destructor do what the exitfn functionality used to
do.
* Removed the now superfluous exitfn functionality.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
Also remove file writing logic from `stats_update_size()` and
delete unused declaration of `stats_timestamp()`.
|
| | |
|
| | |
|
| |
|
|
| |
Also convert result_path to std::string.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The different functions related to current working directory (CWD) have
become messy during the years:
- gnu_getcwd is a simple wrapper around getcwd(3), thus returning the
actual canonical path.
- get_cwd returns $PWD, falling back to getcwd(3) if $PWD is not sane.
- get_current_working_dir (local function in ccache.cpp) memoizes
x_realpath(get_cwd()) (i.e., getcwd(3) in essence...) in the global
current_working_dir variable. Unit tests may manipulate
current_working_dir.
Improve this by:
- Replacing gnu_getcwd with Util::get_actual_cwd.
- Replacing get_cwd with Util::get_apparent_cwd.
- Removing get_current_working_dir and placing both actual and apparent
CWD in the context object.
|
| | |
|
| | |
|
| |
|
|
| |
Also adapted downstream stats functions.
|
| | |
|
|
|
The goal is to eventually move almost all global state into Context.
|