summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Rohmen <26538486+srohmen@users.noreply.github.com>2023-04-19 16:16:03 +0200
committerGitHub <noreply@github.com>2023-04-19 16:16:03 +0200
commit81af12b308a19eec2e426a7e725846cf42cecec4 (patch)
tree5fd1cbf26d0d118e34580115858e14a0774821fb
parente58da98645dded3b87b4ffa9b206f9d1fdce53d7 (diff)
downloadccache-81af12b308a19eec2e426a7e725846cf42cecec4.tar.gz
fix: Limit MSVC debug flag detection to documented parameters (#1263)
-rw-r--r--src/argprocessing.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp
index f300e7bd..54507724 100644
--- a/src/argprocessing.cpp
+++ b/src/argprocessing.cpp
@@ -610,9 +610,13 @@ process_option_arg(const Context& ctx,
if (config.is_compiler_group_msvc() && !config.is_compiler_group_clang()
&& util::starts_with(arg, "-Z")) {
- state.last_seen_msvc_z_option = args[i];
- state.common_args.push_back(args[i]);
- return Statistic::none;
+ // Exclude other options starting with /Z (/Zc), which are not debug flags
+ const char debug_mode = arg[2];
+ if (debug_mode == 'i' || debug_mode == '7' || debug_mode == 'I') {
+ state.last_seen_msvc_z_option = args[i];
+ state.common_args.push_back(args[i]);
+ return Statistic::none;
+ }
}
// These options require special handling, because they behave differently