diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-06-12 09:11:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-06-12 09:11:44 +0200 |
commit | d5cda1f5ca58a11f8dec36b2ad29ffe09064d4fd (patch) | |
tree | d0b9670fea732dca482850e6972207e0ba993f3b | |
parent | ce177a4b12f2fef490683e53ccc9ee8f4d3e0bd6 (diff) |
Only enable modules if practically usable unless forced
-rw-r--r-- | build2/cxx/init.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/build2/cxx/init.cxx b/build2/cxx/init.cxx index 8c4249c..2c59f2c 100644 --- a/build2/cxx/init.cxx +++ b/build2/cxx/init.cxx @@ -126,7 +126,12 @@ namespace build2 if (*v == "experimental") { - // Unless disabled by the user, try to enable C++ modules. + // Unless disabled by the user, try to enable C++ modules. Here + // we use a tri-state: + // + // - false - disabled + // - unspecified - enabled if practically usable + // - true - enabled even if practically unusable // lookup l; if (!(l = rs[v_m]) || cast<bool> (l)) @@ -140,7 +145,7 @@ namespace build2 // makes them pretty much unusable. This has been fixed in // VC15u3 (19.11) // - if (mj > 19 || (mj == 19 && mi >= 11)) + if (mj > 19 || (mj == 19 && mi >= (l ? 10 : 11))) { r.push_back ("/D__cpp_modules=201703"); // n4647 r.push_back ("/experimental:module"); @@ -153,7 +158,8 @@ namespace build2 // Enable starting with GCC 8.0.0 (currently the c++-modules // branch). // - if (mj >= 8 && + if (l && // Barely usable at the moment. + mj >= 8 && ci.version.build.find ("cxx-modules") != string::npos) { r.push_back ("-fmodules"); @@ -168,7 +174,7 @@ namespace build2 // Note that we are using Apple to vanilla Clang version re- // map from above so may need to update things there as well. // - // Note: see Clang modules support hack in cc::compile. + // Also see Clang modules support hack in cc::compile. // if (mj >= 5) { |