[libcxx-commits] [libcxx] [libc++] Properly detect whether C++20 modules are supported by the compiler (PR #94275)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 4 07:09:02 PDT 2024
https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/94275
>From dc4e4b37b80484f69719a8d416fddec1a1b01157 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 3 Jun 2024 15:40:12 -0400
Subject: [PATCH 1/3] [libc++] Properly detect whether C++20 modules are
supported by the compiler
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.
---
libcxx/utils/libcxx/test/features.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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.
>From 5bc8f531e93fd5b6344ff8d2e7158ec2c8e3467e Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 4 Jun 2024 10:02:24 -0400
Subject: [PATCH 2/3] Fix Python formatting
---
libcxx/utils/libcxx/test/features.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 6fe5595b0d405..9c693708695e2 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -323,7 +323,7 @@ def _mingwSupportsModules(cfg):
"""
export module test;
""",
- )
+ ),
),
# The time zone validation tests compare the output of zdump against the
# output generated by <chrono>'s time zone support.
>From 4ce28d70a83d771adf0b6f6d39439c4c82521dba Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 4 Jun 2024 10:06:32 -0400
Subject: [PATCH 3/3] Try to fix the detection by not failing to link
---
libcxx/utils/libcxx/test/features.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 9c693708695e2..7a9631a56e4bb 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -322,6 +322,7 @@ def _mingwSupportsModules(cfg):
cfg,
"""
export module test;
+ int main(int, char**) { return 0; }
""",
),
),
More information about the libcxx-commits
mailing list