blob: 8b8c9c4fe17b6402d285852c838667560993ee65 [file] [log] [blame]
Jordan Rose8c888b12013-02-01 19:50:01 +00001// 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.
Anna Zakseb31a762012-01-04 23:54:01 +00006#pragma clang system_header
7
Jordan Rose262e0d42013-04-15 20:39:45 +00008#ifdef __cplusplus
9#define restrict /*restrict*/
10#endif
11
Anna Zakseb31a762012-01-04 23:54:01 +000012typedef struct _FILE FILE;
13extern FILE *stdin;
Anna Zaksca23eb22012-02-29 18:42:47 +000014extern FILE *stdout;
15extern FILE *stderr;
16// Include a variant of standard streams that occur in the pre-processed file.
17extern FILE *__stdinp;
18extern FILE *__stdoutp;
19extern FILE *__stderrp;
20
Jordan Rose9a0b3c22013-04-15 20:39:37 +000021int scanf(const char *restrict format, ...);
Anna Zaksca23eb22012-02-29 18:42:47 +000022int fscanf(FILE *restrict, const char *restrict, ...);
Jordan Rose9a0b3c22013-04-15 20:39:37 +000023int printf(const char *restrict format, ...);
24int fprintf(FILE *restrict, const char *restrict, ...);
25int getchar(void);
Anna Zakseb31a762012-01-04 23:54:01 +000026
27// Note, on some platforms errno macro gets replaced with a function call.
28extern int errno;
29
NAKAMURA Takumi9620aa82012-09-20 11:03:56 +000030typedef __typeof(sizeof(int)) size_t;
31
32size_t strlen(const char *);
Anna Zaks15d0ae12012-02-11 23:46:36 +000033
Anna Zaksca23eb22012-02-29 18:42:47 +000034char *strcpy(char *restrict, const char *restrict);
Anton Yartsevb7a747b2013-11-17 09:18:48 +000035void *memcpy(void *dst, const void *src, size_t n);
Anna Zaks15d0ae12012-02-11 23:46:36 +000036
Anna Zaks0d389b82012-02-23 01:05:27 +000037typedef unsigned long __darwin_pthread_key_t;
38typedef __darwin_pthread_key_t pthread_key_t;
Anna Zaksca23eb22012-02-29 18:42:47 +000039int pthread_setspecific(pthread_key_t, const void *);
40
41typedef long long __int64_t;
42typedef __int64_t __darwin_off_t;
43typedef __darwin_off_t fpos_t;
44
45void setbuf(FILE * restrict, char * restrict);
46int setvbuf(FILE * restrict, char * restrict, int, size_t);
47
Jordan Rose9a0b3c22013-04-15 20:39:37 +000048FILE *fopen(const char * restrict, const char * restrict);
49int fclose(FILE *);
Anna Zaksca23eb22012-02-29 18:42:47 +000050FILE *funopen(const void *,
51 int (*)(void *, char *, int),
52 int (*)(void *, const char *, int),
53 fpos_t (*)(void *, fpos_t, int),
54 int (*)(void *));
55
Anna Zaksaca0ac52012-05-03 23:50:28 +000056int sqlite3_bind_text_my(int, const char*, int n, void(*)(void*));
Anna Zaksb79d8622012-05-03 23:50:33 +000057
58typedef void (*freeCallback) (void*);
59typedef struct {
60 int i;
61 freeCallback fc;
62} StWithCallback;
63
64int dealocateMemWhenDoneByVal(void*, StWithCallback);
65int dealocateMemWhenDoneByRef(StWithCallback*, const void*);
Jordan Rose1bf908d2012-06-16 00:09:20 +000066
67typedef struct CGContext *CGContextRef;
68CGContextRef CGBitmapContextCreate(void *data/*, size_t width, size_t height,
69 size_t bitsPerComponent, size_t bytesPerRow,
70 CGColorSpaceRef space,
71 CGBitmapInfo bitmapInfo*/);
72void *CGBitmapContextGetData(CGContextRef context);
Anna Zaks52a04812012-06-20 23:35:57 +000073
74// Include xpc.
75typedef struct _xpc_connection_s * xpc_connection_t;
76typedef void (*xpc_finalizer_t)(void *value);
77void xpc_connection_set_context(xpc_connection_t connection, void *context);
78void xpc_connection_set_finalizer_f(xpc_connection_t connection, xpc_finalizer_t finalizer);
79void xpc_connection_resume(xpc_connection_t connection);
Anna Zaks233e26a2013-02-07 23:05:43 +000080
Jordan Rose374ae322013-05-10 17:07:16 +000081//The following are fake system header functions for generic testing.
Anna Zaks233e26a2013-02-07 23:05:43 +000082void fakeSystemHeaderCallInt(int *);
Jordan Rose374ae322013-05-10 17:07:16 +000083void fakeSystemHeaderCallIntPtr(int **);
Anna Zaks233e26a2013-02-07 23:05:43 +000084
85typedef struct __SomeStruct {
86 char * p;
87} SomeStruct;
88void fakeSystemHeaderCall(SomeStruct *);