]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Limit MSVC debug flag detection to documented parameters (#1263)
authorStephan Rohmen <26538486+srohmen@users.noreply.github.com>
Wed, 19 Apr 2023 14:16:03 +0000 (16:16 +0200)
committerGitHub <noreply@github.com>
Wed, 19 Apr 2023 14:16:03 +0000 (16:16 +0200)
src/argprocessing.cpp

index f300e7bd766df32679a7fb64074a81a7d24bec79..54507724c9174463bb0e552eb4431eceb5126619 100644 (file)
@@ -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