| 1 | /* Checking macros for stdio functions. Declarations only. |
| 2 | Copyright (C) 2004-2026 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #ifndef _BITS_STDIO2_DEC_H |
| 20 | #define _BITS_STDIO2_DEC_H 1 |
| 21 | |
| 22 | #ifndef _STDIO_H |
| 23 | # error "Never include <bits/stdio2-decl.h> directly; use <stdio.h> instead." |
| 24 | #endif |
| 25 | |
| 26 | extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen, |
| 27 | 			 const char *__restrict __format, ...) __THROW |
| 28 | __attr_access ((__write_only__, 1, 3)); |
| 29 | extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen, |
| 30 | 			 const char *__restrict __format, |
| 31 | 			 __gnuc_va_list __ap) __THROW |
| 32 | __attr_access ((__write_only__, 1, 3)); |
| 33 | |
| 34 | #if defined __USE_ISOC99 || defined __USE_UNIX98 |
| 35 | |
| 36 | extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag, |
| 37 | 			 size_t __slen, const char *__restrict __format, |
| 38 | 			 ...) __THROW |
| 39 | __attr_access ((__write_only__, 1, 2)); |
| 40 | extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag, |
| 41 | 			 size_t __slen, const char *__restrict __format, |
| 42 | 			 __gnuc_va_list __ap) __THROW |
| 43 | __attr_access ((__write_only__, 1, 2)); |
| 44 | |
| 45 | #endif |
| 46 | |
| 47 | #if __USE_FORTIFY_LEVEL > 1 |
| 48 | |
| 49 | extern int __fprintf_chk (FILE *__restrict __stream, int __flag, |
| 50 | 			 const char *__restrict __format, ...) |
| 51 | __nonnull ((1)); |
| 52 | extern int __printf_chk (int __flag, const char *__restrict __format, ...); |
| 53 | extern int __vfprintf_chk (FILE *__restrict __stream, int __flag, |
| 54 | 			 const char *__restrict __format, |
| 55 | 			 __gnuc_va_list __ap) __nonnull ((1)); |
| 56 | extern int __vprintf_chk (int __flag, const char *__restrict __format, |
| 57 | 			 __gnuc_va_list __ap); |
| 58 | |
| 59 | # ifdef __USE_XOPEN2K8 |
| 60 | extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt, |
| 61 | 			 ...) __attribute__ ((__format__ (__printf__, 3, 4))); |
| 62 | extern int __vdprintf_chk (int __fd, int __flag, |
| 63 | 			 const char *__restrict __fmt, __gnuc_va_list __arg) |
| 64 | __attribute__ ((__format__ (__printf__, 3, 0))); |
| 65 | # endif |
| 66 | |
| 67 | # ifdef __USE_GNU |
| 68 | |
| 69 | extern int __asprintf_chk (char **__restrict __ptr, int __flag, |
| 70 | 			 const char *__restrict __fmt, ...) |
| 71 | __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur; |
| 72 | extern int __vasprintf_chk (char **__restrict __ptr, int __flag, |
| 73 | 			 const char *__restrict __fmt, __gnuc_va_list __arg) |
| 74 | __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur; |
| 75 | extern int __obstack_printf_chk (struct obstack *__restrict __obstack, |
| 76 | 				 int __flag, const char *__restrict __format, |
| 77 | 				 ...) |
| 78 | __THROW __attribute__ ((__format__ (__printf__, 3, 4))); |
| 79 | extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack, |
| 80 | 				 int __flag, |
| 81 | 				 const char *__restrict __format, |
| 82 | 				 __gnuc_va_list __args) |
| 83 | __THROW __attribute__ ((__format__ (__printf__, 3, 0))); |
| 84 | |
| 85 | # endif |
| 86 | #endif |
| 87 | |
| 88 | #if __GLIBC_USE (DEPRECATED_GETS) |
| 89 | extern char *__REDIRECT (__gets_warn, (char *__str), gets) |
| 90 | __wur __warnattr ("please use fgets or getline instead, gets can't " |
| 91 | 		 "specify buffer size"); |
| 92 | |
| 93 | extern char *__gets_chk (char *__str, size_t) __wur; |
| 94 | #endif |
| 95 | |
| 96 | extern char *__REDIRECT (__fgets_alias, |
| 97 | 			 (char *__restrict __s, int __n, |
| 98 | 			 FILE *__restrict __stream), fgets) |
| 99 | __wur __attr_access ((__write_only__, 1, 2)); |
| 100 | extern char *__REDIRECT (__fgets_chk_warn, |
| 101 | 			 (char *__restrict __s, size_t __size, int __n, |
| 102 | 			 FILE *__restrict __stream), __fgets_chk) |
| 103 | __wur __warnattr ("fgets called with bigger size than length " |
| 104 | 		 "of destination buffer"); |
| 105 | |
| 106 | extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n, |
| 107 | 			 FILE *__restrict __stream) |
| 108 | __wur __attr_access ((__write_only__, 1, 3)) __nonnull ((4)); |
| 109 | |
| 110 | extern size_t __REDIRECT (__fread_alias, |
| 111 | 			 (void *__restrict __ptr, size_t __size, |
| 112 | 			 size_t __n, FILE *__restrict __stream), |
| 113 | 			 fread) __wur; |
| 114 | extern size_t __REDIRECT (__fread_chk_warn, |
| 115 | 			 (void *__restrict __ptr, size_t __ptrlen, |
| 116 | 			 size_t __size, size_t __n, |
| 117 | 			 FILE *__restrict __stream), |
| 118 | 			 __fread_chk) |
| 119 | __wur __warnattr ("fread called with bigger size * nmemb than length " |
| 120 | 		 "of destination buffer"); |
| 121 | |
| 122 | extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen, |
| 123 | 			 size_t __size, size_t __n, |
| 124 | 			 FILE *__restrict __stream) __wur __nonnull ((5)); |
| 125 | |
| 126 | #ifdef __USE_GNU |
| 127 | extern char *__REDIRECT_FORTIFY (__fgets_unlocked_alias, |
| 128 | 			 (char *__restrict __s, int __n, |
| 129 | 			 FILE *__restrict __stream), fgets_unlocked) |
| 130 | __wur __attr_access ((__write_only__, 1, 2)); |
| 131 | extern char *__REDIRECT (__fgets_unlocked_chk_warn, |
| 132 | 			 (char *__restrict __s, size_t __size, int __n, |
| 133 | 			 FILE *__restrict __stream), __fgets_unlocked_chk) |
| 134 | __wur __warnattr ("fgets_unlocked called with bigger size than length " |
| 135 | 		 "of destination buffer"); |
| 136 | |
| 137 | |
| 138 | extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size, |
| 139 | 				 int __n, FILE *__restrict __stream) |
| 140 | __wur __attr_access ((__write_only__, 1, 3)) __nonnull ((4)); |
| 141 | #endif |
| 142 | |
| 143 | #ifdef __USE_MISC |
| 144 | # undef fread_unlocked |
| 145 | extern size_t __REDIRECT (__fread_unlocked_alias, |
| 146 | 			 (void *__restrict __ptr, size_t __size, |
| 147 | 			 size_t __n, FILE *__restrict __stream), |
| 148 | 			 fread_unlocked) __wur; |
| 149 | extern size_t __REDIRECT (__fread_unlocked_chk_warn, |
| 150 | 			 (void *__restrict __ptr, size_t __ptrlen, |
| 151 | 			 size_t __size, size_t __n, |
| 152 | 			 FILE *__restrict __stream), |
| 153 | 			 __fread_unlocked_chk) |
| 154 | __wur __warnattr ("fread_unlocked called with bigger size * nmemb than " |
| 155 | 		 "length of destination buffer"); |
| 156 | |
| 157 | extern size_t __fread_unlocked_chk (void *__restrict __ptr, size_t __ptrlen, |
| 158 | 				 size_t __size, size_t __n, |
| 159 | 				 FILE *__restrict __stream) |
| 160 | __wur __nonnull ((5)); |
| 161 | #endif |
| 162 | |
| 163 | #endif /* bits/stdio2-decl.h. */ |