[libc-commits] [libc] 5aed6d6 - Reland: [libc] Move off_t and stdio macros to proxy hdrs (#98384)
via libc-commits
libc-commits at lists.llvm.org
Thu Jul 11 11:09:55 PDT 2024
Author: Michael Jones
Date: 2024-07-11T11:09:51-07:00
New Revision: 5aed6d67e3f051262c67e3295476bf13cfc099c4
URL: https://github.com/llvm/llvm-project/commit/5aed6d67e3f051262c67e3295476bf13cfc099c4
DIFF: https://github.com/llvm/llvm-project/commit/5aed6d67e3f051262c67e3295476bf13cfc099c4.diff
LOG: Reland: [libc] Move off_t and stdio macros to proxy hdrs (#98384)
reland of https://github.com/llvm/llvm-project/pull/98215
Additionally adds proxy headers for FILE and the fopencookie types
The arm32 build has been failing due to redefinitions of the off_t type.
This patch fixes this by moving off_t to a proper proxy header. To do
this, it also moves stdio macros to a proxy header to hopefully avoid
including this proxy header alongside this public stdio.h.
Added:
libc/hdr/stdio_macros.h
libc/hdr/types/FILE.h
libc/hdr/types/cookie_io_functions_t.h
libc/hdr/types/off_t.h
Modified:
libc/config/gpu/api.td
libc/config/linux/api.td
libc/hdr/CMakeLists.txt
libc/hdr/types/CMakeLists.txt
libc/include/llvm-libc-macros/stdio-macros.h
libc/newhdrgen/yaml/stdio.yaml
libc/src/__support/File/CMakeLists.txt
libc/src/__support/File/file.cpp
libc/src/__support/File/file.h
libc/src/__support/File/linux/CMakeLists.txt
libc/src/__support/File/linux/file.cpp
libc/src/__support/File/linux/file.h
libc/src/__support/File/linux/lseekImpl.h
libc/src/__support/File/linux/stderr.cpp
libc/src/__support/File/linux/stdin.cpp
libc/src/__support/File/linux/stdout.cpp
libc/src/__support/OSUtil/linux/CMakeLists.txt
libc/src/__support/OSUtil/linux/fcntl.cpp
libc/src/gpu/rpc_fprintf.h
libc/src/stdio/CMakeLists.txt
libc/src/stdio/baremetal/getchar.cpp
libc/src/stdio/baremetal/printf.cpp
libc/src/stdio/baremetal/vprintf.cpp
libc/src/stdio/clearerr.h
libc/src/stdio/clearerr_unlocked.h
libc/src/stdio/fclose.h
libc/src/stdio/fdopen.h
libc/src/stdio/feof.h
libc/src/stdio/feof_unlocked.h
libc/src/stdio/ferror.h
libc/src/stdio/ferror_unlocked.h
libc/src/stdio/fflush.h
libc/src/stdio/fgetc.h
libc/src/stdio/fgetc_unlocked.h
libc/src/stdio/fgets.h
libc/src/stdio/flockfile.cpp
libc/src/stdio/flockfile.h
libc/src/stdio/fopen.h
libc/src/stdio/fopencookie.cpp
libc/src/stdio/fopencookie.h
libc/src/stdio/fprintf.cpp
libc/src/stdio/fprintf.h
libc/src/stdio/fputc.h
libc/src/stdio/fputs.h
libc/src/stdio/fread.h
libc/src/stdio/fread_unlocked.h
libc/src/stdio/fscanf.cpp
libc/src/stdio/fscanf.h
libc/src/stdio/fseek.h
libc/src/stdio/fseeko.h
libc/src/stdio/ftell.h
libc/src/stdio/ftello.h
libc/src/stdio/funlockfile.cpp
libc/src/stdio/funlockfile.h
libc/src/stdio/fwrite.h
libc/src/stdio/fwrite_unlocked.h
libc/src/stdio/generic/CMakeLists.txt
libc/src/stdio/generic/clearerr.cpp
libc/src/stdio/generic/clearerr_unlocked.cpp
libc/src/stdio/generic/fclose.cpp
libc/src/stdio/generic/feof.cpp
libc/src/stdio/generic/feof_unlocked.cpp
libc/src/stdio/generic/ferror.cpp
libc/src/stdio/generic/ferror_unlocked.cpp
libc/src/stdio/generic/fflush.cpp
libc/src/stdio/generic/fgetc.cpp
libc/src/stdio/generic/fgetc_unlocked.cpp
libc/src/stdio/generic/fgets.cpp
libc/src/stdio/generic/fopen.cpp
libc/src/stdio/generic/fputc.cpp
libc/src/stdio/generic/fputs.cpp
libc/src/stdio/generic/fread.cpp
libc/src/stdio/generic/fread_unlocked.cpp
libc/src/stdio/generic/fwrite.cpp
libc/src/stdio/generic/fwrite_unlocked.cpp
libc/src/stdio/generic/getc.cpp
libc/src/stdio/generic/getc_unlocked.cpp
libc/src/stdio/generic/getchar.cpp
libc/src/stdio/generic/getchar_unlocked.cpp
libc/src/stdio/generic/printf.cpp
libc/src/stdio/generic/putc.cpp
libc/src/stdio/generic/putchar.cpp
libc/src/stdio/generic/puts.cpp
libc/src/stdio/generic/stderr.cpp
libc/src/stdio/generic/stdin.cpp
libc/src/stdio/generic/stdout.cpp
libc/src/stdio/generic/ungetc.cpp
libc/src/stdio/generic/vprintf.cpp
libc/src/stdio/getc.h
libc/src/stdio/getc_unlocked.h
libc/src/stdio/gpu/CMakeLists.txt
libc/src/stdio/gpu/clearerr.cpp
libc/src/stdio/gpu/fclose.cpp
libc/src/stdio/gpu/feof.cpp
libc/src/stdio/gpu/ferror.cpp
libc/src/stdio/gpu/fflush.cpp
libc/src/stdio/gpu/fgetc.cpp
libc/src/stdio/gpu/fgets.cpp
libc/src/stdio/gpu/file.h
libc/src/stdio/gpu/fopen.cpp
libc/src/stdio/gpu/fputc.cpp
libc/src/stdio/gpu/fputs.cpp
libc/src/stdio/gpu/fread.cpp
libc/src/stdio/gpu/fseek.cpp
libc/src/stdio/gpu/ftell.cpp
libc/src/stdio/gpu/fwrite.cpp
libc/src/stdio/gpu/getc.cpp
libc/src/stdio/gpu/getchar.cpp
libc/src/stdio/gpu/putc.cpp
libc/src/stdio/gpu/putchar.cpp
libc/src/stdio/gpu/puts.cpp
libc/src/stdio/gpu/remove.cpp
libc/src/stdio/gpu/stderr.cpp
libc/src/stdio/gpu/stdin.cpp
libc/src/stdio/gpu/stdout.cpp
libc/src/stdio/gpu/ungetc.cpp
libc/src/stdio/printf.h
libc/src/stdio/printf_core/vfprintf_internal.h
libc/src/stdio/putc.h
libc/src/stdio/remove.h
libc/src/stdio/scanf.cpp
libc/src/stdio/scanf_core/vfscanf_internal.h
libc/src/stdio/setbuf.cpp
libc/src/stdio/setbuf.h
libc/src/stdio/setvbuf.cpp
libc/src/stdio/setvbuf.h
libc/src/stdio/sscanf.cpp
libc/src/stdio/ungetc.h
libc/src/stdio/vfprintf.cpp
libc/src/stdio/vfprintf.h
libc/src/stdio/vprintf.h
libc/src/unistd/getopt.cpp
libc/src/unistd/getopt.h
libc/src/wchar/btowc.cpp
libc/src/wchar/wctob.cpp
utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Removed:
################################################################################
diff --git a/libc/config/gpu/api.td b/libc/config/gpu/api.td
index 523ad49ffa3fd..21ddbb95b70c9 100644
--- a/libc/config/gpu/api.td
+++ b/libc/config/gpu/api.td
@@ -59,11 +59,6 @@ def FenvAPI: PublicAPI<"fenv.h"> {
}
def StdIOAPI : PublicAPI<"stdio.h"> {
- let Macros = [
- SimpleMacroDef<"_IOFBF", "0">,
- SimpleMacroDef<"_IOLBF", "1">,
- SimpleMacroDef<"_IONBF", "2">,
- ];
let Types = [
"FILE",
"off_t",
diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td
index eb0090c80b0da..60e9b70f0d8a4 100644
--- a/libc/config/linux/api.td
+++ b/libc/config/linux/api.td
@@ -76,9 +76,6 @@ def StdIOAPI : PublicAPI<"stdio.h"> {
SimpleMacroDef<"stderr", "stderr">,
SimpleMacroDef<"stdin", "stdin">,
SimpleMacroDef<"stdout", "stdout">,
- SimpleMacroDef<"_IOFBF", "0">,
- SimpleMacroDef<"_IOLBF", "1">,
- SimpleMacroDef<"_IONBF", "2">,
];
let Types = [
"FILE",
diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 1303280c2c5ef..da640e8c0f70c 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -69,6 +69,16 @@ add_proxy_header_library(
libc.include.signal
)
+add_proxy_header_library(
+ stdio_macros
+ HDRS
+ stdio_macros.h
+ FULL_BUILD_DEPENDS
+ libc.include.stdio
+ libc.include.llvm-libc-macros.stdio_macros
+ libc.include.llvm-libc-macros.file_seek_macros
+)
+
add_proxy_header_library(
sys_epoll_macros
HDRS
diff --git a/libc/hdr/stdio_macros.h b/libc/hdr/stdio_macros.h
new file mode 100644
index 0000000000000..a212846dd8f41
--- /dev/null
+++ b/libc/hdr/stdio_macros.h
@@ -0,0 +1,23 @@
+//===-- Definition of macros from stdio.h --------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_STDIO_MACROS_H
+#define LLVM_LIBC_HDR_STDIO_MACROS_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-macros/file-seek-macros.h"
+#include "include/llvm-libc-macros/stdio-macros.h"
+
+#else // Overlay mode
+
+#include <stdio.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_STDIO_MACROS_H
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index 1cab1d3b812cf..4fc28fd82e68d 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -135,3 +135,30 @@ add_proxy_header_library(
libc.include.llvm-libc-types.struct_sigaction
libc.include.signal
)
+
+add_proxy_header_library(
+ FILE
+ HDRS
+ FILE.h
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.FILE
+ libc.include.stdio
+)
+
+add_proxy_header_library(
+ off_t
+ HDRS
+ off_t.h
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.off_t
+ libc.include.stdio
+)
+
+add_proxy_header_library(
+ cookie_io_functions_t
+ HDRS
+ cookie_io_functions_t.h
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.cookie_io_functions_t
+ libc.include.stdio
+)
diff --git a/libc/hdr/types/FILE.h b/libc/hdr/types/FILE.h
new file mode 100644
index 0000000000000..60e95f07e37f9
--- /dev/null
+++ b/libc/hdr/types/FILE.h
@@ -0,0 +1,22 @@
+//===-- Proxy for FILE ----------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_TYPES_FILE_H
+#define LLVM_LIBC_HDR_TYPES_FILE_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/FILE.h"
+
+#else // Overlay mode
+
+#include <stdio.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_FILE_H
diff --git a/libc/hdr/types/cookie_io_functions_t.h b/libc/hdr/types/cookie_io_functions_t.h
new file mode 100644
index 0000000000000..d8fe7731a84bd
--- /dev/null
+++ b/libc/hdr/types/cookie_io_functions_t.h
@@ -0,0 +1,22 @@
+//===-- Proxy for cookie_io_functions_t -----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_TYPES_COOKIE_IO_FUNCTIONS_T_H
+#define LLVM_LIBC_HDR_TYPES_COOKIE_IO_FUNCTIONS_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/cookie_io_functions_t.h"
+
+#else // Overlay mode
+
+#include <stdio.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_COOKIE_IO_FUNCTIONS_T_H
diff --git a/libc/hdr/types/off_t.h b/libc/hdr/types/off_t.h
new file mode 100644
index 0000000000000..abc3aa659365f
--- /dev/null
+++ b/libc/hdr/types/off_t.h
@@ -0,0 +1,22 @@
+//===-- Proxy for off_t ---------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_TYPES_OFF_T_H
+#define LLVM_LIBC_HDR_TYPES_OFF_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/off_t.h"
+
+#else // Overlay mode
+
+#include <stdio.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_OFF_T_H
diff --git a/libc/include/llvm-libc-macros/stdio-macros.h b/libc/include/llvm-libc-macros/stdio-macros.h
index 4664801c5731f..69fb71ad3f651 100644
--- a/libc/include/llvm-libc-macros/stdio-macros.h
+++ b/libc/include/llvm-libc-macros/stdio-macros.h
@@ -15,4 +15,8 @@
#define BUFSIZ 1024
+#define _IONBF 2
+#define _IOLBF 1
+#define _IOFBF 0
+
#endif // LLVM_LIBC_MACROS_STDIO_MACROS_H
diff --git a/libc/newhdrgen/yaml/stdio.yaml b/libc/newhdrgen/yaml/stdio.yaml
index 6d2a8557f9b94..687a6d696cad6 100644
--- a/libc/newhdrgen/yaml/stdio.yaml
+++ b/libc/newhdrgen/yaml/stdio.yaml
@@ -1,11 +1,5 @@
header: stdio.h
macros:
- - macro_name: _IONBF
- macro_value: 2
- - macro_name: _IOLBF
- macro_value: 1
- - macro_name: _IOFBF
- macro_value: 0
- macro_name: stdout
macro_value: stdout
- macro_name: stdin
diff --git a/libc/src/__support/File/CMakeLists.txt b/libc/src/__support/File/CMakeLists.txt
index 0416ac2cc902e..1b390a12424d0 100644
--- a/libc/src/__support/File/CMakeLists.txt
+++ b/libc/src/__support/File/CMakeLists.txt
@@ -16,6 +16,8 @@ add_object_library(
libc.src.__support.CPP.span
libc.src.__support.threads.mutex
libc.src.__support.error_or
+ libc.hdr.types.off_t
+ libc.hdr.stdio_macros
)
add_object_library(
diff --git a/libc/src/__support/File/file.cpp b/libc/src/__support/File/file.cpp
index 0b1a8cac21f77..08052f8d0a328 100644
--- a/libc/src/__support/File/file.cpp
+++ b/libc/src/__support/File/file.cpp
@@ -8,13 +8,12 @@
#include "file.h"
+#include "hdr/stdio_macros.h"
+#include "hdr/types/off_t.h"
#include "src/__support/CPP/new.h"
#include "src/__support/CPP/span.h"
#include "src/errno/libc_errno.h" // For error macros
-#include <stdio.h>
-#include <stdlib.h>
-
namespace LIBC_NAMESPACE {
FileIOResult File::write_unlocked(const void *data, size_t len) {
diff --git a/libc/src/__support/File/file.h b/libc/src/__support/File/file.h
index cc82a7ecc9745..d804289702540 100644
--- a/libc/src/__support/File/file.h
+++ b/libc/src/__support/File/file.h
@@ -9,7 +9,8 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H
#define LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H
-#include "include/llvm-libc-types/off_t.h"
+#include "hdr/stdio_macros.h"
+#include "hdr/types/off_t.h"
#include "src/__support/CPP/new.h"
#include "src/__support/error_or.h"
#include "src/__support/macros/properties/architectures.h"
diff --git a/libc/src/__support/File/linux/CMakeLists.txt b/libc/src/__support/File/linux/CMakeLists.txt
index 8436a687116bd..5556b812596f8 100644
--- a/libc/src/__support/File/linux/CMakeLists.txt
+++ b/libc/src/__support/File/linux/CMakeLists.txt
@@ -5,6 +5,7 @@ add_object_library(
file.cpp
HDRS
file.h
+ lseekImpl.h
DEPENDS
libc.include.fcntl
libc.include.stdio
@@ -15,6 +16,9 @@ add_object_library(
libc.src.errno.errno
libc.src.__support.error_or
libc.src.__support.File.file
+ libc.hdr.types.off_t
+ libc.hdr.types.FILE
+ libc.hdr.stdio_macros
)
add_object_library(
@@ -23,6 +27,8 @@ add_object_library(
stdout.cpp
DEPENDS
.file
+ libc.hdr.types.FILE
+ libc.hdr.stdio_macros
)
add_object_library(
@@ -31,6 +37,8 @@ add_object_library(
stdin.cpp
DEPENDS
.file
+ libc.hdr.types.FILE
+ libc.hdr.stdio_macros
)
add_object_library(
@@ -39,6 +47,8 @@ add_object_library(
stderr.cpp
DEPENDS
.file
+ libc.hdr.types.FILE
+ libc.hdr.stdio_macros
)
add_object_library(
diff --git a/libc/src/__support/File/linux/file.cpp b/libc/src/__support/File/linux/file.cpp
index 0f6ed4f0a5ef4..df68570bc1043 100644
--- a/libc/src/__support/File/linux/file.cpp
+++ b/libc/src/__support/File/linux/file.cpp
@@ -8,6 +8,8 @@
#include "file.h"
+#include "hdr/stdio_macros.h"
+#include "hdr/types/off_t.h"
#include "src/__support/CPP/new.h"
#include "src/__support/File/file.h"
#include "src/__support/File/linux/lseekImpl.h"
@@ -15,8 +17,7 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/errno/libc_errno.h" // For error macros
-#include <fcntl.h> // For mode_t and other flags to the open syscall
-#include <stdio.h>
+#include <fcntl.h> // For mode_t and other flags to the open syscall
#include <sys/stat.h> // For S_IS*, S_IF*, and S_IR* flags.
#include <sys/syscall.h> // For syscall numbers
diff --git a/libc/src/__support/File/linux/file.h b/libc/src/__support/File/linux/file.h
index 63b820529932b..0507109e6793f 100644
--- a/libc/src/__support/File/linux/file.h
+++ b/libc/src/__support/File/linux/file.h
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/types/off_t.h"
#include "src/__support/File/file.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/__support/File/linux/lseekImpl.h b/libc/src/__support/File/linux/lseekImpl.h
index d1632b703d3bc..af015a2fd6a70 100644
--- a/libc/src/__support/File/linux/lseekImpl.h
+++ b/libc/src/__support/File/linux/lseekImpl.h
@@ -9,6 +9,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_FILE_LINUX_LSEEKIMPL_H
#define LLVM_LIBC_SRC___SUPPORT_FILE_LINUX_LSEEKIMPL_H
+#include "hdr/types/off_t.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
#include "src/__support/error_or.h"
@@ -16,7 +17,6 @@
#include <stdint.h> // For uint64_t.
#include <sys/syscall.h> // For syscall numbers.
-#include <unistd.h> // For off_t.
namespace LIBC_NAMESPACE {
namespace internal {
diff --git a/libc/src/__support/File/linux/stderr.cpp b/libc/src/__support/File/linux/stderr.cpp
index 65d7865720ffe..0b4b207329fff 100644
--- a/libc/src/__support/File/linux/stderr.cpp
+++ b/libc/src/__support/File/linux/stderr.cpp
@@ -7,7 +7,8 @@
//===----------------------------------------------------------------------===//
#include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h"
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/__support/File/linux/stdin.cpp b/libc/src/__support/File/linux/stdin.cpp
index c9a363bb7c65a..49146dacfd4ac 100644
--- a/libc/src/__support/File/linux/stdin.cpp
+++ b/libc/src/__support/File/linux/stdin.cpp
@@ -7,7 +7,8 @@
//===----------------------------------------------------------------------===//
#include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h"
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/__support/File/linux/stdout.cpp b/libc/src/__support/File/linux/stdout.cpp
index 314692ecbfe1e..58caf85b5167f 100644
--- a/libc/src/__support/File/linux/stdout.cpp
+++ b/libc/src/__support/File/linux/stdout.cpp
@@ -7,7 +7,8 @@
//===----------------------------------------------------------------------===//
#include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h"
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/__support/OSUtil/linux/CMakeLists.txt b/libc/src/__support/OSUtil/linux/CMakeLists.txt
index 78b117fd19439..089cad454d534 100644
--- a/libc/src/__support/OSUtil/linux/CMakeLists.txt
+++ b/libc/src/__support/OSUtil/linux/CMakeLists.txt
@@ -21,4 +21,5 @@ add_object_library(
libc.hdr.types.struct_flock
libc.hdr.types.struct_flock64
libc.hdr.types.struct_f_owner_ex
+ libc.hdr.types.off_t
)
diff --git a/libc/src/__support/OSUtil/linux/fcntl.cpp b/libc/src/__support/OSUtil/linux/fcntl.cpp
index b6483bb7534d6..d5e850a904703 100644
--- a/libc/src/__support/OSUtil/linux/fcntl.cpp
+++ b/libc/src/__support/OSUtil/linux/fcntl.cpp
@@ -9,6 +9,7 @@
#include "src/__support/OSUtil/fcntl.h"
#include "hdr/fcntl_macros.h"
+#include "hdr/types/off_t.h"
#include "hdr/types/struct_f_owner_ex.h"
#include "hdr/types/struct_flock.h"
#include "hdr/types/struct_flock64.h"
diff --git a/libc/src/gpu/rpc_fprintf.h b/libc/src/gpu/rpc_fprintf.h
index 053f7b4f818ae..3292ce2d4b1ec 100644
--- a/libc/src/gpu/rpc_fprintf.h
+++ b/libc/src/gpu/rpc_fprintf.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_GPU_RPC_HOST_CALL_H
#define LLVM_LIBC_SRC_GPU_RPC_HOST_CALL_H
+#include "hdr/types/FILE.h"
#include <stddef.h>
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/CMakeLists.txt b/libc/src/stdio/CMakeLists.txt
index a659d9e847a9e..91b3a864042b9 100644
--- a/libc/src/stdio/CMakeLists.txt
+++ b/libc/src/stdio/CMakeLists.txt
@@ -37,7 +37,7 @@ add_entrypoint_object(
HDRS
flockfile.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -49,7 +49,7 @@ add_entrypoint_object(
HDRS
funlockfile.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -61,7 +61,10 @@ add_entrypoint_object(
HDRS
fopencookie.h
DEPENDS
- libc.include.stdio
+ libc.hdr.stdio_macros
+ libc.hdr.types.off_t
+ libc.hdr.types.cookie_io_functions_t
+ libc.hdr.types.FILE
libc.src.__support.CPP.new
libc.src.__support.File.file
)
@@ -74,7 +77,7 @@ add_entrypoint_object(
setbuf.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.off_t
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -87,7 +90,7 @@ add_entrypoint_object(
setvbuf.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -95,6 +98,7 @@ add_entrypoint_object(
list(APPEND scanf_deps
libc.src.__support.arg_list
libc.src.stdio.scanf_core.vfscanf_internal
+ libc.hdr.types.FILE
)
if(LLVM_LIBC_FULL_BUILD)
@@ -166,6 +170,7 @@ add_entrypoint_object(
HDRS
fprintf.h
DEPENDS
+ libc.hdr.types.FILE
libc.src.__support.arg_list
libc.src.stdio.printf_core.vfprintf_internal
)
@@ -199,6 +204,7 @@ add_entrypoint_object(
HDRS
vfprintf.h
DEPENDS
+ libc.hdr.types.FILE
libc.src.__support.arg_list
libc.src.stdio.printf_core.vfprintf_internal
)
diff --git a/libc/src/stdio/baremetal/getchar.cpp b/libc/src/stdio/baremetal/getchar.cpp
index bbd5ba7a954fb..0cd7c59b495dd 100644
--- a/libc/src/stdio/baremetal/getchar.cpp
+++ b/libc/src/stdio/baremetal/getchar.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/getchar.h"
#include "src/__support/OSUtil/io.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/baremetal/printf.cpp b/libc/src/stdio/baremetal/printf.cpp
index b240371a0c20e..dfc3c0b853959 100644
--- a/libc/src/stdio/baremetal/printf.cpp
+++ b/libc/src/stdio/baremetal/printf.cpp
@@ -14,6 +14,7 @@
#include "src/stdio/printf_core/writer.h"
#include <stdarg.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/baremetal/vprintf.cpp b/libc/src/stdio/baremetal/vprintf.cpp
index cd1541297f3b6..203ec18efb657 100644
--- a/libc/src/stdio/baremetal/vprintf.cpp
+++ b/libc/src/stdio/baremetal/vprintf.cpp
@@ -14,6 +14,7 @@
#include "src/stdio/printf_core/writer.h"
#include <stdarg.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/clearerr.h b/libc/src/stdio/clearerr.h
index b8e8d7c5cab82..2b3418037c433 100644
--- a/libc/src/stdio/clearerr.h
+++ b/libc/src/stdio/clearerr.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_CLEARERR_H
#define LLVM_LIBC_SRC_STDIO_CLEARERR_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/clearerr_unlocked.h b/libc/src/stdio/clearerr_unlocked.h
index ff447cea61370..05ddbdd1d7af1 100644
--- a/libc/src/stdio/clearerr_unlocked.h
+++ b/libc/src/stdio/clearerr_unlocked.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_CLEARERR_UNLOCKED_H
#define LLVM_LIBC_SRC_STDIO_CLEARERR_UNLOCKED_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fclose.h b/libc/src/stdio/fclose.h
index 7fe6951a080dc..731e3581d8fd1 100644
--- a/libc/src/stdio/fclose.h
+++ b/libc/src/stdio/fclose.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FCLOSE_H
#define LLVM_LIBC_SRC_STDIO_FCLOSE_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fdopen.h b/libc/src/stdio/fdopen.h
index 158a133e7e131..29028b8ab5ed3 100644
--- a/libc/src/stdio/fdopen.h
+++ b/libc/src/stdio/fdopen.h
@@ -9,11 +9,11 @@
#ifndef LLVM_LIBC_SRC_STDIO_FDOPEN_H
#define LLVM_LIBC_SRC_STDIO_FDOPEN_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
-FILE *fdopen(int fd, const char *mode);
+::FILE *fdopen(int fd, const char *mode);
} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/feof.h b/libc/src/stdio/feof.h
index 66a49bdd25701..3d47db6993e1f 100644
--- a/libc/src/stdio/feof.h
+++ b/libc/src/stdio/feof.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FEOF_H
#define LLVM_LIBC_SRC_STDIO_FEOF_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/feof_unlocked.h b/libc/src/stdio/feof_unlocked.h
index 359609c597900..6eae427992698 100644
--- a/libc/src/stdio/feof_unlocked.h
+++ b/libc/src/stdio/feof_unlocked.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FEOF_UNLOCKED_H
#define LLVM_LIBC_SRC_STDIO_FEOF_UNLOCKED_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/ferror.h b/libc/src/stdio/ferror.h
index 194dff6320c83..9e2f949bf30e5 100644
--- a/libc/src/stdio/ferror.h
+++ b/libc/src/stdio/ferror.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FERROR_H
#define LLVM_LIBC_SRC_STDIO_FERROR_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/ferror_unlocked.h b/libc/src/stdio/ferror_unlocked.h
index 86281025368c3..16cfd5a1b1482 100644
--- a/libc/src/stdio/ferror_unlocked.h
+++ b/libc/src/stdio/ferror_unlocked.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FERROR_UNLOCKED_H
#define LLVM_LIBC_SRC_STDIO_FERROR_UNLOCKED_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fflush.h b/libc/src/stdio/fflush.h
index 839fd986f15b5..d64d5264cf7dd 100644
--- a/libc/src/stdio/fflush.h
+++ b/libc/src/stdio/fflush.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FFLUSH_H
#define LLVM_LIBC_SRC_STDIO_FFLUSH_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fgetc.h b/libc/src/stdio/fgetc.h
index 26a32482a3ba7..f88d759d549ec 100644
--- a/libc/src/stdio/fgetc.h
+++ b/libc/src/stdio/fgetc.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FGETC_H
#define LLVM_LIBC_SRC_STDIO_FGETC_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fgetc_unlocked.h b/libc/src/stdio/fgetc_unlocked.h
index f765e8d502be7..9ff311af833e4 100644
--- a/libc/src/stdio/fgetc_unlocked.h
+++ b/libc/src/stdio/fgetc_unlocked.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FGETC_UNLOCKED_H
#define LLVM_LIBC_SRC_STDIO_FGETC_UNLOCKED_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fgets.h b/libc/src/stdio/fgets.h
index 4264557862479..d3d49a1f42952 100644
--- a/libc/src/stdio/fgets.h
+++ b/libc/src/stdio/fgets.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FGETS_H
#define LLVM_LIBC_SRC_STDIO_FGETS_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/flockfile.cpp b/libc/src/stdio/flockfile.cpp
index 62606c92b9ea9..b996a77b3c300 100644
--- a/libc/src/stdio/flockfile.cpp
+++ b/libc/src/stdio/flockfile.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/flockfile.h"
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/flockfile.h b/libc/src/stdio/flockfile.h
index 1509c140c5e71..ef002657a2416 100644
--- a/libc/src/stdio/flockfile.h
+++ b/libc/src/stdio/flockfile.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FLOCKFILE_H
#define LLVM_LIBC_SRC_STDIO_FLOCKFILE_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fopen.h b/libc/src/stdio/fopen.h
index 68f93f5168f07..23f95cfe592e6 100644
--- a/libc/src/stdio/fopen.h
+++ b/libc/src/stdio/fopen.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FOPEN_H
#define LLVM_LIBC_SRC_STDIO_FOPEN_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fopencookie.cpp b/libc/src/stdio/fopencookie.cpp
index 17b8ae199d3db..367172a6fd8c7 100644
--- a/libc/src/stdio/fopencookie.cpp
+++ b/libc/src/stdio/fopencookie.cpp
@@ -7,12 +7,14 @@
//===----------------------------------------------------------------------===//
#include "src/stdio/fopencookie.h"
+#include "hdr/stdio_macros.h"
+#include "hdr/types/FILE.h"
+#include "hdr/types/cookie_io_functions_t.h"
+#include "hdr/types/off_t.h"
#include "src/__support/CPP/new.h"
#include "src/__support/File/file.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
-#include <stdlib.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fopencookie.h b/libc/src/stdio/fopencookie.h
index 3dff8949dd435..dc832128a30d0 100644
--- a/libc/src/stdio/fopencookie.h
+++ b/libc/src/stdio/fopencookie.h
@@ -9,7 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_FOPENCOOKIE_H
#define LLVM_LIBC_SRC_STDIO_FOPENCOOKIE_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+#include "hdr/types/cookie_io_functions_t.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fprintf.cpp b/libc/src/stdio/fprintf.cpp
index 87b0e74ae09bf..5d14d82b77df7 100644
--- a/libc/src/stdio/fprintf.cpp
+++ b/libc/src/stdio/fprintf.cpp
@@ -12,8 +12,8 @@
#include "src/__support/arg_list.h"
#include "src/stdio/printf_core/vfprintf_internal.h"
+#include "hdr/types/FILE.h"
#include <stdarg.h>
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fprintf.h b/libc/src/stdio/fprintf.h
index 41cd8a858b430..4d070cec7d291 100644
--- a/libc/src/stdio/fprintf.h
+++ b/libc/src/stdio/fprintf.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FPRINTF_H
#define LLVM_LIBC_SRC_STDIO_FPRINTF_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fputc.h b/libc/src/stdio/fputc.h
index 578e569072a1f..6c449650d3c1e 100644
--- a/libc/src/stdio/fputc.h
+++ b/libc/src/stdio/fputc.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FPUTC_H
#define LLVM_LIBC_SRC_STDIO_FPUTC_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fputs.h b/libc/src/stdio/fputs.h
index 0238e46e628a6..4dddf96eab27e 100644
--- a/libc/src/stdio/fputs.h
+++ b/libc/src/stdio/fputs.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FPUTS_H
#define LLVM_LIBC_SRC_STDIO_FPUTS_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fread.h b/libc/src/stdio/fread.h
index ae2295095b9cf..a74095aafff91 100644
--- a/libc/src/stdio/fread.h
+++ b/libc/src/stdio/fread.h
@@ -9,7 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_FREAD_H
#define LLVM_LIBC_SRC_STDIO_FREAD_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fread_unlocked.h b/libc/src/stdio/fread_unlocked.h
index 7cd0ed3e35c57..49a3827608f3a 100644
--- a/libc/src/stdio/fread_unlocked.h
+++ b/libc/src/stdio/fread_unlocked.h
@@ -9,7 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_FREAD_UNLOCKED_H
#define LLVM_LIBC_SRC_STDIO_FREAD_UNLOCKED_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fscanf.cpp b/libc/src/stdio/fscanf.cpp
index 188e28e50d0bd..1f99f873c0700 100644
--- a/libc/src/stdio/fscanf.cpp
+++ b/libc/src/stdio/fscanf.cpp
@@ -12,8 +12,8 @@
#include "src/__support/arg_list.h"
#include "src/stdio/scanf_core/vfscanf_internal.h"
+#include "hdr/types/FILE.h"
#include <stdarg.h>
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fscanf.h b/libc/src/stdio/fscanf.h
index 0e2247d74f0e5..21df616783bb3 100644
--- a/libc/src/stdio/fscanf.h
+++ b/libc/src/stdio/fscanf.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FSCANF_H
#define LLVM_LIBC_SRC_STDIO_FSCANF_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fseek.h b/libc/src/stdio/fseek.h
index 6a7f715d2f998..5496cbef4b2f4 100644
--- a/libc/src/stdio/fseek.h
+++ b/libc/src/stdio/fseek.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FSEEK_H
#define LLVM_LIBC_SRC_STDIO_FSEEK_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fseeko.h b/libc/src/stdio/fseeko.h
index 77fb41215c318..25fc39e561397 100644
--- a/libc/src/stdio/fseeko.h
+++ b/libc/src/stdio/fseeko.h
@@ -9,7 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_FSEEKO_H
#define LLVM_LIBC_SRC_STDIO_FSEEKO_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+#include "hdr/types/off_t.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/ftell.h b/libc/src/stdio/ftell.h
index e72bb8b32bd94..b644edd70181c 100644
--- a/libc/src/stdio/ftell.h
+++ b/libc/src/stdio/ftell.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FTELL_H
#define LLVM_LIBC_SRC_STDIO_FTELL_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/ftello.h b/libc/src/stdio/ftello.h
index 5ab17f9244a5a..fc00b6a3e0516 100644
--- a/libc/src/stdio/ftello.h
+++ b/libc/src/stdio/ftello.h
@@ -9,7 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_FTELLO_H
#define LLVM_LIBC_SRC_STDIO_FTELLO_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+#include "hdr/types/off_t.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/funlockfile.cpp b/libc/src/stdio/funlockfile.cpp
index 88e2eaef8ba03..404b2324efd15 100644
--- a/libc/src/stdio/funlockfile.cpp
+++ b/libc/src/stdio/funlockfile.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/funlockfile.h"
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/funlockfile.h b/libc/src/stdio/funlockfile.h
index c50f9dd1d7009..65b77ddfc711e 100644
--- a/libc/src/stdio/funlockfile.h
+++ b/libc/src/stdio/funlockfile.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_FUNLOCKFILE_H
#define LLVM_LIBC_SRC_STDIO_FUNLOCKFILE_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fwrite.h b/libc/src/stdio/fwrite.h
index a71f20cff023a..c1532984582d1 100644
--- a/libc/src/stdio/fwrite.h
+++ b/libc/src/stdio/fwrite.h
@@ -9,7 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_FWRITE_H
#define LLVM_LIBC_SRC_STDIO_FWRITE_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/fwrite_unlocked.h b/libc/src/stdio/fwrite_unlocked.h
index 7012e0d16737a..c1a02af807b08 100644
--- a/libc/src/stdio/fwrite_unlocked.h
+++ b/libc/src/stdio/fwrite_unlocked.h
@@ -9,7 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_FWRITE_UNLOCKED_H
#define LLVM_LIBC_SRC_STDIO_FWRITE_UNLOCKED_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/CMakeLists.txt b/libc/src/stdio/generic/CMakeLists.txt
index 9cd4cfdae17f4..b0ce8ccc08bd6 100644
--- a/libc/src/stdio/generic/CMakeLists.txt
+++ b/libc/src/stdio/generic/CMakeLists.txt
@@ -5,7 +5,7 @@ add_entrypoint_object(
HDRS
../clearerr.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -17,7 +17,7 @@ add_entrypoint_object(
HDRS
../clearerr_unlocked.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -29,7 +29,7 @@ add_entrypoint_object(
HDRS
../feof.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -41,7 +41,7 @@ add_entrypoint_object(
HDRS
../feof_unlocked.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -53,7 +53,7 @@ add_entrypoint_object(
HDRS
../ferror.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -65,7 +65,7 @@ add_entrypoint_object(
HDRS
../ferror_unlocked.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -77,7 +77,7 @@ add_entrypoint_object(
HDRS
../fileno.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -90,7 +90,7 @@ add_entrypoint_object(
../fflush.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -150,7 +150,7 @@ add_entrypoint_object(
HDRS
../fopen.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -162,7 +162,7 @@ add_entrypoint_object(
HDRS
../fclose.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.errno.errno
libc.src.__support.File.file
libc.src.__support.File.platform_file
@@ -176,7 +176,7 @@ add_entrypoint_object(
../fread_unlocked.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -189,7 +189,7 @@ add_entrypoint_object(
../fread.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -202,7 +202,7 @@ add_entrypoint_object(
../fputs.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -215,7 +215,7 @@ add_entrypoint_object(
../puts.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_stdout
)
@@ -228,7 +228,7 @@ add_entrypoint_object(
../fwrite_unlocked.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -241,7 +241,7 @@ add_entrypoint_object(
../fwrite.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -254,7 +254,7 @@ add_entrypoint_object(
../fputc.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -267,7 +267,7 @@ add_entrypoint_object(
../putc.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -280,7 +280,7 @@ add_entrypoint_object(
../putchar.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -293,7 +293,7 @@ add_entrypoint_object(
../fgetc.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -306,7 +306,7 @@ add_entrypoint_object(
../fgetc_unlocked.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -319,7 +319,7 @@ add_entrypoint_object(
../getc.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -332,7 +332,7 @@ add_entrypoint_object(
../getc_unlocked.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -345,7 +345,7 @@ add_entrypoint_object(
../getchar.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -358,7 +358,7 @@ add_entrypoint_object(
../getchar_unlocked.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -404,7 +404,7 @@ add_entrypoint_object(
../fgets.h
DEPENDS
libc.src.errno.errno
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -416,7 +416,7 @@ add_entrypoint_object(
HDRS
../ungetc.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
@@ -428,7 +428,7 @@ add_entrypoint_object(
HDRS
../stdin.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_stdin
)
@@ -440,7 +440,7 @@ add_entrypoint_object(
HDRS
../stdout.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_stdout
)
@@ -452,7 +452,7 @@ add_entrypoint_object(
HDRS
../stderr.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.File.file
libc.src.__support.File.platform_stderr
)
diff --git a/libc/src/stdio/generic/clearerr.cpp b/libc/src/stdio/generic/clearerr.cpp
index 1f1ce38639f50..11a2da1847321 100644
--- a/libc/src/stdio/generic/clearerr.cpp
+++ b/libc/src/stdio/generic/clearerr.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/clearerr.h"
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/clearerr_unlocked.cpp b/libc/src/stdio/generic/clearerr_unlocked.cpp
index 2840e3703ca93..86caa7ba8a4c5 100644
--- a/libc/src/stdio/generic/clearerr_unlocked.cpp
+++ b/libc/src/stdio/generic/clearerr_unlocked.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/clearerr_unlocked.h"
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fclose.cpp b/libc/src/stdio/generic/fclose.cpp
index cc163ab21e78d..50ef17cf2a4a5 100644
--- a/libc/src/stdio/generic/fclose.cpp
+++ b/libc/src/stdio/generic/fclose.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/fclose.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/feof.cpp b/libc/src/stdio/generic/feof.cpp
index 311561c4271f0..77df40e8bcfdf 100644
--- a/libc/src/stdio/generic/feof.cpp
+++ b/libc/src/stdio/generic/feof.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/feof.h"
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/feof_unlocked.cpp b/libc/src/stdio/generic/feof_unlocked.cpp
index e8c718c136961..0dcefafb6c259 100644
--- a/libc/src/stdio/generic/feof_unlocked.cpp
+++ b/libc/src/stdio/generic/feof_unlocked.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/feof_unlocked.h"
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/ferror.cpp b/libc/src/stdio/generic/ferror.cpp
index 65cf99fe48473..66128fd6b7753 100644
--- a/libc/src/stdio/generic/ferror.cpp
+++ b/libc/src/stdio/generic/ferror.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/ferror.h"
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/ferror_unlocked.cpp b/libc/src/stdio/generic/ferror_unlocked.cpp
index 089ea4ab36b57..76a4e2556dee3 100644
--- a/libc/src/stdio/generic/ferror_unlocked.cpp
+++ b/libc/src/stdio/generic/ferror_unlocked.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/ferror_unlocked.h"
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fflush.cpp b/libc/src/stdio/generic/fflush.cpp
index dc5275b1cd08e..670dda03d54eb 100644
--- a/libc/src/stdio/generic/fflush.cpp
+++ b/libc/src/stdio/generic/fflush.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/fflush.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fgetc.cpp b/libc/src/stdio/generic/fgetc.cpp
index 771811382fd59..66afa64875597 100644
--- a/libc/src/stdio/generic/fgetc.cpp
+++ b/libc/src/stdio/generic/fgetc.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/fgetc.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fgetc_unlocked.cpp b/libc/src/stdio/generic/fgetc_unlocked.cpp
index e7aaf9dc8ea22..7d67a94400ae9 100644
--- a/libc/src/stdio/generic/fgetc_unlocked.cpp
+++ b/libc/src/stdio/generic/fgetc_unlocked.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/fgetc_unlocked.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fgets.cpp b/libc/src/stdio/generic/fgets.cpp
index 8c9dac8bd3b31..121790bf7d180 100644
--- a/libc/src/stdio/generic/fgets.cpp
+++ b/libc/src/stdio/generic/fgets.cpp
@@ -9,9 +9,9 @@
#include "src/stdio/fgets.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
#include <stddef.h>
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fopen.cpp b/libc/src/stdio/generic/fopen.cpp
index 794ef0366dd66..19cf3bcd02f5e 100644
--- a/libc/src/stdio/generic/fopen.cpp
+++ b/libc/src/stdio/generic/fopen.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/fopen.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fputc.cpp b/libc/src/stdio/generic/fputc.cpp
index ecbe45e97208d..71d4bb8d5debb 100644
--- a/libc/src/stdio/generic/fputc.cpp
+++ b/libc/src/stdio/generic/fputc.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/fputc.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fputs.cpp b/libc/src/stdio/generic/fputs.cpp
index ef77ad43a1b42..cefc6c6813750 100644
--- a/libc/src/stdio/generic/fputs.cpp
+++ b/libc/src/stdio/generic/fputs.cpp
@@ -10,8 +10,9 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fread.cpp b/libc/src/stdio/generic/fread.cpp
index e8bd2517df6f8..986828b86b340 100644
--- a/libc/src/stdio/generic/fread.cpp
+++ b/libc/src/stdio/generic/fread.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/fread.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fread_unlocked.cpp b/libc/src/stdio/generic/fread_unlocked.cpp
index 9810c9d6519d9..072503d0502ec 100644
--- a/libc/src/stdio/generic/fread_unlocked.cpp
+++ b/libc/src/stdio/generic/fread_unlocked.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/fread_unlocked.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fwrite.cpp b/libc/src/stdio/generic/fwrite.cpp
index bd11f62a7121c..14c14f5e1a981 100644
--- a/libc/src/stdio/generic/fwrite.cpp
+++ b/libc/src/stdio/generic/fwrite.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/fwrite.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/fwrite_unlocked.cpp b/libc/src/stdio/generic/fwrite_unlocked.cpp
index 5ab7c766087b7..0c76bd13d995a 100644
--- a/libc/src/stdio/generic/fwrite_unlocked.cpp
+++ b/libc/src/stdio/generic/fwrite_unlocked.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/fwrite_unlocked.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/getc.cpp b/libc/src/stdio/generic/getc.cpp
index 5cea28d506f6b..20f39479d3100 100644
--- a/libc/src/stdio/generic/getc.cpp
+++ b/libc/src/stdio/generic/getc.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/getc.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/getc_unlocked.cpp b/libc/src/stdio/generic/getc_unlocked.cpp
index 883405e84bad0..849d0be6725ae 100644
--- a/libc/src/stdio/generic/getc_unlocked.cpp
+++ b/libc/src/stdio/generic/getc_unlocked.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/getc_unlocked.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/getchar.cpp b/libc/src/stdio/generic/getchar.cpp
index 181999fe56c42..bf3825bbbf166 100644
--- a/libc/src/stdio/generic/getchar.cpp
+++ b/libc/src/stdio/generic/getchar.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/getchar.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/getchar_unlocked.cpp b/libc/src/stdio/generic/getchar_unlocked.cpp
index be98d0333ec87..86777d118ce3b 100644
--- a/libc/src/stdio/generic/getchar_unlocked.cpp
+++ b/libc/src/stdio/generic/getchar_unlocked.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/getchar_unlocked.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/printf.cpp b/libc/src/stdio/generic/printf.cpp
index 5701ca9eb2704..14a4225af44c5 100644
--- a/libc/src/stdio/generic/printf.cpp
+++ b/libc/src/stdio/generic/printf.cpp
@@ -12,8 +12,8 @@
#include "src/__support/arg_list.h"
#include "src/stdio/printf_core/vfprintf_internal.h"
+#include "hdr/types/FILE.h"
#include <stdarg.h>
-#include <stdio.h>
#ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE
#define PRINTF_STDOUT LIBC_NAMESPACE::stdout
diff --git a/libc/src/stdio/generic/putc.cpp b/libc/src/stdio/generic/putc.cpp
index 58e3b4d1bae4d..e8ebbb3d18e9d 100644
--- a/libc/src/stdio/generic/putc.cpp
+++ b/libc/src/stdio/generic/putc.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/putc.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/putchar.cpp b/libc/src/stdio/generic/putchar.cpp
index 4a4aeb54c9c6f..e9e6f962b3415 100644
--- a/libc/src/stdio/generic/putchar.cpp
+++ b/libc/src/stdio/generic/putchar.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/putchar.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/puts.cpp b/libc/src/stdio/generic/puts.cpp
index 0f19ec5267671..247d4f088463c 100644
--- a/libc/src/stdio/generic/puts.cpp
+++ b/libc/src/stdio/generic/puts.cpp
@@ -10,8 +10,9 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/stderr.cpp b/libc/src/stdio/generic/stderr.cpp
index 31b618f6928a0..65ba305a14934 100644
--- a/libc/src/stdio/generic/stderr.cpp
+++ b/libc/src/stdio/generic/stderr.cpp
@@ -8,6 +8,6 @@
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
extern "C" FILE *stderr;
diff --git a/libc/src/stdio/generic/stdin.cpp b/libc/src/stdio/generic/stdin.cpp
index f99ea898dfcd1..ce1ae2d987ad9 100644
--- a/libc/src/stdio/generic/stdin.cpp
+++ b/libc/src/stdio/generic/stdin.cpp
@@ -8,6 +8,6 @@
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
extern "C" FILE *stdin;
diff --git a/libc/src/stdio/generic/stdout.cpp b/libc/src/stdio/generic/stdout.cpp
index 2d5aaf5667260..8ad8f64bae961 100644
--- a/libc/src/stdio/generic/stdout.cpp
+++ b/libc/src/stdio/generic/stdout.cpp
@@ -8,6 +8,6 @@
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
extern "C" FILE *stdout;
diff --git a/libc/src/stdio/generic/ungetc.cpp b/libc/src/stdio/generic/ungetc.cpp
index ccfbfb0121c86..8e2897e3c5261 100644
--- a/libc/src/stdio/generic/ungetc.cpp
+++ b/libc/src/stdio/generic/ungetc.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/ungetc.h"
#include "src/__support/File/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/generic/vprintf.cpp b/libc/src/stdio/generic/vprintf.cpp
index eff968d1e9134..f78a84fb8454f 100644
--- a/libc/src/stdio/generic/vprintf.cpp
+++ b/libc/src/stdio/generic/vprintf.cpp
@@ -12,8 +12,8 @@
#include "src/__support/arg_list.h"
#include "src/stdio/printf_core/vfprintf_internal.h"
+#include "hdr/types/FILE.h"
#include <stdarg.h>
-#include <stdio.h>
#ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE
#define PRINTF_STDOUT LIBC_NAMESPACE::stdout
diff --git a/libc/src/stdio/getc.h b/libc/src/stdio/getc.h
index c085d35d7de9c..85675268cb405 100644
--- a/libc/src/stdio/getc.h
+++ b/libc/src/stdio/getc.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_GETC_H
#define LLVM_LIBC_SRC_STDIO_GETC_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/getc_unlocked.h b/libc/src/stdio/getc_unlocked.h
index f4e1165dd75dc..45dcb4eb0afa4 100644
--- a/libc/src/stdio/getc_unlocked.h
+++ b/libc/src/stdio/getc_unlocked.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_GETC_UNLOCKED_H
#define LLVM_LIBC_SRC_STDIO_GETC_UNLOCKED_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/CMakeLists.txt b/libc/src/stdio/gpu/CMakeLists.txt
index 8940843ea91b2..64bae7dc02d58 100644
--- a/libc/src/stdio/gpu/CMakeLists.txt
+++ b/libc/src/stdio/gpu/CMakeLists.txt
@@ -3,6 +3,7 @@ add_header_library(
HDRS
file.h
DEPENDS
+ libc.hdr.types.FILE
libc.src.__support.RPC.rpc_client
libc.src.__support.common
.stdin
@@ -17,7 +18,7 @@ add_entrypoint_object(
HDRS
../feof.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.RPC.rpc_client
)
@@ -28,7 +29,7 @@ add_entrypoint_object(
HDRS
../ferror.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.RPC.rpc_client
)
@@ -39,7 +40,7 @@ add_entrypoint_object(
HDRS
../fseek.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
)
@@ -50,7 +51,7 @@ add_entrypoint_object(
HDRS
../ftell.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
)
@@ -61,7 +62,7 @@ add_entrypoint_object(
HDRS
../fflush.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
)
@@ -72,7 +73,7 @@ add_entrypoint_object(
HDRS
../clearerr.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
libc.src.__support.RPC.rpc_client
)
@@ -83,7 +84,7 @@ add_entrypoint_object(
HDRS
../fopen.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
)
add_entrypoint_object(
@@ -93,7 +94,7 @@ add_entrypoint_object(
HDRS
../fclose.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
)
add_entrypoint_object(
@@ -103,7 +104,7 @@ add_entrypoint_object(
HDRS
../fread.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
)
add_entrypoint_object(
@@ -113,7 +114,8 @@ add_entrypoint_object(
HDRS
../puts.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
+ libc.include.stdio # needed for stdin
.gpu_file
)
@@ -124,7 +126,7 @@ add_entrypoint_object(
HDRS
../fputs.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
)
@@ -135,7 +137,7 @@ add_entrypoint_object(
HDRS
../fwrite.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
)
@@ -146,7 +148,7 @@ add_entrypoint_object(
HDRS
../fputc.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
)
@@ -157,7 +159,8 @@ add_entrypoint_object(
HDRS
../putc.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
+ libc.include.stdio # needed for stdin
.gpu_file
)
@@ -168,7 +171,8 @@ add_entrypoint_object(
HDRS
../putchar.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
+ libc.include.stdio # needed for stdin
.gpu_file
)
@@ -179,18 +183,7 @@ add_entrypoint_object(
HDRS
../fgetc.h
DEPENDS
- libc.include.stdio
- .gpu_file
-)
-
-add_entrypoint_object(
- fgetc_unlocked
- SRCS
- fgetc_unlocked.cpp
- HDRS
- ../fgetc_unlocked.h
- DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
)
@@ -201,18 +194,8 @@ add_entrypoint_object(
HDRS
../getc.h
DEPENDS
- libc.include.stdio
- .gpu_file
-)
-
-add_entrypoint_object(
- getc_unlocked
- SRCS
- getc_unlocked.cpp
- HDRS
- ../getc_unlocked.h
- DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
+ libc.include.stdio # needed for stdin
.gpu_file
)
@@ -223,18 +206,8 @@ add_entrypoint_object(
HDRS
../getchar.h
DEPENDS
- libc.include.stdio
- .gpu_file
-)
-
-add_entrypoint_object(
- getchar_unlocked
- SRCS
- getc_unlocked.cpp
- HDRS
- ../getc_unlocked.h
- DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
+ libc.include.stdio # needed for stdin
.gpu_file
)
@@ -245,7 +218,7 @@ add_entrypoint_object(
HDRS
../fgets.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
.feof
.ferror
@@ -258,7 +231,7 @@ add_entrypoint_object(
HDRS
../ungetc.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
)
@@ -269,7 +242,7 @@ add_entrypoint_object(
HDRS
../remove.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
.gpu_file
)
@@ -280,7 +253,7 @@ add_entrypoint_object(
HDRS
../stdin.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
)
add_entrypoint_object(
@@ -290,7 +263,7 @@ add_entrypoint_object(
HDRS
../stdout.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
)
add_entrypoint_object(
@@ -300,5 +273,5 @@ add_entrypoint_object(
HDRS
../stderr.h
DEPENDS
- libc.include.stdio
+ libc.hdr.types.FILE
)
diff --git a/libc/src/stdio/gpu/clearerr.cpp b/libc/src/stdio/gpu/clearerr.cpp
index 2267fdf8115ee..ec7fe41ac08e1 100644
--- a/libc/src/stdio/gpu/clearerr.cpp
+++ b/libc/src/stdio/gpu/clearerr.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/clearerr.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/fclose.cpp b/libc/src/stdio/gpu/fclose.cpp
index bdedbe51ec38e..3bc68f1dfc7cd 100644
--- a/libc/src/stdio/gpu/fclose.cpp
+++ b/libc/src/stdio/gpu/fclose.cpp
@@ -9,7 +9,8 @@
#include "src/stdio/fclose.h"
#include "src/stdio/gpu/file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h"
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/feof.cpp b/libc/src/stdio/gpu/feof.cpp
index ddcef384142c4..dee1e3841e638 100644
--- a/libc/src/stdio/gpu/feof.cpp
+++ b/libc/src/stdio/gpu/feof.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/feof.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/ferror.cpp b/libc/src/stdio/gpu/ferror.cpp
index 9ed598fb67541..90e1592cdbe09 100644
--- a/libc/src/stdio/gpu/ferror.cpp
+++ b/libc/src/stdio/gpu/ferror.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/ferror.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/fflush.cpp b/libc/src/stdio/gpu/fflush.cpp
index 68192174e58a8..60c352217dd96 100644
--- a/libc/src/stdio/gpu/fflush.cpp
+++ b/libc/src/stdio/gpu/fflush.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/fflush.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/fgetc.cpp b/libc/src/stdio/gpu/fgetc.cpp
index 56f42a04857fb..08e6eb37c5e0d 100644
--- a/libc/src/stdio/gpu/fgetc.cpp
+++ b/libc/src/stdio/gpu/fgetc.cpp
@@ -9,7 +9,8 @@
#include "src/stdio/fgetc.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h" // for EOF.
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/fgets.cpp b/libc/src/stdio/gpu/fgets.cpp
index 5ea4bdcdc9e0f..fb0a30b78e697 100644
--- a/libc/src/stdio/gpu/fgets.cpp
+++ b/libc/src/stdio/gpu/fgets.cpp
@@ -11,8 +11,9 @@
#include "src/stdio/feof.h"
#include "src/stdio/ferror.h"
+#include "hdr/stdio_macros.h" // for EOF.
+#include "hdr/types/FILE.h"
#include <stddef.h>
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/file.h b/libc/src/stdio/gpu/file.h
index 2cab2e6d36a25..8cbba9ec5d713 100644
--- a/libc/src/stdio/gpu/file.h
+++ b/libc/src/stdio/gpu/file.h
@@ -9,7 +9,9 @@
#include "src/__support/RPC/rpc_client.h"
#include "src/string/string_utils.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+
+#include <stdio.h> //needed for stdin/out/err
namespace LIBC_NAMESPACE {
namespace file {
diff --git a/libc/src/stdio/gpu/fopen.cpp b/libc/src/stdio/gpu/fopen.cpp
index 41d2c89473168..1e55725f18cce 100644
--- a/libc/src/stdio/gpu/fopen.cpp
+++ b/libc/src/stdio/gpu/fopen.cpp
@@ -10,7 +10,7 @@
#include "src/__support/CPP/string_view.h"
#include "src/stdio/gpu/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/fputc.cpp b/libc/src/stdio/gpu/fputc.cpp
index e6ef12f4b2f80..a99eaeb8ceb93 100644
--- a/libc/src/stdio/gpu/fputc.cpp
+++ b/libc/src/stdio/gpu/fputc.cpp
@@ -6,10 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#include "file.h"
#include "src/stdio/fputc.h"
+#include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h" // for EOF.
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/fputs.cpp b/libc/src/stdio/gpu/fputs.cpp
index 1b6e0732b98cd..4803da978dc1f 100644
--- a/libc/src/stdio/gpu/fputs.cpp
+++ b/libc/src/stdio/gpu/fputs.cpp
@@ -11,7 +11,8 @@
#include "src/errno/libc_errno.h"
#include "src/stdio/gpu/file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h" // for EOF.
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/fread.cpp b/libc/src/stdio/gpu/fread.cpp
index fe367ae1aa249..233a7809e8468 100644
--- a/libc/src/stdio/gpu/fread.cpp
+++ b/libc/src/stdio/gpu/fread.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/fread.h"
#include "src/stdio/gpu/file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/fseek.cpp b/libc/src/stdio/gpu/fseek.cpp
index 3e93ddb46bf97..3b1f85db1fd0b 100644
--- a/libc/src/stdio/gpu/fseek.cpp
+++ b/libc/src/stdio/gpu/fseek.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/fseek.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/ftell.cpp b/libc/src/stdio/gpu/ftell.cpp
index aea3e8b229fce..5664726d68d30 100644
--- a/libc/src/stdio/gpu/ftell.cpp
+++ b/libc/src/stdio/gpu/ftell.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/ftell.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/fwrite.cpp b/libc/src/stdio/gpu/fwrite.cpp
index a059bd5ea3b71..1321e32c272a1 100644
--- a/libc/src/stdio/gpu/fwrite.cpp
+++ b/libc/src/stdio/gpu/fwrite.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/fwrite.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/getc.cpp b/libc/src/stdio/gpu/getc.cpp
index b50e3963c31a1..d77d8ba0ff421 100644
--- a/libc/src/stdio/gpu/getc.cpp
+++ b/libc/src/stdio/gpu/getc.cpp
@@ -9,7 +9,8 @@
#include "src/stdio/getc.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h" // for EOF.
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/getchar.cpp b/libc/src/stdio/gpu/getchar.cpp
index c8a004124a2e5..28e86da8400a3 100644
--- a/libc/src/stdio/gpu/getchar.cpp
+++ b/libc/src/stdio/gpu/getchar.cpp
@@ -9,7 +9,10 @@
#include "src/stdio/getchar.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h" // for EOF.
+#include "hdr/types/FILE.h"
+
+#include <stdio.h> //needed for stdin
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/putc.cpp b/libc/src/stdio/gpu/putc.cpp
index b5ecbfc65d677..d054d282c4632 100644
--- a/libc/src/stdio/gpu/putc.cpp
+++ b/libc/src/stdio/gpu/putc.cpp
@@ -9,7 +9,8 @@
#include "src/stdio/putc.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h" // for EOF.
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/putchar.cpp b/libc/src/stdio/gpu/putchar.cpp
index 57663eec40f3b..3e38401c7a042 100644
--- a/libc/src/stdio/gpu/putchar.cpp
+++ b/libc/src/stdio/gpu/putchar.cpp
@@ -6,10 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#include "file.h"
#include "src/stdio/putchar.h"
+#include "file.h"
+
+#include "hdr/stdio_macros.h" // for EOF.
+#include "hdr/types/FILE.h"
-#include <stdio.h>
+#include <stdio.h> //needed for stdout
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/puts.cpp b/libc/src/stdio/gpu/puts.cpp
index 10573a862a4c2..f6d91ccf63008 100644
--- a/libc/src/stdio/gpu/puts.cpp
+++ b/libc/src/stdio/gpu/puts.cpp
@@ -11,7 +11,10 @@
#include "src/errno/libc_errno.h"
#include "src/stdio/gpu/file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h" // for EOF.
+#include "hdr/types/FILE.h"
+
+#include <stdio.h> //needed for stdout
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/remove.cpp b/libc/src/stdio/gpu/remove.cpp
index 398be5f7ef436..6b53e1f6af596 100644
--- a/libc/src/stdio/gpu/remove.cpp
+++ b/libc/src/stdio/gpu/remove.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/remove.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/gpu/stderr.cpp b/libc/src/stdio/gpu/stderr.cpp
index 70846827064a3..e239b94c7b8a9 100644
--- a/libc/src/stdio/gpu/stderr.cpp
+++ b/libc/src/stdio/gpu/stderr.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
static struct {
diff --git a/libc/src/stdio/gpu/stdin.cpp b/libc/src/stdio/gpu/stdin.cpp
index 1a58461c3dec9..6a305c89ac23c 100644
--- a/libc/src/stdio/gpu/stdin.cpp
+++ b/libc/src/stdio/gpu/stdin.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
static struct {
diff --git a/libc/src/stdio/gpu/stdout.cpp b/libc/src/stdio/gpu/stdout.cpp
index abeeff2ce9f53..fffe1376a818f 100644
--- a/libc/src/stdio/gpu/stdout.cpp
+++ b/libc/src/stdio/gpu/stdout.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
static struct {
diff --git a/libc/src/stdio/gpu/ungetc.cpp b/libc/src/stdio/gpu/ungetc.cpp
index 373164a0c53a3..52379e125464b 100644
--- a/libc/src/stdio/gpu/ungetc.cpp
+++ b/libc/src/stdio/gpu/ungetc.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/ungetc.h"
#include "file.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/printf.h b/libc/src/stdio/printf.h
index c5b4603c589d5..60ccf613e2980 100644
--- a/libc/src/stdio/printf.h
+++ b/libc/src/stdio/printf.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_H
#define LLVM_LIBC_SRC_STDIO_PRINTF_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/printf_core/vfprintf_internal.h b/libc/src/stdio/printf_core/vfprintf_internal.h
index c16c3ae15fb7c..2917aa22865f5 100644
--- a/libc/src/stdio/printf_core/vfprintf_internal.h
+++ b/libc/src/stdio/printf_core/vfprintf_internal.h
@@ -16,7 +16,7 @@
#include "src/stdio/printf_core/printf_main.h"
#include "src/stdio/printf_core/writer.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/putc.h b/libc/src/stdio/putc.h
index a8fb5b7fa97eb..9d331d005bf68 100644
--- a/libc/src/stdio/putc.h
+++ b/libc/src/stdio/putc.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_PUTC_H
#define LLVM_LIBC_SRC_STDIO_PUTC_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/remove.h b/libc/src/stdio/remove.h
index 8c52fe5eee8e8..3e541a0c675ae 100644
--- a/libc/src/stdio/remove.h
+++ b/libc/src/stdio/remove.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_REMOVE_H
#define LLVM_LIBC_SRC_STDIO_REMOVE_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/scanf.cpp b/libc/src/stdio/scanf.cpp
index 3a9fafab38be3..bfa8d46007b99 100644
--- a/libc/src/stdio/scanf.cpp
+++ b/libc/src/stdio/scanf.cpp
@@ -12,8 +12,8 @@
#include "src/__support/arg_list.h"
#include "src/stdio/scanf_core/vfscanf_internal.h"
+#include "hdr/types/FILE.h"
#include <stdarg.h>
-#include <stdio.h>
#ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE
#define SCANF_STDIN LIBC_NAMESPACE::stdin
diff --git a/libc/src/stdio/scanf_core/vfscanf_internal.h b/libc/src/stdio/scanf_core/vfscanf_internal.h
index 8081136d471a2..0571eaca3c570 100644
--- a/libc/src/stdio/scanf_core/vfscanf_internal.h
+++ b/libc/src/stdio/scanf_core/vfscanf_internal.h
@@ -14,7 +14,8 @@
#include "src/stdio/scanf_core/reader.h"
#include "src/stdio/scanf_core/scanf_main.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/setbuf.cpp b/libc/src/stdio/setbuf.cpp
index 8819901849a08..61a5cc617828d 100644
--- a/libc/src/stdio/setbuf.cpp
+++ b/libc/src/stdio/setbuf.cpp
@@ -7,10 +7,9 @@
//===----------------------------------------------------------------------===//
#include "src/stdio/setbuf.h"
+#include "hdr/stdio_macros.h"
#include "src/__support/File/file.h"
-
#include "src/errno/libc_errno.h"
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/setbuf.h b/libc/src/stdio/setbuf.h
index 9c7aab95d2c9e..ec81994d22815 100644
--- a/libc/src/stdio/setbuf.h
+++ b/libc/src/stdio/setbuf.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_SETBUF_H
#define LLVM_LIBC_SRC_STDIO_SETBUF_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/setvbuf.cpp b/libc/src/stdio/setvbuf.cpp
index 5fdaebcdb75c2..186848a548062 100644
--- a/libc/src/stdio/setvbuf.cpp
+++ b/libc/src/stdio/setvbuf.cpp
@@ -9,8 +9,9 @@
#include "src/stdio/setvbuf.h"
#include "src/__support/File/file.h"
+#include "hdr/types/FILE.h"
#include "src/errno/libc_errno.h"
-#include <stdio.h>
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/setvbuf.h b/libc/src/stdio/setvbuf.h
index 21d9c9918ffa1..4fe4811a795c2 100644
--- a/libc/src/stdio/setvbuf.h
+++ b/libc/src/stdio/setvbuf.h
@@ -9,7 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_SETVBUF_H
#define LLVM_LIBC_SRC_STDIO_SETVBUF_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
+#include <stddef.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/sscanf.cpp b/libc/src/stdio/sscanf.cpp
index 9bbd813514ffa..28c3e75907fad 100644
--- a/libc/src/stdio/sscanf.cpp
+++ b/libc/src/stdio/sscanf.cpp
@@ -13,8 +13,9 @@
#include "src/stdio/scanf_core/reader.h"
#include "src/stdio/scanf_core/scanf_main.h"
+#include "hdr/stdio_macros.h"
+#include "hdr/types/FILE.h"
#include <stdarg.h>
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/ungetc.h b/libc/src/stdio/ungetc.h
index c24d8e5600cad..9a4470485e35d 100644
--- a/libc/src/stdio/ungetc.h
+++ b/libc/src/stdio/ungetc.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_STDIO_UNGETC_H
#define LLVM_LIBC_SRC_STDIO_UNGETC_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/vfprintf.cpp b/libc/src/stdio/vfprintf.cpp
index 2504ce8a20bac..4e3d460af74d9 100644
--- a/libc/src/stdio/vfprintf.cpp
+++ b/libc/src/stdio/vfprintf.cpp
@@ -12,8 +12,8 @@
#include "src/__support/arg_list.h"
#include "src/stdio/printf_core/vfprintf_internal.h"
+#include "hdr/types/FILE.h"
#include <stdarg.h>
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/vfprintf.h b/libc/src/stdio/vfprintf.h
index 01827c59d6ce1..af8e3c9112a55 100644
--- a/libc/src/stdio/vfprintf.h
+++ b/libc/src/stdio/vfprintf.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_VFPRINTF_H
#define LLVM_LIBC_SRC_STDIO_VFPRINTF_H
+#include "hdr/types/FILE.h"
#include <stdarg.h>
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/stdio/vprintf.h b/libc/src/stdio/vprintf.h
index fe4252bd86203..adc507a4c0b9a 100644
--- a/libc/src/stdio/vprintf.h
+++ b/libc/src/stdio/vprintf.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STDIO_VPRINTF_H
#define LLVM_LIBC_SRC_STDIO_VPRINTF_H
+#include "hdr/types/FILE.h"
#include <stdarg.h>
-#include <stdio.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/unistd/getopt.cpp b/libc/src/unistd/getopt.cpp
index ccdfdc6c64666..2a05500b2d74f 100644
--- a/libc/src/unistd/getopt.cpp
+++ b/libc/src/unistd/getopt.cpp
@@ -13,7 +13,7 @@
#include "src/__support/common.h"
#include "src/stdio/fprintf.h"
-#include <stdio.h>
+#include "hdr/types/FILE.h"
// This is POSIX compliant and does not support GNU extensions, mainly this is
// just the re-ordering of argv elements such that unknown arguments can be
diff --git a/libc/src/unistd/getopt.h b/libc/src/unistd/getopt.h
index ae27958756f44..fe8ae5ff5b91c 100644
--- a/libc/src/unistd/getopt.h
+++ b/libc/src/unistd/getopt.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_UNISTD_GETOPT_H
#define LLVM_LIBC_SRC_UNISTD_GETOPT_H
-#include <stdio.h>
+#include "hdr/types/FILE.h"
#include <unistd.h>
namespace LIBC_NAMESPACE {
diff --git a/libc/src/wchar/btowc.cpp b/libc/src/wchar/btowc.cpp
index 040c60eb805c7..ea093bc5f2552 100644
--- a/libc/src/wchar/btowc.cpp
+++ b/libc/src/wchar/btowc.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/wctype_utils.h"
-#include <stdio.h> // for EOF.
+#include "hdr/stdio_macros.h" // for EOF.
namespace LIBC_NAMESPACE {
diff --git a/libc/src/wchar/wctob.cpp b/libc/src/wchar/wctob.cpp
index 538d5388e5058..885c526d0d634 100644
--- a/libc/src/wchar/wctob.cpp
+++ b/libc/src/wchar/wctob.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/wctype_utils.h"
-#include <stdio.h> // for EOF.
+#include "hdr/stdio_macros.h" // for EOF.
namespace LIBC_NAMESPACE {
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 76b6aac185f5e..28cc040ff4bee 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -138,6 +138,11 @@ libc_support_library(
hdrs = ["hdr/float_macros.h"],
)
+libc_support_library(
+ name = "hdr_stdio_macros",
+ hdrs = ["hdr/stdio_macros.h"],
+)
+
############################ Type Proxy Header Files ###########################
libc_support_library(
@@ -180,6 +185,16 @@ libc_support_library(
hdrs = ["hdr/types/pid_t.h"],
)
+libc_support_library(
+ name = "types_off_t",
+ hdrs = ["hdr/types/off_t.h"],
+)
+
+libc_support_library(
+ name = "types_FILE",
+ hdrs = ["hdr/types/FILE.h"],
+)
+
############################### Support libraries ##############################
libc_support_library(
@@ -667,6 +682,8 @@ libc_support_library(
":__support_error_or",
":__support_threads_mutex",
":errno",
+ ":hdr_stdio_macros",
+ ":types_off_t",
],
)
@@ -678,6 +695,7 @@ libc_support_library(
":__support_error_or",
":__support_osutil_syscall",
":errno",
+ ":types_off_t",
],
)
@@ -3430,6 +3448,7 @@ libc_function(
":__support_arg_list",
":__support_file_file",
":errno",
+ ":types_FILE",
":vfprintf_internal",
],
)
@@ -3442,6 +3461,7 @@ libc_function(
":__support_arg_list",
":__support_file_file",
":errno",
+ ":types_FILE",
":vfprintf_internal",
],
)
@@ -3479,6 +3499,7 @@ libc_function(
":__support_arg_list",
":__support_file_file",
":errno",
+ ":types_FILE",
":vfprintf_internal",
],
)
@@ -3491,6 +3512,7 @@ libc_function(
":__support_arg_list",
":__support_file_file",
":errno",
+ ":types_FILE",
":vfprintf_internal",
],
)
@@ -3503,6 +3525,7 @@ libc_function(
":__support_common",
":__support_osutil_syscall",
":errno",
+ ":types_FILE",
],
)
More information about the libc-commits
mailing list