]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Context: move output_is_precompiled_header
authorThomas Otto <thomas.otto@pdv-fs.de>
Fri, 24 Jan 2020 19:16:47 +0000 (20:16 +0100)
committerThomas Otto <thomas.otto@pdv-fs.de>
Mon, 17 Feb 2020 20:38:59 +0000 (21:38 +0100)
src/ccache.cpp
src/ccache.hpp
src/legacy_globals.cpp
src/legacy_globals.hpp
src/manifest.cpp

index 7c85309f867b07409976ef53223c2929b145303d..7d4f5764e2a9a91f1550c7193203b65e725726de 100644 (file)
@@ -1047,7 +1047,7 @@ update_manifest_file(Context& ctx)
   // See comment in get_file_hash_index for why saving of timestamps is forced
   // for precompiled headers.
   bool save_timestamp = (ctx.config.sloppiness() & SLOPPY_FILE_STAT_MATCHES)
-                        || output_is_precompiled_header;
+                        || ctx.args_info.output_is_precompiled_header;
 
   MTR_BEGIN("manifest", "manifest_put");
   cc_log("Adding result name to %s", manifest_path);
@@ -1776,7 +1776,7 @@ calculate_result_name(Context& ctx,
     // hash. The theory is that these arguments will change the output of -E if
     // they are going to have any effect at all. For precompiled headers this
     // might not be the case.
-    if (!direct_mode && !output_is_precompiled_header
+    if (!direct_mode && !ctx.args_info.output_is_precompiled_header
         && !ctx.args_info.using_precompiled_header) {
       if (compopt_affects_cpp(args->argv[i])) {
         if (compopt_takes_arg(args->argv[i])) {
@@ -2040,7 +2040,8 @@ from_cache(Context& ctx,
   //     file 'foo.h' has been modified since the precompiled header 'foo.pch'
   //     was built
   if ((guessed_compiler == GUESSED_CLANG || guessed_compiler == GUESSED_UNKNOWN)
-      && output_is_precompiled_header && mode == FROMCACHE_CPP_MODE) {
+      && ctx.args_info.output_is_precompiled_header
+      && mode == FROMCACHE_CPP_MODE) {
     cc_log("Not considering cached precompiled header in preprocessor mode");
     return;
   }
@@ -3540,7 +3541,6 @@ cc_reset()
   has_absolute_include_headers = false;
   i_tmpfile = NULL;
   free_and_nullify(cpp_stderr);
-  output_is_precompiled_header = false;
 }
 
 // Make a copy of stderr that will not be cached, so things like distcc can
@@ -3684,8 +3684,6 @@ do_cache_compilation(Context& ctx, char* argv[])
     failed(); // stats_update is called in cc_process_args.
   }
 
-  output_is_precompiled_header = ctx.args_info.output_is_precompiled_header;
-
   arch_args_size = ctx.args_info.arch_args_size;
   for (size_t i = 0; i < ctx.args_info.arch_args_size; ++i) {
     arch_args[i] = x_strdup(ctx.args_info.arch_args[i]);
index 8d0bf256970b258f28bbe6d1aed57ce4eda3abd1..990ec7098f2360b4b43672d3abe1cc091ed42fb3 100644 (file)
@@ -62,7 +62,7 @@ enum guessed_compiler {
 #define SLOPPY_MODULES (1U << 9)
 
 extern time_t time_of_compilation;
-extern bool output_is_precompiled_header;
+
 void block_signals();
 void unblock_signals();
 bool cc_process_args(Context& ctx,
index d856dbd97d88200f592b92f50175b407f23ba4fd..468ed6d8e26536320145ebc17dbf26f7baa39940 100644 (file)
@@ -64,9 +64,6 @@ char* cpp_stderr;
 // The stats file to use for the manifest.
 char* manifest_stats_file;
 
-// Whether the output is a precompiled header.
-bool output_is_precompiled_header = false;
-
 // Compiler guessing is currently only based on the compiler name, so nothing
 // should hard-depend on it if possible.
 enum guessed_compiler guessed_compiler = GUESSED_UNKNOWN;
index d3fa54452346bd53f2ebd8bd5f8ef74356fdb25c..fb0bd27c0622fb4e0763f9231e99f7a44d1b3223 100644 (file)
@@ -56,8 +56,6 @@ extern char* cpp_stderr;
 
 extern char* manifest_stats_file;
 
-extern bool output_is_precompiled_header;
-
 extern enum guessed_compiler guessed_compiler;
 
 extern char* included_pch_file;
index 07d416b427f52bfcb81d247ba4a840e97f66ebdd..965b4f05518ce08587dc65c2f35955295d8aa64d 100644 (file)
@@ -413,7 +413,7 @@ verify_result(const Context& ctx,
     // and will error out if that header is later used without rebuilding.
     if ((guessed_compiler == GUESSED_CLANG
          || guessed_compiler == GUESSED_UNKNOWN)
-        && output_is_precompiled_header && fi.mtime != fs.mtime) {
+        && ctx.args_info.output_is_precompiled_header && fi.mtime != fs.mtime) {
       cc_log("Precompiled header includes %s, which has a new mtime",
              path.c_str());
       return false;