diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2022-10-15 20:17:00 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2022-10-16 10:50:09 +0200 |
commit | 4ad17e899ddb30a1591829c365c4e7e3b17a5943 (patch) | |
tree | c5e4161e903d7e4bf49ea3437145cd3e2d27d989 | |
parent | 7d679310cca01190d25786b79eacd19e052e4de0 (diff) | |
download | ccache-4ad17e899ddb30a1591829c365c4e7e3b17a5943.tar.gz |
chore: Tweak code related to auto depend mode for MSVC
-rw-r--r-- | src/Config.hpp | 14 | ||||
-rw-r--r-- | src/Context.hpp | 2 | ||||
-rw-r--r-- | src/argprocessing.cpp | 2 | ||||
-rw-r--r-- | unittest/test_core_ShowIncludesParser.cpp | 6 |
4 files changed, 13 insertions, 11 deletions
diff --git a/src/Config.hpp b/src/Config.hpp index 18cf74a7..b75ff43c 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 25b11409..883c02f4 100644 --- a/src/Context.hpp +++ b/src/Context.hpp @@ -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. diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp index 2b0603f9..d71425fb 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 2d3fc572..61af1f82 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)); |