Files
gcc/libstdc++-v3/include/std
Tomasz Kamiński 43e5eab8a4 libstdc+: Eliminate usage of alloca for non-localized formatting
This patch eliminate the use of __builtin_alloca for non-localized formatting
of integers and pointers.

For integers, the transcoding to _CharT moved from _M_format_int function
to format. This makes the maximum size (that depends on sizeof(_Int)) of the
buffer known (__buf_size) and allows use local array of _CharT (__wbuf) for
the storage. The _M_format_int is modified to accept the string of _CharT.

For pointers, r16-7844-gbfc2b87f8244a1 modified _Pres_p and _Pres_P to have
same value as _Pres_x and _Pres_X, so format specifiers are subset of one
allowed for integers. In consequence we simply delegate to format method
of __formatter_int, reducing the code duplication. The set of allowed
specifiers is still limited per C++ standard by __formatter_ptr::parse.

This patch fix issue in __formatter_ptr::parse, where for 'p' and 'P' the value
of _M_alt was negated for _M_spec (result of previous parse) instead of __spec
(result of current parse), and adjust the __formatter_ptr default constructor
to set _M_spec._M_type and _M_spec._M_alt appropriately.

libstdc++-v3/ChangeLog:

	* include/std/format (__formatter_int::format): Handle transcoding
	to _CharT before calling _M_format_int.
	(__formatter_int::_M_format_int): Accept basic_string_view<_CharT>
	and remove transcoding.
	(__formatter_ptr::__formatter_ptr): Configure _M_spec member.
	(__formatter_ptr::parse): Negate _M_alt for __spec and not _M_spec.
	(__formatter_ptr::format): Delegate to __formatter_int.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-03-10 08:23:25 +01:00
..
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00