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