[libc-commits] [libc] [libc] Include EOF macro in stdio.h on baremetal (PR #85159)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Wed Mar 13 17:23:11 PDT 2024


https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/85159

libc++ char_traits.h assumes EOF is always available

See #85158 for more details.

>From 5ab1ef66ecb97453b2767d09a65ebf6bacf0ad55 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Wed, 13 Mar 2024 00:28:47 -0700
Subject: [PATCH] [libc] Include EOF macro in stdio.h on baremetal

libc++ char_traits.h assumes EOF is always available

See #85158 for more details.
---
 libc/config/baremetal/api.td | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libc/config/baremetal/api.td b/libc/config/baremetal/api.td
index 80d0e0ba22ca51..e33c1ff5521902 100644
--- a/libc/config/baremetal/api.td
+++ b/libc/config/baremetal/api.td
@@ -52,6 +52,15 @@ def IntTypesAPI : PublicAPI<"inttypes.h"> {
   let Types = ["imaxdiv_t"];
 }
 
+def StdIOAPI : PublicAPI<"stdio.h"> {
+  let Macros = [
+    SimpleMacroDef<"EOF", "-1">,
+  ];
+  let Types = [
+    "size_t"
+  ];
+}
+
 def StdlibAPI : PublicAPI<"stdlib.h"> {
   let Types = [
     "div_t",



More information about the libc-commits mailing list