[PATCH] libstdc++: Correct export checks for _GLIBCXX_EXTERN_TEMPLATE
Jonathan Wakely
jwakely@redhat.com
Wed Jun 24 11:11:07 GMT 2026
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
>
> 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
>
More information about the Libstdc++
mailing list