Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / Inputs / std-c-library-functions-POSIX.h
blob63e22ebdb306027605f5f7339410de6331c262e6
1 #include "std-c-library-functions.h"
3 typedef int off_t;
4 typedef unsigned int mode_t;
5 typedef __WCHAR_TYPE__ wchar_t;
6 typedef unsigned int dev_t;
7 typedef unsigned int uid_t;
8 typedef unsigned int gid_t;
9 typedef unsigned long socklen_t;
10 typedef unsigned long int pthread_t;
11 typedef unsigned long time_t;
12 typedef unsigned long clockid_t;
13 typedef __INT64_TYPE__ off64_t;
15 typedef struct {
16 int a;
17 } DIR;
18 struct stat {
19 int a;
21 struct timespec { int x; };
22 struct timeval { int x; };
23 struct sockaddr;
24 struct sockaddr_at;
25 struct msghdr;
26 struct utimbuf;
27 struct itimerval;
28 typedef union {
29 int x;
30 } pthread_cond_t;
31 typedef union {
32 int x;
33 } pthread_attr_t;
34 typedef union {
35 int x;
36 } pthread_mutex_t;
37 typedef union {
38 int x;
39 } pthread_mutexattr_t;
41 FILE *fopen(const char *restrict pathname, const char *restrict mode);
42 FILE *tmpfile(void);
43 FILE *freopen(const char *restrict pathname, const char *restrict mode,
44 FILE *restrict stream);
45 int fclose(FILE *stream);
46 int fseek(FILE *stream, long offset, int whence);
47 int fileno(FILE *stream);
48 long a64l(const char *str64);
49 char *l64a(long value);
50 int open(const char *path, int oflag, ...);
51 int openat(int fd, const char *path, int oflag, ...);
52 int access(const char *pathname, int amode);
53 int faccessat(int dirfd, const char *pathname, int mode, int flags);
54 int dup(int fildes);
55 int dup2(int fildes1, int filedes2);
56 int fdatasync(int fildes);
57 int fnmatch(const char *pattern, const char *string, int flags);
58 int fsync(int fildes);
59 int truncate(const char *path, off_t length);
60 int symlink(const char *oldpath, const char *newpath);
61 int symlinkat(const char *oldpath, int newdirfd, const char *newpath);
62 int lockf(int fd, int cmd, off_t len);
63 int creat(const char *pathname, mode_t mode);
64 unsigned int sleep(unsigned int seconds);
65 int dirfd(DIR *dirp);
66 unsigned int alarm(unsigned int seconds);
67 int closedir(DIR *dir);
68 char *strdup(const char *s);
69 char *strndup(const char *s, size_t n);
70 wchar_t *wcsdup(const wchar_t *s);
71 int mkstemp(char *template);
72 char *mkdtemp(char *template);
73 char *getcwd(char *buf, size_t size);
74 int mkdir(const char *pathname, mode_t mode);
75 int mkdirat(int dirfd, const char *pathname, mode_t mode);
76 int mknod(const char *pathname, mode_t mode, dev_t dev);
77 int mknodat(int dirfd, const char *pathname, mode_t mode, dev_t dev);
78 int chmod(const char *path, mode_t mode);
79 int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);
80 int fchmod(int fildes, mode_t mode);
81 int fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags);
82 int chown(const char *path, uid_t owner, gid_t group);
83 int lchown(const char *path, uid_t owner, gid_t group);
84 int fchown(int fildes, uid_t owner, gid_t group);
85 int rmdir(const char *pathname);
86 int chdir(const char *path);
87 int link(const char *oldpath, const char *newpath);
88 int linkat(int fd1, const char *path1, int fd2, const char *path2, int flag);
89 int unlink(const char *pathname);
90 int unlinkat(int fd, const char *path, int flag);
91 int fstat(int fd, struct stat *statbuf);
92 int stat(const char *restrict path, struct stat *restrict buf);
93 int lstat(const char *restrict path, struct stat *restrict buf);
94 int fstatat(int fd, const char *restrict path, struct stat *restrict buf, int flag);
95 DIR *opendir(const char *name);
96 DIR *fdopendir(int fd);
97 int isatty(int fildes);
98 FILE *popen(const char *command, const char *type);
99 int pclose(FILE *stream);
100 int close(int fildes);
101 long fpathconf(int fildes, int name);
102 long pathconf(const char *path, int name);
103 FILE *fdopen(int fd, const char *mode);
104 void rewinddir(DIR *dir);
105 void seekdir(DIR *dirp, long loc);
106 int rand_r(unsigned int *seedp);
107 int fileno(FILE *stream);
108 int fseeko(FILE *stream, off_t offset, int whence);
109 off_t ftello(FILE *stream);
110 void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
111 void *mmap64(void *addr, size_t length, int prot, int flags, int fd, off64_t offset);
112 int pipe(int fildes[2]);
113 off_t lseek(int fildes, off_t offset, int whence);
114 ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
115 ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, size_t bufsize);
116 int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
117 char *realpath(const char *restrict file_name, char *restrict resolved_name);
118 int execv(const char *path, char *const argv[]);
119 int execvp(const char *file, char *const argv[]);
120 int getopt(int argc, char *const argv[], const char *optstring);
122 // In some libc implementations, sockaddr parameter is a transparent
123 // union of the underlying sockaddr_ pointers instead of being a
124 // pointer to struct sockaddr.
125 // We match that with the joker Irrelevant type.
126 #define __SOCKADDR_ALLTYPES \
127 __SOCKADDR_ONETYPE(sockaddr) \
128 __SOCKADDR_ONETYPE(sockaddr_at)
129 #define __SOCKADDR_ONETYPE(type) struct type *restrict __##type##__;
130 typedef union {
131 __SOCKADDR_ALLTYPES
132 } __SOCKADDR_ARG __attribute__((__transparent_union__));
133 #undef __SOCKADDR_ONETYPE
134 #define __SOCKADDR_ONETYPE(type) const struct type *restrict __##type##__;
135 typedef union {
136 __SOCKADDR_ALLTYPES
137 } __CONST_SOCKADDR_ARG __attribute__((__transparent_union__));
138 #undef __SOCKADDR_ONETYPE
140 int socket(int domain, int type, int protocol);
141 int accept(int socket, __SOCKADDR_ARG address, socklen_t *restrict address_len);
142 int bind(int socket, __CONST_SOCKADDR_ARG address, socklen_t address_len);
143 int getpeername(int socket, __SOCKADDR_ARG address, socklen_t *restrict address_len);
144 int getsockname(int socket, __SOCKADDR_ARG address, socklen_t *restrict address_len);
145 int connect(int socket, __CONST_SOCKADDR_ARG address, socklen_t address_len);
146 ssize_t recvfrom(int socket, void *restrict buffer, size_t length, int flags, __SOCKADDR_ARG address, socklen_t *restrict address_len);
147 ssize_t sendto(int socket, const void *message, size_t length, int flags, __CONST_SOCKADDR_ARG dest_addr, socklen_t dest_len);
148 int listen(int sockfd, int backlog);
149 ssize_t recv(int sockfd, void *buf, size_t len, int flags);
150 ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
151 ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
152 int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
153 int getsockopt(int socket, int level, int option_name, void *restrict option_value, socklen_t *restrict option_len);
154 ssize_t send(int sockfd, const void *buf, size_t len, int flags);
155 int socketpair(int domain, int type, int protocol, int sv[2]);
156 int shutdown(int socket, int how);
157 int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, char *restrict node, socklen_t nodelen, char *restrict service, socklen_t servicelen, int flags);
158 int utime(const char *filename, struct utimbuf *buf);
159 int futimens(int fd, const struct timespec times[2]);
160 int utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags);
161 int utimes(const char *filename, const struct timeval times[2]);
162 int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
163 struct tm *localtime(const time_t *tp);
164 struct tm *localtime_r(const time_t *restrict timer, struct tm *restrict result);
165 char *asctime_r(const struct tm *restrict tm, char *restrict buf);
166 char *ctime_r(const time_t *timep, char *buf);
167 struct tm *gmtime_r(const time_t *restrict timer, struct tm *restrict result);
168 struct tm *gmtime(const time_t *tp);
169 int clock_gettime(clockid_t clock_id, struct timespec *tp);
170 int getitimer(int which, struct itimerval *curr_value);
172 int pthread_cond_signal(pthread_cond_t *cond);
173 int pthread_cond_broadcast(pthread_cond_t *cond);
174 int pthread_create(pthread_t *restrict thread, const pthread_attr_t *restrict attr, void *(*start_routine)(void *), void *restrict arg);
175 int pthread_attr_destroy(pthread_attr_t *attr);
176 int pthread_attr_init(pthread_attr_t *attr);
177 int pthread_attr_getstacksize(const pthread_attr_t *restrict attr, size_t *restrict stacksize);
178 int pthread_attr_getguardsize(const pthread_attr_t *restrict attr, size_t *restrict guardsize);
179 int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
180 int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize);
181 int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr);
182 int pthread_mutex_destroy(pthread_mutex_t *mutex);
183 int pthread_mutex_lock(pthread_mutex_t *mutex);
184 int pthread_mutex_trylock(pthread_mutex_t *mutex);
185 int pthread_mutex_unlock(pthread_mutex_t *mutex);