1 // -*- C++ -*-
2 //===---------------------------- stdio.h ---------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #if defined(__need_FILE) || defined(__need___FILE)
11 
12 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
13 #pragma GCC system_header
14 #endif
15 
16 #include_next <stdio.h>
17 
18 #elif !defined(_LIBCPP_STDIO_H)
19 #define _LIBCPP_STDIO_H
20 
21 /*
22     stdio.h synopsis
23 
24 Macros:
25 
26     BUFSIZ
27     EOF
28     FILENAME_MAX
29     FOPEN_MAX
30     L_tmpnam
31     NULL
32     SEEK_CUR
33     SEEK_END
34     SEEK_SET
35     TMP_MAX
36     _IOFBF
37     _IOLBF
38     _IONBF
39     stderr
40     stdin
41     stdout
42 
43 Types:
44 
45 FILE
46 fpos_t
47 size_t
48 
49 int remove(const char* filename);
50 int rename(const char* old, const char* new);
51 FILE* tmpfile(void);
52 char* tmpnam(char* s);
53 int fclose(FILE* stream);
54 int fflush(FILE* stream);
55 FILE* fopen(const char* restrict filename, const char* restrict mode);
56 FILE* freopen(const char* restrict filename, const char * restrict mode,
57               FILE * restrict stream);
58 void setbuf(FILE* restrict stream, char* restrict buf);
59 int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
60 int fprintf(FILE* restrict stream, const char* restrict format, ...);
61 int fscanf(FILE* restrict stream, const char * restrict format, ...);
62 int printf(const char* restrict format, ...);
63 int scanf(const char* restrict format, ...);
64 int snprintf(char* restrict s, size_t n, const char* restrict format, ...);    // C99
65 int sprintf(char* restrict s, const char* restrict format, ...);
66 int sscanf(const char* restrict s, const char* restrict format, ...);
67 int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
68 int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg);  // C99
69 int vprintf(const char* restrict format, va_list arg);
70 int vscanf(const char* restrict format, va_list arg);                          // C99
71 int vsnprintf(char* restrict s, size_t n, const char* restrict format,         // C99
72               va_list arg);
73 int vsprintf(char* restrict s, const char* restrict format, va_list arg);
74 int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
75 int fgetc(FILE* stream);
76 char* fgets(char* restrict s, int n, FILE* restrict stream);
77 int fputc(int c, FILE* stream);
78 int fputs(const char* restrict s, FILE* restrict stream);
79 int getc(FILE* stream);
80 int getchar(void);
81 char* gets(char* s);  // removed in C++14
82 int putc(int c, FILE* stream);
83 int putchar(int c);
84 int puts(const char* s);
85 int ungetc(int c, FILE* stream);
86 size_t fread(void* restrict ptr, size_t size, size_t nmemb,
87              FILE* restrict stream);
88 size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
89               FILE* restrict stream);
90 int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
91 int fseek(FILE* stream, long offset, int whence);
92 int fsetpos(FILE*stream, const fpos_t* pos);
93 long ftell(FILE* stream);
94 void rewind(FILE* stream);
95 void clearerr(FILE* stream);
96 int feof(FILE* stream);
97 int ferror(FILE* stream);
98 void perror(const char* s);
99 */
100 
101 #include <__config>
102 
103 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
104 #pragma GCC system_header
105 #endif
106 
107 #include_next <stdio.h>
108 
109 #ifdef __cplusplus
110 
111 #undef getc
112 #undef putc
113 #undef clearerr
114 #undef feof
115 #undef ferror
116 
117 #endif
118 
119 #endif  // _LIBCPP_STDIO_H
120