stdlib: Suppress gcc diagnostic that char8_t is a keyword in C++20 in uchar.h.

Message ID 20220724051143.1893401-1-tom@honermann.net
State Committed
Commit 825f84f133bd840347dc49229b6d831f07d04775
Headers
Series stdlib: Suppress gcc diagnostic that char8_t is a keyword in C++20 in uchar.h. |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Tom Honermann July 24, 2022, 5:11 a.m. UTC
  gcc 13 issues the following diagnostic for the uchar.h header when the
-Wc++20-compat option is enabled in C++ modes that do not enable char8_t
as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE
and the gcc -f[no-]char8_t option).
  warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
This change modifies the uchar.h header to suppress the diagnostic through
the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the
-Wc++20-compat option was added in gcc version 10).  Unfortunately, a bug
in gcc currently prevents those directives from having the intended effect
as reported at https://gcc.gnu.org/PR106423.  A patch for that issue has
been submitted and is available in the email thread archive linked below.
  https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html
---
 wcsmbs/uchar.h | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Florian Weimer July 25, 2022, 9:07 a.m. UTC | #1
* Tom Honermann via Libc-alpha:

> gcc 13 issues the following diagnostic for the uchar.h header when the
> -Wc++20-compat option is enabled in C++ modes that do not enable char8_t
> as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE
> and the gcc -f[no-]char8_t option).
>   warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
> This change modifies the uchar.h header to suppress the diagnostic through
> the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the
> -Wc++20-compat option was added in gcc version 10).  Unfortunately, a bug
> in gcc currently prevents those directives from having the intended effect
> as reported at https://gcc.gnu.org/PR106423.  A patch for that issue has
> been submitted and is available in the email thread archive linked below.
>   https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html
> ---
>  wcsmbs/uchar.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
> index c37e8619a0..5f7139f279 100644
> --- a/wcsmbs/uchar.h
> +++ b/wcsmbs/uchar.h
> @@ -34,8 +34,16 @@
>  /* Declare the C2x char8_t typedef in C2x modes, but only if the C++
>    __cpp_char8_t feature test macro is not defined.  */
>  #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t
> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
> +/* Suppress the diagnostic regarding char8_t being a keyword in C++20.  */
> +# pragma GCC diagnostic push
> +# pragma GCC diagnostic ignored "-Wc++20-compat"
> +#endif
>  /* Define the 8-bit character type.  */
>  typedef unsigned char char8_t;
> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
> +# pragma GCC diagnostic pop
> +#endif
>  #endif

Patch looks okay to me.  The warning was introduced in GCC 10.

This needs RM approval at this point, I think.

Thanks,
Florian
  
Adhemerval Zanella Netto July 25, 2022, 12:34 p.m. UTC | #2
On 25/07/22 06:07, Florian Weimer wrote:
> * Tom Honermann via Libc-alpha:
> 
>> gcc 13 issues the following diagnostic for the uchar.h header when the
>> -Wc++20-compat option is enabled in C++ modes that do not enable char8_t
>> as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE
>> and the gcc -f[no-]char8_t option).
>>   warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
>> This change modifies the uchar.h header to suppress the diagnostic through
>> the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the
>> -Wc++20-compat option was added in gcc version 10).  Unfortunately, a bug
>> in gcc currently prevents those directives from having the intended effect
>> as reported at https://gcc.gnu.org/PR106423.  A patch for that issue has
>> been submitted and is available in the email thread archive linked below.
>>   https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html
>> ---
>>  wcsmbs/uchar.h | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
>> index c37e8619a0..5f7139f279 100644
>> --- a/wcsmbs/uchar.h
>> +++ b/wcsmbs/uchar.h
>> @@ -34,8 +34,16 @@
>>  /* Declare the C2x char8_t typedef in C2x modes, but only if the C++
>>    __cpp_char8_t feature test macro is not defined.  */
>>  #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t
>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>> +/* Suppress the diagnostic regarding char8_t being a keyword in C++20.  */
>> +# pragma GCC diagnostic push
>> +# pragma GCC diagnostic ignored "-Wc++20-compat"
>> +#endif
>>  /* Define the 8-bit character type.  */
>>  typedef unsigned char char8_t;
>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>> +# pragma GCC diagnostic pop
>> +#endif
>>  #endif
> 
> Patch looks okay to me.  The warning was introduced in GCC 10.
> 
> This needs RM approval at this point, I think.
> 
> Thanks,
> Florian
> 

This is ok for 2.36, thanks.
  
Tom Honermann July 29, 2022, 6:22 p.m. UTC | #3
On 7/25/22 8:34 AM, Adhemerval Zanella Netto via Libc-alpha wrote:
>
> On 25/07/22 06:07, Florian Weimer wrote:
>> * Tom Honermann via Libc-alpha:
>>
>>> gcc 13 issues the following diagnostic for the uchar.h header when the
>>> -Wc++20-compat option is enabled in C++ modes that do not enable char8_t
>>> as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE
>>> and the gcc -f[no-]char8_t option).
>>>    warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
>>> This change modifies the uchar.h header to suppress the diagnostic through
>>> the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the
>>> -Wc++20-compat option was added in gcc version 10).  Unfortunately, a bug
>>> in gcc currently prevents those directives from having the intended effect
>>> as reported at https://gcc.gnu.org/PR106423.  A patch for that issue has
>>> been submitted and is available in the email thread archive linked below.
>>>    https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html
>>> ---
>>>   wcsmbs/uchar.h | 8 ++++++++
>>>   1 file changed, 8 insertions(+)
>>>
>>> diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
>>> index c37e8619a0..5f7139f279 100644
>>> --- a/wcsmbs/uchar.h
>>> +++ b/wcsmbs/uchar.h
>>> @@ -34,8 +34,16 @@
>>>   /* Declare the C2x char8_t typedef in C2x modes, but only if the C++
>>>     __cpp_char8_t feature test macro is not defined.  */
>>>   #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t
>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>> +/* Suppress the diagnostic regarding char8_t being a keyword in C++20.  */
>>> +# pragma GCC diagnostic push
>>> +# pragma GCC diagnostic ignored "-Wc++20-compat"
>>> +#endif
>>>   /* Define the 8-bit character type.  */
>>>   typedef unsigned char char8_t;
>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>> +# pragma GCC diagnostic pop
>>> +#endif
>>>   #endif
>> Patch looks okay to me.  The warning was introduced in GCC 10.
>>
>> This needs RM approval at this point, I think.
>>
>> Thanks,
>> Florian
>>
> This is ok for 2.36, thanks.
Thanks. Please commit on my behalf; I don't have commit access.

Tom.
  
Adhemerval Zanella Netto Aug. 1, 2022, 1:38 p.m. UTC | #4
On 29/07/22 15:22, Tom Honermann wrote:
> On 7/25/22 8:34 AM, Adhemerval Zanella Netto via Libc-alpha wrote:
>>
>> On 25/07/22 06:07, Florian Weimer wrote:
>>> * Tom Honermann via Libc-alpha:
>>>
>>>> gcc 13 issues the following diagnostic for the uchar.h header when the
>>>> -Wc++20-compat option is enabled in C++ modes that do not enable char8_t
>>>> as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE
>>>> and the gcc -f[no-]char8_t option).
>>>>    warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
>>>> This change modifies the uchar.h header to suppress the diagnostic through
>>>> the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the
>>>> -Wc++20-compat option was added in gcc version 10).  Unfortunately, a bug
>>>> in gcc currently prevents those directives from having the intended effect
>>>> as reported at https://gcc.gnu.org/PR106423.  A patch for that issue has
>>>> been submitted and is available in the email thread archive linked below.
>>>>    https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html
>>>> ---
>>>>   wcsmbs/uchar.h | 8 ++++++++
>>>>   1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
>>>> index c37e8619a0..5f7139f279 100644
>>>> --- a/wcsmbs/uchar.h
>>>> +++ b/wcsmbs/uchar.h
>>>> @@ -34,8 +34,16 @@
>>>>   /* Declare the C2x char8_t typedef in C2x modes, but only if the C++
>>>>     __cpp_char8_t feature test macro is not defined.  */
>>>>   #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t
>>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>>> +/* Suppress the diagnostic regarding char8_t being a keyword in C++20.  */
>>>> +# pragma GCC diagnostic push
>>>> +# pragma GCC diagnostic ignored "-Wc++20-compat"
>>>> +#endif
>>>>   /* Define the 8-bit character type.  */
>>>>   typedef unsigned char char8_t;
>>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>>> +# pragma GCC diagnostic pop
>>>> +#endif
>>>>   #endif
>>> Patch looks okay to me.  The warning was introduced in GCC 10.
>>>
>>> This needs RM approval at this point, I think.
>>>
>>> Thanks,
>>> Florian
>>>
>> This is ok for 2.36, thanks.
> Thanks. Please commit on my behalf; I don't have commit access.
> 
> Tom.
> 

Ack, done.
  
Tom Honermann Aug. 1, 2022, 3:27 p.m. UTC | #5
On 8/1/22 9:38 AM, Adhemerval Zanella Netto wrote:
>
> On 29/07/22 15:22, Tom Honermann wrote:
>> On 7/25/22 8:34 AM, Adhemerval Zanella Netto via Libc-alpha wrote:
>>> On 25/07/22 06:07, Florian Weimer wrote:
>>>> * Tom Honermann via Libc-alpha:
>>>>
>>>>> gcc 13 issues the following diagnostic for the uchar.h header when the
>>>>> -Wc++20-compat option is enabled in C++ modes that do not enable char8_t
>>>>> as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE
>>>>> and the gcc -f[no-]char8_t option).
>>>>>     warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
>>>>> This change modifies the uchar.h header to suppress the diagnostic through
>>>>> the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the
>>>>> -Wc++20-compat option was added in gcc version 10).  Unfortunately, a bug
>>>>> in gcc currently prevents those directives from having the intended effect
>>>>> as reported at https://gcc.gnu.org/PR106423.  A patch for that issue has
>>>>> been submitted and is available in the email thread archive linked below.
>>>>>     https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html
>>>>> ---
>>>>>    wcsmbs/uchar.h | 8 ++++++++
>>>>>    1 file changed, 8 insertions(+)
>>>>>
>>>>> diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
>>>>> index c37e8619a0..5f7139f279 100644
>>>>> --- a/wcsmbs/uchar.h
>>>>> +++ b/wcsmbs/uchar.h
>>>>> @@ -34,8 +34,16 @@
>>>>>    /* Declare the C2x char8_t typedef in C2x modes, but only if the C++
>>>>>      __cpp_char8_t feature test macro is not defined.  */
>>>>>    #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t
>>>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>>>> +/* Suppress the diagnostic regarding char8_t being a keyword in C++20.  */
>>>>> +# pragma GCC diagnostic push
>>>>> +# pragma GCC diagnostic ignored "-Wc++20-compat"
>>>>> +#endif
>>>>>    /* Define the 8-bit character type.  */
>>>>>    typedef unsigned char char8_t;
>>>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>>>> +# pragma GCC diagnostic pop
>>>>> +#endif
>>>>>    #endif
>>>> Patch looks okay to me.  The warning was introduced in GCC 10.
>>>>
>>>> This needs RM approval at this point, I think.
>>>>
>>>> Thanks,
>>>> Florian
>>>>
>>> This is ok for 2.36, thanks.
>> Thanks. Please commit on my behalf; I don't have commit access.
>>
>> Tom.
>>
> Ack, done.

Thank you! Should this (and H.J. Lu's "missing test-c8rtomb/test-mbrtoc8 
dependency" patch) be merged for 2.36? Both appear to have been approved 
for 2.36 but I don't see them on the release/2.36/master branch at the 
moment.

Tom.
  
Adhemerval Zanella Netto Aug. 1, 2022, 3:48 p.m. UTC | #6
On 01/08/22 12:27, Tom Honermann wrote:
> On 8/1/22 9:38 AM, Adhemerval Zanella Netto wrote:
>>
>> On 29/07/22 15:22, Tom Honermann wrote:
>>> On 7/25/22 8:34 AM, Adhemerval Zanella Netto via Libc-alpha wrote:
>>>> On 25/07/22 06:07, Florian Weimer wrote:
>>>>> * Tom Honermann via Libc-alpha:
>>>>>
>>>>>> gcc 13 issues the following diagnostic for the uchar.h header when the
>>>>>> -Wc++20-compat option is enabled in C++ modes that do not enable char8_t
>>>>>> as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE
>>>>>> and the gcc -f[no-]char8_t option).
>>>>>>     warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
>>>>>> This change modifies the uchar.h header to suppress the diagnostic through
>>>>>> the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the
>>>>>> -Wc++20-compat option was added in gcc version 10).  Unfortunately, a bug
>>>>>> in gcc currently prevents those directives from having the intended effect
>>>>>> as reported at https://gcc.gnu.org/PR106423.  A patch for that issue has
>>>>>> been submitted and is available in the email thread archive linked below.
>>>>>>     https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html
>>>>>> ---
>>>>>>    wcsmbs/uchar.h | 8 ++++++++
>>>>>>    1 file changed, 8 insertions(+)
>>>>>>
>>>>>> diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
>>>>>> index c37e8619a0..5f7139f279 100644
>>>>>> --- a/wcsmbs/uchar.h
>>>>>> +++ b/wcsmbs/uchar.h
>>>>>> @@ -34,8 +34,16 @@
>>>>>>    /* Declare the C2x char8_t typedef in C2x modes, but only if the C++
>>>>>>      __cpp_char8_t feature test macro is not defined.  */
>>>>>>    #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t
>>>>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>>>>> +/* Suppress the diagnostic regarding char8_t being a keyword in C++20.  */
>>>>>> +# pragma GCC diagnostic push
>>>>>> +# pragma GCC diagnostic ignored "-Wc++20-compat"
>>>>>> +#endif
>>>>>>    /* Define the 8-bit character type.  */
>>>>>>    typedef unsigned char char8_t;
>>>>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>>>>> +# pragma GCC diagnostic pop
>>>>>> +#endif
>>>>>>    #endif
>>>>> Patch looks okay to me.  The warning was introduced in GCC 10.
>>>>>
>>>>> This needs RM approval at this point, I think.
>>>>>
>>>>> Thanks,
>>>>> Florian
>>>>>
>>>> This is ok for 2.36, thanks.
>>> Thanks. Please commit on my behalf; I don't have commit access.
>>>
>>> Tom.
>>>
>> Ack, done.
> 
> Thank you! Should this (and H.J. Lu's "missing test-c8rtomb/test-mbrtoc8 dependency" patch) be merged for 2.36? Both appear to have been approved for 2.36 but I don't see them on the release/2.36/master branch at the moment.

I think I did it [1].

[1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.36/master
  
Tom Honermann Aug. 1, 2022, 4:24 p.m. UTC | #7
On 8/1/22 11:48 AM, Adhemerval Zanella Netto wrote:
>
> On 01/08/22 12:27, Tom Honermann wrote:
>> On 8/1/22 9:38 AM, Adhemerval Zanella Netto wrote:
>>> On 29/07/22 15:22, Tom Honermann wrote:
>>>> On 7/25/22 8:34 AM, Adhemerval Zanella Netto via Libc-alpha wrote:
>>>>> On 25/07/22 06:07, Florian Weimer wrote:
>>>>>> * Tom Honermann via Libc-alpha:
>>>>>>
>>>>>>> gcc 13 issues the following diagnostic for the uchar.h header when the
>>>>>>> -Wc++20-compat option is enabled in C++ modes that do not enable char8_t
>>>>>>> as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE
>>>>>>> and the gcc -f[no-]char8_t option).
>>>>>>>      warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
>>>>>>> This change modifies the uchar.h header to suppress the diagnostic through
>>>>>>> the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the
>>>>>>> -Wc++20-compat option was added in gcc version 10).  Unfortunately, a bug
>>>>>>> in gcc currently prevents those directives from having the intended effect
>>>>>>> as reported at https://gcc.gnu.org/PR106423.  A patch for that issue has
>>>>>>> been submitted and is available in the email thread archive linked below.
>>>>>>>      https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html
>>>>>>> ---
>>>>>>>     wcsmbs/uchar.h | 8 ++++++++
>>>>>>>     1 file changed, 8 insertions(+)
>>>>>>>
>>>>>>> diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
>>>>>>> index c37e8619a0..5f7139f279 100644
>>>>>>> --- a/wcsmbs/uchar.h
>>>>>>> +++ b/wcsmbs/uchar.h
>>>>>>> @@ -34,8 +34,16 @@
>>>>>>>     /* Declare the C2x char8_t typedef in C2x modes, but only if the C++
>>>>>>>       __cpp_char8_t feature test macro is not defined.  */
>>>>>>>     #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t
>>>>>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>>>>>> +/* Suppress the diagnostic regarding char8_t being a keyword in C++20.  */
>>>>>>> +# pragma GCC diagnostic push
>>>>>>> +# pragma GCC diagnostic ignored "-Wc++20-compat"
>>>>>>> +#endif
>>>>>>>     /* Define the 8-bit character type.  */
>>>>>>>     typedef unsigned char char8_t;
>>>>>>> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
>>>>>>> +# pragma GCC diagnostic pop
>>>>>>> +#endif
>>>>>>>     #endif
>>>>>> Patch looks okay to me.  The warning was introduced in GCC 10.
>>>>>>
>>>>>> This needs RM approval at this point, I think.
>>>>>>
>>>>>> Thanks,
>>>>>> Florian
>>>>>>
>>>>> This is ok for 2.36, thanks.
>>>> Thanks. Please commit on my behalf; I don't have commit access.
>>>>
>>>> Tom.
>>>>
>>> Ack, done.
>> Thank you! Should this (and H.J. Lu's "missing test-c8rtomb/test-mbrtoc8 dependency" patch) be merged for 2.36? Both appear to have been approved for 2.36 but I don't see them on the release/2.36/master branch at the moment.
> I think I did it [1].

Looks, good, thank you!

Tom.

>
> [1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.36/master
  
Tom Honermann Aug. 17, 2022, 3:11 p.m. UTC | #8
On 7/24/22 1:11 AM, Tom Honermann via Libc-alpha wrote:
> gcc 13 issues the following diagnostic for the uchar.h header when the
> -Wc++20-compat option is enabled in C++ modes that do not enable char8_t
> as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE
> and the gcc -f[no-]char8_t option).
>    warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
> This change modifies the uchar.h header to suppress the diagnostic through
> the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the
> -Wc++20-compat option was added in gcc version 10).  Unfortunately, a bug
> in gcc currently prevents those directives from having the intended effect
> as reported athttps://gcc.gnu.org/PR106423.  A patch for that issue has
> been submitted and is available in the email thread archive linked below.
>    https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html

The above linked gcc patch has landed 
<https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=60468d6cd46a3bd3afe8ff856f82afcd4c65a217> 
for gcc 13; the diagnostic suppression in the patch below (committed for 
2.37 and as a post 2.36 update to release/2.36/master 
<https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.36/master>) 
will become effective with that release.

Tom.

> ---
>   wcsmbs/uchar.h | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
> index c37e8619a0..5f7139f279 100644
> --- a/wcsmbs/uchar.h
> +++ b/wcsmbs/uchar.h
> @@ -34,8 +34,16 @@
>   /* Declare the C2x char8_t typedef in C2x modes, but only if the C++
>     __cpp_char8_t feature test macro is not defined.  */
>   #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t
> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
> +/* Suppress the diagnostic regarding char8_t being a keyword in C++20.  */
> +# pragma GCC diagnostic push
> +# pragma GCC diagnostic ignored "-Wc++20-compat"
> +#endif
>   /* Define the 8-bit character type.  */
>   typedef unsigned char char8_t;
> +#if __GNUC_PREREQ (10, 0) && defined __cplusplus
> +# pragma GCC diagnostic pop
> +#endif
>   #endif
>   
>   #ifndef __USE_ISOCXX11
  

Patch

diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
index c37e8619a0..5f7139f279 100644
--- a/wcsmbs/uchar.h
+++ b/wcsmbs/uchar.h
@@ -34,8 +34,16 @@ 
 /* Declare the C2x char8_t typedef in C2x modes, but only if the C++
   __cpp_char8_t feature test macro is not defined.  */
 #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t
+#if __GNUC_PREREQ (10, 0) && defined __cplusplus
+/* Suppress the diagnostic regarding char8_t being a keyword in C++20.  */
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++20-compat"
+#endif
 /* Define the 8-bit character type.  */
 typedef unsigned char char8_t;
+#if __GNUC_PREREQ (10, 0) && defined __cplusplus
+# pragma GCC diagnostic pop
+#endif
 #endif
 
 #ifndef __USE_ISOCXX11