[libcxx] [libcxx] [modules] Add _LIBCPP_USING_IF_EXISTS on aligned_alloc (PR #89827)

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 23 13:49:31 PDT 2024


https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/89827

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.

>From 9130e139e34f2d8fa30e880bd435ced5b1571906 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Tue, 23 Apr 2024 12:25:52 +0300
Subject: [PATCH] =?UTF-8?q?[libcxx]=20[modules]=C2=A0Add=20=5FLIBCPP=5FUSI?=
 =?UTF-8?q?NG=5FIF=5FEXISTS=20on=20aligned=5Falloc?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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.
---
 libcxx/modules/std.compat/cstdlib.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/modules/std.compat/cstdlib.inc b/libcxx/modules/std.compat/cstdlib.inc
index a45a0a1caf8ba9..4783cbf5162390 100644
--- a/libcxx/modules/std.compat/cstdlib.inc
+++ b/libcxx/modules/std.compat/cstdlib.inc
@@ -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;



More information about the libcxx-commits mailing list