xref: /llvm-project-15.0.7/libc/spec/stdc.td (revision 2f251925)
1def StdC : StandardSpec<"stdc"> {
2
3  NamedType StructTmType = NamedType<"struct tm">;
4  PtrType StructTmPtr = PtrType<StructTmType>;
5  PtrType TimeTTypePtr = PtrType<TimeTType>;
6
7  NamedType DivTType = NamedType<"div_t">;
8  NamedType LDivTType = NamedType<"ldiv_t">;
9  NamedType LLDivTType = NamedType<"lldiv_t">;
10
11  HeaderSpec Assert = HeaderSpec<
12      "assert.h",
13      [
14          Macro<"static_assert">,
15          Macro<"assert">,
16      ],
17      [], // Types
18      [], // Enumerations
19      []
20  >;
21
22  HeaderSpec CType = HeaderSpec<
23      "ctype.h",
24      [], // Macros
25      [], // Types
26      [], // Enumerations
27      [
28          FunctionSpec<
29              "isalnum",
30              RetValSpec<IntType>,
31              [ArgSpec<IntType>]
32          >,
33          FunctionSpec<
34              "isalpha",
35              RetValSpec<IntType>,
36              [ArgSpec<IntType>]
37          >,
38          FunctionSpec<
39              "isblank",
40              RetValSpec<IntType>,
41              [ArgSpec<IntType>]
42          >,
43          FunctionSpec<
44              "iscntrl",
45              RetValSpec<IntType>,
46              [ArgSpec<IntType>]
47          >,
48          FunctionSpec<
49              "isdigit",
50              RetValSpec<IntType>,
51              [ArgSpec<IntType>]
52          >,
53          FunctionSpec<
54              "isgraph",
55              RetValSpec<IntType>,
56              [ArgSpec<IntType>]
57          >,
58          FunctionSpec<
59              "islower",
60              RetValSpec<IntType>,
61              [ArgSpec<IntType>]
62          >,
63          FunctionSpec<
64              "isprint",
65              RetValSpec<IntType>,
66              [ArgSpec<IntType>]
67          >,
68          FunctionSpec<
69              "ispunct",
70              RetValSpec<IntType>,
71              [ArgSpec<IntType>]
72          >,
73          FunctionSpec<
74              "isspace",
75              RetValSpec<IntType>,
76              [ArgSpec<IntType>]
77          >,
78          FunctionSpec<
79              "isupper",
80              RetValSpec<IntType>,
81              [ArgSpec<IntType>]
82          >,
83          FunctionSpec<
84              "isxdigit",
85              RetValSpec<IntType>,
86              [ArgSpec<IntType>]
87          >,
88          FunctionSpec<
89              "tolower",
90              RetValSpec<IntType>,
91              [ArgSpec<IntType>]
92          >,
93          FunctionSpec<
94              "toupper",
95              RetValSpec<IntType>,
96              [ArgSpec<IntType>]
97          >,
98      ]
99  >;
100
101  NamedType FEnvT = NamedType<"fenv_t">;
102  PtrType FEnvTPtr = PtrType<FEnvT>;
103  ConstType ConstFEnvTPtr = ConstType<FEnvTPtr>;
104  NamedType FExceptT = NamedType<"fexcept_t">;
105  PtrType FExceptTPtr = PtrType<FExceptT>;
106  ConstType ConstFExceptTPtr = ConstType<FExceptTPtr>;
107  HeaderSpec Fenv = HeaderSpec<
108      "fenv.h",
109      [
110          Macro<"FE_DIVBYZERO">,
111          Macro<"FE_INEXACT">,
112          Macro<"FE_INVALID">,
113          Macro<"FE_OVERFLOW">,
114          Macro<"FE_UNDERFLOW">,
115          Macro<"FE_ALL_EXCEPT">,
116
117          Macro<"FE_DOWNWARD">,
118          Macro<"FE_TONEAREST">,
119          Macro<"FE_TOWARDZERO">,
120          Macro<"FE_UPWARD">,
121
122          Macro<"FE_DFL_ENV">
123      ],
124      [
125          NamedType<"fenv_t">,
126          NamedType<"fexcept_t">,
127      ], // Types
128      [], // Enumerations
129      [
130          FunctionSpec<
131              "feclearexcept",
132              RetValSpec<IntType>,
133              [ArgSpec<IntType>]
134          >,
135          FunctionSpec<
136              "fetestexcept",
137              RetValSpec<IntType>,
138              [ArgSpec<IntType>]
139          >,
140          FunctionSpec<
141              "feraiseexcept",
142              RetValSpec<IntType>,
143              [ArgSpec<IntType>]
144          >,
145          FunctionSpec<
146              "fesetround",
147              RetValSpec<IntType>,
148              [ArgSpec<IntType>]
149          >,
150          FunctionSpec<
151              "fegetround",
152              RetValSpec<IntType>,
153              []
154          >,
155          FunctionSpec<
156              "fegetenv",
157              RetValSpec<IntType>,
158              [ArgSpec<FEnvTPtr>]
159          >,
160          FunctionSpec<
161              "fesetenv",
162              RetValSpec<IntType>,
163              [ArgSpec<ConstFEnvTPtr>]
164          >,
165          FunctionSpec<
166              "fegetexceptflag",
167              RetValSpec<IntType>,
168              [ArgSpec<FExceptTPtr>, ArgSpec<IntType>]
169          >,
170          FunctionSpec<
171              "fesetexceptflag",
172              RetValSpec<IntType>,
173              [ArgSpec<ConstFExceptTPtr>, ArgSpec<IntType>]
174          >,
175          FunctionSpec<
176              "feholdexcept",
177              RetValSpec<IntType>,
178              [ArgSpec<FEnvTPtr>]
179          >,
180          FunctionSpec<
181              "feupdateenv",
182              RetValSpec<IntType>,
183              [ArgSpec<ConstFEnvTPtr>]
184          >,
185      ]
186  >;
187
188  HeaderSpec String = HeaderSpec<
189      "string.h",
190      [
191          Macro<"NULL">,
192      ],
193      [
194          SizeTType,
195      ],
196      [], // Enumerations
197      [
198          FunctionSpec<
199              "memcpy",
200              RetValSpec<VoidPtr>,
201              [ArgSpec<VoidRestrictedPtr>,
202               ArgSpec<ConstVoidRestrictedPtr>,
203               ArgSpec<SizeTType>]
204          >,
205          FunctionSpec<
206              "memmove",
207              RetValSpec<VoidPtr>,
208              [ArgSpec<VoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
209          >,
210          FunctionSpec<
211              "memcmp",
212              RetValSpec<IntType>,
213              [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
214          >,
215          FunctionSpec<
216              "memchr",
217              RetValSpec<VoidPtr>,
218              [ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
219          >,
220          FunctionSpec<
221              "memset",
222              RetValSpec<VoidPtr>,
223              [ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
224          >,
225          FunctionSpec<
226              "strcpy",
227              RetValSpec<CharPtr>,
228              [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
229          >,
230          FunctionSpec<
231              "strncpy",
232              RetValSpec<CharPtr>,
233              [ArgSpec<CharRestrictedPtr>,
234               ArgSpec<ConstCharRestrictedPtr>,
235               ArgSpec<SizeTType>]
236          >,
237          FunctionSpec<
238              "strcat",
239              RetValSpec<CharPtr>,
240              [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
241          >,
242          FunctionSpec<
243              "strncat",
244              RetValSpec<CharPtr>,
245              [ArgSpec<CharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
246          >,
247          FunctionSpec<
248              "strcmp",
249              RetValSpec<IntType>,
250              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
251          >,
252          FunctionSpec<
253              "strcoll",
254              RetValSpec<IntType>,
255              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
256          >,
257          FunctionSpec<
258              "strncmp",
259              RetValSpec<IntType>,
260              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
261          >,
262          FunctionSpec<
263              "strxfrm",
264              RetValSpec<SizeTType>,
265              [ArgSpec<CharRestrictedPtr>,
266               ArgSpec<ConstCharRestrictedPtr>,
267               ArgSpec<SizeTType>]
268          >,
269          FunctionSpec<
270              "strchr",
271              RetValSpec<CharPtr>,
272              [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
273          >,
274          FunctionSpec<
275              "strcspn",
276              RetValSpec<SizeTType>,
277              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
278          >,
279          FunctionSpec<
280              "strdup",
281              RetValSpec<CharPtr>,
282              [ArgSpec<ConstCharPtr>]
283          >,
284          FunctionSpec<
285              "strndup",
286              RetValSpec<CharPtr>,
287              [ArgSpec<ConstCharPtr>,ArgSpec<SizeTType>]
288          >,
289          FunctionSpec<
290              "strpbrk",
291              RetValSpec<CharPtr>,
292              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
293          >,
294          FunctionSpec<
295              "strrchr",
296              RetValSpec<CharPtr>,
297              [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
298          >,
299          FunctionSpec<
300              "strspn",
301              RetValSpec<SizeTType>,
302              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
303          >,
304          FunctionSpec<
305              "strstr",
306              RetValSpec<CharPtr>,
307              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
308          >,
309          FunctionSpec<
310              "strtok",
311              RetValSpec<CharPtr>,
312              [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
313          >,
314          FunctionSpec<
315              "strerror",
316              RetValSpec<CharPtr>,
317              [ArgSpec<IntType>]
318          >,
319          FunctionSpec<
320              "strlen",
321              RetValSpec<SizeTType>,
322              [ArgSpec<ConstCharPtr>]
323          >,
324      ]
325  >;
326
327  HeaderSpec Math = HeaderSpec<
328      "math.h",
329      [
330          Macro<"MATH_ERRNO">,
331          Macro<"MATH_ERREXCEPT">,
332          Macro<"math_errhandling">,
333
334          Macro<"INFINITY">,
335          Macro<"NAN">,
336
337          Macro<"FP_ILOGB0">,
338          Macro<"FP_ILOGBNAN">,
339
340          Macro<"isfinite">,
341          Macro<"isinf">,
342          Macro<"isnan">,
343      ],
344      [
345          NamedType<"float_t">,
346          NamedType<"double_t">,
347      ],
348      [], // Enumerations
349      [
350          FunctionSpec<"copysign", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
351          FunctionSpec<"copysignf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
352          FunctionSpec<"copysignl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
353
354          FunctionSpec<"ceil", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
355          FunctionSpec<"ceilf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
356          FunctionSpec<"ceill", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
357
358          FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
359          FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
360          FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
361
362          FunctionSpec<"fdim", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
363          FunctionSpec<"fdimf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
364          FunctionSpec<"fdiml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
365
366          FunctionSpec<"floor", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
367          FunctionSpec<"floorf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
368          FunctionSpec<"floorl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
369
370          FunctionSpec<"fmin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
371          FunctionSpec<"fminf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
372          FunctionSpec<"fminl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
373
374          FunctionSpec<"fmax", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
375          FunctionSpec<"fmaxf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
376          FunctionSpec<"fmaxl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
377
378          FunctionSpec<"fma", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
379          FunctionSpec<"fmaf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<FloatType>]>,
380
381          FunctionSpec<"frexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
382          FunctionSpec<"frexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
383          FunctionSpec<"frexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
384
385          FunctionSpec<"hypot", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
386          FunctionSpec<"hypotf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
387
388          FunctionSpec<"ilogb", RetValSpec<IntType>, [ArgSpec<DoubleType>]>,
389          FunctionSpec<"ilogbf", RetValSpec<IntType>, [ArgSpec<FloatType>]>,
390          FunctionSpec<"ilogbl", RetValSpec<IntType>, [ArgSpec<LongDoubleType>]>,
391
392          FunctionSpec<"ldexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
393          FunctionSpec<"ldexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
394          FunctionSpec<"ldexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>]>,
395
396          FunctionSpec<"log10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
397
398          FunctionSpec<"log1pf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
399
400          FunctionSpec<"log2f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
401
402          FunctionSpec<"logf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
403
404          FunctionSpec<"logb", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
405          FunctionSpec<"logbf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
406          FunctionSpec<"logbl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
407
408          FunctionSpec<"modf", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoublePtr>]>,
409          FunctionSpec<"modff", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatPtr>]>,
410          FunctionSpec<"modfl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoublePtr>]>,
411
412          FunctionSpec<"cos", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
413          FunctionSpec<"cosf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
414          FunctionSpec<"sin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
415          FunctionSpec<"sinf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
416          FunctionSpec<"tan", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
417
418          FunctionSpec<"expf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
419          FunctionSpec<"exp2f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
420          FunctionSpec<"expm1f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
421
422          FunctionSpec<"remainderf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
423          FunctionSpec<"remainder", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
424          FunctionSpec<"remainderl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
425
426          FunctionSpec<"remquof", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
427          FunctionSpec<"remquo", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
428          FunctionSpec<"remquol", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
429
430          FunctionSpec<"round", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
431          FunctionSpec<"roundf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
432          FunctionSpec<"roundl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
433
434          FunctionSpec<"lround", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
435          FunctionSpec<"lroundf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
436          FunctionSpec<"lroundl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
437
438          FunctionSpec<"llround", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
439          FunctionSpec<"llroundf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
440          FunctionSpec<"llroundl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
441
442          FunctionSpec<"rint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
443          FunctionSpec<"rintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
444          FunctionSpec<"rintl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
445
446          FunctionSpec<"lrint", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
447          FunctionSpec<"lrintf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
448          FunctionSpec<"lrintl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
449
450          FunctionSpec<"llrint", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
451          FunctionSpec<"llrintf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
452          FunctionSpec<"llrintl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
453
454          FunctionSpec<"sqrt", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
455          FunctionSpec<"sqrtf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
456          FunctionSpec<"sqrtl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
457
458          FunctionSpec<"trunc", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
459          FunctionSpec<"truncf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
460          FunctionSpec<"truncl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
461
462          FunctionSpec<"nearbyint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
463          FunctionSpec<"nearbyintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
464          FunctionSpec<"nearbyintl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
465
466          FunctionSpec<"nextafterf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
467          FunctionSpec<"nextafter", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
468          FunctionSpec<"nextafterl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
469      ]
470  >;
471
472  HeaderSpec StdIO = HeaderSpec<
473      "stdio.h",
474      [], // Macros
475      [ // Types
476          SizeTType,
477          FILE,
478      ],
479      [], // Enumerations
480      [
481          FunctionSpec<
482              "fclose",
483              RetValSpec<IntType>,
484              [ArgSpec<FILEPtr>]
485          >,
486          FunctionSpec<
487              "fflush",
488              RetValSpec<IntType>,
489              [ArgSpec<FILEPtr>]
490          >,
491          FunctionSpec<
492              "fopen",
493              RetValSpec<FILEPtr>,
494              [ArgSpec<ConstCharPtr>,
495               ArgSpec<ConstCharPtr>]
496          >,
497          FunctionSpec<
498              "fread",
499              RetValSpec<SizeTType>,
500              [ArgSpec<VoidRestrictedPtr>,
501               ArgSpec<SizeTType>,
502               ArgSpec<SizeTType>,
503               ArgSpec<FILERestrictedPtr>]
504          >,
505          FunctionSpec<
506              "fseek",
507              RetValSpec<IntType>,
508              [ArgSpec<FILEPtr>,
509               ArgSpec<LongType>,
510               ArgSpec<IntType>]
511          >,
512          FunctionSpec<
513              "fwrite",
514              RetValSpec<SizeTType>,
515              [ArgSpec<ConstVoidRestrictedPtr>,
516               ArgSpec<SizeTType>,
517               ArgSpec<SizeTType>,
518               ArgSpec<FILERestrictedPtr>]
519          >,
520      ]
521  >;
522
523  HeaderSpec StdLib = HeaderSpec<
524      "stdlib.h",
525      [], // Macros
526      [
527          DivTType,
528          LDivTType,
529          LLDivTType,
530          SizeTType,
531          BSearchCompareT,
532          QSortCompareT,
533          AtexitHandlerT,
534      ], // Types
535      [], // Enumerations
536      [
537          FunctionSpec<"abort", RetValSpec<NoReturn>, [ArgSpec<VoidType>]>,
538
539          FunctionSpec<"bsearch", RetValSpec<VoidPtr>, [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<BSearchCompareT>]>,
540
541          FunctionSpec<"abs", RetValSpec<IntType>, [ArgSpec<IntType>]>,
542          FunctionSpec<"labs", RetValSpec<LongType>, [ArgSpec<LongType>]>,
543          FunctionSpec<"llabs", RetValSpec<LongLongType>, [ArgSpec<LongLongType>]>,
544
545          FunctionSpec<"atof", RetValSpec<DoubleType>, [ArgSpec<ConstCharRestrictedPtr>]>,
546          FunctionSpec<"atoi", RetValSpec<IntType>, [ArgSpec<ConstCharPtr>]>,
547          FunctionSpec<"atol", RetValSpec<LongType>, [ArgSpec<ConstCharPtr>]>,
548          FunctionSpec<"atoll", RetValSpec<LongLongType>, [ArgSpec<ConstCharPtr>]>,
549
550          FunctionSpec<"div", RetValSpec<DivTType>, [ArgSpec<IntType>, ArgSpec<IntType>]>,
551          FunctionSpec<"ldiv", RetValSpec<LDivTType>, [ArgSpec<LongType>, ArgSpec<LongType>]>,
552          FunctionSpec<"lldiv", RetValSpec<LLDivTType>, [ArgSpec<LongLongType>, ArgSpec<LongLongType>]>,
553
554          FunctionSpec<"qsort", RetValSpec<VoidType>, [ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<QSortCompareT>]>,
555
556          FunctionSpec<"strtof", RetValSpec<FloatType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
557          FunctionSpec<"strtod", RetValSpec<DoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
558          FunctionSpec<"strtold", RetValSpec<LongDoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
559          FunctionSpec<"strtol", RetValSpec<LongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
560          FunctionSpec<"strtoll", RetValSpec<LongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
561          FunctionSpec<"strtoul", RetValSpec<UnsignedLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
562          FunctionSpec<"strtoull", RetValSpec<UnsignedLongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
563
564          FunctionSpec<"malloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>]>,
565          FunctionSpec<"calloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>, ArgSpec<SizeTType>]>,
566          FunctionSpec<"realloc", RetValSpec<VoidPtr>, [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]>,
567          FunctionSpec<"aligned_alloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>, ArgSpec<SizeTType>]>,
568          FunctionSpec<"free", RetValSpec<VoidType>, [ArgSpec<VoidPtr>]>,
569
570          FunctionSpec<"_Exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
571          FunctionSpec<"exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
572          FunctionSpec<"atexit", RetValSpec<IntType>, [ArgSpec<AtexitHandlerT>]>,
573      ]
574  >;
575
576  NamedType IMaxDivTType = NamedType<"imaxdiv_t">;
577
578  HeaderSpec IntTypes = HeaderSpec<
579      "inttypes.h",
580      [], // Macros
581      [
582        IMaxDivTType,
583      ], // Types
584      [], // Enumerations
585      [
586          FunctionSpec<"imaxabs", RetValSpec<IntMaxTType>, [ArgSpec<IntMaxTType>]>,
587          FunctionSpec<"imaxdiv", RetValSpec<IMaxDivTType>, [ArgSpec<IntMaxTType>, ArgSpec<IntMaxTType>]>,
588          FunctionSpec<"strtoimax", RetValSpec<IntMaxTType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
589          FunctionSpec<"strtoumax", RetValSpec<UIntMaxTType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
590      ]
591  >;
592
593  HeaderSpec Errno = HeaderSpec<
594      "errno.h",
595      [
596        Macro<"errno">,
597        Macro<"EDOM">,
598        Macro<"EILSEQ">,
599        Macro<"ERANGE">,
600      ]
601  >;
602
603  HeaderSpec Signal = HeaderSpec<
604      "signal.h",
605      [
606        Macro<"SIG_BLOCK">,
607        Macro<"SIG_UNBLOCK">,
608        Macro<"SIG_SETMASK">,
609
610        Macro<"SIGABRT">,
611        Macro<"SIGFPE">,
612        Macro<"SIGILL">,
613        Macro<"SIGINT">,
614        Macro<"SIGSEGV">,
615        Macro<"SIGTERM">
616      ],
617      [
618        SizeTType,
619        SigHandlerT,
620      ],
621      [], // Enumerations
622      [
623        FunctionSpec<"raise", RetValSpec<IntType>, [ArgSpec<IntType>]>,
624        FunctionSpec<
625          "signal",
626          RetValSpec<SigHandlerT>,
627          [ArgSpec<IntType>, ArgSpec<SigHandlerT>]
628        >,
629      ]
630  >;
631
632  HeaderSpec Threads = HeaderSpec<
633      "threads.h",
634      [
635          Macro<"ONCE_FLAG_INIT">,
636      ],
637      [
638          OnceFlagType,
639          CallOnceFuncType,
640          CndTType,
641          MtxTType,
642          ThrdStartTType,
643          ThrdTType,
644      ],
645      [
646          EnumeratedNameValue<"mtx_plain">,
647          EnumeratedNameValue<"mtx_recursive">,
648          EnumeratedNameValue<"mtx_timed">,
649          EnumeratedNameValue<"thrd_timedout">,
650          EnumeratedNameValue<"thrd_success">,
651          EnumeratedNameValue<"thrd_busy">,
652          EnumeratedNameValue<"thrd_error">,
653          EnumeratedNameValue<"thrd_nomem">,
654      ],
655      [
656          FunctionSpec<
657              "call_once",
658              RetValSpec<VoidType>,
659              [
660                  ArgSpec<OnceFlagTypePtr>,
661                  ArgSpec<CallOnceFuncType>,
662              ]
663          >,
664          FunctionSpec<
665              "cnd_broadcast",
666              RetValSpec<IntType>,
667              [
668                  ArgSpec<CndTTypePtr>,
669              ]
670          >,
671          FunctionSpec<
672              "cnd_destroy",
673              RetValSpec<VoidType>,
674              [
675                  ArgSpec<CndTTypePtr>,
676              ]
677          >,
678          FunctionSpec<
679              "cnd_init",
680              RetValSpec<IntType>,
681              [
682                  ArgSpec<CndTTypePtr>,
683              ]
684          >,
685          FunctionSpec<
686              "cnd_signal",
687              RetValSpec<IntType>,
688              [
689                  ArgSpec<CndTTypePtr>,
690              ]
691          >,
692          FunctionSpec<
693              "cnd_wait",
694              RetValSpec<IntType>,
695              [
696                  ArgSpec<CndTTypePtr>,
697                  ArgSpec<MtxTTypePtr>,
698              ]
699          >,
700          FunctionSpec<
701              "mtx_init",
702              RetValSpec<IntType>,
703              [
704                  ArgSpec<MtxTTypePtr>,
705                  ArgSpec<IntType>,
706              ]
707          >,
708          FunctionSpec<
709              "mtx_destroy",
710              RetValSpec<IntType>,
711              [
712                  ArgSpec<VoidType>,
713              ]
714          >,
715          FunctionSpec<
716              "mtx_lock",
717              RetValSpec<IntType>,
718              [
719                  ArgSpec<MtxTTypePtr>,
720              ]
721          >,
722          FunctionSpec<
723              "mtx_unlock",
724              RetValSpec<IntType>,
725              [
726                  ArgSpec<MtxTTypePtr>,
727              ]
728          >,
729          FunctionSpec<
730              "thrd_create",
731              RetValSpec<IntType>,
732              [
733                  ArgSpec<ThrdTTypePtr>,
734                  ArgSpec<ThrdStartTType>,
735                  ArgSpec<VoidPtr>,
736              ]
737          >,
738          FunctionSpec<
739              "thrd_join",
740              RetValSpec<IntType>,
741              [
742                  ArgSpec<ThrdTTypePtr>,
743                  ArgSpec<IntPtr>,
744              ]
745          >
746      ]
747  >;
748
749  HeaderSpec Time = HeaderSpec<
750      "time.h",
751      [], // Macros
752      [ // Types
753       StructTmType,
754       TimeTType,
755      ],
756      [], // Enumerations
757      [
758          FunctionSpec<
759              "asctime",
760              RetValSpec<CharPtr>,
761              [ArgSpec<StructTmPtr>]
762          >,
763          FunctionSpec<
764              "asctime_r",
765              RetValSpec<CharPtr>,
766              [
767                  ArgSpec<StructTmPtr>,
768                  ArgSpec<CharPtr>,
769              ]
770          >,
771          FunctionSpec<
772              "gmtime",
773              RetValSpec<StructTmPtr>,
774              [ArgSpec<TimeTTypePtr>]
775          >,
776          FunctionSpec<
777              "gmtime_r",
778              RetValSpec<StructTmPtr>,
779              [
780                  ArgSpec<TimeTTypePtr>,
781                  ArgSpec<StructTmPtr>,
782              ]
783          >,
784          FunctionSpec<
785              "mktime",
786              RetValSpec<TimeTType>,
787              [ArgSpec<StructTmPtr>]
788          >,
789      ]
790  >;
791
792  let Headers = [
793    Assert,
794    CType,
795    Errno,
796    Fenv,
797    Math,
798    String,
799    StdIO,
800    StdLib,
801    IntTypes,
802    Signal,
803    Threads,
804    Time,
805  ];
806}
807