[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / libc / spec / gnu_ext.td
blobf3311e3a782de68e539f5e50cb680ac5180c3056
1 def CpuSetT : NamedType<"cpu_set_t">;
2 def CpuSetPtr : PtrType<CpuSetT>;
3 def ConstCpuSetPtr : ConstType<CpuSetPtr>;
5 def GnuExtensions : StandardSpec<"GNUExtensions"> {
6   NamedType CookieIOFunctionsT = NamedType<"cookie_io_functions_t">;
7   HeaderSpec CType = HeaderSpec<
8     "ctype.h",
9     [], // Macros
10     [], // Types
11     [], // Enumerations
12     [
13         FunctionSpec<
14             "toascii",
15             RetValSpec<IntType>,
16             [ArgSpec<IntType>]
17         >,
18     ]
19   >;
21   HeaderSpec Math = HeaderSpec<
22       "math.h",
23       [], // Macros
24       [], // Types
25       [], // Enumerations
26       [
27         FunctionSpec<
28             "sincosf",
29             RetValSpec<VoidType>,
30             [ArgSpec<FloatType>, ArgSpec<FloatPtr>, ArgSpec<FloatPtr>]
31         >,
32         FunctionSpec<"exp10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
33       ]
34   >;
36   HeaderSpec Sched = HeaderSpec<
37       "sched.h",
38       [], // Macros
39       [PidT, SizeTType, CpuSetT], // Types
40       [], // Enumerations
41       [
42         FunctionSpec<
43             "sched_getaffinity",
44             RetValSpec<IntType>,
45             [ArgSpec<PidT>, ArgSpec<SizeTType>, ArgSpec<CpuSetPtr>]
46         >,
47         FunctionSpec<
48             "sched_setaffinity",
49             RetValSpec<IntType>,
50             [ArgSpec<PidT>, ArgSpec<SizeTType>, ArgSpec<ConstCpuSetPtr>]
51         >,
52       ]
53   >;
55   HeaderSpec String = HeaderSpec<
56       "string.h",
57       [], // Macros
58       [], // Types
59       [], // Enumerations
60       [ 
61         FunctionSpec<
62             "memrchr",
63             RetValSpec<VoidPtr>,
64             [ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
65         >,
66         FunctionSpec<
67             "strerror_r",
68             RetValSpec<CharPtr>,
69             [ArgSpec<IntType>, ArgSpec<CharPtr>, ArgSpec<SizeTType>]
70         >,
71         FunctionSpec<
72             "strcasestr",
73             RetValSpec<CharPtr>,
74             [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
75         >,
76       ]
77   >;
79   HeaderSpec FEnv = HeaderSpec<
80       "fenv.h",
81       [], // Macros
82       [], // Types
83       [], // Enumerations
84       [
85         FunctionSpec<
86             "fedisableexcept",
87             RetValSpec<IntType>,
88             [ArgSpec<IntType>]
89         >,
90         FunctionSpec<
91             "feenableexcept",
92             RetValSpec<IntType>,
93             [ArgSpec<IntType>]
94         >,
95         FunctionSpec<
96             "fegetexcept",
97             RetValSpec<IntType>,
98             []
99         >
100       ]
101   >;
103   HeaderSpec StdIO = HeaderSpec<
104       "stdio.h",
105       [], // Macros
106       [CookieIOFunctionsT], // Types
107       [], // Enumerations
108       [
109           FunctionSpec<
110               "clearerr_unlocked",
111               RetValSpec<VoidType>,
112               [ArgSpec<FILEPtr>]
113           >,
114           FunctionSpec<
115               "feof_unlocked",
116               RetValSpec<IntType>,
117               [ArgSpec<FILEPtr>]
118           >,
119           FunctionSpec<
120               "ferror_unlocked",
121               RetValSpec<IntType>,
122               [ArgSpec<FILEPtr>]
123           >,
124           FunctionSpec<
125               "fopencookie",
126               RetValSpec<FILEPtr>,
127               [ArgSpec<VoidPtr>, ArgSpec<ConstCharPtr>, ArgSpec<CookieIOFunctionsT>]
128           >,
129           FunctionSpec<
130               "fread_unlocked",
131               RetValSpec<SizeTType>,
132               [ArgSpec<VoidRestrictedPtr>,
133                ArgSpec<SizeTType>,
134                ArgSpec<SizeTType>,
135                ArgSpec<FILERestrictedPtr>]
136           >,
137           FunctionSpec<
138               "fwrite_unlocked",
139               RetValSpec<SizeTType>,
140               [ArgSpec<ConstVoidRestrictedPtr>,
141                ArgSpec<SizeTType>,
142                ArgSpec<SizeTType>,
143                ArgSpec<FILERestrictedPtr>]
144           >,
145           FunctionSpec<
146               "fgetc_unlocked",
147               RetValSpec<IntType>,
148               [ArgSpec<FILEPtr>]
149           >,
150       ]
151   >;
153   HeaderSpec PThread = HeaderSpec<
154       "pthread.h",
155       [], // Macros
156       [], // Types
157       [], // Enumerations
158       [
159           FunctionSpec<
160               "pthread_setname_np",
161               RetValSpec<IntType>,
162               [ArgSpec<PThreadTType>, ArgSpec<ConstCharPtr>]
163           >,
164           FunctionSpec<
165               "pthread_getname_np",
166               RetValSpec<IntType>,
167               [ArgSpec<PThreadTType>, ArgSpec<CharPtr>, ArgSpec<SizeTType>]
168           >,
169       ]
170   >;
172   HeaderSpec SysAuxv = HeaderSpec<
173       "sys/auxv.h",
174       [], // Macros
175       [], // Types
176       [], // Enumerations
177       []  // Functions
178   >;
180   HeaderSpec SendFile = HeaderSpec<
181       "sys/sendfile.h",
182       [], // Macros
183       [OffTType, SizeTType, SSizeTType,], // Types
184       [], // Enumerations
185       [
186           FunctionSpec<
187               "sendfile",
188               RetValSpec<SSizeTType>,
189               [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<OffTPtr>, ArgSpec<SizeTType>]
190           >,
191       ]
192   >;
194   HeaderSpec UniStd = HeaderSpec<
195     "unistd.h",
196     [], // Macros
197     [], // Types
198     [], // Enumerations
199     [
200         FunctionSpec<
201             "dup2",
202             RetValSpec<IntType>,
203             [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>]
204         >,
205     ]
206   >;
208   let Headers = [
209     CType,
210     FEnv,
211     Math,
212     PThread,
213     Sched,
214     SendFile,
215     SysAuxv,
216     StdIO,
217     String,
218     UniStd,
219   ];