diff options
author | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-04-24 09:32:24 +0200 |
---|---|---|
committer | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-04-25 13:02:04 +0200 |
commit | 74605294950e4a49627fb71fdedefea176f5ecf7 (patch) | |
tree | 67f2ac6d7ec11e28f8646b139336ec4812e66de0 /gcc/fortran/dump-parse-tree.cc | |
parent | 8b6cc2064306ba506b61f3e224829219033a9373 (diff) | |
download | gcc-74605294950e4a49627fb71fdedefea176f5ecf7.zip gcc-74605294950e4a49627fb71fdedefea176f5ecf7.tar.gz gcc-74605294950e4a49627fb71fdedefea176f5ecf7.tar.bz2 |
libstdc++: Constrain formatter for thread::id [PR119918]
This patch add constraint __formatter::__char to _CharT type parameter
of formatter<thread::id, _CharT> specialization, matching the constraint
of formatting of integer/pointers that are used as native handles.
The dependency on <format> header, is changed to <bits/formatfwd.h>.
To achieve that, formatting of pointers is extracted from void const*
specialization to internal __formatter_ptr<_CharT>, that can be forward
declared.
Finally, the handle representation is now printed directly to __fc.out(),
by the formatter for handle type. To support this, internal formatters
can now be constructed from _Spec object as alternative to invoking parse
method.
PR libstdc++/119918
libstdc++-v3/ChangeLog:
* include/bits/formatfwd.h (__format::_Align): Moved from std/format.
(std::__throw_format_error, __format::__formatter_str)
(__format::__formatter_ptr): Declare.
* include/std/format (__format::_Align): Moved to bits/formatfwd.h.
(__formatter_int::__formatter_int): Define.
(__format::__formatter_ptr): Extracted from formatter for const void*.
(std::formatter<const void*, _CharT>, formatter<void*, _CharT>)
(std::formatter<nullptr_t, _CharT>): Delegate to __formatter_ptr<_CharT>.
* include/std/thread (std::formatter<thread::id, _CharT>): Constrain
_CharT template parameter.
(formatter<thread::id, _CharT>::parse): Specify default aligment, and
qualify __throw_format_error to disable ADL.
(formatter<thread::id, _CharT>::format): Use formatters to write directly
to output.
* testsuite/30_threads/thread/id/output.cc: Tests for formatting thread::id
representing not-a-thread with padding and formattable concept.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diffstat (limited to 'gcc/fortran/dump-parse-tree.cc')
0 files changed, 0 insertions, 0 deletions