diff --git a/libc/src/stdio/baremetal/printf.cpp b/libc/src/stdio/baremetal/printf.cpp index c94698ec02953..7253c6549a4e4 100644 --- a/libc/src/stdio/baremetal/printf.cpp +++ b/libc/src/stdio/baremetal/printf.cpp @@ -21,8 +21,8 @@ namespace LIBC_NAMESPACE_DECL { namespace { -LIBC_INLINE int raw_write_hook(cpp::string_view new_str, void *) { - write_to_stderr(new_str); +LIBC_INLINE int stdout_write_hook(cpp::string_view new_str, void *) { + write_to_stdout(new_str); return printf_core::WRITE_OK; } @@ -35,11 +35,11 @@ LLVM_LIBC_FUNCTION(int, printf, (const char *__restrict format, ...)) { // and pointer semantics, as well as handling // destruction automatically. va_end(vlist); - constexpr size_t BUFF_SIZE = 1024; + static constexpr size_t BUFF_SIZE = 1024; char buffer[BUFF_SIZE]; printf_core::WriteBuffer wb( - buffer, BUFF_SIZE, &raw_write_hook, nullptr); + buffer, BUFF_SIZE, &stdout_write_hook, nullptr); printf_core::Writer writer(wb); int retval = printf_core::printf_main(&writer, format, args); diff --git a/libc/src/stdio/baremetal/putchar.cpp b/libc/src/stdio/baremetal/putchar.cpp index 0ba46a5ade6c9..ac21e6e783b01 100644 --- a/libc/src/stdio/baremetal/putchar.cpp +++ b/libc/src/stdio/baremetal/putchar.cpp @@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, putchar, (int c)) { char uc = static_cast(c); - write_to_stderr(cpp::string_view(&uc, 1)); + write_to_stdout(cpp::string_view(&uc, 1)); return 0; } diff --git a/libc/src/stdio/baremetal/puts.cpp b/libc/src/stdio/baremetal/puts.cpp index 5062efda1c0dc..fcd3aa086b2bf 100644 --- a/libc/src/stdio/baremetal/puts.cpp +++ b/libc/src/stdio/baremetal/puts.cpp @@ -17,8 +17,8 @@ LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { cpp::string_view str_view(str); // TODO: Can we combine these to avoid needing two writes? - write_to_stderr(str_view); - write_to_stderr("\n"); + write_to_stdout(str_view); + write_to_stdout("\n"); return 0; } diff --git a/libc/src/stdio/baremetal/vprintf.cpp b/libc/src/stdio/baremetal/vprintf.cpp index 3e8631abd90d9..ab02533f14911 100644 --- a/libc/src/stdio/baremetal/vprintf.cpp +++ b/libc/src/stdio/baremetal/vprintf.cpp @@ -21,8 +21,8 @@ namespace LIBC_NAMESPACE_DECL { namespace { -LIBC_INLINE int raw_write_hook(cpp::string_view new_str, void *) { - write_to_stderr(new_str); +LIBC_INLINE int stdout_write_hook(cpp::string_view new_str, void *) { + write_to_stdout(new_str); return printf_core::WRITE_OK; } @@ -33,11 +33,11 @@ LLVM_LIBC_FUNCTION(int, vprintf, internal::ArgList args(vlist); // This holder class allows for easier copying // and pointer semantics, as well as handling // destruction automatically. - constexpr size_t BUFF_SIZE = 1024; + static constexpr size_t BUFF_SIZE = 1024; char buffer[BUFF_SIZE]; printf_core::WriteBuffer wb( - buffer, BUFF_SIZE, &raw_write_hook, nullptr); + buffer, BUFF_SIZE, &stdout_write_hook, nullptr); printf_core::Writer writer(wb); int retval = printf_core::printf_main(&writer, format, args);