16 changes: 11 additions & 5 deletions libc/src/stdio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -87,14 +90,15 @@ 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
)

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)
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/baremetal/getchar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
1 change: 1 addition & 0 deletions libc/src/stdio/baremetal/printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "src/stdio/printf_core/writer.h"

#include <stdarg.h>
#include <stddef.h>

namespace LIBC_NAMESPACE {

Expand Down
1 change: 1 addition & 0 deletions libc/src/stdio/baremetal/vprintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "src/stdio/printf_core/writer.h"

#include <stdarg.h>
#include <stddef.h>

namespace LIBC_NAMESPACE {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/clearerr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/clearerr_unlocked.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fclose.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
4 changes: 2 additions & 2 deletions libc/src/stdio/fdopen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/feof.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/feof_unlocked.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/ferror.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/ferror_unlocked.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fgetc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fgetc_unlocked.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/flockfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/flockfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fopen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
6 changes: 4 additions & 2 deletions libc/src/stdio/fopencookie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/fopencookie.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fprintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fputc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fputs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/fread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/fread_unlocked.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fscanf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fscanf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/fseek.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/fseeko.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/ftell.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/ftello.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/funlockfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/funlockfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/fwrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/fwrite_unlocked.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
60 changes: 30 additions & 30 deletions libc/src/stdio/generic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand Down Expand Up @@ -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
)
Expand All @@ -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
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand Down Expand Up @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/clearerr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/clearerr_unlocked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/fclose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/feof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/feof_unlocked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/ferror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/ferror_unlocked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/fflush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/fgetc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/fgetc_unlocked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/fgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/fopen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/fputc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/fputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/fread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/fread_unlocked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/fwrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/fwrite_unlocked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/getc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/getc_unlocked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/getchar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/getchar_unlocked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/putc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/putchar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/generic/puts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/stderr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

#include "src/__support/File/file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

extern "C" FILE *stderr;
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/stdin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

#include "src/__support/File/file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

extern "C" FILE *stdin;
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/stdout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

#include "src/__support/File/file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

extern "C" FILE *stdout;
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/ungetc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/generic/vprintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/getc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/getc_unlocked.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
87 changes: 30 additions & 57 deletions libc/src/stdio/gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,7 +18,7 @@ add_entrypoint_object(
HDRS
../feof.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
libc.src.__support.RPC.rpc_client
)

Expand All @@ -28,7 +29,7 @@ add_entrypoint_object(
HDRS
../ferror.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
libc.src.__support.RPC.rpc_client
)

Expand All @@ -39,7 +40,7 @@ add_entrypoint_object(
HDRS
../fseek.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
.gpu_file
)

Expand All @@ -50,7 +51,7 @@ add_entrypoint_object(
HDRS
../ftell.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
.gpu_file
)

Expand All @@ -61,7 +62,7 @@ add_entrypoint_object(
HDRS
../fflush.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
.gpu_file
)

Expand All @@ -72,7 +73,7 @@ add_entrypoint_object(
HDRS
../clearerr.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
libc.src.__support.RPC.rpc_client
)

Expand All @@ -83,7 +84,7 @@ add_entrypoint_object(
HDRS
../fopen.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
)

add_entrypoint_object(
Expand All @@ -93,7 +94,7 @@ add_entrypoint_object(
HDRS
../fclose.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
)

add_entrypoint_object(
Expand All @@ -103,7 +104,7 @@ add_entrypoint_object(
HDRS
../fread.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
)

add_entrypoint_object(
Expand All @@ -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
)

Expand All @@ -124,7 +126,7 @@ add_entrypoint_object(
HDRS
../fputs.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
.gpu_file
)

Expand All @@ -135,7 +137,7 @@ add_entrypoint_object(
HDRS
../fwrite.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
.gpu_file
)

Expand All @@ -146,7 +148,7 @@ add_entrypoint_object(
HDRS
../fputc.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
.gpu_file
)

Expand All @@ -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
)

Expand All @@ -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
)

Expand All @@ -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
)

Expand All @@ -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
)

Expand All @@ -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
)

Expand All @@ -245,7 +218,7 @@ add_entrypoint_object(
HDRS
../fgets.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
.gpu_file
.feof
.ferror
Expand All @@ -258,7 +231,7 @@ add_entrypoint_object(
HDRS
../ungetc.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
.gpu_file
)

Expand All @@ -269,7 +242,7 @@ add_entrypoint_object(
HDRS
../remove.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
.gpu_file
)

Expand All @@ -280,7 +253,7 @@ add_entrypoint_object(
HDRS
../stdin.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
)

add_entrypoint_object(
Expand All @@ -290,7 +263,7 @@ add_entrypoint_object(
HDRS
../stdout.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
)

add_entrypoint_object(
Expand All @@ -300,5 +273,5 @@ add_entrypoint_object(
HDRS
../stderr.h
DEPENDS
libc.include.stdio
libc.hdr.types.FILE
)
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/clearerr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "src/stdio/clearerr.h"
#include "file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/gpu/fclose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/feof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "src/stdio/feof.h"
#include "file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/ferror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "src/stdio/ferror.h"
#include "file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/fflush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "src/stdio/fflush.h"
#include "file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/gpu/fgetc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/gpu/fgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
4 changes: 3 additions & 1 deletion libc/src/stdio/gpu/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/fopen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
5 changes: 3 additions & 2 deletions libc/src/stdio/gpu/fputc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/gpu/fputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/fread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/fseek.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "src/stdio/fseek.h"
#include "file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/ftell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "src/stdio/ftell.h"
#include "file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/fwrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "src/stdio/fwrite.h"
#include "file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/gpu/getc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
5 changes: 4 additions & 1 deletion libc/src/stdio/gpu/getchar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/gpu/putc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
7 changes: 5 additions & 2 deletions libc/src/stdio/gpu/putchar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
5 changes: 4 additions & 1 deletion libc/src/stdio/gpu/puts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/remove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "src/stdio/remove.h"
#include "file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/stderr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {
static struct {
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/stdin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {
static struct {
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/stdout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {
static struct {
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/gpu/ungetc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "src/stdio/ungetc.h"
#include "file.h"

#include <stdio.h>
#include "hdr/types/FILE.h"

namespace LIBC_NAMESPACE {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/printf_core/vfprintf_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/putc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/remove.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/scanf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/scanf_core/vfscanf_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 1 addition & 2 deletions libc/src/stdio/setbuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/setbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/setvbuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/setvbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/stdio/sscanf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/ungetc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/vfprintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/vfprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/vprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/unistd/getopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libc/src/unistd/getopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion libc/src/wchar/btowc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/wchar/wctob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
23 changes: 23 additions & 0 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -667,6 +682,8 @@ libc_support_library(
":__support_error_or",
":__support_threads_mutex",
":errno",
":hdr_stdio_macros",
":types_off_t",
],
)

Expand All @@ -678,6 +695,7 @@ libc_support_library(
":__support_error_or",
":__support_osutil_syscall",
":errno",
":types_off_t",
],
)

Expand Down Expand Up @@ -3430,6 +3448,7 @@ libc_function(
":__support_arg_list",
":__support_file_file",
":errno",
":types_FILE",
":vfprintf_internal",
],
)
Expand All @@ -3442,6 +3461,7 @@ libc_function(
":__support_arg_list",
":__support_file_file",
":errno",
":types_FILE",
":vfprintf_internal",
],
)
Expand Down Expand Up @@ -3479,6 +3499,7 @@ libc_function(
":__support_arg_list",
":__support_file_file",
":errno",
":types_FILE",
":vfprintf_internal",
],
)
Expand All @@ -3491,6 +3512,7 @@ libc_function(
":__support_arg_list",
":__support_file_file",
":errno",
":types_FILE",
":vfprintf_internal",
],
)
Expand All @@ -3503,6 +3525,7 @@ libc_function(
":__support_common",
":__support_osutil_syscall",
":errno",
":types_FILE",
],
)

Expand Down