[gcc r16-2768] libstdc++: Add various missing exports [PR121373]
Jakub Jelinek
jakub@gcc.gnu.org
Mon Aug 4 15:20:22 GMT 2025
https://gcc.gnu.org/g:490c2c885ee5de1659d8339ea6bedd908acfacea
commit r16-2768-g490c2c885ee5de1659d8339ea6bedd908acfacea
Author: Jakub Jelinek <jakub@redhat.com>
Date: Mon Aug 4 17:12:55 2025 +0200
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 <jakub@redhat.com>
hexne <printfne@gmail.com>
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.
Diff:
---
libstdc++-v3/src/c++23/std.cc.in | 66 +++++++++++++++++++++++++++++++++++++---
1 file changed, 61 insertions(+), 5 deletions(-)
diff --git a/libstdc++-v3/src/c++23/std.cc.in b/libstdc++-v3/src/c++23/std.cc.in
index ec048f6f4f3a..2300126a5b13 100644
--- a/libstdc++-v3/src/c++23/std.cc.in
+++ b/libstdc++-v3/src/c++23/std.cc.in
@@ -277,15 +277,14 @@ export namespace std
using std::ranges::shuffle;
}
using std::shift_left;
- namespace ranges
- {
- using std::ranges::shift_left;
- }
using std::shift_right;
+#if __cpp_lib_shift >= 202202L // >= C++23
namespace ranges
{
+ using std::ranges::shift_left;
using std::ranges::shift_right;
}
+#endif
using std::sort;
namespace ranges
{
@@ -500,7 +499,9 @@ export namespace std
using ranges::fold_left;
using ranges::fold_left_first;
using ranges::fold_left_first_with_iter;
+ using ranges::fold_left_first_with_iter_result;
using ranges::fold_left_with_iter;
+ using ranges::fold_left_with_iter_result;
using ranges::fold_right;
using ranges::fold_right_last;
using ranges::in_value_result;
@@ -672,6 +673,9 @@ export namespace std
using std::popcount;
using std::rotl;
using std::rotr;
+#if __cpp_lib_byteswap // >= C++23
+ using std::byteswap;
+#endif
}
// 22.9 <bitset>
@@ -1693,6 +1697,8 @@ export namespace std
{
using std::ranges::advance;
using std::ranges::distance;
+ using std::ranges::iter_move;
+ using std::ranges::iter_swap;
using std::ranges::next;
using std::ranges::prev;
}
@@ -1747,6 +1753,9 @@ export namespace std
using std::make_const_iterator;
using std::make_const_sentinel;
#endif
+#if __glibcxx_algorithm_default_value_type // >= C++26
+ using std::projected_value_t;
+#endif
}
// <latch>
@@ -1973,6 +1982,8 @@ export namespace std
#if __cpp_lib_out_ptr
using std::out_ptr;
using std::inout_ptr;
+ using std::out_ptr_t;
+ using std::inout_ptr_t;
#endif
#if __cpp_lib_indirect
using std::indirect;
@@ -2101,7 +2112,11 @@ export namespace std
using std::lcm;
using std::midpoint;
#if __cpp_lib_ranges_iota
- namespace ranges { using ranges::iota; }
+ namespace ranges
+ {
+ using ranges::iota;
+ using ranges::iota_result;
+ }
#endif
#if __cpp_lib_saturation_arithmetic
using std::add_sat;
@@ -2512,6 +2527,43 @@ export namespace std
using std::regex_constants::operator|;
using std::regex_constants::operator|=;
using std::regex_constants::operator~;
+ using std::regex_constants::awk;
+ using std::regex_constants::basic;
+ using std::regex_constants::collate;
+ using std::regex_constants::ECMAScript;
+ using std::regex_constants::egrep;
+ using std::regex_constants::extended;
+ using std::regex_constants::grep;
+ using std::regex_constants::icase;
+ using std::regex_constants::multiline;
+ using std::regex_constants::nosubs;
+ using std::regex_constants::optimize;
+ using std::regex_constants::format_default;
+ using std::regex_constants::format_first_only;
+ using std::regex_constants::format_no_copy;
+ using std::regex_constants::format_sed;
+ using std::regex_constants::match_any;
+ using std::regex_constants::match_continuous;
+ using std::regex_constants::match_default;
+ using std::regex_constants::match_not_bol;
+ using std::regex_constants::match_not_bow;
+ using std::regex_constants::match_not_eol;
+ using std::regex_constants::match_not_eow;
+ using std::regex_constants::match_not_null;
+ using std::regex_constants::match_prev_avail;
+ using std::regex_constants::error_backref;
+ using std::regex_constants::error_badbrace;
+ using std::regex_constants::error_badrepeat;
+ using std::regex_constants::error_brace;
+ using std::regex_constants::error_brack;
+ using std::regex_constants::error_collate;
+ using std::regex_constants::error_complexity;
+ using std::regex_constants::error_ctype;
+ using std::regex_constants::error_escape;
+ using std::regex_constants::error_paren;
+ using std::regex_constants::error_range;
+ using std::regex_constants::error_space;
+ using std::regex_constants::error_stack;
}
using std::basic_regex;
using std::csub_match;
@@ -3153,6 +3205,10 @@ export namespace std
using std::is_pointer_interconvertible_base_of_v;
using std::is_pointer_interconvertible_with_class;
#endif
+#if __cpp_lib_is_scoped_enum
+ using std::is_scoped_enum;
+ using std::is_scoped_enum_v;
+#endif
}
// <typeindex>
More information about the Libstdc++-cvs
mailing list