[clang] [modules] Implement P3618R0: Allow attaching main to the global module (#146461)

Remove the prior warning for attaching extern "C++" to main.
This commit is contained in:
Ashwin Banwari
2025-07-01 18:52:10 -07:00
committed by GitHub
parent 3deed4211a
commit 2599a9aeb5
7 changed files with 27 additions and 15 deletions

View File

@@ -336,12 +336,22 @@ DEFAULT_FEATURES = [
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 sourceBuilds(
cfg,
"""
# older versions don't support extern "C++", newer versions don't support main in named module.
or not (
sourceBuilds(
cfg,
"""
export module test;
extern "C++" int main(int, char**) { return 0; }
""",
)
or sourceBuilds(
cfg,
"""
export module test;
int main(int, char**) { return 0; }
""",
)
),
),
# The time zone validation tests compare the output of zdump against the