]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Context: move has_absolute_include_headers
authorThomas Otto <thomas.otto@pdv-fs.de>
Sat, 25 Jan 2020 09:55:49 +0000 (10:55 +0100)
committerThomas Otto <thomas.otto@pdv-fs.de>
Mon, 17 Feb 2020 20:55:02 +0000 (21:55 +0100)
src/Context.hpp
src/ccache.cpp
src/legacy_globals.cpp
src/legacy_globals.hpp

index cb60dcb6e80debcfdd8a7d063f84673270a48d6f..4931ebc63a6a13a210eaab7a2549464c5e4dd4e6 100644 (file)
@@ -69,4 +69,7 @@ struct Context : NonCopyable
   // Files included by the preprocessor and their hashes.
   // Key: file path. Value: struct digest.
   std::unordered_map<std::string, digest> included_files;
+
+  // Uses absolute path for some include files.
+  bool has_absolute_include_headers = false;
 };
index 7a0ce22590978cbb21689365f06d50b079067c89..a15b58d636d00df71ea375809abfd9defde8cb37 100644 (file)
@@ -806,8 +806,8 @@ process_preprocessed_file(Context& ctx,
       }
       // p and q span the include file path.
       char* inc_path = x_strndup(p, q - p);
-      if (!has_absolute_include_headers) {
-        has_absolute_include_headers = is_absolute_path(inc_path);
+      if (!ctx.has_absolute_include_headers) {
+        ctx.has_absolute_include_headers = is_absolute_path(inc_path);
       }
       char* saved_inc_path = inc_path;
       inc_path = x_strdup(make_relative_path(ctx, inc_path).c_str());
@@ -892,7 +892,7 @@ use_relative_paths_in_depfile(const Context& ctx)
     cc_log("Base dir not set, skip using relative paths");
     return; // nothing to do
   }
-  if (!has_absolute_include_headers) {
+  if (!ctx.has_absolute_include_headers) {
     cc_log(
       "No absolute path for included files found, skip using relative"
       " paths");
@@ -994,8 +994,8 @@ result_name_from_depfile(Context& ctx, struct hash* hash)
       if (str_endswith(token, ":") || str_eq(token, "\\")) {
         continue;
       }
-      if (!has_absolute_include_headers) {
-        has_absolute_include_headers = is_absolute_path(token);
+      if (!ctx.has_absolute_include_headers) {
+        ctx.has_absolute_include_headers = is_absolute_path(token);
       }
       std::string path = make_relative_path(ctx, token);
       remember_include_file(ctx, path, hash, false, hash);
@@ -3531,7 +3531,6 @@ cc_reset()
   }
   free_and_nullify(ignore_headers);
   ignore_headers_len = 0;
-  has_absolute_include_headers = false;
   i_tmpfile = NULL;
   free_and_nullify(cpp_stderr);
 }
index 7c91213de5c59484a6e14b07ecec0dec946328b2..80898479c3cba1b3c69766aecbf84b068e8fd35e 100644 (file)
@@ -18,9 +18,6 @@
 
 #include "legacy_globals.hpp"
 
-// Uses absolute path for some include files.
-bool has_absolute_include_headers = false;
-
 // List of headers to ignore.
 char** ignore_headers;
 
index 2e065b8d75d576d483f5f04a4e999f30ca3b30e6..eba4d1400ccc2807577b345be97c1d11c7d24c83 100644 (file)
@@ -30,8 +30,6 @@
 
 extern unsigned lock_staleness_limit;
 
-extern bool has_absolute_include_headers;
-
 extern char** ignore_headers;
 
 extern size_t ignore_headers_len;