[PATCH] libstdc++: Correct export checks for _GLIBCXX_EXTERN_TEMPLATE
Tomasz Kaminski
tkaminsk@redhat.com
Tue Jun 23 17:59:22 GMT 2026
On Tue, Jun 23, 2026 at 7:52 PM Tomasz Kamiński <tkaminsk@redhat.com> wrote:
> Replace a basic_string specific _GLIBCXX_EXTERN_TEMPLATE > 0 with
> simple check for _GLIBCXX_EXTERN_TEMPLATE. This make sure that
> extern definition is also use for -O0 (default).
> Exported declarations are also important for future extensibility,
> as they always pick latest implementation.
>
> libstdc++-v3/ChangeLog:
>
> * include/std/format (__do_vformat_to): Change the preprocessor
> check for __do_vformat_to.
> ---
> I haven't noticed the issue, because I was testing the build times
> with -O2.
>
For the file compiled with -O0 now I see:
U
_ZNSt8__format15__do_vformat_toIcLj1EEENS_10_Sink_iterIT_EES3_St17basic_string_viewIS2_St11char_traitsIS2_EERSt20basic_format_contextIS3_S2_E
>
> Testing on x86_64-linux. OK for trunk and 16 when all test passes?
>
> libstdc++-v3/include/std/format | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/std/format
> b/libstdc++-v3/include/std/format
> index 4a517b70889..db226ecb0c8 100644
> --- a/libstdc++-v3/include/std/format
> +++ b/libstdc++-v3/include/std/format
> @@ -5381,7 +5381,7 @@ namespace __format
> // instantiates formatters for types stored in basic_format_arg, we can
> // support only single encoding, in this case unicode. This should cover
> // most common use cases.
> -#if __cplusplus <= 202002L && _GLIBCXX_EXTERN_TEMPLATE > 0
> +#if __cplusplus <= 202002L && _GLIBCXX_EXTERN_TEMPLATE
> extern template _Sink_iter<char>
> __do_vformat_to<char, 1>(_Sink_iter<char>, string_view,
> format_context&);
> --
> 2.54.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20260623/76cf80bc/attachment-0001.htm>
More information about the Libstdc++
mailing list