• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *  * Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in
12  *    the documentation and/or other materials provided with the
13  *    distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #include <stdio.h>
30 
31 #include "header_checks.h"
32 
stdio_h()33 static void stdio_h() {
34   TYPE(FILE*);
35   TYPE(fpos_t);
36   TYPE(off_t);
37   TYPE(size_t);
38   TYPE(ssize_t);
39   TYPE(va_list);
40 
41   MACRO(BUFSIZ);
42   MACRO(L_ctermid);
43   MACRO(L_tmpnam);
44 
45   MACRO(_IOFBF);
46   MACRO(_IOLBF);
47   MACRO(_IONBF);
48 
49   MACRO(SEEK_CUR);
50   MACRO(SEEK_END);
51   MACRO(SEEK_SET);
52 
53   MACRO(FILENAME_MAX);
54   MACRO(FOPEN_MAX);
55   MACRO(TMP_MAX);
56 
57   MACRO(EOF);
58 
59   MACRO(NULL);
60 
61   const char* s;
62   s = P_tmpdir;
63 
64 #if !defined(stderr)
65 #error stderr
66 #endif
67 #if !defined(stdin)
68 #error stdin
69 #endif
70 #if !defined(stdout)
71 #error stdout
72 #endif
73   FILE* fp;
74   fp = stderr;
75   fp = stdin;
76   fp = stdout;
77 
78   FUNCTION(clearerr, void (*f)(FILE*));
79   FUNCTION(ctermid, char* (*f)(char*));
80   FUNCTION(dprintf, int (*f)(int, const char*, ...));
81   FUNCTION(fclose, int (*f)(FILE*));
82   FUNCTION(fdopen, FILE* (*f)(int, const char*));
83   FUNCTION(feof, int (*f)(FILE*));
84   FUNCTION(ferror, int (*f)(FILE*));
85   FUNCTION(fflush, int (*f)(FILE*));
86   FUNCTION(fgetc, int (*f)(FILE*));
87   FUNCTION(fgetpos, int (*f)(FILE*, fpos_t*));
88   FUNCTION(fgets, char* (*f)(char*, int, FILE*));
89   FUNCTION(fileno, int (*f)(FILE*));
90   FUNCTION(flockfile, void (*f)(FILE*));
91   FUNCTION(fmemopen, FILE* (*f)(void*, size_t, const char*));
92   FUNCTION(fopen, FILE* (*f)(const char*, const char*));
93   FUNCTION(fprintf, int (*f)(FILE*, const char*, ...));
94   FUNCTION(fputc, int (*f)(int, FILE*));
95   FUNCTION(fputs, int (*f)(const char*, FILE*));
96   FUNCTION(fread, size_t (*f)(void*, size_t, size_t, FILE*));
97   FUNCTION(freopen, FILE* (*f)(const char*, const char*, FILE*));
98   FUNCTION(fscanf, int (*f)(FILE*, const char*, ...));
99   FUNCTION(fseek, int (*f)(FILE*, long, int));
100   FUNCTION(fseeko, int (*f)(FILE*, off_t, int));
101   FUNCTION(fsetpos, int (*f)(FILE*, const fpos_t*));
102   FUNCTION(ftell, long (*f)(FILE*));
103   FUNCTION(ftello, off_t (*f)(FILE*));
104   FUNCTION(ftrylockfile, int (*f)(FILE*));
105   FUNCTION(funlockfile, void (*f)(FILE*));
106   FUNCTION(fwrite, size_t (*f)(const void*, size_t, size_t, FILE*));
107   FUNCTION(getc, int (*f)(FILE*));
108   FUNCTION(getchar, int (*f)(void));
109   FUNCTION(getc_unlocked, int (*f)(FILE*));
110   FUNCTION(getchar_unlocked, int (*f)(void));
111   FUNCTION(getdelim, ssize_t (*f)(char**, size_t*, int, FILE*));
112   FUNCTION(getline, ssize_t (*f)(char**, size_t*, FILE*));
113   // gets() was removed in C11.
114   // FUNCTION(gets, char* (*f)(char*));
115   FUNCTION(open_memstream, FILE* (*f)(char**, size_t*));
116   FUNCTION(pclose, int (*f)(FILE*));
117   FUNCTION(perror, void (*f)(const char*));
118   FUNCTION(popen, FILE* (*f)(const char*, const char*));
119   FUNCTION(printf, int (*f)(const char*, ...));
120   FUNCTION(putc, int (*f)(int, FILE*));
121   FUNCTION(putchar, int (*f)(int));
122   FUNCTION(putc_unlocked, int (*f)(int, FILE*));
123   FUNCTION(putchar_unlocked, int (*f)(int));
124   FUNCTION(puts, int (*f)(const char*));
125   FUNCTION(remove, int (*f)(const char*));
126   FUNCTION(rename, int (*f)(const char*, const char*));
127   FUNCTION(renameat, int (*f)(int, const char*, int, const char*));
128   FUNCTION(rewind, void (*f)(FILE*));
129   FUNCTION(scanf, int (*f)(const char*, ...));
130   FUNCTION(setbuf, void (*f)(FILE*, char*));
131   FUNCTION(setvbuf, int (*f)(FILE*, char*, int, size_t));
132   FUNCTION(snprintf, int (*f)(char*, size_t, const char*, ...));
133   FUNCTION(sprintf, int (*f)(char*, const char*, ...));
134   FUNCTION(sscanf, int (*f)(const char*, const char*, ...));
135   FUNCTION(tempnam, char* (*f)(const char*, const char*));
136   FUNCTION(tmpfile, FILE* (*f)(void));
137   FUNCTION(tmpnam, char* (*f)(char*));
138   FUNCTION(ungetc, int (*f)(int, FILE*));
139   FUNCTION(vdprintf, int (*f)(int, const char*, va_list));
140   FUNCTION(vfprintf, int (*f)(FILE*, const char*, va_list));
141   FUNCTION(vfscanf, int (*f)(FILE*, const char*, va_list));
142   FUNCTION(vprintf, int (*f)(const char*, va_list));
143   FUNCTION(vscanf, int (*f)(const char*, va_list));
144   FUNCTION(vsnprintf, int (*f)(char*, size_t, const char*, va_list));
145   FUNCTION(vsprintf, int (*f)(char*, const char*, va_list));
146   FUNCTION(vsscanf, int (*f)(const char*, const char*, va_list));
147 }
148