[libc-commits] [clang] [libc] [libc] Support opaque FILE* on baremetal (PR #168931)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Fri Dec 12 10:18:28 PST 2025


================
@@ -7,18 +7,13 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/stdio/putchar.h"
-#include "src/__support/CPP/string_view.h"
-#include "src/__support/OSUtil/io.h"
+
+#include "src/__support/common.h"
 #include "src/__support/macros/config.h"
+#include "src/stdio/baremetal/fputc_internal.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
-LLVM_LIBC_FUNCTION(int, putchar, (int c)) {
-  char uc = static_cast<char>(c);
-
-  write_to_stdout(cpp::string_view(&uc, 1));
-
-  return 0;
-}
+LLVM_LIBC_FUNCTION(int, putchar, (int c)) { return fputc_internal(c, stdout); }
----------------
petrhosek wrote:

I believe this should be addressed in the latest version.

https://github.com/llvm/llvm-project/pull/168931


More information about the libc-commits mailing list