xref: /llvm-project/clang/test/Analysis/Inputs/system-header-simulator-for-valist.h (revision 239312e49b2fdf35e23d75197a621ee6087743ee)
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 
7 #pragma clang system_header
8 
9 #ifdef __cplusplus
10 #define restrict /*restrict*/
11 #endif
12 
13 typedef struct _FILE FILE;
14 
15 typedef __builtin_va_list va_list;
16 
17 #define va_start(ap, param) __builtin_va_start(ap, param)
18 #define va_end(ap)          __builtin_va_end(ap)
19 #define va_arg(ap, type)    __builtin_va_arg(ap, type)
20 #define va_copy(dst, src)   __builtin_va_copy(dst, src)
21 
22 int vprintf (const char *restrict format, va_list arg);
23 
24 int vsprintf (char *restrict s, const char *restrict format, va_list arg);
25 
26 int vfprintf(FILE *stream, const char *format, va_list ap);
27 
28 int vfscanf(FILE *stream, const char *format, va_list ap);
29 
30 int some_library_function(int n, va_list arg);
31 
32 // No warning from system header.
__impl_detail(int fst,...)33 inline void __impl_detail(int fst, ...) {
34   va_list va;
35   (void)va_arg(va, int);
36 }
37