diff options
-rw-r--r-- | libbuild2/c/init.cxx | 26 | ||||
-rw-r--r-- | libbuild2/cxx/init.cxx | 6 |
2 files changed, 20 insertions, 12 deletions
diff --git a/libbuild2/c/init.cxx b/libbuild2/c/init.cxx index 8bc2f7d..f100abc 100644 --- a/libbuild2/c/init.cxx +++ b/libbuild2/c/init.cxx @@ -111,23 +111,31 @@ namespace build2 // From version 16.8 VC now supports /std:c11 and /std:c17 options // which enable C11/17 conformance. However, as of version 16.10, // neither SDK nor CRT can be compiled in these modes (see the /std - // option documentation for details/updates). + // option documentation for details/updates). There is also now + // /std:clatest which can be used to enable C23 typeof as of MSVC + // 17.9. So let's map C23 to that. // if (v == nullptr) ; else if (!stdcmp ("90")) { - uint64_t cver (ci.version.major); - - if ((stdcmp ("99") && cver < 16) || // Since VS2010/10.0. - ((stdcmp ("11") || - stdcmp ("17") || - stdcmp ("18")) && cver < 18) || // Since VS????/11.0. - (stdcmp ("23", "2x") )) + uint64_t mj (ci.version.major); + uint64_t mi (ci.version.minor); + + if (stdcmp ("99") && mj >= 16) // Since VS2010/10.0. + ; + else if ((stdcmp ("11") || + stdcmp ("17") || + stdcmp ("18")) && mj >= 18) // Since VS????/11.0. + ; + else if (stdcmp ("23", "2x") && + (mj > 19 || (mj == 19 && mi >= 39))) // Since 17.9. { + mode.insert (mode.begin (), "/std:clatest"); + } + else fail << "C " << *v << " is not supported by " << ci.signature << info << "required by " << project (rs) << '@' << rs; - } } break; } diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx index 8159d18..0c29d41 100644 --- a/libbuild2/cxx/init.cxx +++ b/libbuild2/cxx/init.cxx @@ -498,8 +498,8 @@ namespace build2 // Unless disabled by the user, try to enable C++ modules. // - // NOTE: see also diagnostics about modules support required in compile - // rule. + // NOTE: see also diagnostics about modules support required (if + // attempting to use) in compile rule. // if (!modules.value || *modules.value) { @@ -580,7 +580,7 @@ namespace build2 // around Clang 16 so we don't support anything earlier than // that (it's not practically usable anyway). // - // Clang enable modules by default in c++20 or later but they + // Clang enables modules by default in c++20 or later but they // don't yet (as of Clang 18) define __cpp_modules. When they // do, we can consider enabling modules by default on our side. // For now, we only enable modules if forced with explicit |