[gcc r17-1809] libstdc++: Correct export checks for _GLIBCXX_EXTERN_TEMPLATE

Tomasz Kaminski tkaminsk@gcc.gnu.org
Wed Jun 24 15:03:48 GMT 2026


https://gcc.gnu.org/g:6ac3a6c8aa22dc78f68eb3c99e2c600ca3e57904

commit r17-1809-g6ac3a6c8aa22dc78f68eb3c99e2c600ca3e57904
Author: Tomasz Kamiński <tkaminsk@redhat.com>
Date:   Tue Jun 23 19:12:01 2026 +0200

    libstdc++: Correct export checks for _GLIBCXX_EXTERN_TEMPLATE
    
    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.
    
    Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
    Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>

Diff:
---
 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 4a517b70889c..db226ecb0c84 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&);


More information about the Libstdc++-cvs mailing list