]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Context: move generating_dependencies 538/head
authorThomas Otto <thomas.otto@pdv-fs.de>
Fri, 24 Jan 2020 18:40:14 +0000 (19:40 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 13 Feb 2020 20:15:57 +0000 (21:15 +0100)
src/ccache.cpp
src/legacy_globals.cpp
src/legacy_globals.hpp
unittest/test_argument_processing.cpp

index e61fbdea0d912c3d324d395092619649a4daacb3..dd58453c0ac4bd825a76ad246b4c3662b6a1d33d 100644 (file)
@@ -1310,8 +1310,8 @@ to_cache(Context& ctx,
     update_cached_result_globals(result_name);
   }
 
-  bool produce_dep_file =
-    generating_dependencies && ctx.args_info.output_dep != "/dev/null";
+  bool produce_dep_file = ctx.args_info.generating_dependencies
+                          && ctx.args_info.output_dep != "/dev/null";
 
   if (produce_dep_file) {
     use_relative_paths_in_depfile(ctx);
@@ -1339,7 +1339,7 @@ to_cache(Context& ctx,
     result_file_map.emplace(FileType::stderr_output, tmp_stderr);
   }
   result_file_map.emplace(FileType::object, ctx.args_info.output_obj);
-  if (generating_dependencies) {
+  if (ctx.args_info.generating_dependencies) {
     result_file_map.emplace(FileType::dependency, ctx.args_info.output_dep);
   }
   if (generating_coverage) {
@@ -1661,7 +1661,7 @@ hash_common_info(Context& ctx,
     }
   }
 
-  if (generating_dependencies || seen_split_dwarf) {
+  if (ctx.args_info.generating_dependencies || seen_split_dwarf) {
     // The output object file name is part of the .d file, so include the path
     // in the hash if generating dependencies.
     //
@@ -1812,7 +1812,7 @@ calculate_result_name(Context& ctx,
 
     // If we're generating dependencies, we make sure to skip the filename of
     // the dependency file, since it doesn't impact the output.
-    if (generating_dependencies) {
+    if (ctx.args_info.generating_dependencies) {
       if (str_startswith(args->argv[i], "-Wp,")) {
         if (str_startswith(args->argv[i], "-Wp,-MD,")
             && !strchr(args->argv[i] + 8, ',')) {
@@ -1903,7 +1903,8 @@ calculate_result_name(Context& ctx,
 
   // Make results with dependency file /dev/null different from those without
   // it.
-  if (generating_dependencies && ctx.args_info.output_dep == "/dev/null") {
+  if (ctx.args_info.generating_dependencies
+      && ctx.args_info.output_dep == "/dev/null") {
     hash_delimiter(hash, "/dev/null dependency file");
   }
 
@@ -2065,8 +2066,8 @@ from_cache(Context& ctx,
 
   MTR_BEGIN("cache", "from_cache");
 
-  bool produce_dep_file =
-    generating_dependencies && ctx.args_info.output_dep != "/dev/null";
+  bool produce_dep_file = ctx.args_info.generating_dependencies
+                          && ctx.args_info.output_dep != "/dev/null";
 
   MTR_BEGIN("file", "file_get");
 
@@ -3562,7 +3563,6 @@ cc_reset(void)
   ignore_headers_len = 0;
   g_included_files.clear();
   has_absolute_include_headers = false;
-  generating_dependencies = false;
   generating_coverage = false;
   generating_stackusage = false;
   profile_arcs = false;
@@ -3707,7 +3707,6 @@ do_cache_compilation(Context& ctx, char* argv[])
     failed(); // stats_update is called in cc_process_args.
   }
 
-  generating_dependencies = ctx.args_info.generating_dependencies;
   generating_coverage = ctx.args_info.generating_coverage;
   generating_stackusage = ctx.args_info.generating_stackusage;
   generating_diagnostics = ctx.args_info.generating_diagnostics;
@@ -3729,14 +3728,15 @@ do_cache_compilation(Context& ctx, char* argv[])
   MTR_END("main", "process_args");
 
   if (g_config.depend_mode()
-      && (!generating_dependencies || ctx.args_info.output_dep == "/dev/null"
+      && (!ctx.args_info.generating_dependencies
+          || ctx.args_info.output_dep == "/dev/null"
           || !g_config.run_second_cpp())) {
     cc_log("Disabling depend mode");
     g_config.set_depend_mode(false);
   }
 
   cc_log("Source file: %s", ctx.args_info.input_file.c_str());
-  if (generating_dependencies) {
+  if (ctx.args_info.generating_dependencies) {
     cc_log("Dependency file: %s", ctx.args_info.output_dep.c_str());
   }
   if (generating_coverage) {
index 6fc9cd8bbc857daac66f64f160aca00a6a910525..3ab84a27517c85be25897a53937917e8096761cf 100644 (file)
@@ -58,9 +58,6 @@ char** ignore_headers;
 // Size of headers to ignore list.
 size_t ignore_headers_len;
 
-// Is the compiler being asked to output dependencies?
-bool generating_dependencies;
-
 // Is the compiler being asked to output coverage?
 bool generating_coverage;
 
index 64105e0feb6f4be8c9215070f9549fd3a466ba36..ed0ace5e2f0536905a65369279b53f11c26e5d8d 100644 (file)
@@ -54,8 +54,6 @@ extern char** ignore_headers;
 
 extern size_t ignore_headers_len;
 
-extern bool generating_dependencies;
-
 extern bool generating_coverage;
 
 extern bool generating_stackusage;
index cab64142a3e61e6911cc0d66eeebe6a8ddcb917d..72c5f8238fc98351630e515e1df8343889abbbe9 100644 (file)
@@ -84,7 +84,6 @@ cc_process_args(Context& ctx,
                                  extra_args_to_hash,
                                  compiler_args);
 
-  generating_dependencies = ctx.args_info.generating_dependencies;
   generating_coverage = ctx.args_info.generating_coverage;
   generating_stackusage = ctx.args_info.generating_stackusage;
   generating_diagnostics = ctx.args_info.generating_diagnostics;