Author: Michael Jones Date: 2024-07-09T16:22:13-07:00 New Revision: b7fa6cee242086ae030a74cc3894c22ecc79b6c4
URL: https://github.com/llvm/llvm-project/commit/b7fa6cee242086ae030a74cc3894c22ecc79b6c4 DIFF: https://github.com/llvm/llvm-project/commit/b7fa6cee242086ae030a74cc3894c22ecc79b6c4.diff LOG: Revert "[libc] Move off_t and stdio macros to proxy hdrs (#98215)" This reverts commit 240ec5a37517f55a64cd0c69fd4fa1613ab30f97. Added: 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/OSUtil/linux/CMakeLists.txt libc/src/__support/OSUtil/linux/fcntl.cpp libc/src/stdio/CMakeLists.txt libc/src/stdio/fopencookie.cpp libc/src/stdio/setbuf.cpp utils/bazel/llvm-project-overlay/libc/BUILD.bazel Removed: libc/hdr/stdio_macros.h libc/hdr/types/off_t.h ################################################################################ diff --git a/libc/config/gpu/api.td b/libc/config/gpu/api.td index 21ddbb95b70c9..523ad49ffa3fd 100644 --- a/libc/config/gpu/api.td +++ b/libc/config/gpu/api.td @@ -59,6 +59,11 @@ 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 60e9b70f0d8a4..eb0090c80b0da 100644 --- a/libc/config/linux/api.td +++ b/libc/config/linux/api.td @@ -76,6 +76,9 @@ 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 da640e8c0f70c..1303280c2c5ef 100644 --- a/libc/hdr/CMakeLists.txt +++ b/libc/hdr/CMakeLists.txt @@ -69,16 +69,6 @@ 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 deleted file mode 100644 index a212846dd8f41..0000000000000 --- a/libc/hdr/stdio_macros.h +++ /dev/null @@ -1,23 +0,0 @@ -//===-- 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 f66f2cf5dda9f..1cab1d3b812cf 100644 --- a/libc/hdr/types/CMakeLists.txt +++ b/libc/hdr/types/CMakeLists.txt @@ -135,12 +135,3 @@ add_proxy_header_library( libc.include.llvm-libc-types.struct_sigaction libc.include.signal ) - -add_proxy_header_library( - off_t - HDRS - off_t.h - FULL_BUILD_DEPENDS - libc.include.llvm-libc-types.off_t - libc.include.stdio -) diff --git a/libc/hdr/types/off_t.h b/libc/hdr/types/off_t.h deleted file mode 100644 index abc3aa659365f..0000000000000 --- a/libc/hdr/types/off_t.h +++ /dev/null @@ -1,22 +0,0 @@ -//===-- 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 69fb71ad3f651..4664801c5731f 100644 --- a/libc/include/llvm-libc-macros/stdio-macros.h +++ b/libc/include/llvm-libc-macros/stdio-macros.h @@ -15,8 +15,4 @@ #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 687a6d696cad6..6d2a8557f9b94 100644 --- a/libc/newhdrgen/yaml/stdio.yaml +++ b/libc/newhdrgen/yaml/stdio.yaml @@ -1,5 +1,11 @@ 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 1b390a12424d0..0416ac2cc902e 100644 --- a/libc/src/__support/File/CMakeLists.txt +++ b/libc/src/__support/File/CMakeLists.txt @@ -16,8 +16,6 @@ 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 08052f8d0a328..0b1a8cac21f77 100644 --- a/libc/src/__support/File/file.cpp +++ b/libc/src/__support/File/file.cpp @@ -8,12 +8,13 @@ #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 d804289702540..cc82a7ecc9745 100644 --- a/libc/src/__support/File/file.h +++ b/libc/src/__support/File/file.h @@ -9,8 +9,7 @@ #ifndef LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H #define LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H -#include "hdr/stdio_macros.h" -#include "hdr/types/off_t.h" +#include "include/llvm-libc-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 10302ffb9e2b6..8436a687116bd 100644 --- a/libc/src/__support/File/linux/CMakeLists.txt +++ b/libc/src/__support/File/linux/CMakeLists.txt @@ -5,7 +5,6 @@ add_object_library( file.cpp HDRS file.h - lseekImpl.h DEPENDS libc.include.fcntl libc.include.stdio @@ -16,8 +15,6 @@ add_object_library( libc.src.errno.errno libc.src.__support.error_or libc.src.__support.File.file - libc.hdr.types.off_t - 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 df68570bc1043..0f6ed4f0a5ef4 100644 --- a/libc/src/__support/File/linux/file.cpp +++ b/libc/src/__support/File/linux/file.cpp @@ -8,8 +8,6 @@ #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" @@ -17,7 +15,8 @@ #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 <fcntl.h> // For mode_t and other flags to the open syscall +#include <stdio.h> #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 0507109e6793f..63b820529932b 100644 --- a/libc/src/__support/File/linux/file.h +++ b/libc/src/__support/File/linux/file.h @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#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 af015a2fd6a70..d1632b703d3bc 100644 --- a/libc/src/__support/File/linux/lseekImpl.h +++ b/libc/src/__support/File/linux/lseekImpl.h @@ -9,7 +9,6 @@ #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" @@ -17,6 +16,7 @@ #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/OSUtil/linux/CMakeLists.txt b/libc/src/__support/OSUtil/linux/CMakeLists.txt index 089cad454d534..78b117fd19439 100644 --- a/libc/src/__support/OSUtil/linux/CMakeLists.txt +++ b/libc/src/__support/OSUtil/linux/CMakeLists.txt @@ -21,5 +21,4 @@ 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 d5e850a904703..b6483bb7534d6 100644 --- a/libc/src/__support/OSUtil/linux/fcntl.cpp +++ b/libc/src/__support/OSUtil/linux/fcntl.cpp @@ -9,7 +9,6 @@ #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/stdio/CMakeLists.txt b/libc/src/stdio/CMakeLists.txt index 18702f589474b..a659d9e847a9e 100644 --- a/libc/src/stdio/CMakeLists.txt +++ b/libc/src/stdio/CMakeLists.txt @@ -61,8 +61,7 @@ add_entrypoint_object( HDRS fopencookie.h DEPENDS - libc.hdr.stdio_macros - libc.hdr.types.off_t + libc.include.stdio libc.src.__support.CPP.new libc.src.__support.File.file ) @@ -75,7 +74,7 @@ add_entrypoint_object( setbuf.h DEPENDS libc.src.errno.errno - libc.hdr.types.off_t + libc.include.stdio libc.src.__support.File.file libc.src.__support.File.platform_file ) diff --git a/libc/src/stdio/fopencookie.cpp b/libc/src/stdio/fopencookie.cpp index 22614757248ab..17b8ae199d3db 100644 --- a/libc/src/stdio/fopencookie.cpp +++ b/libc/src/stdio/fopencookie.cpp @@ -7,12 +7,12 @@ //===----------------------------------------------------------------------===// #include "src/stdio/fopencookie.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/errno/libc_errno.h" +#include <stdio.h> +#include <stdlib.h> namespace LIBC_NAMESPACE { diff --git a/libc/src/stdio/setbuf.cpp b/libc/src/stdio/setbuf.cpp index 61a5cc617828d..8819901849a08 100644 --- a/libc/src/stdio/setbuf.cpp +++ b/libc/src/stdio/setbuf.cpp @@ -7,9 +7,10 @@ //===----------------------------------------------------------------------===// #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/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index b521d28dc2ae0..76b6aac185f5e 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -138,11 +138,6 @@ 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( @@ -185,11 +180,6 @@ libc_support_library( hdrs = ["hdr/types/pid_t.h"], ) -libc_support_library( - name = "types_off_t", - hdrs = ["hdr/types/off_t.h"], -) - ############################### Support libraries ############################## libc_support_library( @@ -677,8 +667,6 @@ libc_support_library( ":__support_error_or", ":__support_threads_mutex", ":errno", - ":hdr_stdio_macros", - ":types_off_t", ], ) @@ -690,7 +678,6 @@ libc_support_library( ":__support_error_or", ":__support_osutil_syscall", ":errno", - ":types_off_t", ], ) _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits