[libc-commits] [libc] 5210803 - [libc] Cast the error value to int (#172724)
via libc-commits
libc-commits at lists.llvm.org
Wed Dec 17 12:09:39 PST 2025
Author: Petr Hosek
Date: 2025-12-17T20:09:35Z
New Revision: 521080386e13f6708dff74e80008aa276ee3cde9
URL: https://github.com/llvm/llvm-project/commit/521080386e13f6708dff74e80008aa276ee3cde9
DIFF: https://github.com/llvm/llvm-project/commit/521080386e13f6708dff74e80008aa276ee3cde9.diff
LOG: [libc] Cast the error value to int (#172724)
The negative value represents an error and we already use cast in this
scenario elsewhere.
Added:
Modified:
libc/src/stdio/baremetal/vfprintf_internal.h
Removed:
################################################################################
diff --git a/libc/src/stdio/baremetal/vfprintf_internal.h b/libc/src/stdio/baremetal/vfprintf_internal.h
index 59a95ea23c89e..d38a56481bc37 100644
--- a/libc/src/stdio/baremetal/vfprintf_internal.h
+++ b/libc/src/stdio/baremetal/vfprintf_internal.h
@@ -30,7 +30,7 @@ LIBC_INLINE int write_hook(cpp::string_view str_view, void *cookie) {
auto result =
__llvm_libc_stdio_write(cookie, str_view.data(), str_view.size());
if (result <= 0)
- return result;
+ return static_cast<int>(result);
if (static_cast<size_t>(result) != str_view.size())
return printf_core::FILE_WRITE_ERROR;
return printf_core::WRITE_OK;
More information about the libc-commits
mailing list