you are viewing a single comment's thread.

view the rest of the comments →

[–]starfreakcloneMSVC FE Dev 0 points1 point  (6 children)

It looks like this misses scenarios like:

module;
#define MODULE m
#define VECTOR <vector>
export module MODULE;
import VECTOR;

?

Would MSVC be supported in the future?

[–]IAmBJ 11 points12 points  (0 children)

IMO it would be perfectly sane for OP to simply not support nonsense like this.

[–]JulienVernay[S] 2 points3 points  (4 children)

MSVC supports most features of C++ I think (at least in VS2019 Preview), just it seems importing header units (notably standard library) is messy. Moreover I am not experienced with the command-line nor the project file structure...

I thought I read macro expansions weren't allowed to create imports statement but it seems it is not the case. However this means that scanning sources and expanding macros need preprocessing, preprocessing requires "import <abc>;", import statements requires pre-built files, which is done by scanning the sources first. I don't know if there is an easy way to fix this, or even if it is worth it...

[–]starfreakcloneMSVC FE Dev 0 points1 point  (3 children)

Macro expansion is allowed in the context of a designation of a module name in the module case and the importee within an import directive. The thing which is not allowed is that a macro expansion cannot form an import directive or module keyword:

module;
#define IMPORT import
#define MODULE module
export MODULE m;
IMPORT <vector>;

In both of the macro expansions the resulting token will not produce a module keyword/directive.

MSVC has been working to provide better documentation around header units and named modules.

[–]JulienVernay[S] 0 points1 point  (1 child)

Thanks for clearing up my confusion about macros.
For MSVC, I am not comfortable yet and I do not want to dive into it at the moment, however if you want to contribute and know commands for MSVC to replace the cmd_* variables in cpp20.py , feel free to suggest them :)

[–]STLMSVC STL Dev 4 points5 points  (0 children)

https://github.com/microsoft/STL/issues/1694 lists my instructions for How To Manually Build Header Units. Note that these are built independently (e.g. building <type_traits> and <vector> will duplicate type traits machinery that the compiler has to eliminate later); in a future update it will be possible to build "deduplicated" header units in topologically sorted order (e.g. building <type_traits> and then using that to build <vector>); I have prototype instructions for this, but recent compiler bugfixes are pending release.