From 81af12b308a19eec2e426a7e725846cf42cecec4 Mon Sep 17 00:00:00 2001 From: Stephan Rohmen <26538486+srohmen@users.noreply.github.com> Date: Wed, 19 Apr 2023 16:16:03 +0200 Subject: [PATCH] fix: Limit MSVC debug flag detection to documented parameters (#1263) --- src/argprocessing.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp index f300e7bd7..54507724c 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 -- 2.47.2