[libc-commits] [libc] [libc] Include stdio.h in baremetal getchar.cpp (PR #98188)
Petr Hosek via libc-commits
libc-commits at lists.llvm.org
Tue Jul 9 09:57:45 PDT 2024
https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/98188
This is needed for the EOF constant.
>From 05d24c450df98deb05990e124e8d2cf020a860e0 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Tue, 9 Jul 2024 09:54:50 -0700
Subject: [PATCH] [libc] Include stdio.h in baremetal getchar.cpp
This is needed for the EOF constant.
---
libc/src/stdio/baremetal/CMakeLists.txt | 1 +
libc/src/stdio/baremetal/getchar.cpp | 2 ++
2 files changed, 3 insertions(+)
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, ()) {
More information about the libc-commits
mailing list