Skip to content

[libc] Move EOF macro to stdio-macros.h - #85159

Merged
petrhosek merged 5 commits into
llvm:mainfrom
petrhosek:libc-baremetal-stdio-eof
Mar 15, 2024
Merged

petrhosek merged 5 commits into
llvm:mainfrom
petrhosek:libc-baremetal-stdio-eof

Conversation

@petrhosek

Copy link
Copy Markdown
Member

libc++ char_traits.h assumes EOF is always available

See #85158 for more details.

libc++ char_traits.h assumes EOF is always available

See llvm#85158 for more details.
@llvmbot

llvmbot commented Mar 14, 2024

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

Changes

libc++ char_traits.h assumes EOF is always available

See #85158 for more details.


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

1 Files Affected:

  • (modified) libc/config/baremetal/api.td (+9)
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",

Comment thread libc/config/baremetal/api.td Outdated

def StdIOAPI : PublicAPI<"stdio.h"> {
let Macros = [
SimpleMacroDef<"EOF", "-1">,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this definition in libc/include/llvm-libc-macros/stdio-macros.h instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@petrhosek petrhosek changed the title [libc] Include EOF macro in stdio.h on baremetal [libc] Move EOF macro to stdio-macros.h Mar 14, 2024

@michaelrj-google michaelrj-google left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SchrodingerZhu SchrodingerZhu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@petrhosek
petrhosek merged commit d6722bc into llvm:main Mar 15, 2024
@petrhosek
petrhosek deleted the libc-baremetal-stdio-eof branch July 12, 2024 08:27
paleauraaaa pushed a commit to paleauraaaa/llvm-project that referenced this pull request Oct 7, 2026
libc++ char_traits.h assumes EOF is always available

See llvm#85158 for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants