* [PATCH] libstdc++: Do not assume existence of char8_t codecvt facet
@ 2023-06-02 15:44 Joseph Faulls
2023-06-02 16:52 ` Jonathan Wakely
0 siblings, 1 reply; 3+ messages in thread
From: Joseph Faulls @ 2023-06-02 15:44 UTC (permalink / raw)
To: libstdc++, gcc-patches; +Cc: jwakely
[-- Attachment #1: Type: text/plain, Size: 1052 bytes --]
It is not required that codecvt<char8_t, char, mbstate_t> facet be supported by
the locale, nor is it added as part of the default locale. This can lead to
dangerous behaviour when static_cast.
libstdc++-v3/ChangeLog:
* include/bits/locale_classes.tcc: Remove check.
---
libstdc++-v3/include/bits/locale_classes.tcc | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libstdc++-v3/include/bits/locale_classes.tcc b/libstdc++-v3/include/bits/locale_classes.tcc
index 94838cd7796..2351dd5bcfb 100644
--- a/libstdc++-v3/include/bits/locale_classes.tcc
+++ b/libstdc++-v3/include/bits/locale_classes.tcc
@@ -129,9 +129,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_STD_FACET(time_put<wchar_t>);
_GLIBCXX_STD_FACET(messages<wchar_t>);
#endif
-#ifdef _GLIBCXX_USE_CHAR8_T
- _GLIBCXX_STD_FACET(codecvt<char8_t, char, mbstate_t>);
-#endif
#if __cplusplus >= 201103L
_GLIBCXX_STD_FACET(codecvt<char16_t, char, mbstate_t>);
_GLIBCXX_STD_FACET(codecvt<char32_t, char, mbstate_t>);
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libstdc++: Do not assume existence of char8_t codecvt facet
2023-06-02 15:44 [PATCH] libstdc++: Do not assume existence of char8_t codecvt facet Joseph Faulls
@ 2023-06-02 16:52 ` Jonathan Wakely
2023-06-06 11:45 ` Jonathan Wakely
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2023-06-02 16:52 UTC (permalink / raw)
To: Joseph Faulls; +Cc: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]
On Fri, 2 Jun 2023 at 16:45, Joseph Faulls wrote:
> It is not required that codecvt<char8_t, char, mbstate_t> facet be
> supported by
>
> the locale, nor is it added as part of the default locale. This can lead to
>
> dangerous behaviour when static_cast.
>
Ouch, yes indeed. I don't know why I added that there. Thanks for the
patch, I'll apply it to trunk and gcc-13 ASAP.
>
> libstdc++-v3/ChangeLog:
>
>
>
> * include/bits/locale_classes.tcc: Remove check.
>
> ---
>
> libstdc++-v3/include/bits/locale_classes.tcc | 3 ---
>
> 1 file changed, 3 deletions(-)
>
>
>
> diff --git a/libstdc++-v3/include/bits/locale_classes.tcc
> b/libstdc++-v3/include/bits/locale_classes.tcc
>
> index 94838cd7796..2351dd5bcfb 100644
>
> --- a/libstdc++-v3/include/bits/locale_classes.tcc
>
> +++ b/libstdc++-v3/include/bits/locale_classes.tcc
>
> @@ -129,9 +129,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
> _GLIBCXX_STD_FACET(time_put<wchar_t>);
>
> _GLIBCXX_STD_FACET(messages<wchar_t>);
>
> #endif
>
> -#ifdef _GLIBCXX_USE_CHAR8_T
>
> - _GLIBCXX_STD_FACET(codecvt<char8_t, char, mbstate_t>);
>
> -#endif
>
> #if __cplusplus >= 201103L
>
> _GLIBCXX_STD_FACET(codecvt<char16_t, char, mbstate_t>);
>
> _GLIBCXX_STD_FACET(codecvt<char32_t, char, mbstate_t>);
>
> --
>
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libstdc++: Do not assume existence of char8_t codecvt facet
2023-06-02 16:52 ` Jonathan Wakely
@ 2023-06-06 11:45 ` Jonathan Wakely
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2023-06-06 11:45 UTC (permalink / raw)
To: Joseph Faulls; +Cc: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1773 bytes --]
On Fri, 2 Jun 2023 at 17:52, Jonathan Wakely <jwakely@redhat.com> wrote:
> On Fri, 2 Jun 2023 at 16:45, Joseph Faulls wrote:
>
>> It is not required that codecvt<char8_t, char, mbstate_t> facet be
>> supported by
>>
>> the locale, nor is it added as part of the default locale. This can lead
>> to
>>
>> dangerous behaviour when static_cast.
>>
>
> Ouch, yes indeed. I don't know why I added that there. Thanks for the
> patch, I'll apply it to trunk and gcc-13 ASAP.
>
I've pushed it to trunk now. As it's only removing 3 lines I don't think we
need a copyright assignment or DCO sign-off for this patch - thanks for
contributing it.
I think what I intended to check for there was codecvt<char16_t, char8_t,
mbstate_t> and codecvt<char32_t, char8_t, mbstate_t>, but I had a brainfart.
>
>
>
>
>>
>> libstdc++-v3/ChangeLog:
>>
>>
>>
>> * include/bits/locale_classes.tcc: Remove check.
>>
>> ---
>>
>> libstdc++-v3/include/bits/locale_classes.tcc | 3 ---
>>
>> 1 file changed, 3 deletions(-)
>>
>>
>>
>> diff --git a/libstdc++-v3/include/bits/locale_classes.tcc
>> b/libstdc++-v3/include/bits/locale_classes.tcc
>>
>> index 94838cd7796..2351dd5bcfb 100644
>>
>> --- a/libstdc++-v3/include/bits/locale_classes.tcc
>>
>> +++ b/libstdc++-v3/include/bits/locale_classes.tcc
>>
>> @@ -129,9 +129,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>
>> _GLIBCXX_STD_FACET(time_put<wchar_t>);
>>
>> _GLIBCXX_STD_FACET(messages<wchar_t>);
>>
>> #endif
>>
>> -#ifdef _GLIBCXX_USE_CHAR8_T
>>
>> - _GLIBCXX_STD_FACET(codecvt<char8_t, char, mbstate_t>);
>>
>> -#endif
>>
>> #if __cplusplus >= 201103L
>>
>> _GLIBCXX_STD_FACET(codecvt<char16_t, char, mbstate_t>);
>>
>> _GLIBCXX_STD_FACET(codecvt<char32_t, char, mbstate_t>);
>>
>> --
>>
>> 2.34.1
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-06 11:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02 15:44 [PATCH] libstdc++: Do not assume existence of char8_t codecvt facet Joseph Faulls
2023-06-02 16:52 ` Jonathan Wakely
2023-06-06 11:45 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).