[Workflow] Roll back some settings since they caused more issues
[llvm-project.git] / libc / config / linux / api.td
blob377763b97cfd95803dd01ad2feb641a7e67d9719
1 include "config/public_api.td"
3 include "spec/bsd_ext.td"
4 include "spec/gnu_ext.td"
5 include "spec/linux.td"
6 include "spec/llvm_libc_ext.td"
7 include "spec/posix.td"
8 include "spec/stdc.td"
10 def AssertMacro : MacroDef<"assert"> {
11   let Defn = [{
12     #undef assert
14     #ifdef NDEBUG
15     #define assert(e) (void)0
16     #else
18     #ifdef __cplusplus
19     extern "C"
20     #endif
21     _Noreturn void __assert_fail(const char *, const char *, unsigned, const char *) __NOEXCEPT;
23     #define assert(e)  \
24       ((e) ? (void)0 : __assert_fail(#e, __FILE__, __LINE__, __PRETTY_FUNCTION__))
26     #endif
27   }];
30 def StaticAssertMacro : MacroDef<"static_assert"> {
31   let Defn = [{
32     #ifndef __cplusplus
33     #undef static_assert
34     #define static_assert _Static_assert
35     #endif
36   }];
39 def AssertAPI : PublicAPI<"assert.h"> {
40   let Macros = [
41     AssertMacro,
42     StaticAssertMacro,
43   ];
46 def CTypeAPI : PublicAPI<"ctype.h"> {
49 def FCntlAPI : PublicAPI<"fcntl.h"> {
50   let Types = ["mode_t"];
53 def IntTypesAPI : PublicAPI<"inttypes.h"> {
54   let Types = ["imaxdiv_t"];
57 def MathAPI : PublicAPI<"math.h"> {
58   let Types = ["double_t", "float_t"];
61 def FenvAPI: PublicAPI<"fenv.h"> {
62   let Types = ["fenv_t", "fexcept_t"];
65 def StringAPI : PublicAPI<"string.h"> {
66   let Types = ["size_t"];
69 def StdIOAPI : PublicAPI<"stdio.h"> {
70   let Macros = [
71     SimpleMacroDef<"stderr", "stderr">,
72     SimpleMacroDef<"stdin", "stdin">,
73     SimpleMacroDef<"stdout", "stdout">,
74     SimpleMacroDef<"_IOFBF", "0">,
75     SimpleMacroDef<"_IOLBF", "1">,
76     SimpleMacroDef<"_IONBF", "2">,
77     SimpleMacroDef<"EOF", "-1">,
78   ];
79   let Types = ["size_t", "FILE", "cookie_io_functions_t"];
82 def StdlibAPI : PublicAPI<"stdlib.h"> {
83   let Types = [
84     "div_t",
85     "ldiv_t",
86     "lldiv_t",
87     "size_t",
88     "__bsearchcompare_t",
89     "__qsortcompare_t",
90     "__qsortrcompare_t",
91     "__atexithandler_t",
92   ];
95 def TimeAPI : PublicAPI<"time.h"> {
96   let Types = [
97     "clock_t",
98     "time_t",
99     "struct tm",
100     "struct timespec",
101     "struct timeval",
102     "clockid_t",
103   ];
106 def SchedAPI : PublicAPI<"sched.h"> {
107   let Types = [
108     "pid_t",
109     "size_t",
110     "cpu_set_t",
111     "struct sched_param",
112     // Needed according to posix standard
113     "time_t",
114     "struct timespec",
115   ];
118 def SysMManAPI : PublicAPI<"sys/mman.h"> {
119   let Types = ["off_t", "size_t"];
122 def SignalAPI : PublicAPI<"signal.h"> {
123   let Types = [
124     "sig_atomic_t",
125     "sigset_t",
126     "struct sigaction",
127     "union sigval",
128     "siginfo_t",
129     "stack_t",
130     "pid_t",
131   ];
134 def ThreadsAPI : PublicAPI<"threads.h"> {
135   let Macros = [
136     SimpleMacroDef<"ONCE_FLAG_INIT", "{0}">,
137   ];
139   let Types = [
140     "__call_once_func_t",
141     "once_flag",
142     "cnd_t",
143     "mtx_t",
144     "thrd_t",
145     "thrd_start_t",
146     "tss_t",
147     "tss_dtor_t",
148   ];
150   let Enumerations = [
151     "mtx_plain",
152     "mtx_recursive",
153     "mtx_timed",
154     "thrd_timedout",
155     "thrd_success",
156     "thrd_busy",
157     "thrd_error",
158     "thrd_nomem",
159   ];
162 def PThreadAPI : PublicAPI<"pthread.h"> {
163   let Types = [
164       "__atfork_callback_t",
165       "__pthread_once_func_t",
166       "__pthread_start_t",
167       "__pthread_tss_dtor_t",
168       "pthread_attr_t",
169       "pthread_mutex_t",
170       "pthread_mutexattr_t",
171       "pthread_t",
172       "pthread_key_t",
173       "pthread_once_t",
174   ];
177 def DirentAPI : PublicAPI<"dirent.h"> {
178   let Types = [
179     "ino_t",
180     "DIR",
181     "struct dirent",
182   ];
185 def UniStdAPI : PublicAPI<"unistd.h"> {
186   let Types = ["__exec_argv_t", "__exec_envp_t", "off_t", "pid_t", "size_t",
187                "ssize_t", "uid_t", "__getoptargv_t"];
190 def WCharAPI : PublicAPI<"wchar.h"> {
191   let Types = [
192     "wchar_t",
193     "wint_t",
194     "size_t",
195   ];
198 def SysRandomAPI : PublicAPI<"sys/random.h"> {
199   let Types = ["size_t", "ssize_t"];
202 def SysSelectAPI : PublicAPI<"sys/select.h"> {
203   let Types = ["fd_set", "sigset_t", "suseconds_t", "time_t", "struct timespec",
204                "struct timeval"];
207 def SysSocketAPI : PublicAPI<"sys/socket.h"> {
208   let Types = ["struct sockaddr", "sa_family_t"];
211 def SysResourceAPI : PublicAPI<"sys/resource.h"> {
212   let Types = ["rlim_t", "struct rlimit"];
215 def SysStatAPI : PublicAPI<"sys/stat.h"> {
216   let Types = ["mode_t", "dev_t", "ino_t", "nlink_t", "uid_t", "gid_t", "off_t",
217                "struct timespec", "struct timeval", "blksize_t", "blkcnt_t",
218                "struct stat"];
221 def SysWaitAPI : PublicAPI<"sys/wait.h"> {
222   let Types = ["pid_t", "struct rusage", "siginfo_t"];
225 def SysSendfileAPI : PublicAPI<"sys/sendfile.h"> {
226   let Types = ["off_t", "size_t", "ssize_t"];
229 def SysTypesAPI : PublicAPI<"sys/types.h"> {
230   let Types = ["blkcnt_t", "blksize_t", "clockid_t", "dev_t", "gid_t", "ino_t",
231                "mode_t", "nlink_t", "off_t", "pid_t", "pthread_attr_t", "pthread_key_t",
232                "pthread_mutex_t", "pthread_mutexattr_t", "pthread_once_t", "pthread_t",
233                "size_t", "ssize_t", "suseconds_t", "time_t", "uid_t"];
236 def SysUtsNameAPI : PublicAPI<"sys/utsname.h"> {
237   let Types = ["struct utsname"];
240 def SpawnAPI : PublicAPI<"spawn.h"> {
241   let Types = ["mode_t", "pid_t", "posix_spawnattr_t", "posix_spawn_file_actions_t"];
244 def TermiosAPI : PublicAPI<"termios.h"> {
245   let Types = ["cc_t", "pid_t", "speed_t", "struct termios", "tcflag_t"];
248 def SetJmpAPI : PublicAPI<"setjmp.h"> {
249   let Types = ["jmp_buf"];