[libc-commits] [libc] [libc] Include stdio.h in baremetal getchar.cpp (PR #98188)

via libc-commits libc-commits at lists.llvm.org
Tue Jul 9 09:58:03 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

<details>
<summary>Changes</summary>

This is needed for the EOF constant.

---
Full diff: https://github.com/llvm/llvm-project/pull/98188.diff


2 Files Affected:

- (modified) libc/src/stdio/baremetal/CMakeLists.txt (+1) 
- (modified) libc/src/stdio/baremetal/getchar.cpp (+2) 


``````````diff
diff --git a/libc/src/stdio/baremetal/CMakeLists.txt b/libc/src/stdio/baremetal/CMakeLists.txt
index 5ace85d009040..9bfd5eb2ae0ee 100644
--- a/libc/src/stdio/baremetal/CMakeLists.txt
+++ b/libc/src/stdio/baremetal/CMakeLists.txt
@@ -5,6 +5,7 @@ add_entrypoint_object(
   HDRS
     ../getchar.h
   DEPENDS
+    libc.include.stdio
     libc.src.__support.OSUtil.osutil
     libc.src.__support.CPP.string_view
 )
diff --git a/libc/src/stdio/baremetal/getchar.cpp b/libc/src/stdio/baremetal/getchar.cpp
index 6398197e2f143..bbd5ba7a954fb 100644
--- a/libc/src/stdio/baremetal/getchar.cpp
+++ b/libc/src/stdio/baremetal/getchar.cpp
@@ -9,6 +9,8 @@
 #include "src/stdio/getchar.h"
 #include "src/__support/OSUtil/io.h"
 
+#include <stdio.h>
+
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(int, getchar, ()) {

``````````

</details>


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


More information about the libc-commits mailing list