Skip to content

Commit 3ee93f4

Browse files
authored
[libc] Added transitive bindings for OffsetType (#87397)
Adding OffTType to fcntl.h and stdio.h 's Macro lists in libc/spec/posix.td as mentioned here: #87266
1 parent e506dd0 commit 3ee93f4

File tree

7 files changed

+30
-12
lines changed

7 files changed

+30
-12
lines changed

libc/config/baremetal/api.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ def MathAPI : PublicAPI<"math.h"> {
5757
}
5858

5959
def StdIOAPI : PublicAPI<"stdio.h"> {
60-
let Types = ["size_t"];
60+
let Types = [
61+
"size_t",
62+
"off_t",
63+
];
6164
}
6265

6366
def StdlibAPI : PublicAPI<"stdlib.h"> {

libc/config/gpu/api.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ def StdIOAPI : PublicAPI<"stdio.h"> {
6464
SimpleMacroDef<"_IOLBF", "1">,
6565
SimpleMacroDef<"_IONBF", "2">,
6666
];
67-
let Types = ["size_t", "FILE"];
67+
let Types = [
68+
"FILE",
69+
"off_t",
70+
"size_t",
71+
];
6872
}
6973

7074
def IntTypesAPI : PublicAPI<"inttypes.h"> {

libc/config/linux/api.td

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ def CTypeAPI : PublicAPI<"ctype.h"> {
4949
}
5050

5151
def FCntlAPI : PublicAPI<"fcntl.h"> {
52-
let Types = ["mode_t"];
52+
let Types = [
53+
"mode_t",
54+
"off_t",
55+
];
5356
}
5457

5558
def IntTypesAPI : PublicAPI<"inttypes.h"> {
@@ -77,7 +80,12 @@ def StdIOAPI : PublicAPI<"stdio.h"> {
7780
SimpleMacroDef<"_IOLBF", "1">,
7881
SimpleMacroDef<"_IONBF", "2">,
7982
];
80-
let Types = ["size_t", "FILE", "cookie_io_functions_t"];
83+
let Types = [
84+
"FILE",
85+
"cookie_io_functions_t",
86+
"off_t",
87+
"size_t",
88+
];
8189
}
8290

8391
def StdlibAPI : PublicAPI<"stdlib.h"> {

libc/include/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ add_gen_header(
4141
DEF_FILE fcntl.h.def
4242
GEN_HDR fcntl.h
4343
DEPENDS
44-
.llvm_libc_common_h
4544
.llvm-libc-macros.fcntl_macros
4645
.llvm-libc-types.mode_t
46+
.llvm-libc-types.off_t
47+
.llvm_libc_common_h
4748
)
4849

4950
add_gen_header(
@@ -264,13 +265,14 @@ add_gen_header(
264265
DEF_FILE stdio.h.def
265266
GEN_HDR stdio.h
266267
DEPENDS
267-
.llvm_libc_common_h
268268
.llvm-libc-macros.file_seek_macros
269269
.llvm-libc-macros.stdio_macros
270-
.llvm-libc-types.size_t
271-
.llvm-libc-types.ssize_t
272270
.llvm-libc-types.FILE
273271
.llvm-libc-types.cookie_io_functions_t
272+
.llvm-libc-types.off_t
273+
.llvm-libc-types.size_t
274+
.llvm-libc-types.ssize_t
275+
.llvm_libc_common_h
274276
)
275277

276278
add_gen_header(

libc/spec/posix.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ def POSIX : StandardSpec<"POSIX"> {
210210
HeaderSpec FCntl = HeaderSpec<
211211
"fcntl.h",
212212
[], // Macros
213-
[ModeTType],
213+
[
214+
ModeTType,
215+
OffTType,
216+
],
214217
[], // Enumerations
215218
[
216219
FunctionSpec<
@@ -1180,7 +1183,7 @@ def POSIX : StandardSpec<"POSIX"> {
11801183
HeaderSpec StdIO = HeaderSpec<
11811184
"stdio.h",
11821185
[], // Macros
1183-
[], // Types
1186+
[OffTType], // Types
11841187
[], // Enumerations
11851188
[
11861189
FunctionSpec<

libc/src/stdio/fseeko.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define LLVM_LIBC_SRC_STDIO_FSEEKO_H
1111

1212
#include <stdio.h>
13-
#include <unistd.h>
1413

1514
namespace LIBC_NAMESPACE {
1615

libc/src/stdio/ftello.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define LLVM_LIBC_SRC_STDIO_FTELLO_H
1111

1212
#include <stdio.h>
13-
#include <unistd.h>
1413

1514
namespace LIBC_NAMESPACE {
1615

0 commit comments

Comments
 (0)