diff options
author | Michael Jones <michaelrj@google.com> | 2025-06-06 14:12:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-06 14:12:07 -0700 |
commit | 3695d6cdf98c252af4a747af8e247b48e046721a (patch) | |
tree | dbc14c9b19fd6579fe62fc09c3c8b2f9a1c363ef /libc | |
parent | 549ce80f27b228ef08a71ec1c32c29322d997825 (diff) | |
download | llvm-3695d6cdf98c252af4a747af8e247b48e046721a.zip llvm-3695d6cdf98c252af4a747af8e247b48e046721a.tar.gz llvm-3695d6cdf98c252af4a747af8e247b48e046721a.tar.bz2 |
[libc][GPU] clean up includes (#143203)
The GPU stdio functions were depending on indirect inclusion for some of
their dependencies. This patch should fix all of that.
Diffstat (limited to 'libc')
32 files changed, 69 insertions, 68 deletions
diff --git a/libc/src/stdio/gpu/CMakeLists.txt b/libc/src/stdio/gpu/CMakeLists.txt index c4ad333..bea1134 100644 --- a/libc/src/stdio/gpu/CMakeLists.txt +++ b/libc/src/stdio/gpu/CMakeLists.txt @@ -59,6 +59,7 @@ add_entrypoint_object( DEPENDS libc.hdr.types.FILE libc.src.__support.RPC.rpc_client + .gpu_file ) add_entrypoint_object( @@ -70,6 +71,7 @@ add_entrypoint_object( DEPENDS libc.hdr.types.FILE libc.src.__support.RPC.rpc_client + .gpu_file ) add_entrypoint_object( @@ -114,6 +116,7 @@ add_entrypoint_object( DEPENDS libc.hdr.types.FILE libc.src.__support.RPC.rpc_client + .gpu_file ) add_entrypoint_object( @@ -124,6 +127,7 @@ add_entrypoint_object( ../fopen.h DEPENDS libc.hdr.types.FILE + .gpu_file ) add_entrypoint_object( @@ -134,6 +138,8 @@ add_entrypoint_object( ../fclose.h DEPENDS libc.hdr.types.FILE + libc.hdr.stdio_macros + .gpu_file ) add_entrypoint_object( @@ -144,6 +150,7 @@ add_entrypoint_object( ../fread.h DEPENDS libc.hdr.types.FILE + .gpu_file ) add_entrypoint_object( @@ -254,8 +261,6 @@ add_entrypoint_object( DEPENDS libc.hdr.types.FILE .gpu_file - .feof - .ferror ) add_entrypoint_object( diff --git a/libc/src/stdio/gpu/clearerr.cpp b/libc/src/stdio/gpu/clearerr.cpp index 4d843e4..5a0ca52 100644 --- a/libc/src/stdio/gpu/clearerr.cpp +++ b/libc/src/stdio/gpu/clearerr.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/clearerr.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/fclose.cpp b/libc/src/stdio/gpu/fclose.cpp index 847d6b8..1e00515 100644 --- a/libc/src/stdio/gpu/fclose.cpp +++ b/libc/src/stdio/gpu/fclose.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fclose.h" -#include "src/__support/macros/config.h" -#include "src/stdio/gpu/file.h" #include "hdr/stdio_macros.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" +#include "src/stdio/gpu/file.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/feof.cpp b/libc/src/stdio/gpu/feof.cpp index a15e487..3ae308b 100644 --- a/libc/src/stdio/gpu/feof.cpp +++ b/libc/src/stdio/gpu/feof.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/feof.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/ferror.cpp b/libc/src/stdio/gpu/ferror.cpp index 8273820..64d62e7 100644 --- a/libc/src/stdio/gpu/ferror.cpp +++ b/libc/src/stdio/gpu/ferror.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/ferror.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/fflush.cpp b/libc/src/stdio/gpu/fflush.cpp index 5a5137b..0b6ef92 100644 --- a/libc/src/stdio/gpu/fflush.cpp +++ b/libc/src/stdio/gpu/fflush.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fflush.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/fgetc.cpp b/libc/src/stdio/gpu/fgetc.cpp index cb42f31..aaeb159 100644 --- a/libc/src/stdio/gpu/fgetc.cpp +++ b/libc/src/stdio/gpu/fgetc.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fgetc.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/stdio_macros.h" // for EOF. #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/fgets.cpp b/libc/src/stdio/gpu/fgets.cpp index d90b7aa..5447e86 100644 --- a/libc/src/stdio/gpu/fgets.cpp +++ b/libc/src/stdio/gpu/fgets.cpp @@ -7,14 +7,13 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fgets.h" -#include "file.h" -#include "src/__support/macros/config.h" -#include "src/stdio/feof.h" -#include "src/stdio/ferror.h" +#include "file.h" #include "hdr/stdio_macros.h" // for EOF. #include "hdr/types/FILE.h" -#include <stddef.h> +#include "src/__support/common.h" + +#include <stdint.h> namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/file.h b/libc/src/stdio/gpu/file.h index 020f888..102c6c6 100644 --- a/libc/src/stdio/gpu/file.h +++ b/libc/src/stdio/gpu/file.h @@ -6,14 +6,11 @@ // //===----------------------------------------------------------------------===// +#include "hdr/stdio_macros.h" // For stdin/out/err +#include "hdr/types/FILE.h" #include "src/__support/RPC/rpc_client.h" #include "src/__support/common.h" #include "src/__support/macros/attributes.h" -#include "src/__support/macros/config.h" -#include "src/string/string_utils.h" - -#include "hdr/stdio_macros.h" // For stdin/out/err -#include "hdr/types/FILE.h" namespace LIBC_NAMESPACE_DECL { namespace file { diff --git a/libc/src/stdio/gpu/fopen.cpp b/libc/src/stdio/gpu/fopen.cpp index 0148e32a3..eee3eda 100644 --- a/libc/src/stdio/gpu/fopen.cpp +++ b/libc/src/stdio/gpu/fopen.cpp @@ -7,12 +7,12 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fopen.h" -#include "src/__support/CPP/string_view.h" -#include "src/__support/macros/config.h" -#include "src/stdio/gpu/file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" +#include "src/stdio/gpu/file.h" #include "src/string/memory_utils/inline_memcpy.h" +#include "src/string/string_utils.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/fprintf.cpp b/libc/src/stdio/gpu/fprintf.cpp index 46196d7..5b8f01d 100644 --- a/libc/src/stdio/gpu/fprintf.cpp +++ b/libc/src/stdio/gpu/fprintf.cpp @@ -11,6 +11,7 @@ #include "hdr/types/FILE.h" #include "src/__support/CPP/string_view.h" #include "src/__support/arg_list.h" +#include "src/__support/common.h" #include "src/errno/libc_errno.h" #include "src/stdio/gpu/vfprintf_utils.h" diff --git a/libc/src/stdio/gpu/fputc.cpp b/libc/src/stdio/gpu/fputc.cpp index ad2db03..8a8959b0 100644 --- a/libc/src/stdio/gpu/fputc.cpp +++ b/libc/src/stdio/gpu/fputc.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fputc.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/stdio_macros.h" // for EOF. #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/fputs.cpp b/libc/src/stdio/gpu/fputs.cpp index 7a08244..780a40d 100644 --- a/libc/src/stdio/gpu/fputs.cpp +++ b/libc/src/stdio/gpu/fputs.cpp @@ -7,13 +7,12 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fputs.h" -#include "src/__support/CPP/string_view.h" -#include "src/__support/macros/config.h" -#include "src/errno/libc_errno.h" -#include "src/stdio/gpu/file.h" #include "hdr/stdio_macros.h" // for EOF. #include "hdr/types/FILE.h" +#include "src/__support/CPP/string_view.h" +#include "src/__support/common.h" +#include "src/stdio/gpu/file.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/fread.cpp b/libc/src/stdio/gpu/fread.cpp index 57fa5b6..5619b54 100644 --- a/libc/src/stdio/gpu/fread.cpp +++ b/libc/src/stdio/gpu/fread.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fread.h" -#include "src/__support/macros/config.h" -#include "src/stdio/gpu/file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" +#include "src/stdio/gpu/file.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/fseek.cpp b/libc/src/stdio/gpu/fseek.cpp index 5ada5de..468d65f 100644 --- a/libc/src/stdio/gpu/fseek.cpp +++ b/libc/src/stdio/gpu/fseek.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fseek.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/ftell.cpp b/libc/src/stdio/gpu/ftell.cpp index 04bb0dd..7ee33d7 100644 --- a/libc/src/stdio/gpu/ftell.cpp +++ b/libc/src/stdio/gpu/ftell.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/ftell.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/fwrite.cpp b/libc/src/stdio/gpu/fwrite.cpp index 6c54869..73c2651 100644 --- a/libc/src/stdio/gpu/fwrite.cpp +++ b/libc/src/stdio/gpu/fwrite.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fwrite.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/getc.cpp b/libc/src/stdio/gpu/getc.cpp index 9c32974..6dfb5ce 100644 --- a/libc/src/stdio/gpu/getc.cpp +++ b/libc/src/stdio/gpu/getc.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "src/stdio/getc.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/stdio_macros.h" // for EOF. #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/getchar.cpp b/libc/src/stdio/gpu/getchar.cpp index d99b97b..7bf561f 100644 --- a/libc/src/stdio/gpu/getchar.cpp +++ b/libc/src/stdio/gpu/getchar.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/getchar.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/stdio_macros.h" // for EOF and stdin. +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/printf.cpp b/libc/src/stdio/gpu/printf.cpp index be1885f..53fe69d 100644 --- a/libc/src/stdio/gpu/printf.cpp +++ b/libc/src/stdio/gpu/printf.cpp @@ -10,6 +10,7 @@ #include "src/__support/CPP/string_view.h" #include "src/__support/arg_list.h" +#include "src/__support/common.h" #include "src/errno/libc_errno.h" #include "src/stdio/gpu/vfprintf_utils.h" diff --git a/libc/src/stdio/gpu/putc.cpp b/libc/src/stdio/gpu/putc.cpp index f8ae98d..da80d6c 100644 --- a/libc/src/stdio/gpu/putc.cpp +++ b/libc/src/stdio/gpu/putc.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "src/stdio/putc.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/stdio_macros.h" // for EOF. #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/putchar.cpp b/libc/src/stdio/gpu/putchar.cpp index c49b02e..da2d0a8 100644 --- a/libc/src/stdio/gpu/putchar.cpp +++ b/libc/src/stdio/gpu/putchar.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/putchar.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/stdio_macros.h" // for EOF and stdout. +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/puts.cpp b/libc/src/stdio/gpu/puts.cpp index fc252ab..9b4ae66 100644 --- a/libc/src/stdio/gpu/puts.cpp +++ b/libc/src/stdio/gpu/puts.cpp @@ -7,19 +7,18 @@ //===----------------------------------------------------------------------===// #include "src/stdio/puts.h" -#include "src/__support/CPP/string_view.h" -#include "src/__support/macros/config.h" -#include "src/errno/libc_errno.h" -#include "src/stdio/gpu/file.h" #include "hdr/stdio_macros.h" // for EOF and stdout. +#include "src/__support/CPP/string_view.h" +#include "src/__support/common.h" +#include "src/stdio/gpu/file.h" namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { cpp::string_view str_view(str); - auto written = file::write_impl<LIBC_WRITE_TO_STDOUT_NEWLINE>(stdout, str, - str_view.size()); + auto written = file::write_impl<LIBC_WRITE_TO_STDOUT_NEWLINE>( + stdout, str, str_view.size()); if (written != str_view.size() + 1) return EOF; return 0; diff --git a/libc/src/stdio/gpu/remove.cpp b/libc/src/stdio/gpu/remove.cpp index 4bfb5d3..3cd7274 100644 --- a/libc/src/stdio/gpu/remove.cpp +++ b/libc/src/stdio/gpu/remove.cpp @@ -7,10 +7,11 @@ //===----------------------------------------------------------------------===// #include "src/stdio/remove.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" +#include "src/string/string_utils.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/rename.cpp b/libc/src/stdio/gpu/rename.cpp index 589bf24..d7c71fc 100644 --- a/libc/src/stdio/gpu/rename.cpp +++ b/libc/src/stdio/gpu/rename.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "src/stdio/rename.h" -#include "src/__support/CPP/string_view.h" -#include "src/__support/macros/config.h" -#include "src/stdio/gpu/file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" +#include "src/stdio/gpu/file.h" +#include "src/string/string_utils.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/stderr.cpp b/libc/src/stdio/gpu/stderr.cpp index efbc3b4..d0fa1ae 100644 --- a/libc/src/stdio/gpu/stderr.cpp +++ b/libc/src/stdio/gpu/stderr.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "hdr/types/FILE.h" -#include "src/__support/macros/config.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { static struct { diff --git a/libc/src/stdio/gpu/stdin.cpp b/libc/src/stdio/gpu/stdin.cpp index 66618fd..fef4c3e 100644 --- a/libc/src/stdio/gpu/stdin.cpp +++ b/libc/src/stdio/gpu/stdin.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "hdr/types/FILE.h" -#include "src/__support/macros/config.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { static struct { diff --git a/libc/src/stdio/gpu/stdout.cpp b/libc/src/stdio/gpu/stdout.cpp index e3869f9..e458dcc 100644 --- a/libc/src/stdio/gpu/stdout.cpp +++ b/libc/src/stdio/gpu/stdout.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "hdr/types/FILE.h" -#include "src/__support/macros/config.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { static struct { diff --git a/libc/src/stdio/gpu/ungetc.cpp b/libc/src/stdio/gpu/ungetc.cpp index fd1db46..fadd1d7 100644 --- a/libc/src/stdio/gpu/ungetc.cpp +++ b/libc/src/stdio/gpu/ungetc.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdio/ungetc.h" -#include "file.h" -#include "src/__support/macros/config.h" +#include "file.h" #include "hdr/types/FILE.h" +#include "src/__support/common.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/vfprintf.cpp b/libc/src/stdio/gpu/vfprintf.cpp index c92685f..16a5ed4 100644 --- a/libc/src/stdio/gpu/vfprintf.cpp +++ b/libc/src/stdio/gpu/vfprintf.cpp @@ -11,7 +11,7 @@ #include "hdr/types/FILE.h" #include "src/__support/CPP/string_view.h" #include "src/__support/arg_list.h" -#include "src/errno/libc_errno.h" +#include "src/__support/common.h" #include "src/stdio/gpu/vfprintf_utils.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/gpu/vfprintf_utils.h b/libc/src/stdio/gpu/vfprintf_utils.h index df157d36..6df4648 100644 --- a/libc/src/stdio/gpu/vfprintf_utils.h +++ b/libc/src/stdio/gpu/vfprintf_utils.h @@ -10,7 +10,6 @@ #include "src/__support/GPU/utils.h" #include "src/__support/RPC/rpc_client.h" #include "src/__support/arg_list.h" -#include "src/__support/macros/config.h" #include "src/stdio/gpu/file.h" #include "src/string/string_utils.h" diff --git a/libc/src/stdio/gpu/vprintf.cpp b/libc/src/stdio/gpu/vprintf.cpp index 54012f3..65f5dbf 100644 --- a/libc/src/stdio/gpu/vprintf.cpp +++ b/libc/src/stdio/gpu/vprintf.cpp @@ -10,7 +10,7 @@ #include "src/__support/CPP/string_view.h" #include "src/__support/arg_list.h" -#include "src/errno/libc_errno.h" +#include "src/__support/common.h" #include "src/stdio/gpu/vfprintf_utils.h" namespace LIBC_NAMESPACE_DECL { |