From: Thomas Otto Date: Fri, 24 Jan 2020 18:40:14 +0000 (+0100) Subject: Context: move generating_dependencies X-Git-Tag: v4.0~628^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F538%2Fhead;p=thirdparty%2Fccache.git Context: move generating_dependencies --- diff --git a/src/ccache.cpp b/src/ccache.cpp index e61fbdea0..dd58453c0 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -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) { diff --git a/src/legacy_globals.cpp b/src/legacy_globals.cpp index 6fc9cd8bb..3ab84a275 100644 --- a/src/legacy_globals.cpp +++ b/src/legacy_globals.cpp @@ -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; diff --git a/src/legacy_globals.hpp b/src/legacy_globals.hpp index 64105e0fe..ed0ace5e2 100644 --- a/src/legacy_globals.hpp +++ b/src/legacy_globals.hpp @@ -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; diff --git a/unittest/test_argument_processing.cpp b/unittest/test_argument_processing.cpp index cab64142a..72c5f8238 100644 --- a/unittest/test_argument_processing.cpp +++ b/unittest/test_argument_processing.cpp @@ -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;