Jordan Gordeev <jgopensource_at_proton.me> wrote on
Date: Sat, 26 Apr 2025 18:41:12 UTC :

> I've recently discovered that the modules feature of the clang compiler is 
> not used when building ports.

clang++ has 2 distinct "module" features. One of them is not from
any C/C++ language standard. The other is C++ specific and is
from modern enough versions of the C++ standards.

Avoid getting the 2 confused. C does not have the C++ specific
modules. The partial terminology reuse is unfortunate.

> That feature was created primarily to reduce build times, especially when 
> compiling C++ code. It is described in detail here: 
> https://clang.llvm.org/docs/Modules.html

That Clang C++ "Modules" page reports:

QUOTE
Note
Modules are adopted into C++20 Standard. And its semantic and command
line interface are very different from the Clang C++ modules. See 
https://clang.llvm.org/docs/StandardCPlusPlusModules.html for details.
END QUOTE (I expanded the link so its content could be seen.)

That page is titled "Standard C++ Modules" instead.

https://clang.llvm.org/docs/Modules.html is not about standard C++
modules at all.

> The modules feature has the potential to speed up building of FreeBSD 
> ports/packages, so I wanted to bring it to your attention and encourage you 
> to experiment with it.

How much of any changes would need to be made upstream
and then put to use?

> The feature is enabled simply by supplying the -fmodules flag when invoking 
> clang (or clang++). It works in FreeBSD 14.2 but is broken in 15.0-CURRENT 
> right now (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=286342).




===
Mark Millard
marklmi at yahoo.com


Reply via email to