xref: /llvm-project/clang/test/Analysis/Inputs/system-header-simulator-for-simple-stream.h (revision 69bc159142c6e4ed168e32a6168392d396f891de)
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
7 
8 typedef __typeof(sizeof(int)) size_t;
9 typedef struct _FILE {
10   unsigned char *_p;
11 } FILE;
12 FILE *fopen(const char *restrict, const char *restrict) __asm("_" "fopen" );
13 int fputc(int, FILE *);
14 int fputs(const char *restrict, FILE *restrict) __asm("_" "fputs" );
15 size_t fread(void *buffer, size_t size, size_t count, FILE *stream);
16 int fgetc(FILE *stream);
17 int fclose(FILE *);
18 void exit(int);
19 
20 // The following is a fake system header function
21 typedef struct __FileStruct {
22   FILE * p;
23 } FileStruct;
24 void fakeSystemHeaderCall(FileStruct *);
25