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

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 3 12:43:06 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/94275.diff


1 Files Affected:

- (modified) libcxx/utils/libcxx/test/features.py (+7-1) 


``````````diff
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 093cd39ea64c6..6fe5595b0d405 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -317,7 +317,13 @@ def _mingwSupportsModules(cfg):
         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;
+          """,
+        )
     ),
     # The time zone validation tests compare the output of zdump against the
     # output generated by <chrono>'s time zone support.

``````````

</details>


https://github.com/llvm/llvm-project/pull/94275


More information about the libcxx-commits mailing list