diff options
author | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-06-06 11:56:08 +0200 |
---|---|---|
committer | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-06-13 08:29:29 +0200 |
commit | c550b5aff5227ff1298d43b060bbf3823559f383 (patch) | |
tree | 789e7e57ea240f9a44f314391527c031262c2fa1 /libstdc++-v3/testsuite/std | |
parent | cec7355d9fe2e24ccb1d82913034eebcc6c0e974 (diff) | |
download | gcc-c550b5aff5227ff1298d43b060bbf3823559f383.zip gcc-c550b5aff5227ff1298d43b060bbf3823559f383.tar.gz gcc-c550b5aff5227ff1298d43b060bbf3823559f383.tar.bz2 |
libstdc++: Format empty chrono-spec for the sys_info and local_info directly.
This patch change implementation of the formatters for sys_info and local_info,
so they no longer delegate to operator<< for ostream in case of empty spec.
As this types may be only formatted with chrono-spec containing only %%, %t, %n
specifiers and fill characters, we use a separate __formatter_chrono_info formatter.
For empty chron-spec __formatter_chrono_info formats sys_info using format_to call
with format specifier extracted from corresponding operator<<, that now delegates
to format with empty spec. For local_info we replicate functionality of the operator<<.
The alignment and padding is handled using an _Padding_sink.
For non-empty spec, we delegate to __formatter_chrono::_M_format. As non-of the
format specifiers depends on the formatted object, we pass chrono::day to avoid
triggering additional specializations.
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h (__format::__formatter_chrono_info)
[_GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI]: Define.
(std::formatter<chrono::sys_info, _CharT>)
(std::formatter<chrono::local_inf, _CharT>): Delegate to
__format::__formatter_chrono_info.
(std::operator<<(basic_ostream<_CharT, _Traits>& const sys_info&)):
Use format on sys_info with empty format spec.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diffstat (limited to 'libstdc++-v3/testsuite/std')
0 files changed, 0 insertions, 0 deletions