diff options
-rw-r--r-- | libbuild2/cc/compile-rule.cxx | 17 | ||||
-rw-r--r-- | libbuild2/cxx/init.cxx | 12 |
2 files changed, 16 insertions, 13 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 4f94167..ee97b39 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -6893,7 +6893,8 @@ namespace build2 // #if 0 // In Clang the module implementation's unit .pcm is special and - // must be "loaded". + // must be "loaded". Note: not anymore, not from Clang 16 and is + // deprecated in 17. // if (ut == unit_type::module_impl) { @@ -6926,17 +6927,9 @@ namespace build2 const file& f (pt->as<file> ()); string s (relative (f.path ()).string ()); - // In Clang the module implementation's unit .pcm is special and - // must be "loaded". - // - if (ut == unit_type::module_impl && i == ms.start) - s.insert (0, "-fmodule-file="); - else - { - s.insert (0, 1, '='); - s.insert (0, cast<string> (f.state[a].vars[c_module_name])); - s.insert (0, "-fmodule-file="); - } + s.insert (0, 1, '='); + s.insert (0, cast<string> (f.state[a].vars[c_module_name])); + s.insert (0, "-fmodule-file="); stor.push_back (move (s)); } diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx index 0d4faf2..3023ad5 100644 --- a/libbuild2/cxx/init.cxx +++ b/libbuild2/cxx/init.cxx @@ -433,6 +433,8 @@ namespace build2 } case compiler_type::clang: { + // @@ TMP: revise + // // At the time of this writing, support for C++20 modules in // Clang is incomplete. And starting with Clang 9 (Apple Clang // 11.0.3), they are enabled by default in the C++2a mode which @@ -448,8 +450,16 @@ namespace build2 // if (modules.value) { + if (mj < 16) + { + fail << "support for C++ modules requires Clang 16 or later" << + info << "C++ compiler is " << ci.signature << + info << "required by " << project (rs) << '@' << rs; + } + + // See https://github.com/llvm/llvm-project/issues/71364 + // prepend ("-D__cpp_modules=201704"); // p0629r0 - mode.push_back ("-fmodules-ts"); // For the hack to work. modules = true; } |