Skip to content

Commit e1b1ef4

Browse files
committed
fix: suppress MSVC STL std.ixx warnings when compiled by Clang
MSVC's std.ixx uses #include inside the module purview (by design), triggering -Winclude-angled-in-module-purview (~56 warnings) and -Wreserved-module-identifier (1 warning). Both are harmless — the module compiles and works correctly. Suppress with -Wno flags.
1 parent e594bbb commit e1b1ef4

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/toolchain/clang.cppm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,18 @@ std::vector<std::string> std_module_build_commands(const Toolchain& tc,
201201
// recognize the .ixx extension as a module source by default).
202202
auto absBmi = (cacheDir / relBmi).string();
203203
auto ext = tc.stdModuleSource.extension().string();
204-
std::string langFlag = (ext == ".ixx") ? " -x c++-module" : "";
204+
// MSVC STL's std.ixx needs -x c++-module (Clang doesn't recognize .ixx)
205+
// and generates harmless warnings about #include in module purview and
206+
// the reserved 'std' module name — suppress both.
207+
std::string ixxFlags = (ext == ".ixx")
208+
? " -x c++-module -Wno-include-angled-in-module-purview -Wno-reserved-module-identifier"
209+
: "";
205210
return {
206211
std::format(
207212
"{} -std=c++23{}{} "
208213
"--precompile {} -o {}",
209214
tc.binaryPath.string(),
210-
langFlag,
215+
ixxFlags,
211216
sysrootFlag,
212217
mcpp::xlings::shq(tc.stdModuleSource.string()),
213218
mcpp::xlings::shq(absBmi)),

0 commit comments

Comments
 (0)