[PATCH 2/3]: C++20 P0482R6 and C2X N2653: Implement mbrtoc8, c8rtomb, char8_t

Tom Honermann tom@honermann.net
Mon Jun 7 02:08:03 GMT 2021


This patch provides implementations for the mbrtoc8 and c8rtomb 
functions adopted for C++20 via WG21 P0482R6 [1] and proposed for C2X 
via WG14 N2653 [2].  It also provides the char8_t typedef from WG14 
N2653 [2] and introduces a _CHAR8_T_SOURCE feature test macro to opt-in 
to the new declarations.

The mbrtoc8 and c8rtomb functions are declared in uchar.h if either the 
C++20 __cpp_char8_t feature test macro or the _CHAR8_T_SOURCE feature 
test macro are defined.

The char8_t typedef is declared in uchar.h if _CHAR8_T_SOURCE is defined 
and __cpp_char8_t is not defined (if __cpp_char8_t is defined, then 
char8_t is a builtin type).

Additionally, in features.h, missing comments for the 
__GLIBC_USE_ISOC2X, __GLIBC_USE_DEPRECATED_GETS, and 
__GLIBC_USE_DEPRECATED_SCANF macros are added.

Tested on Linux x86_64.

Tom.

[1]: WG21 P0482R6
      "char8_t: A type for UTF-8 characters and strings (Revision 6)"
      https://wg21.link/p0482r6

[2]: WG14 N2653
      "char8_t: A type for UTF-8 characters and strings (Revision 1)"
      http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2653.htm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: n2653-2.patch
Type: text/x-patch
Size: 39183 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20210606/5f5b419c/attachment-0001.bin>


More information about the Libc-alpha mailing list