summaryrefslogtreecommitdiff
path: root/libc/src/stdio/sprintf.cpp
AgeCommit message (Collapse)Author
2025-11-05[libc] Add printf error handling (with fixes #2) (#166517)Marcell Leleszi
https://github.com/llvm/llvm-project/issues/159474 Another try of trying to land https://github.com/llvm/llvm-project/pull/166382 - Fix some leftover tests checking for specific errnos - Guard errno checking tests to not run on the GPU @michaelrj-google
2025-11-04Revert commit d8e5698 and 15b19c7 (#166498)Kewen Meng
2025-11-04[libc] Add printf error handling (with fixes) (#166382)Marcell Leleszi
https://github.com/llvm/llvm-project/issues/159474 Resubmitting https://github.com/llvm/llvm-project/pull/162876 with fixes as it broke some buildbots: - Fix comparisons of integer expressions of different signedness - Not check for specific errnos in tests, as they might not be available on all platforms
2025-11-03Revert "[libc] Add printf error handling" (#166232)Kewen Meng
2025-11-03[libc] Add printf error handling (#162876)Marcell Leleszi
[#159474](https://github.com/llvm/llvm-project/issues/159474) - All printf variants set errno and consistently return -1 on error, instead of returning various predefined error codes - Return value overflow handling is added
2025-03-12[libc] Template the writing mode for the writer class (#111559)Joseph Huber
Summary: Currently we dispatch the writing mode off of a runtime enum passed in by the constructor. This causes very unfortunate codegen for the GPU targets where we get worst-case codegen because of the unused function pointer for `sprintf`. Instead, this patch moves all of this to a template so it can be masked out. This results in no dynamic stack and uses 60 VGPRs instead of 117. It also compiles about 5x as fast.
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-07-20[libc] Move printf writer to new designMichael Jones
The new printf writer design focuses on optimizing the fast path. It inlines any write to a buffer or string, and by handling buffering itself can more effectively work with both internal and external file implementations. The overflow hook should allow for expansion to asprintf with minimal extra code. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D153999
2022-08-24[libc] move printf to use StringViewsMichael Jones
The FormatSection and the writer functions both previously took a char* and a length to represent a string. Now they use the StringView class to represent that more succinctly. This change also required fixing everywhere these were used, so it touches a lot of files. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D131994
2022-05-17[libc] add snprintfMichael Jones
After adding sprintf, snprintf is simple. The functions are very similar. The tests only cover the behavior of the max length since the sprintf tests should cover the other behavior. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D125826
2022-05-17[libc] add sprintfMichael Jones
This adds the sprintf entrypoint, as well as unit tests. Currently sprintf only supports %%, %s, and %c, but the other conversions are on the way. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D125573