summaryrefslogtreecommitdiff
path: root/libc/src/stdio/baremetal/printf.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-09-01Revert "[libc] Migrate from baremetal stdio.h to generic stdio.h" (#156371)William Huynh
Reverts llvm/llvm-project#152748
2025-09-01[libc] Migrate from baremetal stdio.h to generic stdio.h (#152748)William Huynh
This is a follow up to the RFC here: https://discourse.llvm.org/t/rfc-implementation-of-stdio-on-baremetal/86944 This provides the stdout/stderr/stdin symbols (which now don't have to provided by the user). This allows the user to have access to all functions, currently I've only tested `fprintf` but in theory everything that works in the generic folder should work in the baremetal configuration. All streams are _non-buffered_, which does NOT require flushing. It is based on the CookieFile that already existed
2025-06-16[libc] Change default behaviour of baremetal/printf to use stdout (#143703)William Huynh
In #94078, `write_to_stdout` had not been fully implemented. However, now that it has been implemented, to conform with the C standard (7.23.6.3. The printf function, specifically point 2), we use `stdout`. This issue is tracked in #94685. - Also prefer `static constexpr` - Made it explicit that we are writing to `stdout`
2025-03-13[stdio][baremetal] Fix templating for print functions (#131232)PiJoules
This addresses build errors from https://github.com/llvm/llvm-project/pull/111559.
2025-03-13[libc] Fix non-templated uses of `printf_core::Writer` (#131149)Simon Tatham
Commit 598e882ee88a1e3 turned `Writer` into a template, and updated most of the call sites that use it. But not all. The alternative FP printf system in `float_dec_converter_limited.h` wasn't updated, and neither was `baremetal/printf.cpp` or `baremetal/vprintf.cpp`. This patch updates `float_dec_converter_limited.h` in the same way that the previous commit updated `float_dec_converter.h`: propagate the templatedness through everything in the header, so that anything using a `Writer` at all has a `write_mode` template parameter to pass on to it. `printf.cpp` and `vprintf.cpp` are updated in the same way that the previous commit updated `printf_core/vfprintf_internal.h`: the `WriteBuffer` has parameter `WriteMode::FLUSH_TO_STREAM`, and `Writer` picks it up implicitly from that.
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.
2024-07-11Reland: [libc] Move off_t and stdio macros to proxy hdrs (#98384)Michael Jones
reland of https://github.com/llvm/llvm-project/pull/98215 Additionally adds proxy headers for FILE and the fopencookie types The arm32 build has been failing due to redefinitions of the off_t type. This patch fixes this by moving off_t to a proper proxy header. To do this, it also moves stdio macros to a proxy header to hopefully avoid including this proxy header alongside this public stdio.h.
2024-06-12[libc] Add baremetal putchar (#95182)Michael Jones
In #94685 I discussed my ideas for cleaner baremetal output writing. This patch is not that. This patch just uses `write_to_stderr` for outputting from putchar and printf on baremetal. I'm still planning to create a proper design for writing to stdout and stderr on various platforms, but that will be a followup patch.
2024-06-07[libc] Add baremetal printf (#94078)Michael Jones
For baremetal targets that don't support FILE, this version of printf just writes directly to a function provided by a vendor. To do this both printf and vprintf were moved to /generic (vprintf since they need the same flags and cmake gets funky about setting variables in one file and reading them in another).