Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 15, 2024

Conversation

petrhosek
Copy link
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
Copy link
Member

llvmbot commented Mar 14, 2024

@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",

@@ -52,6 +52,15 @@ def IntTypesAPI : PublicAPI<"inttypes.h"> {
let Types = ["imaxdiv_t"];
}

def StdIOAPI : PublicAPI<"stdio.h"> {
let Macros = [
SimpleMacroDef<"EOF", "-1">,
Copy link
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
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
Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@SchrodingerZhu SchrodingerZhu left a comment

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
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