mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:25:24 +02:00
We don't want to export std::vprint_unicode etc. from libstdc++.so yet, but we can give users the option of improving compile times by getting the definitions of the std::print internals from libstdc++exp.a instead. This commit adds a macro, _GLIBCXX_NO_INLINE_PRINT, which disables the inline definitions of std::vprint_unicode etc. so that extern definitions in libstdc++exp.a can be used instead. With this change compiling a helloworld using std::print goes from 8s to under 2s with trunk. For release branches with --enable-checking=release we should see even faster times. The object file size is also dramatically smaller, because there's just a single call to an extern function instead of instantiating the entire std::print and std::format implementation inline. libstdc++-v3/ChangeLog: PR libstdc++/124410 * doc/html/*: Regenerate. * doc/xml/manual/using.xml (_GLIBCXX_NO_INLINE_PRINT): Document macro. * include/Makefile.am: Add bits/print.h and bits/ostream_print.h headers. * include/Makefile.in: Regenerate. * include/std/ostream (vprint_nonunicode, vprint_unicode): Move definitions to new bits/ostream_print.h header. * include/std/print (__format::_File_sink, vprint_nonunicode) (vprint_nonunicode_buffered, vprint_unicode) (vprint_unicode_buffered): Move definitions to new bits/print.h header. * src/c++23/print.cc: Include new headers to define symbols for inline print functions. * include/bits/ostream_print.h: New file. * include/bits/print.h: New file.