libstdc++: Plugin to dump possibly needed missing exports

Jakub Jelinek jakub@redhat.com
Mon Aug 4 09:26:37 GMT 2025


On Mon, Aug 04, 2025 at 10:58:21AM +0200, Jakub Jelinek wrote:
> 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.
> 
> /home/jakub/src/gcc/obj98/gcc/xg++ -B/home/jakub/src/gcc/obj98/gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ -nostdinc++ -B/home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -B/home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu  -I/home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/include  -I/home/jakub/src/gcc/libstdc++-v3/libsupc++ -L/home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -g -O2 -fchecking=1 /tmp/std_plugin.cc -I. -I/home/jakub/src/gcc/gcc/testsuite -I/home/jakub/src/gcc/gcc -I/home/jakub/src/gcc/obj98/gcc  -I/home/jakub/src/gcc/include -I/home/jakub/src/gcc/libcpp/include   -I/home/jakub/src/gcc/obj98/gettext/intl  -DIN_GCC -fPIC -shared -fno-rtti -o std_plugin.so
> /home/jakub/src/gcc/obj98/gcc/cc1plus -quiet -nostdinc++ -v -I /home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu -I /home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/include -I /home/jakub/src/gcc/libstdc++-v3/libsupc++ -I /home/jakub/src/gcc/libstdc++-v3/include/backward -I /home/jakub/src/gcc/libstdc++-v3/testsuite/util -iprefix /home/jakub/src/gcc/obj98/gcc/../lib/gcc/x86_64-pc-linux-gnu/16.0.0/ -isystem /home/jakub/src/gcc/obj98/gcc/include -isystem /home/jakub/src/gcc/obj98/gcc/include-fixed -iplugindir=/home/jakub/src/gcc/obj98/gcc/plugin -D_GNU_SOURCE /tmp/std_test.cc -iplugindir=/home/jakub/src/gcc/obj98/gcc/plugin -quiet -dumpbase std_test.cc -dumpbase-ext .cc -mtune=generic -march=x86-64 -O -std=c++20 -version -fdiagnostics-color=never -fdiagnostics-urls=never -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-path-format=separate-events -fdiagnostics-text-art-charset=none -fno-diagnostics-show-event-links -fmessage-length=0 -fplugin=./std_plugin.so -o std_test.s 2>&1 | sed -n 's/^cc1plus: note: //p' | sort -u | while read i; do fgrep -q "$i" *.in || echo $i; done

Sorry, seems some usings in *.in aren't fully qualified and so the list
contains some false positives.

Using:
/home/jakub/src/gcc/obj98/gcc/cc1plus -quiet -nostdinc++ -v -I /home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu -I /home/jakub/src/gcc/obj98/x86_64-pc-linux-gnu/libstdc++-v3/include -I /home/jakub/src/gcc/libstdc++-v3/libsupc++ -I /home/jakub/src/gcc/libstdc++-v3/include/backward -I /home/jakub/src/gcc/libstdc++-v3/testsuite/util -iprefix /home/jakub/src/gcc/obj98/gcc/../lib/gcc/x86_64-pc-linux-gnu/16.0.0/ -isystem /home/jakub/src/gcc/obj98/gcc/include -isystem /home/jakub/src/gcc/obj98/gcc/include-fixed -iplugindir=/home/jakub/src/gcc/obj98/gcc/plugin -D_GNU_SOURCE /tmp/std_test.cc -iplugindir=/home/jakub/src/gcc/obj98/gcc/plugin -quiet -dumpbase std_test.cc -dumpbase-ext .cc -mtune=generic -march=x86-64 -O -std=c++20 -version -fdiagnostics-color=never -fdiagnostics-urls=never -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-path-format=separate-events -fdiagnostics-text-art-charset=none -fno-diagnostics-show-event-links -fmessage-length=0 -fplugin=./std_plugin.so -o std_test.s 2>&1 | sed -n 's/^cc1plus: note: //p' | sort -u | while read i; do fgrep -q "$i" *.in && continue; case "$i" in *::*::*) fgrep -q "`echo $i | sed 's/ std::/ /'`" *.in && continue;; esac; case "$i" in *::*::*::*) fgrep -q "`echo $i | sed 's/ std::[^:]*::/ /'`" *.in && continue;; esac; echo $i; done
gives shorter lists.

	Jakub
-------------- next part --------------
using std::auto_ptr;
using std::auto_ptr_ref;
using std::binary_function;
using std::binary_negate;
using std::bind1st;
using std::bind2nd;
using std::binder1st;
using std::binder2nd;
using std::const_mem_fun1_ref_t;
using std::const_mem_fun1_t;
using std::const_mem_fun_ref_t;
using std::const_mem_fun_t;
using std::declare_no_pointers;
using std::declare_reachable;
using std::get_pointer_safety;
using std::get_temporary_buffer;
using std::get_unexpected;
using std::is_literal_type;
using std::is_literal_type_v;
using std::mem_fun;
using std::mem_fun1_ref_t;
using std::mem_fun1_t;
using std::mem_fun_ref;
using std::mem_fun_ref_t;
using std::mem_fun_t;
using std::not1;
using std::not2;
using std::operator""d;
using std::operator""h;
using std::operator""min;
using std::operator""ms;
using std::operator""ns;
using std::operator""sv;
using std::operator""us;
using std::operator""y;
using std::pointer_safety;
using std::pointer_to_binary_function;
using std::pointer_to_unary_function;
using std::ptr_fun;
using std::random_shuffle;
using std::ranges::iter_move;
using std::ranges::iter_swap;
using std::raw_storage_iterator;
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::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::regex_constants::extended;
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::grep;
using std::regex_constants::icase;
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::multiline;
using std::regex_constants::nosubs;
using std::regex_constants::optimize;
using std::result_of;
using std::result_of_t;
using std::return_temporary_buffer;
using std::set_unexpected;
using std::unary_function;
using std::unary_negate;
using std::undeclare_no_pointers;
using std::undeclare_reachable;
using std::unexpected_handler;
-------------- next part --------------
using std::auto_ptr;
using std::auto_ptr_ref;
using std::binary_function;
using std::binary_negate;
using std::bind1st;
using std::bind2nd;
using std::binder1st;
using std::binder2nd;
using std::byteswap;
using std::const_mem_fun1_ref_t;
using std::const_mem_fun1_t;
using std::const_mem_fun_ref_t;
using std::const_mem_fun_t;
using std::get_temporary_buffer;
using std::inout_ptr_t;
using std::is_literal_type;
using std::is_literal_type_v;
using std::is_scoped_enum;
using std::is_scoped_enum_v;
using std::mem_fun;
using std::mem_fun1_ref_t;
using std::mem_fun1_t;
using std::mem_fun_ref;
using std::mem_fun_ref_t;
using std::mem_fun_t;
using std::not1;
using std::not2;
using std::operator""d;
using std::operator""h;
using std::operator""min;
using std::operator""ms;
using std::operator""ns;
using std::operator""sv;
using std::operator""us;
using std::operator""y;
using std::out_ptr_t;
using std::pointer_to_binary_function;
using std::pointer_to_unary_function;
using std::ptr_fun;
using std::random_shuffle;
using std::ranges::fold_left_first_with_iter_result;
using std::ranges::fold_left_with_iter_result;
using std::ranges::iota_result;
using std::ranges::iter_move;
using std::ranges::iter_swap;
using std::raw_storage_iterator;
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::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::regex_constants::extended;
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::grep;
using std::regex_constants::icase;
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::multiline;
using std::regex_constants::nosubs;
using std::regex_constants::optimize;
using std::result_of;
using std::result_of_t;
using std::return_temporary_buffer;
using std::unary_function;
using std::unary_negate;
-------------- next part --------------
using std::auto_ptr;
using std::auto_ptr_ref;
using std::binary_function;
using std::binary_negate;
using std::bind1st;
using std::bind2nd;
using std::binder1st;
using std::binder2nd;
using std::byteswap;
using std::const_mem_fun1_ref_t;
using std::const_mem_fun1_t;
using std::const_mem_fun_ref_t;
using std::const_mem_fun_t;
using std::get_temporary_buffer;
using std::inout_ptr_t;
using std::is_literal_type;
using std::is_literal_type_v;
using std::is_scoped_enum;
using std::is_scoped_enum_v;
using std::mem_fun;
using std::mem_fun1_ref_t;
using std::mem_fun1_t;
using std::mem_fun_ref;
using std::mem_fun_ref_t;
using std::mem_fun_t;
using std::not1;
using std::not2;
using std::operator""d;
using std::operator""h;
using std::operator""min;
using std::operator""ms;
using std::operator""ns;
using std::operator""sv;
using std::operator""us;
using std::operator""y;
using std::out_ptr_t;
using std::pointer_to_binary_function;
using std::pointer_to_unary_function;
using std::projected_value_t;
using std::ptr_fun;
using std::random_shuffle;
using std::ranges::fold_left_first_with_iter_result;
using std::ranges::fold_left_with_iter_result;
using std::ranges::iota_result;
using std::ranges::iter_move;
using std::ranges::iter_swap;
using std::raw_storage_iterator;
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::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::regex_constants::extended;
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::grep;
using std::regex_constants::icase;
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::multiline;
using std::regex_constants::nosubs;
using std::regex_constants::optimize;
using std::result_of;
using std::result_of_t;
using std::return_temporary_buffer;
using std::unary_function;
using std::unary_negate;


More information about the Libstdc++ mailing list