From df56d347a75151c7bd6a4d3837f62777cc0354ca Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 5 Nov 2018 11:24:45 +0200 Subject: Resolve /WN /Wall /w option overrides Failed that, MSVC "helpfully" warns that one is overriding the other. --- build2/cc/compile-rule.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'build2/cc/compile-rule.cxx') diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx index 720b9d0..437255e 100644 --- a/build2/cc/compile-rule.cxx +++ b/build2/cc/compile-rule.cxx @@ -1448,6 +1448,9 @@ namespace build2 } } + void + msvc_sanitize_cl (cstrings&); // msvc.cxx + // Extract and inject header dependencies. Return the preprocessed source // file as well as an indication if it is usable for compilation (see // below for details). @@ -1916,6 +1919,8 @@ namespace build2 args.push_back (pp); // /C (preserve comments). args.push_back ("/WX"); // Warning as error (see above). + msvc_sanitize_cl (args); + psrc = auto_rmfile (t.path () + x_pext); if (cast (rs[x_version_major]) >= 18) @@ -2984,6 +2989,9 @@ namespace build2 args.push_back ("/E"); args.push_back ("/C"); + + msvc_sanitize_cl (args); + args.push_back (langopt (md)); // Compile as. break; @@ -4331,6 +4339,8 @@ namespace build2 if (!find_option_prefixes ({"/MD", "/MT"}, args)) args.push_back ("/MD"); + msvc_sanitize_cl (args); + append_modules (env, args, mods, a, t, md); // The presence of /Zi or /ZI causes the compiler to write debug info -- cgit v1.1