]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix std module for gcc4-compatible ABI
authorJonathan Wakely <jwakely@redhat.com>
Mon, 17 Nov 2025 14:33:50 +0000 (14:33 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 17 Nov 2025 17:57:17 +0000 (17:57 +0000)
Add preprocessor checks to std.cc.in for features which are not
supported with the old string ABI.

The COW std::string doesn't properly support C++11 allocators, so the
aliases such as std::pmr::string, std::pmr::u8string etc. are not
defined for the old string ABI.

The std::syncbuf type uses std::string and is not defined for the old
string ABI.

libstdc++-v3/ChangeLog:

* src/c++23/std.cc.in [!__cpp_lib_syncbuf]: Disable exports for
<syncstream> contents when not defined.
[!_GLIBCXX_USE_CXX11_ABI]: Disable exports for pmr aliases in
<string> when not defined.

libstdc++-v3/src/c++23/std.cc.in

index 27d83f1ba1b751b74d950702181bc54e10d098ad..dd458a230e63bbb0847ec171bfdcc8b502f330b1 100644 (file)
@@ -1598,15 +1598,17 @@ export namespace std
   using std::u32streampos;
   using std::u8streampos;
   using std::wstreampos;
-  using std::basic_osyncstream;
-  using std::basic_syncbuf;
   using std::istreambuf_iterator;
   using std::ostreambuf_iterator;
+  using std::fpos;
+#ifdef __cpp_lib_syncbuf
+  using std::basic_osyncstream;
+  using std::basic_syncbuf;
   using std::osyncstream;
   using std::syncbuf;
   using std::wosyncstream;
   using std::wsyncbuf;
-  using std::fpos;
+#endif
 }
 
 // <iostream>
@@ -2176,9 +2178,11 @@ export namespace std
   using std::ostream;
   using std::wostream;
   using std::operator<<;
+#ifdef __cpp_lib_syncbuf
   using std::emit_on_flush;
   using std::noemit_on_flush;
   using std::flush_emit;
+#endif
 }
 
 // <print>
@@ -2619,11 +2623,13 @@ export namespace std
   using std::wsregex_token_iterator;
   namespace pmr
   {
+#if _GLIBCXX_USE_CXX11_ABI
     using std::pmr::cmatch;
     using std::pmr::match_results;
     using std::pmr::smatch;
     using std::pmr::wcmatch;
     using std::pmr::wsmatch;
+#endif
   }
 }
 
@@ -2849,12 +2855,14 @@ export namespace std
   using std::wstring;
   namespace pmr
   {
+#if _GLIBCXX_USE_CXX11_ABI
     using std::pmr::basic_string;
     using std::pmr::string;
     using std::pmr::u16string;
     using std::pmr::u32string;
     using std::pmr::u8string;
     using std::pmr::wstring;
+#endif
   }
   using std::hash;
 }
@@ -2899,6 +2907,7 @@ export namespace std
 // <syncstream>
 export namespace std
 {
+#ifdef __cpp_lib_syncbuf
   using std::basic_syncbuf;
   using std::swap;
   using std::basic_osyncstream;
@@ -2906,6 +2915,7 @@ export namespace std
   using std::syncbuf;
   using std::wosyncstream;
   using std::wsyncbuf;
+#endif
 }
 
 // 19.5 <system_error>