[libc++] Properly detect whether C++20 modules are supported by the compiler (#94275)

It is possible for a compiler to support the warning without being able
to compile `export module foo;`, so use that in addition to the warning
to check whether C++20 modules are supported.
This commit is contained in:
Louis Dionne
2024-06-04 11:20:52 -07:00
committed by GitHub
parent b62b7a42bb
commit b9915ad40c

View File

@@ -317,7 +317,14 @@ DEFAULT_FEATURES = [
or ("_WIN32" in compilerMacros(cfg) and not _mingwSupportsModules(cfg))
or platform.system().lower().startswith("aix")
# Avoid building on platforms that don't support modules properly.
or not hasCompileFlag(cfg, "-Wno-reserved-module-identifier"),
or not hasCompileFlag(cfg, "-Wno-reserved-module-identifier")
or not sourceBuilds(
cfg,
"""
export module test;
int main(int, char**) { return 0; }
""",
),
),
# The time zone validation tests compare the output of zdump against the
# output generated by <chrono>'s time zone support.