Skip to content

Commit 1940dea

Browse files
committed
Define char8_t conditionally
Following up on commit d55527c, this patch also puts the `char8_t` typedef under a macro check. From C++20, `char8_t` is a builtin type, so in that case the typedef must not be present. The C++ spec has a macro specific to check if `char8_t` is builtin. This macro is called `__cpp_char8_t`.
1 parent d55527c commit 1940dea

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

newlib/libc/include/uchar.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ typedef _mbstate_t mbstate_t;
5151
#define _MBSTATE_DECLARED
5252
#endif
5353

54+
#ifndef __cpp_char8_t
5455
typedef unsigned char char8_t;
56+
#endif
5557
#if !defined __cplusplus || __cplusplus < 201103L
5658
typedef __uint_least16_t char16_t;
5759
typedef __uint_least32_t char32_t;

0 commit comments

Comments
 (0)