From: Orgad Shaneh Date: Mon, 17 Jan 2022 17:41:15 +0000 (+0200) Subject: feat: Add support for MSVC's -Zs option (#995) X-Git-Tag: v4.6~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cfd4b9c7f0e99b6a4291440272e6ffd0efc1268;p=thirdparty%2Fccache.git feat: Add support for MSVC's -Zs option (#995) Co-authored-by: Luboš Luňák --- diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp index fa788c7ea..1067e6659 100644 --- a/src/argprocessing.cpp +++ b/src/argprocessing.cpp @@ -52,6 +52,7 @@ struct ArgumentProcessingState bool found_fpch_preprocess = false; bool found_Yu = false; bool found_valid_Fp = false; + bool found_syntax_only = false; ColorDiagnostics color_diagnostics = ColorDiagnostics::automatic; bool found_directives_only = false; bool found_rewrite_includes = false; @@ -652,9 +653,11 @@ process_arg(const Context& ctx, return nullopt; } - if (args[i] == "-fsyntax-only") { + // -Zs is MSVC's -fsyntax-only equivalent + if (args[i] == "-fsyntax-only" || args[i] == "-Zs") { args_info.expect_output_obj = false; state.compiler_only_args.push_back(args[i]); + state.found_syntax_only = true; return nullopt; } @@ -1210,6 +1213,8 @@ process_args(Context& ctx) if (!state.found_c_opt && !state.found_dc_opt && !state.found_S_opt) { if (args_info.output_is_precompiled_header) { state.common_args.push_back("-c"); + } else if (state.found_syntax_only) { + // -fsyntax-only/-Zs does not need -c } else { LOG_RAW("No -c option found"); // Having a separate statistic for autoconf tests is useful, as they are