]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
chore: Tweak code related to auto depend mode for MSVC
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 15 Oct 2022 18:17:00 +0000 (20:17 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 16 Oct 2022 08:50:09 +0000 (10:50 +0200)
src/Config.hpp
src/Context.hpp
src/argprocessing.cpp
unittest/test_core_ShowIncludesParser.cpp

index 18cf74a762f3bf48a4b263ff7a835bcd8c5d71f8..b75ff43c475329fe4232766bf192de642eb644df 100644 (file)
@@ -118,9 +118,9 @@ public:
   void set_inode_cache(bool value);
   void set_max_files(uint64_t value);
   void set_max_size(uint64_t value);
+  void set_msvc_dep_prefix(const std::string& value);
   void set_run_second_cpp(bool value);
   void set_temporary_dir(const std::string& value);
-  void set_msvc_dep_prefix(const std::string& value);
 
   // Where to write configuration changes.
   const std::string& config_path() const;
@@ -584,19 +584,19 @@ Config::set_max_size(uint64_t value)
 }
 
 inline void
-Config::set_run_second_cpp(bool value)
+Config::set_msvc_dep_prefix(const std::string& value)
 {
-  m_run_second_cpp = value;
+  m_msvc_dep_prefix = value;
 }
 
 inline void
-Config::set_temporary_dir(const std::string& value)
+Config::set_run_second_cpp(bool value)
 {
-  m_temporary_dir = value;
+  m_run_second_cpp = value;
 }
 
 inline void
-Config::set_msvc_dep_prefix(const std::string& value)
+Config::set_temporary_dir(const std::string& value)
 {
-  m_msvc_dep_prefix = value;
+  m_temporary_dir = value;
 }
index 25b114097af664e04c472868b34f19131b5310b7..883c02f4a7f692bf93298b6bf15144759afded6f 100644 (file)
@@ -118,6 +118,8 @@ public:
   std::unique_ptr<MiniTrace> mini_trace;
 #endif
 
+  // Whether we have added "/showIncludes" ourselves since it's missing and
+  // depend mode is enabled.
   bool auto_depend_mode = false;
 
   // Register a temporary file to remove at program exit.
index 2b0603f954a9432e0d8340a9f1c232ea32a290c6..d71425fb5b31a24d5ca138698bdb40e44ecd971d 100644 (file)
@@ -1503,7 +1503,7 @@ process_args(Context& ctx)
       && ctx.config.compiler_type() == CompilerType::msvc) {
     ctx.auto_depend_mode = true;
     args_info.generating_includes = true;
-    args_info.depend_extra_args.push_back("-showIncludes");
+    args_info.depend_extra_args.push_back("/showIncludes");
   }
 
   return {
index 2d3fc572eef8b6bb95558302f6725ab8b0d524fc..61af1f8242df81b6f4420a8c6b3724bc56db5032 100644 (file)
@@ -103,14 +103,14 @@ TEST_CASE("ShowIncludesParser::strip_includes")
     "Note: including file: foo\n"
     "Second\n");
 
-  SUBCASE("empty output")
+  SUBCASE("Empty output")
   {
     const util::Bytes result =
       core::ShowIncludesParser::strip_includes(ctx, {});
     CHECK(result.size() == 0);
   }
 
-  SUBCASE("feature disabled")
+  SUBCASE("Feature disabled")
   {
     const util::Bytes result =
       core::ShowIncludesParser::strip_includes(ctx, util::Bytes(input));
@@ -119,7 +119,7 @@ TEST_CASE("ShowIncludesParser::strip_includes")
 
   ctx.auto_depend_mode = true;
 
-  SUBCASE("wrong compiler")
+  SUBCASE("Wrong compiler")
   {
     const util::Bytes result =
       core::ShowIncludesParser::strip_includes(ctx, util::Bytes(input));