Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / Inputs / system-header-simulator.h
blob8924103f5046ea2c890c3864328b82b07f435366
1 // Like the compiler, the static analyzer treats some functions differently if
2 // they come from a system header -- for example, it is assumed that system
3 // functions do not arbitrarily free() their parameters, and that some bugs
4 // found in system headers cannot be fixed by the user and should be
5 // suppressed.
6 #pragma clang system_header
8 #ifdef __cplusplus
9 #define restrict /*restrict*/
10 #endif
12 typedef __typeof(sizeof(int)) size_t;
13 typedef long long __int64_t;
14 typedef __int64_t __darwin_off_t;
15 typedef __darwin_off_t fpos_t;
17 typedef struct _FILE FILE;
18 #define SEEK_SET 0 /* Seek from beginning of file. */
19 #define SEEK_CUR 1 /* Seek from current position. */
20 #define SEEK_END 2 /* Seek from end of file. */
22 extern FILE *stdin;
23 extern FILE *stdout;
24 extern FILE *stderr;
25 // Include a variant of standard streams that occur in the pre-processed file.
26 extern FILE *__stdinp;
27 extern FILE *__stdoutp;
28 extern FILE *__stderrp;
30 int scanf(const char *restrict format, ...);
31 int fscanf(FILE *restrict, const char *restrict, ...);
32 int printf(const char *restrict format, ...);
33 int fprintf(FILE *restrict, const char *restrict, ...);
34 int getchar(void);
36 void setbuf(FILE *restrict, char *restrict);
37 int setvbuf(FILE *restrict, char *restrict, int, size_t);
39 FILE *funopen(const void *,
40 int (*)(void *, char *, int),
41 int (*)(void *, const char *, int),
42 fpos_t (*)(void *, fpos_t, int),
43 int (*)(void *));
45 FILE *fopen(const char *restrict path, const char *restrict mode);
46 FILE *tmpfile(void);
47 FILE *freopen(const char *restrict pathname, const char *restrict mode, FILE *restrict stream);
48 int fclose(FILE *fp);
49 size_t fread(void *restrict, size_t, size_t, FILE *restrict);
50 size_t fwrite(const void *restrict, size_t, size_t, FILE *restrict);
51 int fputc(int ch, FILE *stream);
52 int fseek(FILE *__stream, long int __off, int __whence);
53 long int ftell(FILE *__stream);
54 void rewind(FILE *__stream);
55 int fgetpos(FILE *restrict stream, fpos_t *restrict pos);
56 int fsetpos(FILE *stream, const fpos_t *pos);
57 void clearerr(FILE *stream);
58 int feof(FILE *stream);
59 int ferror(FILE *stream);
60 int fileno(FILE *stream);
62 size_t strlen(const char *);
64 char *strcpy(char *restrict, const char *restrict);
65 char *strncpy(char *dst, const char *src, size_t n);
66 char *strsep(char **stringp, const char *delim);
67 void *memcpy(void *dst, const void *src, size_t n);
68 void *memset(void *s, int c, size_t n);
70 typedef unsigned long __darwin_pthread_key_t;
71 typedef __darwin_pthread_key_t pthread_key_t;
72 int pthread_setspecific(pthread_key_t, const void *);
74 int sqlite3_bind_text_my(int, const char*, int n, void(*)(void*));
76 typedef void (*freeCallback) (void*);
77 typedef struct {
78 int i;
79 freeCallback fc;
80 } StWithCallback;
82 int dealocateMemWhenDoneByVal(void*, StWithCallback);
83 int dealocateMemWhenDoneByRef(StWithCallback*, const void*);
85 typedef struct CGContext *CGContextRef;
86 CGContextRef CGBitmapContextCreate(void *data/*, size_t width, size_t height,
87 size_t bitsPerComponent, size_t bytesPerRow,
88 CGColorSpaceRef space,
89 CGBitmapInfo bitmapInfo*/);
90 void *CGBitmapContextGetData(CGContextRef context);
92 // Include xpc.
93 typedef struct _xpc_connection_s * xpc_connection_t;
94 typedef void (*xpc_finalizer_t)(void *value);
95 void xpc_connection_set_context(xpc_connection_t connection, void *context);
96 void xpc_connection_set_finalizer_f(xpc_connection_t connection, xpc_finalizer_t finalizer);
97 void xpc_connection_resume(xpc_connection_t connection);
99 //The following are fake system header functions for generic testing.
100 void fakeSystemHeaderCallInt(int *);
101 void fakeSystemHeaderCallIntPtr(int **);
103 // Some data strauctures may hold onto the pointer and free it later.
104 void fake_insque(void *, void *);
105 typedef struct fake_rb_tree { void *opaque[8]; } fake_rb_tree_t;
106 void fake_rb_tree_init(fake_rb_tree_t *, const void *);
107 void *fake_rb_tree_insert_node(fake_rb_tree_t *, void *);
109 typedef struct __SomeStruct {
110 char * p;
111 } SomeStruct;
112 void fakeSystemHeaderCall(SomeStruct *);
114 typedef int pid_t;
115 pid_t fork(void);
116 pid_t vfork(void);
117 int execl(const char *path, const char *arg, ...);
118 int execle(const char *path, const char *arg, ...);
119 int execlp(const char *file, const char *arg, ...);
120 int execv(const char *path, char *const argv[]);
121 int execve(const char *path, char *const argv[], char *const envp[]);
122 int execvp(const char *file, char *const argv[]);
123 int execvpe(const char *file, char *const argv[], char *const envp[]);
125 void exit(int status) __attribute__ ((__noreturn__));
126 void _exit(int status) __attribute__ ((__noreturn__));
127 void _Exit(int status) __attribute__ ((__noreturn__));
129 #define UINT32_MAX 4294967295U
130 #define INT64_MIN (-INT64_MAX-1)
131 #define __DBL_MAX__ 1.7976931348623157e+308
132 #define DBL_MAX __DBL_MAX__
133 #ifndef NULL
134 #define __DARWIN_NULL 0
135 #define NULL __DARWIN_NULL
136 #endif
137 #define EOF (-1)
139 #define offsetof(t, d) __builtin_offsetof(t, d)