File tree Expand file tree Collapse file tree 22 files changed +47
-31
lines changed
std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects Expand file tree Collapse file tree 22 files changed +47
-31
lines changed Original file line number Diff line number Diff line change @@ -481,6 +481,21 @@ include(config-ix)
481
481
include (HandleLibC ) # Setup the C library flags
482
482
include (HandleLibCXXABI ) # Setup the ABI library flags
483
483
484
+ # Set C library in use to define respective macro in __config_site
485
+ # RUNTIMES_USE_LIBC was checked in HandleLibC to be one of accepted values
486
+ if (RUNTIMES_USE_LIBC STREQUAL "llvm-libc" )
487
+ set (LIBCXX_LIBC_LLVMLIBC 1 )
488
+ elseif (RUNTIMES_USE_LIBC STREQUAL "picolibc" )
489
+ set (LIBCXX_LIBC_PICOLIBC 1 )
490
+ # picolibc is derived from newlib and behaves the same in regards to libc++
491
+ # so setting both here:
492
+ # * LIBCXX_LIBC_NEWLIB is used now
493
+ # * LIBCXX_LIBC_PICOLIBC can be used for further customizations later
494
+ set (LIBCXX_LIBC_NEWLIB 1 )
495
+ elseif (RUNTIMES_USE_LIBC STREQUAL "newlib" )
496
+ set (LIBCXX_LIBC_NEWLIB 1 )
497
+ endif ()
498
+
484
499
# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC.
485
500
# Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors
486
501
# so they don't get transformed into -Wno and -errors respectively.
Original file line number Diff line number Diff line change 42
42
// Hardening.
43
43
#cmakedefine _LIBCPP_HARDENING_MODE_DEFAULT @_LIBCPP_HARDENING_MODE_DEFAULT@
44
44
45
+ // C libraries
46
+ #cmakedefine LIBCXX_LIBC_LLVMLIBC
47
+ #cmakedefine LIBCXX_LIBC_PICOLIBC
48
+ #cmakedefine LIBCXX_LIBC_NEWLIB
49
+
45
50
// __USE_MINGW_ANSI_STDIO gets redefined on MinGW
46
51
#ifdef __clang__
47
52
# pragma clang diagnostic push
Original file line number Diff line number Diff line change 42
42
# endif
43
43
#endif
44
44
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.
45
+ // TODO: Remove this deprecated behavior after LLVM 22 release
46
+ // To build libc++ with picolibc provide RUNTIMES_USE_LIBC=picolibc
48
47
#if __has_include(<picolibc.h>)
49
- # include < picolibc.h >
48
+ # define LIBCXX_LIBC_NEWLIB
50
49
#endif
51
50
52
51
#ifndef __BYTE_ORDER__
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ using wios = basic_ios<wchar_t>;
31
31
template <class _CharT , class _Traits >
32
32
class _LIBCPP_PREFERRED_NAME (ios) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wios)) basic_ios;
33
33
34
- #if defined(_NEWLIB_VERSION )
34
+ #if defined(LIBCXX_LIBC_NEWLIB )
35
35
// On newlib, off_t is 'long int'
36
36
using streamoff = long int ; // for char_traits in <string>
37
37
#else
Original file line number Diff line number Diff line change @@ -384,7 +384,7 @@ public:
384
384
static const mask xdigit = _ISXDIGIT;
385
385
static const mask blank = _ISBLANK;
386
386
static const mask __regex_word = 0x8000 ;
387
- #elif defined(_NEWLIB_VERSION )
387
+ #elif defined(LIBCXX_LIBC_NEWLIB )
388
388
// Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
389
389
typedef char mask;
390
390
// In case char is signed, static_cast is needed to avoid warning on
Original file line number Diff line number Diff line change 17
17
# include <__cxx03/__locale_dir/locale_base_api/android.h>
18
18
#elif defined(__sun__ )
19
19
# include <__cxx03/__locale_dir/locale_base_api/solaris.h>
20
- #elif defined(_NEWLIB_VERSION )
20
+ #elif defined(LIBCXX_LIBC_NEWLIB )
21
21
# include <__cxx03/__locale_dir/locale_base_api/newlib.h>
22
22
#elif defined(__OpenBSD__ )
23
23
# include <__cxx03/__locale_dir/locale_base_api/openbsd.h>
Original file line number Diff line number Diff line change @@ -209,7 +209,7 @@ typedef basic_fstream<wchar_t> wfstream;
209
209
_LIBCPP_PUSH_MACROS
210
210
#include < __cxx03/__undef_macros>
211
211
212
- #if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION )
212
+ #if defined(_LIBCPP_MSVCRT) || defined(LIBCXX_LIBC_NEWLIB )
213
213
# define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
214
214
#endif
215
215
Original file line number Diff line number Diff line change @@ -220,7 +220,7 @@ template <class charT> class messages_byname;
220
220
221
221
# if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
222
222
// Most unix variants have catopen. These are the specific ones that don't.
223
- # if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION ) && !defined(__EMSCRIPTEN__)
223
+ # if !defined(__BIONIC__) && !defined(LIBCXX_LIBC_NEWLIB ) && !defined(__EMSCRIPTEN__)
224
224
# define _LIBCPP_HAS_CATOPEN 1
225
225
# include < nl_types.h>
226
226
# endif
Original file line number Diff line number Diff line change @@ -984,7 +984,7 @@ public:
984
984
typedef _CharT char_type;
985
985
typedef basic_string<char_type> string_type;
986
986
typedef locale locale_type;
987
- #if defined(__BIONIC__) || defined(_NEWLIB_VERSION )
987
+ #if defined(__BIONIC__) || defined(LIBCXX_LIBC_NEWLIB )
988
988
// Originally bionic's ctype_base used its own ctype masks because the
989
989
// builtin ctype implementation wasn't in libc++ yet. Bionic's ctype mask
990
990
// was only 8 bits wide and already saturated, so it used a wider type here
@@ -993,9 +993,7 @@ public:
993
993
// implementation, but this was not updated to match. Since then Android has
994
994
// needed to maintain a stable libc++ ABI, and this can't be changed without
995
995
// an ABI break.
996
- // We also need this workaround for newlib since _NEWLIB_VERSION is not
997
- // defined yet inside __config, so we can't set the
998
- // _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE macro. Additionally, newlib is
996
+ // We also need this workaround for newlib since newlib is
999
997
// often used for space constrained environments, so it makes sense not to
1000
998
// duplicate the ctype table.
1001
999
typedef uint16_t char_class_type;
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ using wios = basic_ios<wchar_t>;
31
31
template <class _CharT , class _Traits >
32
32
class _LIBCPP_PREFERRED_NAME (ios) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wios)) basic_ios;
33
33
34
- #if defined(_NEWLIB_VERSION )
34
+ #if defined(LIBCXX_LIBC_NEWLIB )
35
35
// On newlib, off_t is 'long int'
36
36
using streamoff = long int ; // for char_traits in <string>
37
37
#else
You can’t perform that action at this time.
0 commit comments