<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/include/nolibc/stdio.h, branch v7.1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-04-06T17:46:51+00:00</updated>
<entry>
<title>tools/nolibc: add support for asprintf()</title>
<updated>2026-04-06T17:46:51+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2026-04-01T15:07:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=12496aad10c5671d66e160487326de942cd440ba'/>
<id>urn:sha1:12496aad10c5671d66e160487326de942cd440ba</id>
<content type='text'>
Add support for dynamically allocating formatted strings through
asprintf() and vasprintf().

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260401-nolibc-asprintf-v1-3-46292313439f@weissschuh.net
</content>
</entry>
<entry>
<title>tools/nolibc/printf: Support negative variable width and precision</title>
<updated>2026-04-01T16:02:37+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2026-03-23T11:22:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1dff9ac2c85860af67a74777fa6d31c2ad07a15a'/>
<id>urn:sha1:1dff9ac2c85860af67a74777fa6d31c2ad07a15a</id>
<content type='text'>
For (eg) "%*.*s" treat a negative field width as a request to left align
the output (the same as the '-' flag), and a negative precision to
request the default precision.

Set the default precision to -1 (not INT_MAX) and add explicit checks
to the string handling for negative values (makes the tet unsigned).

For numeric output check for 'precision &gt;= 0' instead of testing
_NOLIBC_PF_FLAGS_CONTAIN(flags, '.').
This needs an inverted test, some extra goto and removes an indentation.
The changed conditionals fix printf("%0-#o", 0) - but '0' and '-' shouldn't
both be specified.

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Link: https://patch.msgid.link/20260323112247.3196-1-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc/printf: Add support for octal output</title>
<updated>2026-03-20T16:58:24+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2026-03-08T11:37:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=248c7cf60c808f09044af1ce1d2c7c707696dc1e'/>
<id>urn:sha1:248c7cf60c808f09044af1ce1d2c7c707696dc1e</id>
<content type='text'>
Octal output isn't often used, but adding it costs very little.

Supporting "%#o" is mildly annoying, it has to add a leading '0' if
there isn't one present. In simple cases this is the same as adding a sign
of '0' - but that adds an extra '0' in a few places.
So you need 3 tests, %o, # and no leading '0' (which can only be checked
after the zero pad for precision).
If all the test are deferred until after zero padding then too many values
are 'live' across the call to _nolibc_u64toa_base() and get spilled to stack.
Hence the check that ignores the 'sign' if it is the same as the first
character of the output string.

Add tests for octal output.

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260308113742.12649-17-david.laight.linux@gmail.com
[Thomas: avoid a -Wsign-compare]
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc/printf: Add support for zero padding and field precision</title>
<updated>2026-03-20T16:58:10+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2026-03-08T11:37:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d3d3f64f8e964f8af6ac72294e65caad5acc452e'/>
<id>urn:sha1:d3d3f64f8e964f8af6ac72294e65caad5acc452e</id>
<content type='text'>
Includes support for variable field widths (eg "%*.*d").

Zero padding is limited to 31 zero characters.
This is wider than the largest numeric field so shouldn't be a problem.

All the standard printf formats are now supported except octal
and floating point.

Add tests for new features

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260308113742.12649-16-david.laight.linux@gmail.com
[Thomas: fixup testcases for musl libc]
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc/printf: Add support for left aligning fields</title>
<updated>2026-03-20T16:57:21+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2026-03-08T11:37:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b5f3f59cf4384a8c9e60fa4bb1a8f4ad71126a90'/>
<id>urn:sha1:b5f3f59cf4384a8c9e60fa4bb1a8f4ad71126a90</id>
<content type='text'>
Output the characters before or after the pad - writing the pad takes more code.

Include additional/changed tests

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260308113742.12649-15-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc/printf: Special case 0 and add support for %#x</title>
<updated>2026-03-20T16:57:08+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2026-03-08T11:37:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5eae5f1a01aff6f9773547265167d7a680c6fbc3'/>
<id>urn:sha1:5eae5f1a01aff6f9773547265167d7a680c6fbc3</id>
<content type='text'>
The output for %#x is almost the same as that for %p, both output in
hexadecimal with a leading "0x".
However for zero %#x should just output "0" (the same as decimal and ocal).
For %p match glibc and output "(nil)" rather than "0x0" or "0".

Add tests for "%#x", "% d", "%+d" and passing NULL to "%p".

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260308113742.12649-14-david.laight.linux@gmail.com
[Thomas: fix up testcases for musl libc]
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc/printf: Add support for conversion flags space and plus</title>
<updated>2026-03-20T16:55:52+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2026-03-08T11:37:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a30d20588fb8507540d267505a8876bc37bb3ec7'/>
<id>urn:sha1:a30d20588fb8507540d267505a8876bc37bb3ec7</id>
<content type='text'>
Flags ' ' and '+' are sign characters for positive numbers.

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260308113742.12649-13-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc/printf: Prepend sign to converted number</title>
<updated>2026-03-20T16:55:51+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2026-03-08T11:37:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8df70ee45b1383114cdcaa9b2fe7449cdf5f46d5'/>
<id>urn:sha1:8df70ee45b1383114cdcaa9b2fe7449cdf5f46d5</id>
<content type='text'>
Instead of appending the converted number to the sign, convert first
and then prepend the sign (or "0x").
Use the length returned by u64toh_r() instead of calling strlen().

Needed so that zero padding can be inserted between the sign and digits
in an upcoming patch.

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260308113742.12649-12-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc/printf: Handle "%s" with the numeric formats</title>
<updated>2026-03-20T16:55:50+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2026-03-08T11:37:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b43be424343407661d5e7c79a3584a37b91a88bb'/>
<id>urn:sha1:b43be424343407661d5e7c79a3584a37b91a88bb</id>
<content type='text'>
Avoids the extra va_arg() call with is non-trivial on a lot of
modern ABI.

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260308113742.12649-11-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc/printf: Add support for length modifiers tzqL and formats iX</title>
<updated>2026-03-20T16:55:28+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2026-03-08T11:37:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=125632871929e9bf5b0bc907c8fef2d326e4623a'/>
<id>urn:sha1:125632871929e9bf5b0bc907c8fef2d326e4623a</id>
<content type='text'>
Length modifiers t (ptrdiff_t) and z (size_t) are aliases for l (long),
q and L are 64bit the same as j (intmax).
Format i is an alias for d and X similar to x but upper case.
Supporting them is mostly just adding the relevant bit to the bit
pattern used for matching characters.
Although %X is detected the output will be lower case.

Change/add tests to use conversions i and X, and length modifiers L and ll.
Use the correct minimum value for "%Li".

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260308113742.12649-10-david.laight.linux@gmail.com
[Thomas: Fix up testcases for musl libc]
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
</feed>
