Home | History | Annotate | Download | only in include
      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 
     25 Macros:
     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 
     44 Types:
     45 
     46 FILE
     47 fpos_t
     48 size_t
     49 
     50 int remove(const char* filename);
     51 int rename(const char* old, const char* new);
     52 FILE* tmpfile(void);
     53 char* tmpnam(char* s);
     54 int fclose(FILE* stream);
     55 int fflush(FILE* stream);
     56 FILE* fopen(const char* restrict filename, const char* restrict mode);
     57 FILE* freopen(const char* restrict filename, const char * restrict mode,
     58               FILE * restrict stream);
     59 void setbuf(FILE* restrict stream, char* restrict buf);
     60 int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
     61 int fprintf(FILE* restrict stream, const char* restrict format, ...);
     62 int fscanf(FILE* restrict stream, const char * restrict format, ...);
     63 int printf(const char* restrict format, ...);
     64 int scanf(const char* restrict format, ...);
     65 int snprintf(char* restrict s, size_t n, const char* restrict format, ...);    // C99
     66 int sprintf(char* restrict s, const char* restrict format, ...);
     67 int sscanf(const char* restrict s, const char* restrict format, ...);
     68 int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
     69 int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg);  // C99
     70 int vprintf(const char* restrict format, va_list arg);
     71 int vscanf(const char* restrict format, va_list arg);                          // C99
     72 int vsnprintf(char* restrict s, size_t n, const char* restrict format,         // C99
     73               va_list arg);
     74 int vsprintf(char* restrict s, const char* restrict format, va_list arg);
     75 int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
     76 int fgetc(FILE* stream);
     77 char* fgets(char* restrict s, int n, FILE* restrict stream);
     78 int fputc(int c, FILE* stream);
     79 int fputs(const char* restrict s, FILE* restrict stream);
     80 int getc(FILE* stream);
     81 int getchar(void);
     82 char* gets(char* s);  // removed in C++14
     83 int putc(int c, FILE* stream);
     84 int putchar(int c);
     85 int puts(const char* s);
     86 int ungetc(int c, FILE* stream);
     87 size_t fread(void* restrict ptr, size_t size, size_t nmemb,
     88              FILE* restrict stream);
     89 size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
     90               FILE* restrict stream);
     91 int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
     92 int fseek(FILE* stream, long offset, int whence);
     93 int fsetpos(FILE*stream, const fpos_t* pos);
     94 long ftell(FILE* stream);
     95 void rewind(FILE* stream);
     96 void clearerr(FILE* stream);
     97 int feof(FILE* stream);
     98 int ferror(FILE* stream);
     99 void 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_LIKE)
    114 extern "C" {
    115 int vasprintf(char **sptr, const char *__restrict fmt, va_list ap);
    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