llvm-project
84 строки · 1.5 Кб
1include "config/public_api.td"
2
3include "spec/stdc.td"
4include "spec/posix.td"
5include "spec/gpu_ext.td"
6include "spec/gnu_ext.td"
7include "spec/stdc_ext.td"
8include "spec/llvm_libc_ext.td"
9
10def AssertMacro : MacroDef<"assert"> {
11let Defn = [{
12#undef assert
13
14#ifdef NDEBUG
15#define assert(e) (void)0
16#else
17
18#define assert(e) \
19((e) ? (void)0 : __assert_fail(#e, __FILE__, __LINE__, __PRETTY_FUNCTION__))
20#endif
21}];
22}
23
24def StaticAssertMacro : MacroDef<"static_assert"> {
25let Defn = [{
26#ifndef __cplusplus
27#undef static_assert
28#define static_assert _Static_assert
29#endif
30}];
31}
32
33def AssertAPI : PublicAPI<"assert.h"> {
34let Macros = [
35AssertMacro,
36StaticAssertMacro,
37];
38}
39
40def StringAPI : PublicAPI<"string.h"> {
41let Types = ["size_t"];
42}
43
44def StdlibAPI : PublicAPI<"stdlib.h"> {
45let Types = [
46"div_t",
47"ldiv_t",
48"lldiv_t",
49"size_t",
50"__bsearchcompare_t",
51"__qsortcompare_t",
52"__qsortrcompare_t",
53"__atexithandler_t",
54];
55}
56
57def FenvAPI: PublicAPI<"fenv.h"> {
58let Types = ["fenv_t"];
59}
60
61def StdIOAPI : PublicAPI<"stdio.h"> {
62let Macros = [
63SimpleMacroDef<"_IOFBF", "0">,
64SimpleMacroDef<"_IOLBF", "1">,
65SimpleMacroDef<"_IONBF", "2">,
66];
67let Types = [
68"FILE",
69"off_t",
70"size_t",
71];
72}
73
74def IntTypesAPI : PublicAPI<"inttypes.h"> {
75let Types = ["imaxdiv_t"];
76}
77
78def TimeAPI : PublicAPI<"time.h"> {
79let Types = [
80"clock_t",
81"time_t",
82"struct timespec",
83];
84}
85