Skip to content

Commit 490c2c8

Browse files
committed
libstdc++: Add various missing exports [PR121373]
On Sat, Aug 02, 2025 at 09:05:07PM +0200, Jakub Jelinek wrote: > Wonder how to automatically discover other missing exports (like in PR121373 > std::byteswap), maybe one could dig that stuff somehow from the raw > dump (look for identifiers in std namespace (and perhaps inlined namespaces > thereof at least) which don't start with underscore. To answer that question, I wrote a simple plugin which just dumps the names (which do not start with underscore) in std namespace (and its inlined namespaces) and for non-inline namespaces in there which do not start with underscore also recurses on those namespaces. Plugin source in https://gcc.gnu.org/pipermail/libstdc++/2025-August/062859.html I went through it all now, using cppreference as a quick check for stuff removed in C++17/C++20 and for everything added verified it is in corresponding eel.is/c++-draft/*.syn etc. and looked it up in the libstdc++ headers for guarding macros. After all the additions I've compiled std.cc with -std=c++20, -std=c++23 and -std=c++26, the first one revealed std::ranges::shift_{left,right} emitted an error in that case, the patch fixes that too. 2025-08-04 Jakub Jelinek <[email protected]> hexne <[email protected]> PR libstdc++/121373 * src/c++23/std.cc.in (std::ranges::shift_left, std::ranges::shift_right): Only export for C++23 and later. (std::ranges::fold_left_first_with_iter_result, std::ranges::fold_left_with_iter_result): Export. (std::byteswap): Export for C++23 and later. (std::ranges::iter_move, std::ranges::iter_swap): Export. (std::projected_value_t): Export for C++26 and later. (std::out_ptr_t, std::inout_ptr_t): Export. (std::ranges::iota_result): Export. (std::regex_constants): Export a lot of constants. (std::is_scoped_enum, std::is_scoped_enum_v): Export.
1 parent b963237 commit 490c2c8

File tree

1 file changed

+61
-5
lines changed

1 file changed

+61
-5
lines changed

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

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,14 @@ export namespace std
277277
using std::ranges::shuffle;
278278
}
279279
using std::shift_left;
280-
namespace ranges
281-
{
282-
using std::ranges::shift_left;
283-
}
284280
using std::shift_right;
281+
#if __cpp_lib_shift >= 202202L // >= C++23
285282
namespace ranges
286283
{
284+
using std::ranges::shift_left;
287285
using std::ranges::shift_right;
288286
}
287+
#endif
289288
using std::sort;
290289
namespace ranges
291290
{
@@ -500,7 +499,9 @@ export namespace std
500499
using ranges::fold_left;
501500
using ranges::fold_left_first;
502501
using ranges::fold_left_first_with_iter;
502+
using ranges::fold_left_first_with_iter_result;
503503
using ranges::fold_left_with_iter;
504+
using ranges::fold_left_with_iter_result;
504505
using ranges::fold_right;
505506
using ranges::fold_right_last;
506507
using ranges::in_value_result;
@@ -672,6 +673,9 @@ export namespace std
672673
using std::popcount;
673674
using std::rotl;
674675
using std::rotr;
676+
#if __cpp_lib_byteswap // >= C++23
677+
using std::byteswap;
678+
#endif
675679
}
676680

677681
// 22.9 <bitset>
@@ -1693,6 +1697,8 @@ export namespace std
16931697
{
16941698
using std::ranges::advance;
16951699
using std::ranges::distance;
1700+
using std::ranges::iter_move;
1701+
using std::ranges::iter_swap;
16961702
using std::ranges::next;
16971703
using std::ranges::prev;
16981704
}
@@ -1747,6 +1753,9 @@ export namespace std
17471753
using std::make_const_iterator;
17481754
using std::make_const_sentinel;
17491755
#endif
1756+
#if __glibcxx_algorithm_default_value_type // >= C++26
1757+
using std::projected_value_t;
1758+
#endif
17501759
}
17511760

17521761
// <latch>
@@ -1973,6 +1982,8 @@ export namespace std
19731982
#if __cpp_lib_out_ptr
19741983
using std::out_ptr;
19751984
using std::inout_ptr;
1985+
using std::out_ptr_t;
1986+
using std::inout_ptr_t;
19761987
#endif
19771988
#if __cpp_lib_indirect
19781989
using std::indirect;
@@ -2101,7 +2112,11 @@ export namespace std
21012112
using std::lcm;
21022113
using std::midpoint;
21032114
#if __cpp_lib_ranges_iota
2104-
namespace ranges { using ranges::iota; }
2115+
namespace ranges
2116+
{
2117+
using ranges::iota;
2118+
using ranges::iota_result;
2119+
}
21052120
#endif
21062121
#if __cpp_lib_saturation_arithmetic
21072122
using std::add_sat;
@@ -2512,6 +2527,43 @@ export namespace std
25122527
using std::regex_constants::operator|;
25132528
using std::regex_constants::operator|=;
25142529
using std::regex_constants::operator~;
2530+
using std::regex_constants::awk;
2531+
using std::regex_constants::basic;
2532+
using std::regex_constants::collate;
2533+
using std::regex_constants::ECMAScript;
2534+
using std::regex_constants::egrep;
2535+
using std::regex_constants::extended;
2536+
using std::regex_constants::grep;
2537+
using std::regex_constants::icase;
2538+
using std::regex_constants::multiline;
2539+
using std::regex_constants::nosubs;
2540+
using std::regex_constants::optimize;
2541+
using std::regex_constants::format_default;
2542+
using std::regex_constants::format_first_only;
2543+
using std::regex_constants::format_no_copy;
2544+
using std::regex_constants::format_sed;
2545+
using std::regex_constants::match_any;
2546+
using std::regex_constants::match_continuous;
2547+
using std::regex_constants::match_default;
2548+
using std::regex_constants::match_not_bol;
2549+
using std::regex_constants::match_not_bow;
2550+
using std::regex_constants::match_not_eol;
2551+
using std::regex_constants::match_not_eow;
2552+
using std::regex_constants::match_not_null;
2553+
using std::regex_constants::match_prev_avail;
2554+
using std::regex_constants::error_backref;
2555+
using std::regex_constants::error_badbrace;
2556+
using std::regex_constants::error_badrepeat;
2557+
using std::regex_constants::error_brace;
2558+
using std::regex_constants::error_brack;
2559+
using std::regex_constants::error_collate;
2560+
using std::regex_constants::error_complexity;
2561+
using std::regex_constants::error_ctype;
2562+
using std::regex_constants::error_escape;
2563+
using std::regex_constants::error_paren;
2564+
using std::regex_constants::error_range;
2565+
using std::regex_constants::error_space;
2566+
using std::regex_constants::error_stack;
25152567
}
25162568
using std::basic_regex;
25172569
using std::csub_match;
@@ -3153,6 +3205,10 @@ export namespace std
31533205
using std::is_pointer_interconvertible_base_of_v;
31543206
using std::is_pointer_interconvertible_with_class;
31553207
#endif
3208+
#if __cpp_lib_is_scoped_enum
3209+
using std::is_scoped_enum;
3210+
using std::is_scoped_enum_v;
3211+
#endif
31563212
}
31573213

31583214
// <typeindex>

0 commit comments

Comments
 (0)