[libc++] Remove ios_base::__xindex_ from the ABI (#198994)

`__xindex_` is only ever used from the dylib from a single function. We
can simplify the code a bit by making the variable function-local and
avoiding exposing it to the ABI at all. This also fixes a TODO about
whether it's safe to use `atomic` with the GCC ABI: yes, since it's not
actually part of our ABI.
This commit is contained in:
Nikolas Klauser authored and GitHub committed 2026-06-05 00:35:17 +02:00
1 parent becc74f032
commit 762b77ac29
13 files changed
+25 -57

No files matched your search

+5 -11
View File
@@ -235,10 +235,6 @@ storage-class-specifier const error_category& iostream_category() noexcept;
# include <__verbose_abort>
# include <version>
# if _LIBCPP_HAS_ATOMIC_HEADER
# include <__atomic/atomic.h> // for __xindex_
# endif
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif
@@ -406,13 +402,6 @@ private:
int* __index_;
size_t __event_size_;
size_t __event_cap_;
// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
// enabled with clang.
# if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS
static atomic<int> __xindex_;
# else
static int __xindex_;
# endif
long* __iarray_;
size_t __iarray_size_;
size_t __iarray_cap_;
@@ -886,6 +875,11 @@ _LIBCPP_POP_MACROS
# endif // _LIBCPP_HAS_LOCALIZATION
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
# include <ctime>
# include <ratio>
# endif
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+15 -1
View File
@@ -12,13 +12,27 @@ To generate a summary, re-generate the new ABI list using the
New entries should be added directly below the "Version" header.
------------
Version 23.0
------------
* [libc++] Remove ios_base::__xindex_ from the ABI
`__xindex_` is only ever used from the dylib from a single function. We can simplify the code a bit by making the
variable function-local and avoiding exposing it to the ABI at all. This also fixes a TODO about whether it's safe to
use `atomic` with the GCC ABI: yes, since it's not actually part of our ABI.
All platforms
-------------
Symbol removed: __ZNSt3__18ios_base9__xindex_E
------------
Version 22.0
------------
* [libc++] Allows any types of size 4 and 8 to use native platform ulock_wait
This patch added symbols for platform wait functions with the size of the type
This patch added symbols for platform wait functions with the size of the type
All platforms
-------------
@@ -1869,7 +1869,6 @@
{'is_defined': True, 'name': '__ZNSt3__18ios_base7unitbufE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base8internalE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base8showbaseE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base9__xindex_E', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base9basefieldE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base9boolalphaE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base9showpointE', 'size': 0, 'type': 'OBJECT'}
@@ -1507,7 +1507,6 @@
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base7unitbufE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base8internalE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base8showbaseE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base9__xindex_E', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base9basefieldE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base9boolalphaE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base9showpointE', 'size': 4, 'type': 'OBJECT'}
@@ -826,7 +826,6 @@
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base7unitbufE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base8internalE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base8showbaseE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base9__xindex_E', 'storage_mapping_class': 'RW', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base9basefieldE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base9boolalphaE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base9showpointE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
@@ -826,7 +826,6 @@
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base7unitbufE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base8internalE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base8showbaseE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base9__xindex_E', 'storage_mapping_class': 'RW', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base9basefieldE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base9boolalphaE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18ios_base9showpointE', 'storage_mapping_class': 'RO', 'type': 'OBJECT'}
@@ -1859,7 +1859,6 @@
{'is_defined': True, 'name': '__ZNSt3__18ios_base7unitbufE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base8internalE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base8showbaseE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base9__xindex_E', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base9basefieldE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base9boolalphaE', 'size': 0, 'type': 'OBJECT'}
{'is_defined': True, 'name': '__ZNSt3__18ios_base9showpointE', 'size': 0, 'type': 'OBJECT'}
@@ -1507,7 +1507,6 @@
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base7unitbufE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base8internalE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base8showbaseE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base9__xindex_E', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base9basefieldE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base9boolalphaE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt6__ndk18ios_base9showpointE', 'size': 4, 'type': 'OBJECT'}
@@ -1519,7 +1519,6 @@
{'is_defined': True, 'name': '_ZNSt3__18ios_base7unitbufE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base8internalE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base8showbaseE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9__xindex_E', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9basefieldE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9boolalphaE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9showpointE', 'size': 4, 'type': 'OBJECT'}
@@ -1518,7 +1518,6 @@
{'is_defined': True, 'name': '_ZNSt3__18ios_base7unitbufE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base8internalE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base8showbaseE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9__xindex_E', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9basefieldE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9boolalphaE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9showpointE', 'size': 4, 'type': 'OBJECT'}
@@ -1489,7 +1489,6 @@
{'is_defined': True, 'name': '_ZNSt3__18ios_base7unitbufE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base8internalE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base8showbaseE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9__xindex_E', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9basefieldE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9boolalphaE', 'size': 4, 'type': 'OBJECT'}
{'is_defined': True, 'name': '_ZNSt3__18ios_base9showpointE', 'size': 4, 'type': 'OBJECT'}
+5 -8
View File
@@ -9,6 +9,7 @@
#include <__config>
#include <__locale>
#include <algorithm>
#include <atomic>
#include <ios>
#include <limits>
#include <memory>
@@ -111,13 +112,6 @@ locale ios_base::imbue(const locale& newloc) {
locale ios_base::getloc() const { return __loc_; }
// xalloc
#if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS
atomic<int> ios_base::__xindex_{0};
#else
int ios_base::__xindex_ = 0;
#endif
template <typename _Tp>
static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) { // Precondition: __req_size > __current_cap
const size_t mx = std::numeric_limits<size_t>::max() / sizeof(_Tp);
@@ -127,7 +121,10 @@ static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) { // Precon
return mx;
}
int ios_base::xalloc() { return __xindex_++; }
int ios_base::xalloc() {
constinit static atomic<int> xindex = 0;
return xindex++;
}
long& ios_base::iword(int index) {
size_t req_size = static_cast<size_t>(index) + 1;
@@ -73,7 +73,6 @@ ccomplex cstdint
ccomplex cstdio
ccomplex cstdlib
ccomplex cstring
ccomplex ctime
ccomplex cwchar
ccomplex cwctype
ccomplex initializer_list
@@ -81,7 +80,6 @@ ccomplex ios
ccomplex iosfwd
ccomplex istream
ccomplex limits
ccomplex ratio
ccomplex sstream
ccomplex stdexcept
ccomplex streambuf
@@ -166,7 +164,6 @@ complex cstdint
complex cstdio
complex cstdlib
complex cstring
complex ctime
complex cwchar
complex cwctype
complex initializer_list
@@ -174,7 +171,6 @@ complex ios
complex iosfwd
complex istream
complex limits
complex ratio
complex sstream
complex stdexcept
complex streambuf
@@ -214,7 +210,6 @@ ctgmath cstdint
ctgmath cstdio
ctgmath cstdlib
ctgmath cstring
ctgmath ctime
ctgmath cwchar
ctgmath cwctype
ctgmath initializer_list
@@ -222,7 +217,6 @@ ctgmath ios
ctgmath iosfwd
ctgmath istream
ctgmath limits
ctgmath ratio
ctgmath sstream
ctgmath stdexcept
ctgmath streambuf
@@ -264,7 +258,6 @@ experimental/iterator cstdint
experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
experimental/iterator ctime
experimental/iterator cwchar
experimental/iterator cwctype
experimental/iterator initializer_list
@@ -272,7 +265,6 @@ experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
experimental/iterator ratio
experimental/iterator stdexcept
experimental/iterator streambuf
experimental/iterator string
@@ -393,7 +385,6 @@ fstream cstdint
fstream cstdio
fstream cstdlib
fstream cstring
fstream ctime
fstream cwchar
fstream cwctype
fstream initializer_list
@@ -402,7 +393,6 @@ fstream ios
fstream iosfwd
fstream istream
fstream limits
fstream ratio
fstream stdexcept
fstream streambuf
fstream string
@@ -464,14 +454,12 @@ iomanip cstdint
iomanip cstdio
iomanip cstdlib
iomanip cstring
iomanip ctime
iomanip cwchar
iomanip cwctype
iomanip initializer_list
iomanip ios
iomanip iosfwd
iomanip limits
iomanip ratio
iomanip stdexcept
iomanip string
iomanip string_view
@@ -488,13 +476,11 @@ ios cstdint
ios cstdio
ios cstdlib
ios cstring
ios ctime
ios cwchar
ios cwctype
ios initializer_list
ios iosfwd
ios limits
ios ratio
ios stdexcept
ios string
ios string_view
@@ -514,7 +500,6 @@ iostream cstdint
iostream cstdio
iostream cstdlib
iostream cstring
iostream ctime
iostream cwchar
iostream cwctype
iostream format
@@ -526,7 +511,6 @@ iostream limits
iostream optional
iostream ostream
iostream print
iostream ratio
iostream stdexcept
iostream streambuf
iostream string
@@ -545,14 +529,12 @@ istream cstdint
istream cstdio
istream cstdlib
istream cstring
istream ctime
istream cwchar
istream cwctype
istream initializer_list
istream ios
istream iosfwd
istream limits
istream ratio
istream stdexcept
istream streambuf
istream string
@@ -601,14 +583,12 @@ locale cstdint
locale cstdio
locale cstdlib
locale cstring
locale ctime
locale cwchar
locale cwctype
locale initializer_list
locale ios
locale iosfwd
locale limits
locale ratio
locale stdexcept
locale streambuf
locale string
@@ -699,7 +679,6 @@ ostream cstdint
ostream cstdio
ostream cstdlib
ostream cstring
ostream ctime
ostream cwchar
ostream cwctype
ostream format
@@ -709,7 +688,6 @@ ostream iosfwd
ostream limits
ostream optional
ostream print
ostream ratio
ostream stdexcept
ostream streambuf
ostream string
@@ -872,7 +850,6 @@ sstream cstdint
sstream cstdio
sstream cstdlib
sstream cstring
sstream ctime
sstream cwchar
sstream cwctype
sstream initializer_list
@@ -880,7 +857,6 @@ sstream ios
sstream iosfwd
sstream istream
sstream limits
sstream ratio
sstream stdexcept
sstream streambuf
sstream string
@@ -918,14 +894,12 @@ streambuf cstdint
streambuf cstdio
streambuf cstdlib
streambuf cstring
streambuf ctime
streambuf cwchar
streambuf cwctype
streambuf initializer_list
streambuf ios
streambuf iosfwd
streambuf limits
streambuf ratio
streambuf stdexcept
streambuf string
streambuf string_view
@@ -970,7 +944,6 @@ strstream cstdint
strstream cstdio
strstream cstdlib
strstream cstring
strstream ctime
strstream cwchar
strstream cwctype
strstream initializer_list
@@ -978,7 +951,6 @@ strstream ios
strstream iosfwd
strstream istream
strstream limits
strstream ratio
strstream stdexcept
strstream streambuf
strstream string
1 algorithm cctype
73 ccomplex cstdio
74 ccomplex cstdlib
75 ccomplex cstring
ccomplex ctime
76 ccomplex cwchar
77 ccomplex cwctype
78 ccomplex initializer_list
80 ccomplex iosfwd
81 ccomplex istream
82 ccomplex limits
ccomplex ratio
83 ccomplex sstream
84 ccomplex stdexcept
85 ccomplex streambuf
164 complex cstdio
165 complex cstdlib
166 complex cstring
complex ctime
167 complex cwchar
168 complex cwctype
169 complex initializer_list
171 complex iosfwd
172 complex istream
173 complex limits
complex ratio
174 complex sstream
175 complex stdexcept
176 complex streambuf
210 ctgmath cstdio
211 ctgmath cstdlib
212 ctgmath cstring
ctgmath ctime
213 ctgmath cwchar
214 ctgmath cwctype
215 ctgmath initializer_list
217 ctgmath iosfwd
218 ctgmath istream
219 ctgmath limits
ctgmath ratio
220 ctgmath sstream
221 ctgmath stdexcept
222 ctgmath streambuf
258 experimental/iterator cstdio
259 experimental/iterator cstdlib
260 experimental/iterator cstring
experimental/iterator ctime
261 experimental/iterator cwchar
262 experimental/iterator cwctype
263 experimental/iterator initializer_list
265 experimental/iterator iosfwd
266 experimental/iterator iterator
267 experimental/iterator limits
experimental/iterator ratio
268 experimental/iterator stdexcept
269 experimental/iterator streambuf
270 experimental/iterator string
385 fstream cstdio
386 fstream cstdlib
387 fstream cstring
fstream ctime
388 fstream cwchar
389 fstream cwctype
390 fstream initializer_list
393 fstream iosfwd
394 fstream istream
395 fstream limits
fstream ratio
396 fstream stdexcept
397 fstream streambuf
398 fstream string
454 iomanip cstdio
455 iomanip cstdlib
456 iomanip cstring
iomanip ctime
457 iomanip cwchar
458 iomanip cwctype
459 iomanip initializer_list
460 iomanip ios
461 iomanip iosfwd
462 iomanip limits
iomanip ratio
463 iomanip stdexcept
464 iomanip string
465 iomanip string_view
476 ios cstdio
477 ios cstdlib
478 ios cstring
ios ctime
479 ios cwchar
480 ios cwctype
481 ios initializer_list
482 ios iosfwd
483 ios limits
ios ratio
484 ios stdexcept
485 ios string
486 ios string_view
500 iostream cstdio
501 iostream cstdlib
502 iostream cstring
iostream ctime
503 iostream cwchar
504 iostream cwctype
505 iostream format
511 iostream optional
512 iostream ostream
513 iostream print
iostream ratio
514 iostream stdexcept
515 iostream streambuf
516 iostream string
529 istream cstdio
530 istream cstdlib
531 istream cstring
istream ctime
532 istream cwchar
533 istream cwctype
534 istream initializer_list
535 istream ios
536 istream iosfwd
537 istream limits
istream ratio
538 istream stdexcept
539 istream streambuf
540 istream string
583 locale cstdio
584 locale cstdlib
585 locale cstring
locale ctime
586 locale cwchar
587 locale cwctype
588 locale initializer_list
589 locale ios
590 locale iosfwd
591 locale limits
locale ratio
592 locale stdexcept
593 locale streambuf
594 locale string
679 ostream cstdio
680 ostream cstdlib
681 ostream cstring
ostream ctime
682 ostream cwchar
683 ostream cwctype
684 ostream format
688 ostream limits
689 ostream optional
690 ostream print
ostream ratio
691 ostream stdexcept
692 ostream streambuf
693 ostream string
850 sstream cstdio
851 sstream cstdlib
852 sstream cstring
sstream ctime
853 sstream cwchar
854 sstream cwctype
855 sstream initializer_list
857 sstream iosfwd
858 sstream istream
859 sstream limits
sstream ratio
860 sstream stdexcept
861 sstream streambuf
862 sstream string
894 streambuf cstdio
895 streambuf cstdlib
896 streambuf cstring
streambuf ctime
897 streambuf cwchar
898 streambuf cwctype
899 streambuf initializer_list
900 streambuf ios
901 streambuf iosfwd
902 streambuf limits
streambuf ratio
903 streambuf stdexcept
904 streambuf string
905 streambuf string_view
944 strstream cstdio
945 strstream cstdlib
946 strstream cstring
strstream ctime
947 strstream cwchar
948 strstream cwctype
949 strstream initializer_list
951 strstream iosfwd
952 strstream istream
953 strstream limits
strstream ratio
954 strstream stdexcept
955 strstream streambuf
956 strstream string