<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/libstdc++-v3/include/std/format, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/'/>
<entry>
<title>libstdc++: Ensure that _Utf_view is always a view.</title>
<updated>2025-11-14T17:27:01+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-11-14T16:43:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=f94a73e0fcedf7a05b04aa12beee57b9a82859a5'/>
<id>f94a73e0fcedf7a05b04aa12beee57b9a82859a5</id>
<content type='text'>
Previously, _Utf_view accepted any input_range, including reference-to-array
types like char(&amp;)[2], and stored it as the _M_base member. In such cases,
_Utf_view was not assignable, failing the requirements of view concept.

This patch addresses the issue by adding the ranges::view constraint to the
second template parameter of _Utf_view, and for clarity renaming it from
_Range to _View. The constructor is also adjusted to accept its argument
by value (views must be O(1) move-constructible). This prevents implicitly
generated CTAD from deducing a reference type.

This makes _Utf_view consistent with both other standard views and the
wording from P2728R8: Unicode in the Library, Part 1: UTF Transcoding [1].

The explicit CTAD from viewable_range is not defined for _Utf_view because
it depends on views::all_t, views::ref_view, and views::owning_view,
which are declared in &lt;ranges&gt;. Consequently, users must explicitly cast
the argument to a view or specify it as a template parameter.

[1] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2728r8.html

libstdc++-v3/ChangeLog:

	* include/bits/unicode.h (_Utf_view): Rename the template parameter
	from _Range to _View and constrain it with ranges::view.
	(_Utf_view::_Utf_view): Accept by value instead of rvalue reference.
	* include/std/format (__format::__write_padded): Replace _Utf_view
	over const char32_t(&amp;)[1] with span&lt;const char32_t, 1&gt;.
	* testsuite/ext/unicode/view.cc: Add checks if specialization
	of _Utf_view satisfy view. Wrap arrays into std::span before
	constructing _Utf_view.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, _Utf_view accepted any input_range, including reference-to-array
types like char(&amp;)[2], and stored it as the _M_base member. In such cases,
_Utf_view was not assignable, failing the requirements of view concept.

This patch addresses the issue by adding the ranges::view constraint to the
second template parameter of _Utf_view, and for clarity renaming it from
_Range to _View. The constructor is also adjusted to accept its argument
by value (views must be O(1) move-constructible). This prevents implicitly
generated CTAD from deducing a reference type.

This makes _Utf_view consistent with both other standard views and the
wording from P2728R8: Unicode in the Library, Part 1: UTF Transcoding [1].

The explicit CTAD from viewable_range is not defined for _Utf_view because
it depends on views::all_t, views::ref_view, and views::owning_view,
which are declared in &lt;ranges&gt;. Consequently, users must explicitly cast
the argument to a view or specify it as a template parameter.

[1] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2728r8.html

libstdc++-v3/ChangeLog:

	* include/bits/unicode.h (_Utf_view): Rename the template parameter
	from _Range to _View and constrain it with ranges::view.
	(_Utf_view::_Utf_view): Accept by value instead of rvalue reference.
	* include/std/format (__format::__write_padded): Replace _Utf_view
	over const char32_t(&amp;)[1] with span&lt;const char32_t, 1&gt;.
	* testsuite/ext/unicode/view.cc: Add checks if specialization
	of _Utf_view satisfy view. Wrap arrays into std::span before
	constructing _Utf_view.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Remove unused local type alias &lt;format&gt;.</title>
<updated>2025-10-14T15:40:11+00:00</updated>
<author>
<name>Luc Grosheintz</name>
<email>luc.grosheintz@gmail.com</email>
</author>
<published>2025-10-14T15:16:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=ec331001eaa1e42c6ff9536fa51aeaf2a1c86a6a'/>
<id>ec331001eaa1e42c6ff9536fa51aeaf2a1c86a6a</id>
<content type='text'>
After r16-4421-g59cabe08b57a26 the local type alias _String isn't used
anymore and therefore causes warnings when building the tests with
`-Wall -Wextra`.

libstdc++-v3/ChangeLog:

	* include/std/format (_M_format_range): Remove unused local type
	alias _String.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;0
Signed-off-by: Luc Grosheintz &lt;luc.grosheintz@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
After r16-4421-g59cabe08b57a26 the local type alias _String isn't used
anymore and therefore causes warnings when building the tests with
`-Wall -Wextra`.

libstdc++-v3/ChangeLog:

	* include/std/format (_M_format_range): Remove unused local type
	alias _String.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;0
Signed-off-by: Luc Grosheintz &lt;luc.grosheintz@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Implement _Escaping_sink to avoid construction of string</title>
<updated>2025-10-14T13:40:26+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-07-08T16:50:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=59cabe08b57a262d5d7d041515889a012189c908'/>
<id>59cabe08b57a262d5d7d041515889a012189c908</id>
<content type='text'>
This patch implements _Escaping_sink that stores characters in a local (stack)
buffer. When the buffer is full, the range of characters is escaped and written
to the underlying sink.

To support above, the __write_escaped_unicode_part function are defined.
It takes __str and __prev_esc by reference. The __prev_esc value is updated
based on the last character written. If the buffer ends with an incomplete
code point sequence, __str is left non-empty and last code points are not
written. _Escaping_sink then copies these characters to the front of the
buffer to reconstruct the full code point.

__formatter__str::_M_format_range now uses _Escaping_sink to escape any
non-continuous character sequences.

libstdc++-v3/ChangeLog:

	* include/std/format (__format::__write_escape_seqs)
	(__format::_Escaping_sink): Define.
	(__format::__write_escaped_unicode_part): Extract from
	__format::__write_escaped_unicode.
	(__format::__write_escaped_unicode): Forward to
	__write_escaped_unicode_part.
	(__formatter_str::_M_format_range): Use _Escaping sink.
	* testsuite/std/format/ranges/string.cc: New tests for
	character which codepoints will be split in buffer and
	escaping. Invoked test_padding.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch implements _Escaping_sink that stores characters in a local (stack)
buffer. When the buffer is full, the range of characters is escaped and written
to the underlying sink.

To support above, the __write_escaped_unicode_part function are defined.
It takes __str and __prev_esc by reference. The __prev_esc value is updated
based on the last character written. If the buffer ends with an incomplete
code point sequence, __str is left non-empty and last code points are not
written. _Escaping_sink then copies these characters to the front of the
buffer to reconstruct the full code point.

__formatter__str::_M_format_range now uses _Escaping_sink to escape any
non-continuous character sequences.

libstdc++-v3/ChangeLog:

	* include/std/format (__format::__write_escape_seqs)
	(__format::_Escaping_sink): Define.
	(__format::__write_escaped_unicode_part): Extract from
	__format::__write_escaped_unicode.
	(__format::__write_escaped_unicode): Forward to
	__write_escaped_unicode_part.
	(__formatter_str::_M_format_range): Use _Escaping sink.
	* testsuite/std/format/ranges/string.cc: New tests for
	character which codepoints will be split in buffer and
	escaping. Invoked test_padding.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Adjust enable_nonlocking_formatter_optimization specializations [PR121790]</title>
<updated>2025-10-10T07:23:01+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-10-03T07:01:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=ef29eabf5512c0149bfb8261a9a1bafae5547e00'/>
<id>ef29eabf5512c0149bfb8261a9a1bafae5547e00</id>
<content type='text'>
This patch addresses several issues related to the additional specializations
for enable_nonlocking_formatter_optimization fomr P3235R3 proposal:

* LWG4399 [1]: Apply remove_cvref_t to tuple and pair elements when checking if
	the direct printing optimization is enabled.
* LWG4398 [2]: Disable the direct printing optimization for the standard library
	 container adaptors: queue, priority_queue, and stack.
* LWG4400 [3]: Enable the direct printing optimization only for durations that
	 use standard arithmetic types. Conditionally enable it for hh_mm_ss
	 and time_points based on their underlying Duration template argument.

[1] https://cplusplus.github.io/LWG/issue4399
[2] https://cplusplus.github.io/LWG/issue4398
[3] https://cplusplus.github.io/LWG/issue4400

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h (enable_nonlocking_formatter_optimization):
	Adjust specializations for duration, hh_mm_ss and time_points.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Apply remove_cvref_t on pair and tuple elements.
	* include/std/queue (enable_nonlocking_formatter_optimization):
	Change specialization value to false.
	* include/std/stack (enable_nonlocking_formatter_optimization):
	Change specialization value to false.
	* testsuite/std/format/ranges/adaptors.cc: Adjusted tests.
	* testsuite/std/format/tuple.cc: Adjusted tests.
	* testsuite/std/time/format/nonlocking.cc: Adjusted tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch addresses several issues related to the additional specializations
for enable_nonlocking_formatter_optimization fomr P3235R3 proposal:

* LWG4399 [1]: Apply remove_cvref_t to tuple and pair elements when checking if
	the direct printing optimization is enabled.
* LWG4398 [2]: Disable the direct printing optimization for the standard library
	 container adaptors: queue, priority_queue, and stack.
* LWG4400 [3]: Enable the direct printing optimization only for durations that
	 use standard arithmetic types. Conditionally enable it for hh_mm_ss
	 and time_points based on their underlying Duration template argument.

[1] https://cplusplus.github.io/LWG/issue4399
[2] https://cplusplus.github.io/LWG/issue4398
[3] https://cplusplus.github.io/LWG/issue4400

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h (enable_nonlocking_formatter_optimization):
	Adjust specializations for duration, hh_mm_ss and time_points.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Apply remove_cvref_t on pair and tuple elements.
	* include/std/queue (enable_nonlocking_formatter_optimization):
	Change specialization value to false.
	* include/std/stack (enable_nonlocking_formatter_optimization):
	Change specialization value to false.
	* testsuite/std/format/ranges/adaptors.cc: Adjusted tests.
	* testsuite/std/format/tuple.cc: Adjusted tests.
	* testsuite/std/time/format/nonlocking.cc: Adjusted tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Implement P3235R3 optimizations for std::print [PR121790]</title>
<updated>2025-10-10T07:13:00+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-10-02T14:17:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=c8b388a94890b06d58a290dd39b9023cc4383c80'/>
<id>c8b388a94890b06d58a290dd39b9023cc4383c80</id>
<content type='text'>
This patch implements additional enable_nonlocking_formatter_optimization
specializations listed in P3235R3.

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h
	(enable_nonlocking_formatter_optimization): Define specializations
	for chrono types.
	* include/bits/version.def (print): Bump.
	* include/bits/version.h: Regenerate.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Define specializations for pair, tuple and ranges.
	* include/std/queue (enable_nonlocking_formatter_optimization):
	Define specializations for queue and priority_queue.
	* include/std/stack (enable_nonlocking_formatter_optimization):
	Define specialization for stack.
	* include/std/stacktrace (enable_nonlocking_formatter_optimization):
	Define specialization for basic_stacktrace and stacktrace_entry.
	* include/std/thread (enable_nonlocking_formatter_optimization):
	Define specialization for thread::id.
	* include/std/vector (enable_nonlocking_formatter_optimization):
	Define specialization for vector&lt;bool&gt;::reference.
	* testsuite/23_containers/vector/bool/format.cc: Test value of
	enable_nonlocking_formatter_optimization.
	* testsuite/30_threads/thread/id/output.cc: Likewise.
	* testsuite/std/format/ranges/adaptors.cc: Likewise.
	* testsuite/std/format/ranges/formatter.cc: Likewise.
	* testsuite/std/format/tuple.cc: Likewise.
	* testsuite/std/time/format/empty_spec.cc: Extract Rep class
	to custom_rep.h.
	* testsuite/std/time/format/custom_rep.h: Extracted from
	empty_spec.cc.
	* testsuite/std/time/format/nonlocking.cc: New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch implements additional enable_nonlocking_formatter_optimization
specializations listed in P3235R3.

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h
	(enable_nonlocking_formatter_optimization): Define specializations
	for chrono types.
	* include/bits/version.def (print): Bump.
	* include/bits/version.h: Regenerate.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Define specializations for pair, tuple and ranges.
	* include/std/queue (enable_nonlocking_formatter_optimization):
	Define specializations for queue and priority_queue.
	* include/std/stack (enable_nonlocking_formatter_optimization):
	Define specialization for stack.
	* include/std/stacktrace (enable_nonlocking_formatter_optimization):
	Define specialization for basic_stacktrace and stacktrace_entry.
	* include/std/thread (enable_nonlocking_formatter_optimization):
	Define specialization for thread::id.
	* include/std/vector (enable_nonlocking_formatter_optimization):
	Define specialization for vector&lt;bool&gt;::reference.
	* testsuite/23_containers/vector/bool/format.cc: Test value of
	enable_nonlocking_formatter_optimization.
	* testsuite/30_threads/thread/id/output.cc: Likewise.
	* testsuite/std/format/ranges/adaptors.cc: Likewise.
	* testsuite/std/format/ranges/formatter.cc: Likewise.
	* testsuite/std/format/tuple.cc: Likewise.
	* testsuite/std/time/format/empty_spec.cc: Extract Rep class
	to custom_rep.h.
	* testsuite/std/time/format/custom_rep.h: Extracted from
	empty_spec.cc.
	* testsuite/std/time/format/nonlocking.cc: New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Implement P3107R5 optimizations for std::print [PR121790]</title>
<updated>2025-10-10T07:00:22+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2024-02-21T16:11:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=8bd872f1ea74143aed0bd5148804a25dc6a9caf0'/>
<id>8bd872f1ea74143aed0bd5148804a25dc6a9caf0</id>
<content type='text'>
The names of the vprint functions follow the convention from P3235R3.

This takes advantage of the additional permission proposed by P3107R5 so
that std::print can write directly to a FILE stream, rather than
formatting to an intermediate std::string temporary and then writing
that to the stream. The change is to write to a new _File_sink type
instead of a _Str_sink that populates a std::string. There are three
implementations of _File_sink.

For non-Glibc targets that support POSIX flockfile and putc_unlocked,
the stream will be locked and then formatted characters will be buffered
on the stack (instead of allocating a std::string) and copied to the
stream when the buffer fills up.

For Glibc, _File_sink will lock the stream but then if the file is
line-buffered or fully buffered, characters will be written directly
into the file's output buffer. This avoids two levels of buffering and
copying the characters from one to the other. For an unbuffered stream
(like stderr) the _File_sink buffer will still be used, to avoid the
overhead of lots of small writes to the stream.  Because this version of
_File_sink accesses the stream's buffer directly it relies on
glibc-specific implementation details that are exposed in public
headers.

A fallback definition of _File_sink just wraps a _Str_sink so is
equivalent to the original code, and is used when flockfile isn't
available.

Both forms of std::println (taking a FILE* and a std::ostream) can be
implemented more efficiently by appending a newline to the format
string, to avoid formatting twice.

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_STDIO_LOCKING): New macro to check
	for std::print dependencies.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_STDIO_LOCKING.
	* include/bits/formatfwd.h (enable_nonlocking_formatter_optimization):
	Define new variable template.
	* include/bits/version.def (print): Bump value.
	* include/bits/version.h: Regenerate.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Define specializations for variable template.
	* include/std/ostream (print) [!_WIN32]: Do not use
	vprint_unicode at all.
	(println): Append newline to format string instead of formatting
	twice.
	* include/std/print (_File_sink): New class.
	(vprint_nonunicode_locking): New function.
	(vprint_unicode_locking): New function reusing previous code
	from vprint_unicode.
	(vprintf_unicode): Defer to vprint_nonunicode for Windows or to
	vprint_unicode_locking otherwise.
	(print): [!_WIN32]: Do no use vprint_unicode at all.
	Check enable_nonlocking_formatter_optimization and defer to
	either vprint_nonunicode_locking or vprint_nonunicode.
	(println): Use vprint_unicode or format directly to a _File_sink
	instead of formatting twice.
	* testsuite/27_io/print/1.cc: Updated and added new tests.
	* testsuite/std/format/formatter/nonlocking.cc: New tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Co-authored-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The names of the vprint functions follow the convention from P3235R3.

This takes advantage of the additional permission proposed by P3107R5 so
that std::print can write directly to a FILE stream, rather than
formatting to an intermediate std::string temporary and then writing
that to the stream. The change is to write to a new _File_sink type
instead of a _Str_sink that populates a std::string. There are three
implementations of _File_sink.

For non-Glibc targets that support POSIX flockfile and putc_unlocked,
the stream will be locked and then formatted characters will be buffered
on the stack (instead of allocating a std::string) and copied to the
stream when the buffer fills up.

For Glibc, _File_sink will lock the stream but then if the file is
line-buffered or fully buffered, characters will be written directly
into the file's output buffer. This avoids two levels of buffering and
copying the characters from one to the other. For an unbuffered stream
(like stderr) the _File_sink buffer will still be used, to avoid the
overhead of lots of small writes to the stream.  Because this version of
_File_sink accesses the stream's buffer directly it relies on
glibc-specific implementation details that are exposed in public
headers.

A fallback definition of _File_sink just wraps a _Str_sink so is
equivalent to the original code, and is used when flockfile isn't
available.

Both forms of std::println (taking a FILE* and a std::ostream) can be
implemented more efficiently by appending a newline to the format
string, to avoid formatting twice.

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_STDIO_LOCKING): New macro to check
	for std::print dependencies.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_STDIO_LOCKING.
	* include/bits/formatfwd.h (enable_nonlocking_formatter_optimization):
	Define new variable template.
	* include/bits/version.def (print): Bump value.
	* include/bits/version.h: Regenerate.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Define specializations for variable template.
	* include/std/ostream (print) [!_WIN32]: Do not use
	vprint_unicode at all.
	(println): Append newline to format string instead of formatting
	twice.
	* include/std/print (_File_sink): New class.
	(vprint_nonunicode_locking): New function.
	(vprint_unicode_locking): New function reusing previous code
	from vprint_unicode.
	(vprintf_unicode): Defer to vprint_nonunicode for Windows or to
	vprint_unicode_locking otherwise.
	(print): [!_WIN32]: Do no use vprint_unicode at all.
	Check enable_nonlocking_formatter_optimization and defer to
	either vprint_nonunicode_locking or vprint_nonunicode.
	(println): Use vprint_unicode or format directly to a _File_sink
	instead of formatting twice.
	* testsuite/27_io/print/1.cc: Updated and added new tests.
	* testsuite/std/format/formatter/nonlocking.cc: New tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Co-authored-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Fix more missing uses of iter_difference_t [PR119820]</title>
<updated>2025-09-16T09:57:36+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-09-15T13:18:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=0067696c6777f4917a262b7dadefa7fd110de26e'/>
<id>0067696c6777f4917a262b7dadefa7fd110de26e</id>
<content type='text'>
libstdc++-v3/ChangeLog:

	PR libstdc++/119820
	* include/bits/ranges_algo.h (__shuffle_fn): Use
	ranges::distance to get difference type value to add to
	iterator.
	* include/std/format (__formatter_str::_M_format_range):
	Use ranges::next to increment iterator by a size_t value.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
libstdc++-v3/ChangeLog:

	PR libstdc++/119820
	* include/bits/ranges_algo.h (__shuffle_fn): Use
	ranges::distance to get difference type value to add to
	iterator.
	* include/std/format (__formatter_str::_M_format_range):
	Use ranges::next to increment iterator by a size_t value.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Use _Drop_iter&lt;_CharT&gt; for formattable concept checking [PR121765]</title>
<updated>2025-09-10T09:44:33+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-09-04T11:58:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=ac1665954058f355aab11e1b48b1176c7e0af363'/>
<id>ac1665954058f355aab11e1b48b1176c7e0af363</id>
<content type='text'>
When producing output, the libstdc++ format implementation only uses _Sink_iter
specializations. Since users cannot construct basic_format_context, this is the
only iterator type actually used. The __format_padded helper relies on this
property to efficiently pad sequences from tuples and ranges.

However, the standard's formattable concept requires a generic format function
in formatters that works with any iterator type. This is intended to
future-proof the implementation by allowing new format_context types. Previously,
libstdc++ used back_insert_iterator&lt;basic_string&lt;_CharT&gt;&gt; for this purpose.

Normally, concept checks only instantiate function signatures, but with
user-defined formatters and deduced return types, the function body and all
called functions are instantiated. This could trigger a static assertion error
in the range/tuple formatter that assumed the iterator was a _Sink_iter
(see included test).

This patch resolves the issue by replacing the _Iter_for_t alias with the
internal _Drop_iter. This iterator's sematnics is to drop elements, so
__format_padded can handle it by simply returning the input iterator, which
still produces the required behavior [1].

An alternative of using _Sink_iter was considered but rejected because it would
allow formatters to pass formattable requirements while only supporting
format_context and wformat_context, which seems counter to the design intent
(the std/format/formatter/concept.cc fails).

[1] The standard's wording defines format functions as producing an output
representation, but does not explicitly require a formatter to be invoked
for each element. This allows the use of _Drop_iter to pass the concept check
without generating any output.

	PR libstdc++/121765

libstdc++-v3/ChangeLog:

	* include/std/format (__format::_Drop_iter): Define.
	(_Iter_for_t::type): Change alias to _Drop_iter.
	(__format::__format_padded): Return __fc.out() for
	_Drop_iter.
	* testsuite/std/format/pr121765.cc: New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When producing output, the libstdc++ format implementation only uses _Sink_iter
specializations. Since users cannot construct basic_format_context, this is the
only iterator type actually used. The __format_padded helper relies on this
property to efficiently pad sequences from tuples and ranges.

However, the standard's formattable concept requires a generic format function
in formatters that works with any iterator type. This is intended to
future-proof the implementation by allowing new format_context types. Previously,
libstdc++ used back_insert_iterator&lt;basic_string&lt;_CharT&gt;&gt; for this purpose.

Normally, concept checks only instantiate function signatures, but with
user-defined formatters and deduced return types, the function body and all
called functions are instantiated. This could trigger a static assertion error
in the range/tuple formatter that assumed the iterator was a _Sink_iter
(see included test).

This patch resolves the issue by replacing the _Iter_for_t alias with the
internal _Drop_iter. This iterator's sematnics is to drop elements, so
__format_padded can handle it by simply returning the input iterator, which
still produces the required behavior [1].

An alternative of using _Sink_iter was considered but rejected because it would
allow formatters to pass formattable requirements while only supporting
format_context and wformat_context, which seems counter to the design intent
(the std/format/formatter/concept.cc fails).

[1] The standard's wording defines format functions as producing an output
representation, but does not explicitly require a formatter to be invoked
for each element. This allows the use of _Drop_iter to pass the concept check
without generating any output.

	PR libstdc++/121765

libstdc++-v3/ChangeLog:

	* include/std/format (__format::_Drop_iter): Define.
	(_Iter_for_t::type): Change alias to _Drop_iter.
	(__format::__format_padded): Return __fc.out() for
	_Drop_iter.
	* testsuite/std/format/pr121765.cc: New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Treat __int128 as a real integral type [PR96710]</title>
<updated>2025-07-11T07:34:13+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-05-16T12:33:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=4faa42ac0dee2c26ed68f0df002837e7e1c95687'/>
<id>4faa42ac0dee2c26ed68f0df002837e7e1c95687</id>
<content type='text'>
Since LWG 3828 (included in C++23) implementations are allowed to have
extended integer types that are wider than intmax_t. This means we no
longer have to make is_integral_v&lt;__int128&gt; false for strict -std=c++23
mode, removing the confusing inconsistency with -std=gnu++23 (where
is_integral_v&lt;__int128&gt; is true).

This change makes __int128 a true integral type for all modes, treating
LWG 3828 as a DR for previous standards. Most of the change just
involves removing special cases where we wanted to treat __int128 and
unsigned __int128 as integral types even when is_integral_v was false.

There are still some preprocessor conditionals needed, because on some
targets the compiler defines the macro __GLIBCXX_TYPE_INT_N_0 as
__int128 in non-strict modes. Because we define explicit specializations
of templates such as is_integral for all the INT_N types, we already
have a specialization of is_integral&lt;__int128&gt; in non-strict modes, and
so to avoid a redefinition we only must only define
is_integral&lt;__int128&gt; for strict modes.

libstdc++-v3/ChangeLog:

	PR libstdc++/96710
	* include/bits/cpp_type_traits.h (__is_integer): Define explicit
	specializations for __int128.
	(__memcpyable_integer): Remove explicit specializations for
	__int128.
	* include/bits/iterator_concepts.h (incrementable_traits):
	Likewise.
	(__is_signed_int128, __is_unsigned_int128, __is_int128): Remove.
	(__is_integer_like, __is_signed_integer_like): Remove check for
	__int128.
	* include/bits/max_size_type.h: Remove all uses of __is_int128
	in constraints.
	* include/bits/ranges_base.h (__to_unsigned_like): Remove
	overloads for __int128.
	(ranges::ssize): Remove special case for __int128.
	* include/bits/stl_algobase.h (__size_to_integer): Define
	__int128 overloads for strict modes.
	* include/ext/numeric_traits.h (__is_integer_nonstrict): Remove
	explicit specializations for __int128.
	* include/std/charconv (to_chars): Define overloads for
	__int128.
	* include/std/format (__format::make_unsigned_t): Remove.
	(__format::to_chars): Remove.
	* include/std/limits (numeric_limits): Define explicit
	specializations for __int128.
	* include/std/type_traits (__is_integral_helper): Likewise.
	(__make_unsigned, __make_signed): Likewise.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since LWG 3828 (included in C++23) implementations are allowed to have
extended integer types that are wider than intmax_t. This means we no
longer have to make is_integral_v&lt;__int128&gt; false for strict -std=c++23
mode, removing the confusing inconsistency with -std=gnu++23 (where
is_integral_v&lt;__int128&gt; is true).

This change makes __int128 a true integral type for all modes, treating
LWG 3828 as a DR for previous standards. Most of the change just
involves removing special cases where we wanted to treat __int128 and
unsigned __int128 as integral types even when is_integral_v was false.

There are still some preprocessor conditionals needed, because on some
targets the compiler defines the macro __GLIBCXX_TYPE_INT_N_0 as
__int128 in non-strict modes. Because we define explicit specializations
of templates such as is_integral for all the INT_N types, we already
have a specialization of is_integral&lt;__int128&gt; in non-strict modes, and
so to avoid a redefinition we only must only define
is_integral&lt;__int128&gt; for strict modes.

libstdc++-v3/ChangeLog:

	PR libstdc++/96710
	* include/bits/cpp_type_traits.h (__is_integer): Define explicit
	specializations for __int128.
	(__memcpyable_integer): Remove explicit specializations for
	__int128.
	* include/bits/iterator_concepts.h (incrementable_traits):
	Likewise.
	(__is_signed_int128, __is_unsigned_int128, __is_int128): Remove.
	(__is_integer_like, __is_signed_integer_like): Remove check for
	__int128.
	* include/bits/max_size_type.h: Remove all uses of __is_int128
	in constraints.
	* include/bits/ranges_base.h (__to_unsigned_like): Remove
	overloads for __int128.
	(ranges::ssize): Remove special case for __int128.
	* include/bits/stl_algobase.h (__size_to_integer): Define
	__int128 overloads for strict modes.
	* include/ext/numeric_traits.h (__is_integer_nonstrict): Remove
	explicit specializations for __int128.
	* include/std/charconv (to_chars): Define overloads for
	__int128.
	* include/std/format (__format::make_unsigned_t): Remove.
	(__format::to_chars): Remove.
	* include/std/limits (numeric_limits): Define explicit
	specializations for __int128.
	* include/std/type_traits (__is_integral_helper): Likewise.
	(__make_unsigned, __make_signed): Likewise.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Do not expose set_brackets/set_separator for formatter with format_kind other than sequence [PR119861]</title>
<updated>2025-07-08T15:08:46+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-07-08T08:04:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=70bd97e89ddf8fcb8c14e84a8fd580404536eeb1'/>
<id>70bd97e89ddf8fcb8c14e84a8fd580404536eeb1</id>
<content type='text'>
The standard defines separate specializations of range-default-formatter, out
of which only one for range_format::sequence provide the set_brackets and
set_separator methods. We implemented it as one specialization and exposed
this method for range_format other than string or debug_string, i.e. when
range_formatter was used as underlying formatter.

	PR libstdc++/119861

libstdc++-v3/ChangeLog:

	* include/std/format (formatter&lt;_Rg, _CharT&gt;::set_separator)
	(formatter&lt;_Rg, _CharT&gt;::set_brackets): Constrain with
	(format_kind&lt;_Rg&gt; == range_format::sequence).
	* testsuite/std/format/ranges/pr119861_neg.cc: New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The standard defines separate specializations of range-default-formatter, out
of which only one for range_format::sequence provide the set_brackets and
set_separator methods. We implemented it as one specialization and exposed
this method for range_format other than string or debug_string, i.e. when
range_formatter was used as underlying formatter.

	PR libstdc++/119861

libstdc++-v3/ChangeLog:

	* include/std/format (formatter&lt;_Rg, _CharT&gt;::set_separator)
	(formatter&lt;_Rg, _CharT&gt;::set_brackets): Constrain with
	(format_kind&lt;_Rg&gt; == range_format::sequence).
	* testsuite/std/format/ranges/pr119861_neg.cc: New test.
</pre>
</div>
</content>
</entry>
</feed>
