5 Commits

Author SHA1 Message Date
Louis Dionne
4090910a69
[libc++] Guard additional headers with _LIBCPP_HAS_LOCALIZATION (#131921)
There were some remaining headers that were not guarded with
_LIBCPP_HAS_LOCALIZATION, leading to errors when trying to use modules
on platforms that don't support localization (since all the headers get
pulled in when building the 'std' module). This patch brings these
headers in line with what we do for every other header that depends on
localization.

This patch also requires including <picolibc.h> from
<__configuration/platform.h> in order to define _NEWLIB_VERSION. In the
long term, we should use a better approach for doing that, such as
defining a macro in the __config_site header.
2025-04-04 11:48:46 -04:00
Louis Dionne
2c8b124851
[libc++] Guard include of <features.h> with __has_include (#127691)
Some configurations define __AMDGPU__ or __NVPTX__ on platforms that
don't provide <features.h>, such as CUDA on Mac.
2025-02-19 08:21:56 -05:00
Louis Dionne
cffc1ac349
[libc++] Avoid including <features.h> on arbitrary platforms (#125587)
This partially reverts commit 5f2389d4. That commit started checking
whether <features.h> was a valid include unconditionally, however codebases
are free to have such a header on their search path, which breaks compilation.
LLVM libc now provides a more standard way of getting configuration macros
like __LLVM_LIBC__.

After this patch, we only include <features.h> when we're on Linux or
when we're compiling for GPUs.
2025-02-15 10:54:00 +01:00
Joseph Huber
5f2389d49f
[libc++] Do not redeclare lgamma_r when targeting the LLVM C library (#102036)
We use lgamma_r for the random normal distribution support. In this
code we redeclare it, which causes issues with the LLVM C library as
this function is marked noexcept in LLVM libc. This patch ensures that
we don't redeclare that function when targeting LLVM libc.
2024-08-27 17:46:03 -04:00
Louis Dionne
23e1ed65c2
[libc++] Split up ABI and platform configuration to their own headers (#90863)
This is a first step towards splitting up the <__config> header. The
<__config> header is large and rather disorganized at this point,
leading to confusion and subtle mistakes. For example, we never noticed
that the string layout used on arm64 was only enabled for the Clang
compiler, as the setting being in the compiler == clang block was
probably never intentional.

The danger of splitting up the <__config> header is to implicitly use
undefined macros that should have been defined prior to their usage,
however this can be remediated with -Wundef and we've started moving
towards -Wundef enforceable macros.
2024-05-28 07:22:06 -04:00