1// -*- C++ -*- forwarding header.
2
3// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4// 2006, 2007, 2008, 2009, 2010, 2012
5// Free Software Foundation, Inc.
6//
7// This file is part of the GNU ISO C++ Library.  This library is free
8// software; you can redistribute it and/or modify it under the
9// terms of the GNU General Public License as published by the
10// Free Software Foundation; either version 3, or (at your option)
11// any later version.
12
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16// GNU General Public License for more details.
17
18// Under Section 7 of GPL version 3, you are granted additional
19// permissions described in the GCC Runtime Library Exception, version
20// 3.1, as published by the Free Software Foundation.
21
22// You should have received a copy of the GNU General Public License and
23// a copy of the GCC Runtime Library Exception along with this program;
24// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
25// <http://www.gnu.org/licenses/>.
26
27/** @file include/cstdio
28 *  This is a Standard C++ Library file.  You should @c \#include this file
29 *  in your programs, rather than any of the @a *.h implementation files.
30 *
31 *  This is the C++ version of the Standard C Library header @c stdio.h,
32 *  and its contents are (mostly) the same as that header, but are all
33 *  contained in the namespace @c std (except for names which are defined
34 *  as macros in C).
35 */
36
37//
38// ISO C++ 14882: 27.8.2  C Library files
39//
40
41#pragma GCC system_header
42
43#include <bits/c++config.h>
44#include <stdio.h>
45
46#ifndef _GLIBCXX_CSTDIO
47#define _GLIBCXX_CSTDIO 1
48
49#ifndef _GLIBCXX_HAVE_GETS
50extern "C" char* gets (char* __s) __attribute__((deprecated));
51#endif
52
53// Get rid of those macros defined in <stdio.h> in lieu of real functions.
54#undef clearerr
55#undef fclose
56#undef feof
57#undef ferror
58#undef fflush
59#undef fgetc
60#undef fgetpos
61#undef fgets
62#undef fopen
63#undef fprintf
64#undef fputc
65#undef fputs
66#undef fread
67#undef freopen
68#undef fscanf
69#undef fseek
70#undef fsetpos
71#undef ftell
72#undef fwrite
73#undef getc
74#undef gets
75#undef perror
76#undef printf
77#undef putc
78#undef putchar
79#undef puts
80#undef remove
81#undef rename
82#undef rewind
83#undef scanf
84#undef setbuf
85#undef setvbuf
86#undef sprintf
87#undef sscanf
88#undef tmpfile
89#undef tmpnam
90#undef ungetc
91#undef vfprintf
92#undef vprintf
93#undef vsprintf
94
95namespace std
96{
97  using ::FILE;
98  using ::fpos_t;
99
100  using ::clearerr;
101  using ::fclose;
102  using ::feof;
103  using ::ferror;
104  using ::fflush;
105  using ::fgetc;
106  using ::fgetpos;
107  using ::fgets;
108  using ::fopen;
109  using ::fprintf;
110  using ::fputc;
111  using ::fputs;
112  using ::fread;
113  using ::freopen;
114  using ::fscanf;
115  using ::fseek;
116  using ::fsetpos;
117  using ::ftell;
118  using ::fwrite;
119  using ::getc;
120  using ::getchar;
121  using ::gets;
122  using ::perror;
123  using ::printf;
124  using ::putc;
125  using ::putchar;
126  using ::puts;
127  using ::remove;
128  using ::rename;
129  using ::rewind;
130  using ::scanf;
131  using ::setbuf;
132  using ::setvbuf;
133  using ::sprintf;
134  using ::sscanf;
135  using ::tmpfile;
136  using ::tmpnam;
137  using ::ungetc;
138  using ::vfprintf;
139  using ::vprintf;
140  using ::vsprintf;
141} // namespace
142
143#if _GLIBCXX_USE_C99
144
145#undef snprintf
146#undef vfscanf
147#undef vscanf
148#undef vsnprintf
149#undef vsscanf
150
151namespace __gnu_cxx
152{
153#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
154  extern "C" int
155  (snprintf)(char * __restrict, std::size_t, const char * __restrict, ...)
156  throw ();
157  extern "C" int
158  (vfscanf)(FILE * __restrict, const char * __restrict, __gnuc_va_list);
159  extern "C" int (vscanf)(const char * __restrict, __gnuc_va_list);
160  extern "C" int
161  (vsnprintf)(char * __restrict, std::size_t, const char * __restrict,
162	      __gnuc_va_list) throw ();
163  extern "C" int
164  (vsscanf)(const char * __restrict, const char * __restrict, __gnuc_va_list)
165  throw ();
166#endif
167
168#if !_GLIBCXX_USE_C99_DYNAMIC
169  using ::snprintf;
170  using ::vfscanf;
171  using ::vscanf;
172  using ::vsnprintf;
173  using ::vsscanf;
174#endif
175} // namespace __gnu_cxx
176
177namespace std
178{
179  using ::__gnu_cxx::snprintf;
180  using ::__gnu_cxx::vfscanf;
181  using ::__gnu_cxx::vscanf;
182  using ::__gnu_cxx::vsnprintf;
183  using ::__gnu_cxx::vsscanf;
184} // namespace std
185
186#endif // _GLIBCXX_USE_C99
187
188#endif
189