about summary refs log tree commit diff
path: root/include/stdio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/stdio.h')
-rw-r--r--include/stdio.h62
1 files changed, 34 insertions, 28 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 9aa2f782..7d3130e2 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_FILE
 #define __NEED_va_list
 #define __NEED_size_t
@@ -58,8 +64,8 @@ extern FILE *const stderr;
 #define stdout (stdout)
 #define stderr (stderr)
 
-FILE *fopen(const char *, const char *);
-FILE *freopen(const char *, const char *, FILE *);
+FILE *fopen(const char *__restrict, const char *__restrict);
+FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict);
 int fclose(FILE *);
 
 int remove(const char *);
@@ -74,11 +80,11 @@ int fseek(FILE *, long, int);
 long ftell(FILE *);
 void rewind(FILE *);
 
-int fgetpos(FILE *, fpos_t *);
+int fgetpos(FILE *__restrict, fpos_t *__restrict);
 int fsetpos(FILE *, const fpos_t *);
 
-size_t fread(void *, size_t, size_t, FILE *);
-size_t fwrite(const void *, size_t, size_t, FILE *);
+size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
+size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict);
 
 int fgetc(FILE *);
 int getc(FILE *);
@@ -89,35 +95,35 @@ int fputc(int, FILE *);
 int putc(int, FILE *);
 int putchar(int);
 
-char *fgets(char *, int, FILE *);
+char *fgets(char *__restrict, int, FILE *__restrict);
 #if __STDC_VERSION__ < 201112L
 char *gets(char *);
 #endif
 
-int fputs(const char *, FILE *);
+int fputs(const char *__restrict, FILE *__restrict);
 int puts(const char *);
 
-int printf(const char *, ...);
-int fprintf(FILE *, const char *, ...);
-int sprintf(char *, const char *, ...);
-int snprintf(char *, size_t, const char *, ...);
+int printf(const char *__restrict, ...);
+int fprintf(FILE *__restrict, const char *__restrict, ...);
+int sprintf(char *__restrict, const char *__restrict, ...);
+int snprintf(char *__restrict, size_t, const char *__restrict, ...);
 
-int vprintf(const char *, va_list);
-int vfprintf(FILE *, const char *, va_list);
-int vsprintf(char *, const char *, va_list);
-int vsnprintf(char *, size_t, const char *, va_list);
+int vprintf(const char *__restrict, va_list);
+int vfprintf(FILE *__restrict, const char *__restrict, va_list);
+int vsprintf(char *__restrict, const char *__restrict, va_list);
+int vsnprintf(char *__restrict, size_t, const char *__restrict, va_list);
 
-int scanf(const char *, ...);
-int fscanf(FILE *, const char *, ...);
-int sscanf(const char *, const char *, ...);
-int vscanf(const char *, va_list);
-int vfscanf(FILE *, const char *, va_list);
-int vsscanf(const char *, const char *, va_list);
+int scanf(const char *__restrict, ...);
+int fscanf(FILE *__restrict, const char *__restrict, ...);
+int sscanf(const char *__restrict, const char *__restrict, ...);
+int vscanf(const char *__restrict, va_list);
+int vfscanf(FILE *__restrict, const char *__restrict, va_list);
+int vsscanf(const char *__restrict, const char *__restrict, va_list);
 
 void perror(const char *);
 
-int setvbuf(FILE *, char *, int, size_t);
-void setbuf(FILE *, char *);
+int setvbuf(FILE *__restrict, char *__restrict, int, size_t);
+void setbuf(FILE *__restrict, char *__restrict);
 
 char *tmpnam(char *);
 FILE *tmpfile(void);
@@ -125,7 +131,7 @@ FILE *tmpfile(void);
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  || defined(_BSD_SOURCE)
-FILE *fmemopen(void *, size_t, const char *);
+FILE *fmemopen(void *__restrict, size_t, const char *__restrict);
 FILE *open_memstream(char **, size_t *);
 FILE *fdopen(int, const char *);
 FILE *popen(const char *, const char *);
@@ -133,8 +139,8 @@ int pclose(FILE *);
 int fileno(FILE *);
 int fseeko(FILE *, off_t, int);
 off_t ftello(FILE *);
-int dprintf(int, const char *, ...);
-int vdprintf(int, const char *, va_list);
+int dprintf(int, const char *__restrict, ...);
+int vdprintf(int, const char *__restrict, va_list);
 void flockfile(FILE *);
 int ftrylockfile(FILE *);
 void funlockfile(FILE *);
@@ -142,8 +148,8 @@ int getc_unlocked(FILE *);
 int getchar_unlocked(void);
 int putc_unlocked(int, FILE *);
 int putchar_unlocked(int);
-ssize_t getdelim(char **, size_t *, int, FILE *);
-ssize_t getline(char **, size_t *, FILE *);
+ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict);
+ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict);
 int renameat(int, const char *, int, const char *);
 char *ctermid(char *);
 #define L_ctermid 20