// Full path to the file containing the manifest
// (cachedir/a/b/cdef[...]-size.manifest).
std::string manifest_path;
+
+ // Time of compilation. Used to see if include files have changed after
+ // compilation.
+ time_t time_of_compilation = 0;
};
// starting compilation and writing the include file. See also the notes
// under "Performance" in doc/MANUAL.adoc.
if (!(ctx.config.sloppiness() & SLOPPY_INCLUDE_FILE_MTIME)
- && st.mtime() >= time_of_compilation) {
+ && st.mtime() >= ctx.time_of_compilation) {
cc_log("Include file %s too new", path.c_str());
return false;
}
// The same >= logic as above applies to the change time of the file.
if (!(ctx.config.sloppiness() & SLOPPY_INCLUDE_FILE_CTIME)
- && st.ctime() >= time_of_compilation) {
+ && st.ctime() >= ctx.time_of_compilation) {
cc_log("Include file %s ctime too new", path.c_str());
return false;
}
ctx.manifest_path,
*ctx.result_name,
g_included_files,
+ ctx.time_of_compilation,
save_timestamp)) {
cc_log("Failed to add result name to %s", ctx.manifest_path.c_str());
} else {
}
add_prefix(ctx, depend_mode_args, ctx.config.prefix_command().c_str());
- time_of_compilation = time(NULL);
+ ctx.time_of_compilation = time(NULL);
status = execute(
depend_mode_args->argv, tmp_stdout_fd, tmp_stderr_fd, &compiler_pid);
args_free(depend_mode_args);
static struct digest*
get_result_name_from_cpp(Context& ctx, struct args* args, struct hash* hash)
{
- time_of_compilation = time(NULL);
+ ctx.time_of_compilation = time(NULL);
char* path_stderr = NULL;
char* path_stdout = nullptr;
cc_reset()
{
free_and_nullify(included_pch_file);
- time_of_compilation = 0;
for (size_t i = 0; i < ignore_headers_len; i++) {
free_and_nullify(ignore_headers[i]);
}
// Allow caching even if -fmodules is used.
#define SLOPPY_MODULES (1U << 9)
-extern time_t time_of_compilation;
-
void block_signals();
void unblock_signals();
bool cc_process_args(Context& ctx,
#include "legacy_globals.hpp"
-// Time of compilation. Used to see if include files have changed after
-// compilation.
-time_t time_of_compilation;
-
// Files included by the preprocessor and their hashes. Key: file path. Value:
// struct digest.
std::unordered_map<std::string, digest> g_included_files;
extern unsigned lock_staleness_limit;
-extern time_t time_of_compilation;
-
extern std::unordered_map<std::string, digest> g_included_files;
extern bool has_absolute_include_headers;
add_result_entry(
const struct digest& result_digest,
const std::unordered_map<std::string, digest>& included_files,
+ time_t time_of_compilation,
bool save_timestamp)
{
std::unordered_map<std::string, uint32_t /*index*/> mf_files;
std::vector<uint32_t> file_info_indexes;
for (const auto& item : included_files) {
- file_info_indexes.push_back(get_file_info_index(
- item.first, item.second, mf_files, mf_file_infos, save_timestamp));
+ file_info_indexes.push_back(get_file_info_index(item.first,
+ item.second,
+ mf_files,
+ mf_file_infos,
+ time_of_compilation,
+ save_timestamp));
}
results.push_back(ResultEntry{std::move(file_info_indexes), result_digest});
const digest& digest,
const std::unordered_map<std::string, uint32_t>& mf_files,
const std::unordered_map<FileInfo, uint32_t>& mf_file_infos,
+ time_t time_of_compilation,
bool save_timestamp)
{
struct FileInfo fi;
const std::string& path,
const struct digest& result_name,
const std::unordered_map<std::string, digest>& included_files,
+
+ time_t time_of_compilation,
bool save_timestamp)
{
// We don't bother to acquire a lock when writing the manifest to disk. A
mf = std::make_unique<ManifestData>();
}
- mf->add_result_entry(result_name, included_files, save_timestamp);
+ mf->add_result_entry(
+ result_name, included_files, time_of_compilation, save_timestamp);
try {
write_manifest(config, path, *mf);
const std::string& path,
const struct digest& result_name,
const std::unordered_map<std::string, digest>& included_files,
+ time_t time_of_compilation,
bool save_timestamp);
bool manifest_dump(const std::string& path, FILE* stream);