[Development] Request for early MOC support for C++20 Modules

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Mon Dec 18 11:54:07 CET 2023


Il 15/12/23 21:33, Thiago Macieira ha scritto:
> Is the file format for the imported modules already standardised? Is it in the
> C++ standard? I don't remember seeing it there.
> 
> If it's not a standard (ISO C++ standard or otherwise), we'd need to write
> format parsers for each compiler, which raises the cost for supporting modules
> considerably, especially if the compilers aren't committing to a stable format
> in the first place.

There's no such thing as a standardized binary format. There's been 
discussions about it years ago, but it's far from being (widely?) 
adopted, see for instance:

https://github.com/GabrielDosReis/ipr


If anything I think this discussion ties up with the one about the 
future of moc, and whether it should become a compiler plugin. In 
principle this would bypass the problem of parsing the binary module 
formats -- leave it to the compiler infra, and just get the info you 
need out of the `import`s.

> 
> Qt should make the commitment that will support at most one module format. Any
> compiler that doesn't operate on those will not have their modules supported.
> 
> I don't know if this is the same content that CMake had to support. It's
> possible it isn't because CMake doesn't need to know about the classes, enums,
> variables, functions, and all other entities declared, which are part of the
> translation unit. Moc does need that.

... which is really, what info does moc exactly need out of a #include / 
import?

Thank you,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - Trusted Software Excellence

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4244 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231218/c7f29fa2/attachment.bin>


More information about the Development mailing list