[libcxx-commits] [PATCH] D108203: [libc++] Rely solely on using_if_exists for ::aligned_alloc

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 17 05:58:33 PDT 2021


ldionne created this revision.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Instead of carrying around #ifdefs to determine whether aligned_alloc
is available on the platform, use the using_if_exists attribute (with
Clang) to import it into namespace std only when available.

This change means that trying to use libc++ with an old SDK (or on an
old platform for platforms that ship system headers in /usr/include)
will require a recent Clang that supports the using_if_exists attribute.
When using an older Clang or GCC, the underlying platform has to support
::aligned_alloc.

The motivation for this change is that our logic for determining whether
aligned_alloc is provided was wrong in at least some cases (some Apple
platforms). Instead of fixing that logic, the goal has always been to
remove it entirely in favour of the using_if_exists attribute, so that's
what this patch does.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108203

Files:
  libcxx/include/__config
  libcxx/include/cstdlib
  libcxx/test/libcxx/language.support/has_aligned_alloc.compile.pass.cpp
  libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
  libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
  libcxx/test/support/test_macros.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108203.366872.patch
Type: text/x-patch
Size: 6768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210817/89859074/attachment-0001.bin>


More information about the libcxx-commits mailing list