New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bit width length modifier to printf #81685
Comments
@llvm/issue-subscribers-libc Author: None (michaelrj-google)
Specified in C23 on page 349 of this PDF: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf
C23 adds a new length modifier to printf: w_N_ and wf_N_ which allow the user to specify an exact bit width for an integer conversion. To support this, LLVM-libc needs to add support to the printf parser and converter, as well as the internal data types. Below is a (hopefully complete) list of tasks that will add this support. Feel free to reach out if you need help, you can find me as michaelrj on discord, or you can just leave a comment on this bug. Code:In core_structs.h:
In parser.h
Testing:
|
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below. |
@llvm/issue-subscribers-good-first-issue Author: None (michaelrj-google)
Specified in C23 on page 349 of this PDF: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf
C23 adds a new length modifier to printf: w_N_ and wf_N_ which allow the user to specify an exact bit width for an integer conversion. To support this, LLVM-libc needs to add support to the printf parser and converter, as well as the internal data types. Below is a (hopefully complete) list of tasks that will add this support. Feel free to reach out if you need help, you can find me as michaelrj on discord, or you can just leave a comment on this bug. Code:In core_structs.h:
In parser.h
Testing:
|
Hey I am new to LLVM, and was wondering if I could take up this issue. |
@omprakaash: Just create pull request and mention it on this page. |
@omprakaash, |
Yep. I am. Should be done pretty soon. |
Resolves #81685. This adds support for wN and wfN length modifiers in fprintf.
Specified in C23 on page 349 of this PDF: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf
C23 adds a new length modifier to printf: w_N_ and wf_N_ which allow the user to specify an exact bit width for an integer conversion. To support this, LLVM-libc needs to add support to the printf parser and converter, as well as the internal data types. Below is a (hopefully complete) list of tasks that will add this support. Feel free to reach out if you need help, you can find me as michaelrj on discord, or you can just leave a comment on this bug.
Code:
In core_structs.h:
w
andwf
to theLengthModifier
enumFormatSection
to hold the bit width (size_t
would be an appropriate type)operator==
.In parser.h
w
andwf
to theparse_length_modifier
function. This may also involve changing it to return a struct that contains aLengthModifier
and a number.get_next_section
get_type_desc
In converter_utils.h
w
andwf
toapply_length_modifier
(if you've already defined a struct that is a LengthModifier and a number, this would probably be another good place to use it).intmax_t
)In write_int_converter.h
w
andwf
to the switch statement inconvert_write_int
Testing:
In sprintf_test.cpp
In PrintfMatcher.cpp
In parser_test.cpp
The text was updated successfully, but these errors were encountered: