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

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 19 01:22:18 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Dominik Wójt (domin144)

<details>
<summary>Changes</summary>

Picolibc does not provide timespec_get function. Adding "using-if-exists" attribute fixes the modules.

This is a follow up patch for https://github.com/llvm/llvm-project/pull/78580

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


3 Files Affected:

- (modified) libcxx/modules/std.compat/ctime.inc (+1-1) 
- (modified) libcxx/modules/std/ctime.inc (+1-1) 
- (modified) libcxx/test/std/modules/std.compat.pass.cpp (-4) 


``````````diff
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 9a2f330d722edde..a33ed3b6b64533a 100644
--- a/libcxx/test/std/modules/std.compat.pass.cpp
+++ b/libcxx/test/std/modules/std.compat.pass.cpp
@@ -11,10 +11,6 @@
 // UNSUPPORTED: libcpp-has-no-std-modules
 // UNSUPPORTED: clang-modules-build
 
-// 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.
 
 import std.compat;

``````````

</details>


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


More information about the libcxx-commits mailing list