[clang-tidy][NFC]remove deps of clang in clang tidy test (#116588)
[llvm-project.git] / libc / spec / gnu_ext.td
blob64121aed9574f22383cd7a1475235c18681637a2
1 def CpuSetT : NamedType<"cpu_set_t">;
2 def CpuSetPtr : PtrType<CpuSetT>;
3 def ConstCpuSetPtr : ConstType<CpuSetPtr>;
5 def QSortRCompareT : NamedType<"__qsortrcompare_t">;
6 def StructHsearchData : NamedType<"struct hsearch_data">;
7 def StructHsearchDataPtr : PtrType<StructHsearchData>;
9 def GnuExtensions : StandardSpec<"GNUExtensions"> {
10   NamedType CookieIOFunctionsT = NamedType<"cookie_io_functions_t">;
11   HeaderSpec CType = HeaderSpec<
12     "ctype.h",
13     [], // Macros
14     [], // Types
15     [], // Enumerations
16     [
17         FunctionSpec<
18             "toascii",
19             RetValSpec<IntType>,
20             [ArgSpec<IntType>]
21         >,
22     ]
23   >;
25   HeaderSpec Malloc = HeaderSpec<
26       "malloc.h",
27       [], // Macros
28       [], // Types
29       [], // Enumerations
30       [
31           FunctionSpec<"mallopt", RetValSpec<IntType>, [ArgSpec<IntType>, ArgSpec<IntType>]>,
32       ]
33   >;
35   HeaderSpec Math = HeaderSpec<
36       "math.h",
37       [], // Macros
38       [], // Types
39       [], // Enumerations
40       [
41         FunctionSpec<
42             "sincosf",
43             RetValSpec<VoidType>,
44             [ArgSpec<FloatType>, ArgSpec<FloatPtr>, ArgSpec<FloatPtr>]
45         >,
46         FunctionSpec<
47             "lgamma_r",
48             RetValSpec<DoubleType>,
49             [ArgSpec<DoubleType>, ArgSpec<IntPtr>]
50         >,
51         FunctionSpec<
52             "lgammaf_r",
53             RetValSpec<FloatType>,
54             [ArgSpec<FloatType>, ArgSpec<IntPtr>]
55         >,
56         FunctionSpec<
57             "lgammal_r",
58             RetValSpec<LongDoubleType>,
59             [ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]
60         >,
61       ]
62   >;
64   HeaderSpec Sched = HeaderSpec<
65       "sched.h",
66       [], // Macros
67       [PidT, SizeTType, CpuSetT], // Types
68       [], // Enumerations
69       [
70         FunctionSpec<
71             "sched_getaffinity",
72             RetValSpec<IntType>,
73             [ArgSpec<PidT>, ArgSpec<SizeTType>, ArgSpec<CpuSetPtr>]
74         >,
75         FunctionSpec<
76             "sched_setaffinity",
77             RetValSpec<IntType>,
78             [ArgSpec<PidT>, ArgSpec<SizeTType>, ArgSpec<ConstCpuSetPtr>]
79         >,
80       ]
81   >;
82   HeaderSpec String = HeaderSpec<
83       "string.h",
84       [], // Macros
85       [], // Types
86       [], // Enumerations
87       [
88          FunctionSpec<
89             "memmem",
90             RetValSpec<VoidPtr>,
91             [ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
92         >,
93         FunctionSpec<
94             "memrchr",
95             RetValSpec<VoidPtr>,
96             [ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
97         >,
98         FunctionSpec<
99             "strerror_r",
100             RetValSpec<CharPtr>,
101             [ArgSpec<IntType>, ArgSpec<CharPtr>, ArgSpec<SizeTType>]
102         >,
103         FunctionSpec<
104             "strcasestr",
105             RetValSpec<CharPtr>,
106             [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
107         >,
108         FunctionSpec<
109             "strchrnul",
110             RetValSpec<CharPtr>,
111             [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
112         >,
113       ]
114   >;
116   HeaderSpec Search = HeaderSpec<
117     "search.h",
118     [], // Macros
119     [
120         StructHsearchData
121     ],
122     [], // Enumerations
123     [
124         FunctionSpec<
125             "hcreate_r",
126             RetValSpec<IntType>,
127             [
128                 ArgSpec<SizeTType>,
129                 ArgSpec<StructHsearchDataPtr>
130             ]
131         >,
132         FunctionSpec<
133             "hdestroy_r",
134             RetValSpec<VoidType>,
135             [
136                 ArgSpec<StructHsearchDataPtr>
137             ]
138         >,
139         FunctionSpec<
140             "hsearch_r",
141             RetValSpec<IntType>,
142             [
143                 ArgSpec<EntryType>,
144                 ArgSpec<ActionType>,
145                 ArgSpec<EntryTypePtrPtr>,
146                 ArgSpec<StructHsearchDataPtr>
147             ]
148         >,
149     ]
150   >;
152   HeaderSpec FEnv = HeaderSpec<
153       "fenv.h",
154       [], // Macros
155       [], // Types
156       [], // Enumerations
157       [
158         FunctionSpec<
159             "fedisableexcept",
160             RetValSpec<IntType>,
161             [ArgSpec<IntType>]
162         >,
163         FunctionSpec<
164             "feenableexcept",
165             RetValSpec<IntType>,
166             [ArgSpec<IntType>]
167         >,
168         FunctionSpec<
169             "fegetexcept",
170             RetValSpec<IntType>,
171             []
172         >
173       ]
174   >;
176   HeaderSpec StdIO = HeaderSpec<
177       "stdio.h",
178       [], // Macros
179       [CookieIOFunctionsT], // Types
180       [], // Enumerations
181       [
182           FunctionSpec<
183               "clearerr_unlocked",
184               RetValSpec<VoidType>,
185               [ArgSpec<FILEPtr>]
186           >,
187           FunctionSpec<
188               "feof_unlocked",
189               RetValSpec<IntType>,
190               [ArgSpec<FILEPtr>]
191           >,
192           FunctionSpec<
193               "ferror_unlocked",
194               RetValSpec<IntType>,
195               [ArgSpec<FILEPtr>]
196           >,
197           FunctionSpec<
198               "fopencookie",
199               RetValSpec<FILEPtr>,
200               [ArgSpec<VoidPtr>, ArgSpec<ConstCharPtr>, ArgSpec<CookieIOFunctionsT>]
201           >,
202           FunctionSpec<
203               "fread_unlocked",
204               RetValSpec<SizeTType>,
205               [ArgSpec<VoidRestrictedPtr>,
206                ArgSpec<SizeTType>,
207                ArgSpec<SizeTType>,
208                ArgSpec<FILERestrictedPtr>]
209           >,
210           FunctionSpec<
211               "fwrite_unlocked",
212               RetValSpec<SizeTType>,
213               [ArgSpec<ConstVoidRestrictedPtr>,
214                ArgSpec<SizeTType>,
215                ArgSpec<SizeTType>,
216                ArgSpec<FILERestrictedPtr>]
217           >,
218           FunctionSpec<
219               "fgetc_unlocked",
220               RetValSpec<IntType>,
221               [ArgSpec<FILEPtr>]
222           >,
223       ]
224   >;
226   HeaderSpec StdLib = HeaderSpec<
227       "stdlib.h",
228       [], // Macros
229       [QSortRCompareT], // Types
230       [], // Enumerations
231       [
232           FunctionSpec<
233                 "qsort_r",
234                 RetValSpec<VoidType>,
235                 [ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<QSortRCompareT>, ArgSpec<VoidPtr>]
236           >,
237       ]
238   >;
240   HeaderSpec PThread = HeaderSpec<
241       "pthread.h",
242       [], // Macros
243       [], // Types
244       [], // Enumerations
245       [
246           FunctionSpec<
247               "pthread_setname_np",
248               RetValSpec<IntType>,
249               [ArgSpec<PThreadTType>, ArgSpec<ConstCharPtr>]
250           >,
251           FunctionSpec<
252               "pthread_getname_np",
253               RetValSpec<IntType>,
254               [ArgSpec<PThreadTType>, ArgSpec<CharPtr>, ArgSpec<SizeTType>]
255           >,
256       ]
257   >;
259   HeaderSpec SysAuxv = HeaderSpec<
260       "sys/auxv.h",
261       [], // Macros
262       [], // Types
263       [], // Enumerations
264       [
265           FunctionSpec<
266               "getauxval",
267               RetValSpec<UnsignedLongType>,
268               [ArgSpec<UnsignedLongType>]
269           >,
270       ]  // Functions
271   >;
273   HeaderSpec SendFile = HeaderSpec<
274       "sys/sendfile.h",
275       [], // Macros
276       [OffTType, SizeTType, SSizeTType,], // Types
277       [], // Enumerations
278       [
279           FunctionSpec<
280               "sendfile",
281               RetValSpec<SSizeTType>,
282               [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<OffTPtr>, ArgSpec<SizeTType>]
283           >,
284       ]
285   >;
287   HeaderSpec UniStd = HeaderSpec<
288     "unistd.h",
289     [], // Macros
290     [], // Types
291     [], // Enumerations
292     [
293         FunctionSpec<
294             "dup2",
295             RetValSpec<IntType>,
296             [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>]
297         >,
298     ]
299   >;
301   let Headers = [
302     CType,
303     FEnv,
304     Malloc,
305     Math,
306     PThread,
307     Sched,
308     SendFile,
309     SysAuxv,
310     StdIO,
311     StdLib,
312     String,
313     Search,
314     UniStd,
315   ];