[libc-commits] [PATCH] D152983: [libc] Move the definitions of the standard IO streams to the platform

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jun 15 05:06:59 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa09bec645933: [libc] Move the definitions of the standard IO streams to the platform (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152983/new/

https://reviews.llvm.org/D152983

Files:
  libc/src/__support/File/gpu/file.cpp
  libc/src/__support/File/linux/file.cpp
  libc/src/stdio/stderr.cpp
  libc/src/stdio/stdin.cpp
  libc/src/stdio/stdout.cpp


Index: libc/src/stdio/stdout.cpp
===================================================================
--- libc/src/stdio/stdout.cpp
+++ libc/src/stdio/stdout.cpp
@@ -10,6 +10,4 @@
 
 #include <stdio.h>
 
-extern "C" {
-FILE *stdout = reinterpret_cast<FILE *>(__llvm_libc::stdout);
-}
+extern "C" FILE *stdout;
Index: libc/src/stdio/stdin.cpp
===================================================================
--- libc/src/stdio/stdin.cpp
+++ libc/src/stdio/stdin.cpp
@@ -10,6 +10,4 @@
 
 #include <stdio.h>
 
-extern "C" {
-FILE *stdin = reinterpret_cast<FILE *>(__llvm_libc::stdin);
-}
+extern "C" FILE *stdin;
Index: libc/src/stdio/stderr.cpp
===================================================================
--- libc/src/stdio/stderr.cpp
+++ libc/src/stdio/stderr.cpp
@@ -10,6 +10,4 @@
 
 #include <stdio.h>
 
-extern "C" {
-FILE *stderr = reinterpret_cast<FILE *>(__llvm_libc::stderr);
-}
+extern "C" FILE *stderr;
Index: libc/src/__support/File/linux/file.cpp
===================================================================
--- libc/src/__support/File/linux/file.cpp
+++ libc/src/__support/File/linux/file.cpp
@@ -183,3 +183,10 @@
 File *stderr = &StdErr;
 
 } // namespace __llvm_libc
+
+// Provide the external defintitions of the standard IO streams.
+extern "C" {
+FILE *stdin = reinterpret_cast<FILE *>(&__llvm_libc::StdIn);
+FILE *stderr = reinterpret_cast<FILE *>(&__llvm_libc::StdErr);
+FILE *stdout = reinterpret_cast<FILE *>(&__llvm_libc::StdOut);
+}
Index: libc/src/__support/File/gpu/file.cpp
===================================================================
--- libc/src/__support/File/gpu/file.cpp
+++ libc/src/__support/File/gpu/file.cpp
@@ -97,3 +97,10 @@
 File *stderr = &StdErr;
 
 } // namespace __llvm_libc
+
+// Provide the external defintitions of the standard IO streams.
+extern "C" {
+FILE *stdin = reinterpret_cast<FILE *>(&__llvm_libc::StdIn);
+FILE *stderr = reinterpret_cast<FILE *>(&__llvm_libc::StdErr);
+FILE *stdout = reinterpret_cast<FILE *>(&__llvm_libc::StdOut);
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152983.531703.patch
Type: text/x-patch
Size: 2015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230615/a662aa85/attachment.bin>


More information about the libc-commits mailing list