aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-05-14 09:28:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-05-14 09:28:52 +0200
commit07afeea65fd9a663d5b45db7aaf74716a0689142 (patch)
treead80bbdf23a802779512b7a8bc00bd25572d63b6
parentd228d6e33b460be975ac0a0325a94a7f3307c0e2 (diff)
Add /Zc:preprocessor in experimental cxx.std mode from MSVC 17.9 (19.39)
For background, see: https://developercommunity.visualstudio.com/t/Please-clarify-ifwhen-Zc:preprocessor/10537317
-rw-r--r--libbuild2/cc/predefs-rule.cxx2
-rw-r--r--libbuild2/cxx/init.cxx6
2 files changed, 7 insertions, 1 deletions
diff --git a/libbuild2/cc/predefs-rule.cxx b/libbuild2/cc/predefs-rule.cxx
index e74192d..606db06 100644
--- a/libbuild2/cc/predefs-rule.cxx
+++ b/libbuild2/cc/predefs-rule.cxx
@@ -278,7 +278,7 @@ namespace build2
args.push_back ("/Zc:preprocessor"); // Preproc. conformance mode.
// Output (note that while the /Fi: variant is only availbale
- // starting with VS2013, /Zc:preprocessor is only available in
+ // starting with VS2013, /Zc:preprocessor is only available
// starting from VS2019).
//
args.push_back ("/Fi:");
diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx
index 0c29d41..2d897ca 100644
--- a/libbuild2/cxx/init.cxx
+++ b/libbuild2/cxx/init.cxx
@@ -481,6 +481,12 @@ namespace build2
{
case compiler_type::msvc:
{
+ // Let's enable the new preprocessor in this mode. For background,
+ // see MSVC issue 10537317.
+ //
+ if (mj > 19 || (mj == 19 && mi >= 39))
+ prepend ("/Zc:preprocessor");
+
// Starting with 15.5 (19.12) Visual Studio-created projects
// default to the strict mode. However, this flag currently tends
// to trigger too many compiler bugs. So for now we leave it to