Skip to content

Commit 204933e

Browse files
committed
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 07b55f1.
1 parent 1be0128 commit 204933e

3 files changed

Lines changed: 5 additions & 29 deletions

File tree

‎src/ccache/ArgsInfo.hpp‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,4 @@ struct ArgsInfo
145145

146146
// Relocating debuginfo in the format old=new.
147147
std::vector<std::string> debug_prefix_maps;
148-
149-
// Argument list to add to compiler invocation in depend mode.
150-
Args depend_extra_args;
151148
};

‎src/ccache/argprocessing.cpp‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,17 +1684,13 @@ process_args(Context& ctx)
16841684
// the preprocessor, so we need to make sure that they are in color.
16851685
preprocessor_args.push_back(*diagnostics_color_arg);
16861686
}
1687-
if (ctx.config.depend_mode()) {
1688-
// The compiler is invoked with the original arguments in the depend mode.
1689-
args_info.depend_extra_args.push_back(*diagnostics_color_arg);
1690-
}
16911687
}
16921688

16931689
if (ctx.config.depend_mode() && !args_info.generating_includes
16941690
&& ctx.config.compiler_type() == CompilerType::msvc) {
16951691
ctx.auto_depend_mode = true;
16961692
args_info.generating_includes = true;
1697-
args_info.depend_extra_args.push_back("/showIncludes");
1693+
compiler_args.push_back("/showIncludes");
16981694
}
16991695

17001696
return {

‎src/ccache/ccache.cpp‎

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,6 @@ static tl::expected<Hash::Digest, Failure>
10941094
to_cache(Context& ctx,
10951095
Args& args,
10961096
std::optional<Hash::Digest> result_key,
1097-
const Args& depend_extra_args,
10981097
Hash* depend_mode_hash)
10991098
{
11001099
if (ctx.config.is_compiler_group_msvc()) {
@@ -1143,21 +1142,8 @@ to_cache(Context& ctx,
11431142
LOG_RAW("Running real compiler");
11441143

11451144
tl::expected<DoExecuteResult, Failure> result;
1146-
if (!ctx.config.depend_mode()) {
1147-
result = do_execute(ctx, args);
1148-
args.pop_back(3);
1149-
} else {
1150-
// Use the original arguments (including dependency options) in depend
1151-
// mode.
1152-
Args depend_mode_args = ctx.orig_args;
1153-
depend_mode_args.erase_with_prefix("--ccache-");
1154-
// Add depend_mode_args directly after the compiler. We can't add them last
1155-
// since options then may be placed after a "--" option.
1156-
depend_mode_args.insert(1, depend_extra_args);
1157-
add_prefix(depend_mode_args, ctx.config.prefix_command());
1158-
1159-
result = do_execute(ctx, depend_mode_args);
1160-
}
1145+
result = do_execute(ctx, args);
1146+
args.pop_back(3);
11611147

11621148
if (!result) {
11631149
return tl::unexpected(result.error());
@@ -2721,11 +2707,8 @@ do_cache_compilation(Context& ctx)
27212707
Hash* depend_mode_hash = ctx.config.depend_mode() ? &direct_hash : nullptr;
27222708

27232709
// Run real compiler, sending output to cache.
2724-
const auto digest = to_cache(ctx,
2725-
processed.compiler_args,
2726-
result_key,
2727-
ctx.args_info.depend_extra_args,
2728-
depend_mode_hash);
2710+
const auto digest =
2711+
to_cache(ctx, processed.compiler_args, result_key, depend_mode_hash);
27292712
if (!digest) {
27302713
return tl::unexpected(digest.error());
27312714
}

0 commit comments

Comments
 (0)