2022-11-22 20:45:38 +00:00
|
|
|
include "config/public_api.td"
|
|
|
|
|
|
|
|
include "spec/stdc.td"
|
2023-08-29 20:57:18 +00:00
|
|
|
include "spec/posix.td"
|
2023-06-06 16:10:44 +00:00
|
|
|
include "spec/gpu_ext.td"
|
2023-08-31 17:10:19 +00:00
|
|
|
include "spec/gnu_ext.td"
|
|
|
|
include "spec/llvm_libc_ext.td"
|
|
|
|
|
|
|
|
def AssertMacro : MacroDef<"assert"> {
|
|
|
|
let Defn = [{
|
|
|
|
#undef assert
|
|
|
|
|
|
|
|
#ifdef NDEBUG
|
|
|
|
#define assert(e) (void)0
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define assert(e) \
|
|
|
|
((e) ? (void)0 : __assert_fail(#e, __FILE__, __LINE__, __PRETTY_FUNCTION__))
|
|
|
|
#endif
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
def StaticAssertMacro : MacroDef<"static_assert"> {
|
|
|
|
let Defn = [{
|
|
|
|
#ifndef __cplusplus
|
|
|
|
#undef static_assert
|
|
|
|
#define static_assert _Static_assert
|
|
|
|
#endif
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
def AssertAPI : PublicAPI<"assert.h"> {
|
|
|
|
let Macros = [
|
|
|
|
AssertMacro,
|
|
|
|
StaticAssertMacro,
|
|
|
|
];
|
|
|
|
}
|
2022-11-22 20:45:38 +00:00
|
|
|
|
|
|
|
def StringAPI : PublicAPI<"string.h"> {
|
|
|
|
let Types = ["size_t"];
|
|
|
|
}
|
2023-04-26 02:34:59 +00:00
|
|
|
|
|
|
|
def StdlibAPI : PublicAPI<"stdlib.h"> {
|
|
|
|
let Types = [
|
2023-06-29 20:03:18 +00:00
|
|
|
"div_t",
|
|
|
|
"ldiv_t",
|
|
|
|
"lldiv_t",
|
2023-04-26 02:34:59 +00:00
|
|
|
"size_t",
|
2023-09-13 17:06:34 +00:00
|
|
|
"__bsearchcompare_t",
|
|
|
|
"__qsortcompare_t",
|
|
|
|
"__qsortrcompare_t",
|
2023-04-26 02:34:59 +00:00
|
|
|
"__atexithandler_t",
|
|
|
|
];
|
|
|
|
}
|
2023-04-26 23:37:30 +00:00
|
|
|
|
|
|
|
def FenvAPI: PublicAPI<"fenv.h"> {
|
|
|
|
let Types = ["fenv_t"];
|
|
|
|
}
|
2023-05-24 03:35:21 +00:00
|
|
|
|
|
|
|
def StdIOAPI : PublicAPI<"stdio.h"> {
|
|
|
|
let Macros = [
|
|
|
|
SimpleMacroDef<"_IOFBF", "0">,
|
|
|
|
SimpleMacroDef<"_IOLBF", "1">,
|
|
|
|
SimpleMacroDef<"_IONBF", "2">,
|
|
|
|
SimpleMacroDef<"EOF", "-1">,
|
|
|
|
];
|
|
|
|
let Types = ["size_t", "FILE"];
|
|
|
|
}
|
2023-07-05 19:18:27 +00:00
|
|
|
|
|
|
|
def IntTypesAPI : PublicAPI<"inttypes.h"> {
|
|
|
|
let Types = ["imaxdiv_t"];
|
|
|
|
}
|
2023-08-28 21:27:47 +00:00
|
|
|
|
|
|
|
def TimeAPI : PublicAPI<"time.h"> {
|
|
|
|
let Types = [
|
|
|
|
"clock_t",
|
2023-08-29 20:57:18 +00:00
|
|
|
"time_t",
|
|
|
|
"struct timespec",
|
2023-08-28 21:27:47 +00:00
|
|
|
];
|
|
|
|
}
|