<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/libc/docs/dev/printf_behavior.rst, branch users/nico/python-2</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[libc][NFC] Strip all training whitespace and missing newlines (#124163)</title>
<updated>2025-01-23T18:02:54+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2025-01-23T18:02:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=db6b7a84e6e4949569e756f46357d9f54ad16a03'/>
<id>db6b7a84e6e4949569e756f46357d9f54ad16a03</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Add printf strerror conversion (%m) (#105891)</title>
<updated>2024-09-19T17:48:08+00:00</updated>
<author>
<name>Michael Jones</name>
<email>michaelrj@google.com</email>
</author>
<published>2024-09-19T17:48:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f009f72df5285acab0ebb600636653d7db72a552'/>
<id>f009f72df5285acab0ebb600636653d7db72a552</id>
<content type='text'>
This patch adds the %m conversion to printf, which prints the
strerror(errno). Explanation of why is below, this patch also updates
the docs, tests, and build system to accomodate this.

The standard for syslog in posix specifies it uses the same format as
printf, but adds %m which prints the error message string for the
current value of errno. For ease of implementation, it's standard
practice for libc implementers to just add %m to printf instead of
creating a separate parser for syslog.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds the %m conversion to printf, which prints the
strerror(errno). Explanation of why is below, this patch also updates
the docs, tests, and build system to accomodate this.

The standard for syslog in posix specifies it uses the same format as
printf, but adds %m which prints the error message string for the
current value of errno. For ease of implementation, it's standard
practice for libc implementers to just add %m to printf instead of
creating a separate parser for syslog.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Fix printf handling of INT_MIN width (#101729)</title>
<updated>2024-08-02T20:45:54+00:00</updated>
<author>
<name>Michael Jones</name>
<email>michaelrj@google.com</email>
</author>
<published>2024-08-02T20:45:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a21fc4c0a681000c23089301e8935f579517b96a'/>
<id>a21fc4c0a681000c23089301e8935f579517b96a</id>
<content type='text'>
Prevously, if INT_MIN was passed as a wildcard width to a printf
conversion the parser would attempt to negate it to get the positive
width (and set the left justify flag), but it would underflow and the
width would be treated as 0. This patch corrects the issue by instead
treating a width of INT_MIN as identical to -INT_MAX.

Also includes docs changes to explain this behavior and adding b to the
list of int conversions.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Prevously, if INT_MIN was passed as a wildcard width to a printf
conversion the parser would attempt to negate it to get the positive
width (and set the left justify flag), but it would underflow and the
width would be treated as 0. This patch corrects the issue by instead
treating a width of INT_MIN as identical to -INT_MAX.

Also includes docs changes to explain this behavior and adding b to the
list of int conversions.</pre>
</div>
</content>
</entry>
<entry>
<title>Add bit width length modifier to printf (#82461)</title>
<updated>2024-03-29T17:15:22+00:00</updated>
<author>
<name>Om Prakaash</name>
<email>omsuseela@gmail.com</email>
</author>
<published>2024-03-29T17:15:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=fdef5c4f453f0e0de02281a0a9b986667bc5010e'/>
<id>fdef5c4f453f0e0de02281a0a9b986667bc5010e</id>
<content type='text'>
Resolves #81685. This adds support for wN and wfN length modifiers in
fprintf.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Resolves #81685. This adds support for wN and wfN length modifiers in
fprintf.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Make 'printf' converter output "(null)" instead of "null" (#85845)</title>
<updated>2024-03-19T19:44:59+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2024-03-19T19:44:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3dc1b5044e25fc7e574719355091fccddad29ce4'/>
<id>3dc1b5044e25fc7e574719355091fccddad29ce4</id>
<content type='text'>
Summary:
Currently we print `null` for the null pointer in a `%s` expression.
Although it's not defined by the standard, other implementations choose
to use `(null)` to indicate this. We also currently print `(nullptr)` so
I think it's more consistent to use parens in both cases.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
Currently we print `null` for the null pointer in a `%s` expression.
Although it's not defined by the standard, other implementations choose
to use `(null)` to indicate this. We also currently print `(nullptr)` so
I think it's more consistent to use parens in both cases.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Add fixed point support to printf (#82707)</title>
<updated>2024-02-27T19:03:20+00:00</updated>
<author>
<name>Michael Jones</name>
<email>71531609+michaelrj-google@users.noreply.github.com</email>
</author>
<published>2024-02-27T19:03:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8e3b60540c81354b321018a47bf159ca9b52d776'/>
<id>8e3b60540c81354b321018a47bf159ca9b52d776</id>
<content type='text'>
This patch adds the r, R, k, and K conversion specifiers to printf, with
accompanying tests. They are guarded behind the
LIBC_COPT_PRINTF_DISABLE_FIXED_POINT flag as well as automatic fixed
point support detection.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds the r, R, k, and K conversion specifiers to printf, with
accompanying tests. They are guarded behind the
LIBC_COPT_PRINTF_DISABLE_FIXED_POINT flag as well as automatic fixed
point support detection.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][NFC] Remove all trailing spaces from libc (#82831)</title>
<updated>2024-02-23T22:34:00+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2024-02-23T22:34:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=69c0b2febe01108f50db6e8ed21cd8b2e6088caf'/>
<id>69c0b2febe01108f50db6e8ed21cd8b2e6088caf</id>
<content type='text'>
Summary:
There are a lot of random training spaces on various lines. This patch
just got rid of all of them with `sed 's/\ \+$//g'.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
There are a lot of random training spaces on various lines. This patch
just got rid of all of them with `sed 's/\ \+$//g'.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Move printf long double to simple calc (#75414)</title>
<updated>2024-01-25T17:35:40+00:00</updated>
<author>
<name>michaelrj-google</name>
<email>71531609+michaelrj-google@users.noreply.github.com</email>
</author>
<published>2024-01-25T17:35:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a621198a035cdc700f08507879db902f22f8a5e2'/>
<id>a621198a035cdc700f08507879db902f22f8a5e2</id>
<content type='text'>
The Ryu algorithm is very fast with its table, but that table grows too
large for long doubles. This patch adds a method of calculating the
digits of long doubles using just wide integers and fast modulo
operations. This results in significant performance improvements vs the
previous int calc mode, while taking up a similar amound of peak memory.
It will be slow in some %e/%g cases, but reasonable fast for %f with no
loss of accuracy.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The Ryu algorithm is very fast with its table, but that table grows too
large for long doubles. This patch adds a method of calculating the
digits of long doubles using just wide integers and fast modulo
operations. This results in significant performance improvements vs the
previous int calc mode, while taking up a similar amound of peak memory.
It will be slow in some %e/%g cases, but reasonable fast for %f with no
loss of accuracy.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Refactor scanf reader to match printf (#66023)</title>
<updated>2023-09-22T19:50:02+00:00</updated>
<author>
<name>michaelrj-google</name>
<email>71531609+michaelrj-google@users.noreply.github.com</email>
</author>
<published>2023-09-22T19:50:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a5a008ff4f5908e59ded084cc14a2237f080d681'/>
<id>a5a008ff4f5908e59ded084cc14a2237f080d681</id>
<content type='text'>
In a previous patch, the printf writer was rewritten to use a single
writer class with a buffer and a callback hook. This patch refactors
scanf's reader to match conceptually.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In a previous patch, the printf writer was rewritten to use a single
writer class with a buffer and a callback hook. This patch refactors
scanf's reader to match conceptually.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][docs] Printf behavior doc</title>
<updated>2023-09-13T20:42:30+00:00</updated>
<author>
<name>Michael Jones</name>
<email>michaelrj@google.com</email>
</author>
<published>2023-08-18T20:41:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=aa1eacd10cb5e2e84c297d1ccc13e4d6d5d09fc4'/>
<id>aa1eacd10cb5e2e84c297d1ccc13e4d6d5d09fc4</id>
<content type='text'>
In the document on undefined behavior, I noted that writing down your
decisions is very important. This document contains all the information
for compile flags and undefined behavior for our printf.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D158311
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the document on undefined behavior, I noted that writing down your
decisions is very important. This document contains all the information
for compile flags and undefined behavior for our printf.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D158311
</pre>
</div>
</content>
</entry>
</feed>
