From d5cda1f5ca58a11f8dec36b2ad29ffe09064d4fd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 12 Jun 2017 09:11:44 +0200 Subject: Only enable modules if practically usable unless forced --- build2/cxx/init.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'build2') 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 (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) { -- cgit v1.1