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