[libcxx-commits] [PATCH] D90257: [libc++] Use the using_if_exists attribute when provided

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 27 11:23:11 PDT 2020


ldionne created this revision.
ldionne added reviewers: rsmith, erik.pilkington.
Herald added subscribers: libcxx-commits, jfb, jkorous.
Herald added a project: libc++.
Herald added a reviewer: libc++.
ldionne requested review of this revision.

As discussed on cfe-dev [1], use the using_if_exists Clang attribute when
the compiler supports it. This makes it easier to port libc++ on top of
new platforms that don't fully support the C Standard library.

Previously, libc++ would fail to build when trying to import a missing
declaration in a <cXXXX> header. With the attribute, the declaration will
simply not be imported into namespace std, and hence it won't be available
for libc++ to use. In many cases, the declarations were *not* actually
required for libc++ to work, so not importing them into namespace std is
acceptable.

The same thing could be achieved by conscious usage of `#ifdef` along
with platform detection, however that quickly creates a maintenance
problem as libc++ is ported to new platforms.

[1]: http://lists.llvm.org/pipermail/cfe-dev/2020-June/066038.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90257

Files:
  libcxx/include/__config
  libcxx/include/cctype
  libcxx/include/cfenv
  libcxx/include/cinttypes
  libcxx/include/clocale
  libcxx/include/cmath
  libcxx/include/csetjmp
  libcxx/include/csignal
  libcxx/include/cstdarg
  libcxx/include/cstddef
  libcxx/include/cstdint
  libcxx/include/cstdio
  libcxx/include/cstdlib
  libcxx/include/cstring
  libcxx/include/ctime
  libcxx/include/cwchar
  libcxx/include/cwctype

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90257.301063.patch
Type: text/x-patch
Size: 32050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201027/7419b72e/attachment-0001.bin>


More information about the libcxx-commits mailing list