Skip to content

Commit 4090910

Browse files
authored
[libc++] Guard additional headers with _LIBCPP_HAS_LOCALIZATION (llvm#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.
1 parent 1bef59c commit 4090910

File tree

8 files changed

+376
-342
lines changed

8 files changed

+376
-342
lines changed

libcxx/include/__configuration/platform.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242
# endif
4343
#endif
4444

45+
// This is required in order for _NEWLIB_VERSION to be defined in places where we use it.
46+
// TODO: We shouldn't be including arbitrarily-named headers from libc++ since this can break valid
47+
// user code. Move code paths that need _NEWLIB_VERSION to another customization mechanism.
48+
#if __has_include(<picolibc.h>)
49+
# include <picolibc.h>
50+
#endif
51+
4552
#ifndef __BYTE_ORDER__
4653
# error \
4754
"Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform"

0 commit comments

Comments
 (0)