Skip to content

Commit b7fa6ce

Browse files
Revert "[libc] Move off_t and stdio macros to proxy hdrs (#98215)"
This reverts commit 240ec5a.
1 parent 04f0adc commit b7fa6ce

File tree

21 files changed

+27
-103
lines changed

21 files changed

+27
-103
lines changed

libc/config/gpu/api.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ def FenvAPI: PublicAPI<"fenv.h"> {
5959
}
6060

6161
def StdIOAPI : PublicAPI<"stdio.h"> {
62+
let Macros = [
63+
SimpleMacroDef<"_IOFBF", "0">,
64+
SimpleMacroDef<"_IOLBF", "1">,
65+
SimpleMacroDef<"_IONBF", "2">,
66+
];
6267
let Types = [
6368
"FILE",
6469
"off_t",

libc/config/linux/api.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def StdIOAPI : PublicAPI<"stdio.h"> {
7676
SimpleMacroDef<"stderr", "stderr">,
7777
SimpleMacroDef<"stdin", "stdin">,
7878
SimpleMacroDef<"stdout", "stdout">,
79+
SimpleMacroDef<"_IOFBF", "0">,
80+
SimpleMacroDef<"_IOLBF", "1">,
81+
SimpleMacroDef<"_IONBF", "2">,
7982
];
8083
let Types = [
8184
"FILE",

libc/hdr/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,6 @@ add_proxy_header_library(
6969
libc.include.signal
7070
)
7171

72-
add_proxy_header_library(
73-
stdio_macros
74-
HDRS
75-
stdio_macros.h
76-
FULL_BUILD_DEPENDS
77-
libc.include.stdio
78-
libc.include.llvm-libc-macros.stdio_macros
79-
libc.include.llvm-libc-macros.file_seek_macros
80-
)
81-
8272
add_proxy_header_library(
8373
sys_epoll_macros
8474
HDRS

libc/hdr/stdio_macros.h

Lines changed: 0 additions & 23 deletions
This file was deleted.

libc/hdr/types/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,3 @@ add_proxy_header_library(
135135
libc.include.llvm-libc-types.struct_sigaction
136136
libc.include.signal
137137
)
138-
139-
add_proxy_header_library(
140-
off_t
141-
HDRS
142-
off_t.h
143-
FULL_BUILD_DEPENDS
144-
libc.include.llvm-libc-types.off_t
145-
libc.include.stdio
146-
)

libc/hdr/types/off_t.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

libc/include/llvm-libc-macros/stdio-macros.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,4 @@
1515

1616
#define BUFSIZ 1024
1717

18-
#define _IONBF 2
19-
#define _IOLBF 1
20-
#define _IOFBF 0
21-
2218
#endif // LLVM_LIBC_MACROS_STDIO_MACROS_H

libc/newhdrgen/yaml/stdio.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
header: stdio.h
22
macros:
3+
- macro_name: _IONBF
4+
macro_value: 2
5+
- macro_name: _IOLBF
6+
macro_value: 1
7+
- macro_name: _IOFBF
8+
macro_value: 0
39
- macro_name: stdout
410
macro_value: stdout
511
- macro_name: stdin

libc/src/__support/File/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ add_object_library(
1616
libc.src.__support.CPP.span
1717
libc.src.__support.threads.mutex
1818
libc.src.__support.error_or
19-
libc.hdr.types.off_t
20-
libc.hdr.stdio_macros
2119
)
2220

2321
add_object_library(

libc/src/__support/File/file.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88

99
#include "file.h"
1010

11-
#include "hdr/stdio_macros.h"
12-
#include "hdr/types/off_t.h"
1311
#include "src/__support/CPP/new.h"
1412
#include "src/__support/CPP/span.h"
1513
#include "src/errno/libc_errno.h" // For error macros
1614

15+
#include <stdio.h>
16+
#include <stdlib.h>
17+
1718
namespace LIBC_NAMESPACE {
1819

1920
FileIOResult File::write_unlocked(const void *data, size_t len) {

libc/src/__support/File/file.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
#ifndef LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H
1010
#define LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H
1111

12-
#include "hdr/stdio_macros.h"
13-
#include "hdr/types/off_t.h"
12+
#include "include/llvm-libc-types/off_t.h"
1413
#include "src/__support/CPP/new.h"
1514
#include "src/__support/error_or.h"
1615
#include "src/__support/macros/properties/architectures.h"

libc/src/__support/File/linux/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ add_object_library(
55
file.cpp
66
HDRS
77
file.h
8-
lseekImpl.h
98
DEPENDS
109
libc.include.fcntl
1110
libc.include.stdio
@@ -16,8 +15,6 @@ add_object_library(
1615
libc.src.errno.errno
1716
libc.src.__support.error_or
1817
libc.src.__support.File.file
19-
libc.hdr.types.off_t
20-
libc.hdr.stdio_macros
2118
)
2219

2320
add_object_library(

libc/src/__support/File/linux/file.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@
88

99
#include "file.h"
1010

11-
#include "hdr/stdio_macros.h"
12-
#include "hdr/types/off_t.h"
1311
#include "src/__support/CPP/new.h"
1412
#include "src/__support/File/file.h"
1513
#include "src/__support/File/linux/lseekImpl.h"
1614
#include "src/__support/OSUtil/fcntl.h"
1715
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
1816
#include "src/errno/libc_errno.h" // For error macros
1917

20-
#include <fcntl.h> // For mode_t and other flags to the open syscall
18+
#include <fcntl.h> // For mode_t and other flags to the open syscall
19+
#include <stdio.h>
2120
#include <sys/stat.h> // For S_IS*, S_IF*, and S_IR* flags.
2221
#include <sys/syscall.h> // For syscall numbers
2322

libc/src/__support/File/linux/file.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "hdr/types/off_t.h"
109
#include "src/__support/File/file.h"
1110

1211
namespace LIBC_NAMESPACE {

libc/src/__support/File/linux/lseekImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
#ifndef LLVM_LIBC_SRC___SUPPORT_FILE_LINUX_LSEEKIMPL_H
1010
#define LLVM_LIBC_SRC___SUPPORT_FILE_LINUX_LSEEKIMPL_H
1111

12-
#include "hdr/types/off_t.h"
1312
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
1413
#include "src/__support/common.h"
1514
#include "src/__support/error_or.h"
1615
#include "src/errno/libc_errno.h"
1716

1817
#include <stdint.h> // For uint64_t.
1918
#include <sys/syscall.h> // For syscall numbers.
19+
#include <unistd.h> // For off_t.
2020

2121
namespace LIBC_NAMESPACE {
2222
namespace internal {

libc/src/__support/OSUtil/linux/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ add_object_library(
2121
libc.hdr.types.struct_flock
2222
libc.hdr.types.struct_flock64
2323
libc.hdr.types.struct_f_owner_ex
24-
libc.hdr.types.off_t
2524
)

libc/src/__support/OSUtil/linux/fcntl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "src/__support/OSUtil/fcntl.h"
1010

1111
#include "hdr/fcntl_macros.h"
12-
#include "hdr/types/off_t.h"
1312
#include "hdr/types/struct_f_owner_ex.h"
1413
#include "hdr/types/struct_flock.h"
1514
#include "hdr/types/struct_flock64.h"

libc/src/stdio/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ add_entrypoint_object(
6161
HDRS
6262
fopencookie.h
6363
DEPENDS
64-
libc.hdr.stdio_macros
65-
libc.hdr.types.off_t
64+
libc.include.stdio
6665
libc.src.__support.CPP.new
6766
libc.src.__support.File.file
6867
)
@@ -75,7 +74,7 @@ add_entrypoint_object(
7574
setbuf.h
7675
DEPENDS
7776
libc.src.errno.errno
78-
libc.hdr.types.off_t
77+
libc.include.stdio
7978
libc.src.__support.File.file
8079
libc.src.__support.File.platform_file
8180
)

libc/src/stdio/fopencookie.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/stdio/fopencookie.h"
10-
#include "hdr/stdio_macros.h"
11-
#include "hdr/types/off_t.h"
1210
#include "src/__support/CPP/new.h"
1311
#include "src/__support/File/file.h"
1412

1513
#include "src/errno/libc_errno.h"
14+
#include <stdio.h>
15+
#include <stdlib.h>
1616

1717
namespace LIBC_NAMESPACE {
1818

libc/src/stdio/setbuf.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/stdio/setbuf.h"
10-
#include "hdr/stdio_macros.h"
1110
#include "src/__support/File/file.h"
11+
1212
#include "src/errno/libc_errno.h"
13+
#include <stdio.h>
1314

1415
namespace LIBC_NAMESPACE {
1516

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,6 @@ libc_support_library(
138138
hdrs = ["hdr/float_macros.h"],
139139
)
140140

141-
libc_support_library(
142-
name = "hdr_stdio_macros",
143-
hdrs = ["hdr/stdio_macros.h"],
144-
)
145-
146141
############################ Type Proxy Header Files ###########################
147142

148143
libc_support_library(
@@ -185,11 +180,6 @@ libc_support_library(
185180
hdrs = ["hdr/types/pid_t.h"],
186181
)
187182

188-
libc_support_library(
189-
name = "types_off_t",
190-
hdrs = ["hdr/types/off_t.h"],
191-
)
192-
193183
############################### Support libraries ##############################
194184

195185
libc_support_library(
@@ -677,8 +667,6 @@ libc_support_library(
677667
":__support_error_or",
678668
":__support_threads_mutex",
679669
":errno",
680-
":hdr_stdio_macros",
681-
":types_off_t",
682670
],
683671
)
684672

@@ -690,7 +678,6 @@ libc_support_library(
690678
":__support_error_or",
691679
":__support_osutil_syscall",
692680
":errno",
693-
":types_off_t",
694681
],
695682
)
696683

0 commit comments

Comments
 (0)