[libcxx-commits] [libcxx] [libc++] Add "using-if-exists" to timespec_get in modules (PR #78686)

Dominik Wójt via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 22 00:15:45 PST 2024


https://github.com/domin144 updated https://github.com/llvm/llvm-project/pull/78686

>From a9f87e952dc65a2723d51547c8ef07e5db768d20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20W=C3=B3jt?= <dominik.wojt at arm.com>
Date: Fri, 19 Jan 2024 09:12:50 +0100
Subject: [PATCH 1/2] [libc++] Add "using-if-exists" to timespec_get in modules

Picolibc does not provide timespec_get function. Adding
"using-if-exists" attribute fixes the modules.
---
 libcxx/modules/std.compat/ctime.inc         | 2 +-
 libcxx/modules/std/ctime.inc                | 2 +-
 libcxx/test/std/modules/std.compat.pass.cpp | 4 ----
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/libcxx/modules/std.compat/ctime.inc b/libcxx/modules/std.compat/ctime.inc
index 92e3403a5e58e27..6e621f494348d74 100644
--- a/libcxx/modules/std.compat/ctime.inc
+++ b/libcxx/modules/std.compat/ctime.inc
@@ -24,5 +24,5 @@ export {
   using ::mktime;
   using ::strftime;
   using ::time;
-  using ::timespec_get;
+  using ::timespec_get _LIBCPP_USING_IF_EXISTS;
 } // export
diff --git a/libcxx/modules/std/ctime.inc b/libcxx/modules/std/ctime.inc
index c407ffc35e3fe3c..c98cb28e649b85e 100644
--- a/libcxx/modules/std/ctime.inc
+++ b/libcxx/modules/std/ctime.inc
@@ -24,5 +24,5 @@ export namespace std {
   using std::mktime;
   using std::strftime;
   using std::time;
-  using std::timespec_get;
+  using std::timespec_get _LIBCPP_USING_IF_EXISTS;
 } // namespace std
diff --git a/libcxx/test/std/modules/std.compat.pass.cpp b/libcxx/test/std/modules/std.compat.pass.cpp
index 40ea979e2734653..e840f3c6b629cf1 100644
--- a/libcxx/test/std/modules/std.compat.pass.cpp
+++ b/libcxx/test/std/modules/std.compat.pass.cpp
@@ -12,10 +12,6 @@
 
 // XFAIL: has-no-cxx-module-support
 
-// picolibc does not provide the required timespec_get function, and the
-// "using-if-exists" mechanism apparently did not work here.
-// XFAIL: LIBCXX-PICOLIBC-FIXME
-
 // A minimal test to validate import works.
 
 // MODULE_DEPENDENCIES: std.compat

>From 7443ba5596df7da379faa803d6ab73d831da07d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20W=C3=B3jt?= <dominik.wojt at arm.com>
Date: Mon, 22 Jan 2024 09:13:35 +0100
Subject: [PATCH 2/2] Remove XFAIL from remaining tests

---
 .../libcxx/selftest/modules/std-and-std.compat-module.sh.cpp  | 4 ----
 libcxx/test/libcxx/selftest/modules/std.compat-module.sh.cpp  | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/libcxx/test/libcxx/selftest/modules/std-and-std.compat-module.sh.cpp b/libcxx/test/libcxx/selftest/modules/std-and-std.compat-module.sh.cpp
index 81241d7f43f9a13..d56ebb2961d4aeb 100644
--- a/libcxx/test/libcxx/selftest/modules/std-and-std.compat-module.sh.cpp
+++ b/libcxx/test/libcxx/selftest/modules/std-and-std.compat-module.sh.cpp
@@ -12,10 +12,6 @@
 
 // XFAIL: has-no-cxx-module-support
 
-// picolibc does not provide the required timespec_get function, and the
-// "using-if-exists" mechanism apparently did not work here.
-// XFAIL: LIBCXX-PICOLIBC-FIXME
-
 // Make sure that the compile flags contain the expected elements.
 // The tests only look for the expected components and not the exact flags.
 // Otherwise changing the location of the module would break this test.
diff --git a/libcxx/test/libcxx/selftest/modules/std.compat-module.sh.cpp b/libcxx/test/libcxx/selftest/modules/std.compat-module.sh.cpp
index b74c2f1a249fcc1..e84709853fbca1c 100644
--- a/libcxx/test/libcxx/selftest/modules/std.compat-module.sh.cpp
+++ b/libcxx/test/libcxx/selftest/modules/std.compat-module.sh.cpp
@@ -12,10 +12,6 @@
 
 // XFAIL: has-no-cxx-module-support
 
-// picolibc does not provide the required timespec_get function, and the
-// "using-if-exists" mechanism apparently did not work here.
-// XFAIL: LIBCXX-PICOLIBC-FIXME
-
 // Make sure that the compile flags contain the expected elements.
 // The tests only look for the expected components and not the exact flags.
 // Otherwise changing the location of the module would break this test.



More information about the libcxx-commits mailing list