]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Support wide characters output for sys_info and local_info [PR120565]
authorTomasz Kamiński <tkaminsk@redhat.com>
Fri, 6 Jun 2025 07:07:49 +0000 (09:07 +0200)
committerTomasz Kamiński <tkaminsk@redhat.com>
Fri, 6 Jun 2025 08:05:35 +0000 (10:05 +0200)
commit6dcba678030181527c6010551387917b8d734904
tree9b1d48e814b4c9c488f6b338643c28e96e408959
parent66e65eb50d16affca66f29927478d109533f71bb
libstdc++: Support wide characters output for sys_info and local_info [PR120565]

Formatting sys_info as wchar_t require widening of the abbrev (zone) member.
To support that we reuse the existing code in support for '%Z' specifier, for
local_time_format, and produce output using singe format call with
"[{0:%F %T},{1:%F %T},{2:%T},{3:%Q%q},{0:%Z}]" format string. As noted in the
comment, produced output is locale independed, as it does not contain decimal
separtors.

For sys_info, the outputed literals are widended using _GLIBCXX_WIDEN, except
opening and closing brackets, that are fetched from __format::_Separators.

PR libstdc++/120565

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h
(operator<<(basic_ostream<_CharT, _Traits>&, const sys_info&))
(operator<<(basic_ostream<_CharT, _Traits>&, const local_info&)):
Support wchar_t as _CharT.
* testsuite/std/time/format/empty_spec.cc: Instantiated test_infos for
wchar_t and increase timeout.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
libstdc++-v3/include/bits/chrono_io.h
libstdc++-v3/testsuite/std/time/format/empty_spec.cc