[libcxx] [modules] Add _LIBCPP_USING_IF_EXISTS on aligned_alloc (#89827)
authorMartin Storsjö <martin@martin.st>
Wed, 24 Apr 2024 08:45:27 +0000 (11:45 +0300)
committerTom Stellard <tstellar@redhat.com>
Thu, 25 Apr 2024 13:53:04 +0000 (06:53 -0700)
This is missing e.g. on Windows. With this change, it's possible to make
the libcxx std module work on mingw-w64 (although that requires a few
fixes to those headers).

In the regular cstdlib header, we have _LIBCPP_USING_IF_EXISTS flagged
on every single reexported function (since
a9c9183ca42629fa83cdda297d1d30c7bc1d7c91), but the modules seem to only
have _LIBCPP_USING_IF_EXISTS set on a few individual functions, so far.

(cherry picked from commit 91526d64a8adb14edc55adfd5270858791822837)

libcxx/modules/std.compat/cstdlib.inc

index a45a0a1caf8ba9aac9105f8c638cd4c72f809454..4783cbf51623902891c9202493e616e57e5f83ed 100644 (file)
@@ -25,7 +25,7 @@ export {
   using ::system;
 
   // [c.malloc], C library memory allocation
-  using ::aligned_alloc;
+  using ::aligned_alloc _LIBCPP_USING_IF_EXISTS;
   using ::calloc;
   using ::free;
   using ::malloc;