diff mbox series

[3/3] : C N2653 char8_t: Documentation updates

Message ID d3208362-39be-3fca-e3bb-5f3ca4005d8c@honermann.net
State New
Headers show
Series : C N2653 char8_t implementation | expand

Commit Message

Tom Honermann June 7, 2021, 2:32 a.m. UTC
This patch updates documentation for the -fchar8_t and -fno-char8_t 
options to describe their effect on C code as proposed in WG14 N2653 [1].

Tested on Linux x86_64.

2021-05-31  Tom Honermann  <tom@honermann.net>

	* doc/invoke.texi (-fchar8_t): update for char8_t support for C.

Tom.

[1]: 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
diff mbox series

Patch

commit d3cb3c6648cc15fe1beea6c9799e044cb722148a
Author: Tom Honermann <tom@honermann.net>
Date:   Sun May 30 16:57:09 2021 -0400

    N2653 char8_t for C: Documentation updates
    
    This change updates documentation for the -fchar8_t option to describe
    its affect on C code as proposed in WG14 N2653 for C.

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 5cd4e2d993c..ba4c60a6179 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -2884,14 +2884,27 @@  This flag is enabled by default for @option{-std=c++17}.
 @itemx -fno-char8_t
 @opindex fchar8_t
 @opindex fno-char8_t
-Enable support for @code{char8_t} as adopted for C++20.  This includes
-the addition of a new @code{char8_t} fundamental type, changes to the
-types of UTF-8 string and character literals, new signatures for
-user-defined literals, associated standard library updates, and new
-@code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
+Enable support for @code{char8_t} for C as proposed in N2653, and for
+C++ as adopted for C++20.
+
+For C, this changes the type of UTF-8 string literals from array of
+@code{char} to array of @code{unsigned char} and defines the
+@code{_CHAR8_T_SOURCE} macro to inform the C standard library that the
+@code{char8_t} typedef name and the @code{mbrtoc8} and @code{c8rtomb}
+functions should be declared by @code{<uchar.h>}, and that the
+@code{atomic_char8_t} typedef name and the @code{ATOMIC_CHAR8_T_LOCK_FREE}
+macro should be defined by @code{<stdatomic.h>}.
+
+For C++, this enables the @code{char8_t} fundamental type, changes the
+type of UTF-8 string literals from array of @code{char} to array of
+@code{char8_t}, changes the type of character literals from @code{char}
+to @code{char8_t}, adds additional @code{char8_t}-based signatures for
+user-defined literals, enables associated standard library updates, and
+defines the @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature
+test macros.
 
 This option enables functions to be overloaded for ordinary and UTF-8
-strings:
+strings in C++:
 
 @smallexample
 int f(const char *);    // #1