[PATCH] libstdc++: Correct export checks for _GLIBCXX_EXTERN_TEMPLATE
Tomasz Kaminski
tkaminsk@redhat.com
Tue Jul 21 07:57:07 GMT 2026
On Wed, Jun 24, 2026 at 1:11 PM Jonathan Wakely <jwakely@redhat.com> wrote:
> On Tue, 23 Jun 2026 at 18:52, 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.
> >
> > Testing on x86_64-linux. OK for trunk and 16 when all test passes?
>
> OK for both
>
This is now also backported to GCC-16.
>
>
> >
> > 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/20260721/31935954/attachment-0001.htm>
More information about the Libstdc++
mailing list