]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
chore: Remove unnecessary depend_extra_args
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 28 Apr 2024 19:50:58 +0000 (21:50 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 28 Apr 2024 19:50:58 +0000 (21:50 +0200)
The ordinary compiler_args list can be used for executing the compiler
in the depend mode since dependency arguments are present there after
07b55f13e119a2a35d166a73929643911ea69d52.

src/ccache/ArgsInfo.hpp
src/ccache/argprocessing.cpp
src/ccache/ccache.cpp

index fe7c0f4171be864512aa04c748a3dc8db36e5ff2..a9e2ae0fbef0c62be0970fba623f5d64081cbe2d 100644 (file)
@@ -145,7 +145,4 @@ struct ArgsInfo
 
   // Relocating debuginfo in the format old=new.
   std::vector<std::string> debug_prefix_maps;
-
-  // Argument list to add to compiler invocation in depend mode.
-  Args depend_extra_args;
 };
index c014983363f2c3b70f50b01deb2df024754932a6..f58d7c16ed1712db2eed6b0660a772c409f78d4c 100644 (file)
@@ -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 {
index 594c0d8a6f4564c15ae17baa7a88df04c3ab832f..38ef7a26ffa779239f961aa6cea376baa05e9a3b 100644 (file)
@@ -1094,7 +1094,6 @@ static tl::expected<Hash::Digest, Failure>
 to_cache(Context& ctx,
          Args& args,
          std::optional<Hash::Digest> 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<DoExecuteResult, Failure> 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());
   }