cstdio 4.3 KB

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