From: Joel Rosdahl Date: Sat, 15 Oct 2022 18:17:00 +0000 (+0200) Subject: chore: Tweak code related to auto depend mode for MSVC X-Git-Tag: v4.7~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ad17e899ddb30a1591829c365c4e7e3b17a5943;p=thirdparty%2Fccache.git chore: Tweak code related to auto depend mode for MSVC --- diff --git a/src/Config.hpp b/src/Config.hpp index 18cf74a76..b75ff43c4 100644 --- a/src/Config.hpp +++ b/src/Config.hpp @@ -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; } diff --git a/src/Context.hpp b/src/Context.hpp index 25b114097..883c02f4a 100644 --- a/src/Context.hpp +++ b/src/Context.hpp @@ -118,6 +118,8 @@ public: std::unique_ptr 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. diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp index 2b0603f95..d71425fb5 100644 --- a/src/argprocessing.cpp +++ b/src/argprocessing.cpp @@ -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 { diff --git a/unittest/test_core_ShowIncludesParser.cpp b/unittest/test_core_ShowIncludesParser.cpp index 2d3fc572e..61af1f824 100644 --- a/unittest/test_core_ShowIncludesParser.cpp +++ b/unittest/test_core_ShowIncludesParser.cpp @@ -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));