From: Joel Rosdahl Date: Sun, 28 Apr 2024 19:50:58 +0000 (+0200) Subject: chore: Remove unnecessary depend_extra_args X-Git-Tag: v4.10~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=204933e7cec674ccfb8e00dac9e395e1f07766d2;p=thirdparty%2Fccache.git chore: Remove unnecessary depend_extra_args The ordinary compiler_args list can be used for executing the compiler in the depend mode since dependency arguments are present there after 07b55f13e119a2a35d166a73929643911ea69d52. --- diff --git a/src/ccache/ArgsInfo.hpp b/src/ccache/ArgsInfo.hpp index fe7c0f41..a9e2ae0f 100644 --- a/src/ccache/ArgsInfo.hpp +++ b/src/ccache/ArgsInfo.hpp @@ -145,7 +145,4 @@ struct ArgsInfo // Relocating debuginfo in the format old=new. std::vector debug_prefix_maps; - - // Argument list to add to compiler invocation in depend mode. - Args depend_extra_args; }; diff --git a/src/ccache/argprocessing.cpp b/src/ccache/argprocessing.cpp index c0149833..f58d7c16 100644 --- a/src/ccache/argprocessing.cpp +++ b/src/ccache/argprocessing.cpp @@ -1684,17 +1684,13 @@ process_args(Context& ctx) // the preprocessor, so we need to make sure that they are in color. preprocessor_args.push_back(*diagnostics_color_arg); } - if (ctx.config.depend_mode()) { - // The compiler is invoked with the original arguments in the depend mode. - args_info.depend_extra_args.push_back(*diagnostics_color_arg); - } } if (ctx.config.depend_mode() && !args_info.generating_includes && ctx.config.compiler_type() == CompilerType::msvc) { ctx.auto_depend_mode = true; args_info.generating_includes = true; - args_info.depend_extra_args.push_back("/showIncludes"); + compiler_args.push_back("/showIncludes"); } return { diff --git a/src/ccache/ccache.cpp b/src/ccache/ccache.cpp index 594c0d8a..38ef7a26 100644 --- a/src/ccache/ccache.cpp +++ b/src/ccache/ccache.cpp @@ -1094,7 +1094,6 @@ static tl::expected to_cache(Context& ctx, Args& args, std::optional result_key, - const Args& depend_extra_args, Hash* depend_mode_hash) { if (ctx.config.is_compiler_group_msvc()) { @@ -1143,21 +1142,8 @@ to_cache(Context& ctx, LOG_RAW("Running real compiler"); tl::expected result; - if (!ctx.config.depend_mode()) { - result = do_execute(ctx, args); - args.pop_back(3); - } else { - // Use the original arguments (including dependency options) in depend - // mode. - Args depend_mode_args = ctx.orig_args; - depend_mode_args.erase_with_prefix("--ccache-"); - // Add depend_mode_args directly after the compiler. We can't add them last - // since options then may be placed after a "--" option. - depend_mode_args.insert(1, depend_extra_args); - add_prefix(depend_mode_args, ctx.config.prefix_command()); - - result = do_execute(ctx, depend_mode_args); - } + result = do_execute(ctx, args); + args.pop_back(3); if (!result) { return tl::unexpected(result.error()); @@ -2721,11 +2707,8 @@ do_cache_compilation(Context& ctx) Hash* depend_mode_hash = ctx.config.depend_mode() ? &direct_hash : nullptr; // Run real compiler, sending output to cache. - const auto digest = to_cache(ctx, - processed.compiler_args, - result_key, - ctx.args_info.depend_extra_args, - depend_mode_hash); + const auto digest = + to_cache(ctx, processed.compiler_args, result_key, depend_mode_hash); if (!digest) { return tl::unexpected(digest.error()); }