diff options
Diffstat (limited to 'gl/stdio.in.h')
-rw-r--r-- | gl/stdio.in.h | 712 |
1 files changed, 539 insertions, 173 deletions
diff --git a/gl/stdio.in.h b/gl/stdio.in.h index 06cbad00..0ca2c8e1 100644 --- a/gl/stdio.in.h +++ b/gl/stdio.in.h | |||
@@ -1,19 +1,19 @@ | |||
1 | /* A GNU-like <stdio.h>. | 1 | /* A GNU-like <stdio.h>. |
2 | 2 | ||
3 | Copyright (C) 2004, 2007-2013 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2007-2021 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU Lesser General Public License as |
7 | the Free Software Foundation; either version 3, or (at your option) | 7 | published by the Free Software Foundation; either version 2.1 of the |
8 | any later version. | 8 | License, or (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This file is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | #if __GNUC__ >= 3 | 18 | #if __GNUC__ >= 3 |
19 | @PRAGMA_SYSTEM_HEADER@ | 19 | @PRAGMA_SYSTEM_HEADER@ |
@@ -56,36 +56,103 @@ | |||
56 | May also define off_t to a 64-bit type on native Windows. */ | 56 | May also define off_t to a 64-bit type on native Windows. */ |
57 | #include <sys/types.h> | 57 | #include <sys/types.h> |
58 | 58 | ||
59 | /* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ | ||
60 | /* But in any case avoid namespace pollution on glibc systems. */ | ||
61 | #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ | ||
62 | && ! defined __GLIBC__ | ||
63 | # include <unistd.h> | ||
64 | #endif | ||
65 | |||
66 | /* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */ | ||
67 | /* But in any case avoid namespace pollution on glibc systems. */ | ||
68 | #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ | ||
69 | && ! defined __GLIBC__ | ||
70 | # include <sys/stat.h> | ||
71 | #endif | ||
72 | |||
73 | /* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include | ||
74 | it before we #define perror rpl_perror. */ | ||
75 | /* But in any case avoid namespace pollution on glibc systems. */ | ||
76 | #if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \ | ||
77 | && (defined _WIN32 && ! defined __CYGWIN__) \ | ||
78 | && ! defined __GLIBC__ | ||
79 | # include <stdlib.h> | ||
80 | #endif | ||
81 | |||
82 | /* MSVC declares 'remove' in <io.h>, not in <stdio.h>. We must include | ||
83 | it before we #define remove rpl_remove. */ | ||
84 | /* MSVC declares 'rename' in <io.h>, not in <stdio.h>. We must include | ||
85 | it before we #define rename rpl_rename. */ | ||
86 | /* But in any case avoid namespace pollution on glibc systems. */ | ||
87 | #if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \ | ||
88 | && (defined _WIN32 && ! defined __CYGWIN__) \ | ||
89 | && ! defined __GLIBC__ | ||
90 | # include <io.h> | ||
91 | #endif | ||
92 | |||
93 | |||
94 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers | ||
95 | that can be freed by passing them as the Ith argument to the | ||
96 | function F. */ | ||
97 | #ifndef _GL_ATTRIBUTE_DEALLOC | ||
98 | # if __GNUC__ >= 11 | ||
99 | # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) | ||
100 | # else | ||
101 | # define _GL_ATTRIBUTE_DEALLOC(f, i) | ||
102 | # endif | ||
103 | #endif | ||
104 | |||
59 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | 105 | /* The __attribute__ feature is available in gcc versions 2.5 and later. |
60 | The __-protected variants of the attributes 'format' and 'printf' are | 106 | The __-protected variants of the attributes 'format' and 'printf' are |
61 | accepted by gcc versions 2.6.4 (effectively 2.7) and later. | 107 | accepted by gcc versions 2.6.4 (effectively 2.7) and later. |
62 | We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because | 108 | We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because |
63 | gnulib and libintl do '#define printf __printf__' when they override | 109 | gnulib and libintl do '#define printf __printf__' when they override |
64 | the 'printf' function. */ | 110 | the 'printf' function. */ |
65 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) | 111 | #ifndef _GL_ATTRIBUTE_FORMAT |
66 | # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) | 112 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__ |
113 | # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) | ||
114 | # else | ||
115 | # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ | ||
116 | # endif | ||
117 | #endif | ||
118 | |||
119 | /* An __attribute__ __format__ specifier for a function that takes a format | ||
120 | string and arguments, where the format string directives are the ones | ||
121 | standardized by ISO C99 and POSIX. | ||
122 | _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */ | ||
123 | /* __gnu_printf__ is supported in GCC >= 4.4. */ | ||
124 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) | ||
125 | # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__ | ||
67 | #else | 126 | #else |
68 | # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ | 127 | # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__ |
69 | #endif | 128 | #endif |
70 | 129 | ||
71 | /* _GL_ATTRIBUTE_FORMAT_PRINTF | 130 | /* An __attribute__ __format__ specifier for a function that takes a format |
131 | string and arguments, where the format string directives are the ones of the | ||
132 | system printf(), rather than the ones standardized by ISO C99 and POSIX. | ||
133 | _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM */ | ||
134 | /* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to | ||
135 | the standards. The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates | ||
136 | whether this change is effective. On older mingw, it is not. */ | ||
137 | #if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU | ||
138 | # define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD | ||
139 | #else | ||
140 | # define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__ | ||
141 | #endif | ||
142 | |||
143 | /* _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD | ||
72 | indicates to GCC that the function takes a format string and arguments, | 144 | indicates to GCC that the function takes a format string and arguments, |
73 | where the format string directives are the ones standardized by ISO C99 | 145 | where the format string directives are the ones standardized by ISO C99 |
74 | and POSIX. */ | 146 | and POSIX. */ |
75 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) | 147 | #define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \ |
76 | # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ | 148 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument)) |
77 | _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) | ||
78 | #else | ||
79 | # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ | ||
80 | _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) | ||
81 | #endif | ||
82 | 149 | ||
83 | /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF, | 150 | /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD, |
84 | except that it indicates to GCC that the supported format string directives | 151 | except that it indicates to GCC that the supported format string directives |
85 | are the ones of the system printf(), rather than the ones standardized by | 152 | are the ones of the system printf(), rather than the ones standardized by |
86 | ISO C99 and POSIX. */ | 153 | ISO C99 and POSIX. */ |
87 | #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ | 154 | #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ |
88 | _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) | 155 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, formatstring_parameter, first_argument)) |
89 | 156 | ||
90 | /* _GL_ATTRIBUTE_FORMAT_SCANF | 157 | /* _GL_ATTRIBUTE_FORMAT_SCANF |
91 | indicates to GCC that the function takes a format string and arguments, | 158 | indicates to GCC that the function takes a format string and arguments, |
@@ -106,14 +173,6 @@ | |||
106 | #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ | 173 | #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ |
107 | _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) | 174 | _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) |
108 | 175 | ||
109 | /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */ | ||
110 | /* But in any case avoid namespace pollution on glibc systems. */ | ||
111 | #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ | ||
112 | && ! defined __GLIBC__ | ||
113 | # include <unistd.h> | ||
114 | #endif | ||
115 | |||
116 | |||
117 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 176 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
118 | 177 | ||
119 | /* The definition of _GL_ARG_NONNULL is copied here. */ | 178 | /* The definition of _GL_ARG_NONNULL is copied here. */ |
@@ -124,23 +183,32 @@ | |||
124 | #define _GL_STDIO_STRINGIZE(token) #token | 183 | #define _GL_STDIO_STRINGIZE(token) #token |
125 | #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) | 184 | #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) |
126 | 185 | ||
186 | /* When also using extern inline, suppress the use of static inline in | ||
187 | standard headers of problematic Apple configurations, as Libc at | ||
188 | least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., | ||
189 | <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. | ||
190 | Perhaps Apple will fix this some day. */ | ||
191 | #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ | ||
192 | && defined __GNUC__ && defined __STDC__) | ||
193 | # undef putc_unlocked | ||
194 | #endif | ||
127 | 195 | ||
128 | #if @GNULIB_DPRINTF@ | 196 | #if @GNULIB_DPRINTF@ |
129 | # if @REPLACE_DPRINTF@ | 197 | # if @REPLACE_DPRINTF@ |
130 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 198 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
131 | # define dprintf rpl_dprintf | 199 | # define dprintf rpl_dprintf |
132 | # endif | 200 | # endif |
133 | _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) | 201 | _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) |
134 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | 202 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) |
135 | _GL_ARG_NONNULL ((2))); | 203 | _GL_ARG_NONNULL ((2))); |
136 | _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); | 204 | _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); |
137 | # else | 205 | # else |
138 | # if !@HAVE_DPRINTF@ | 206 | # if !@HAVE_DPRINTF@ |
139 | _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) | 207 | _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) |
140 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | 208 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) |
141 | _GL_ARG_NONNULL ((2))); | 209 | _GL_ARG_NONNULL ((2))); |
142 | # endif | 210 | # endif |
143 | _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); | 211 | _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); |
144 | # endif | 212 | # endif |
145 | _GL_CXXALIASWARN (dprintf); | 213 | _GL_CXXALIASWARN (dprintf); |
146 | #elif defined GNULIB_POSIXCHECK | 214 | #elif defined GNULIB_POSIXCHECK |
@@ -162,7 +230,9 @@ _GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); | |||
162 | # else | 230 | # else |
163 | _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); | 231 | _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); |
164 | # endif | 232 | # endif |
233 | # if __GLIBC__ >= 2 | ||
165 | _GL_CXXALIASWARN (fclose); | 234 | _GL_CXXALIASWARN (fclose); |
235 | # endif | ||
166 | #elif defined GNULIB_POSIXCHECK | 236 | #elif defined GNULIB_POSIXCHECK |
167 | # undef fclose | 237 | # undef fclose |
168 | /* Assume fclose is always declared. */ | 238 | /* Assume fclose is always declared. */ |
@@ -170,24 +240,84 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " | |||
170 | "use gnulib module fclose for portable POSIX compliance"); | 240 | "use gnulib module fclose for portable POSIX compliance"); |
171 | #endif | 241 | #endif |
172 | 242 | ||
243 | #if @GNULIB_MDA_FCLOSEALL@ | ||
244 | /* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is | ||
245 | not required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
246 | platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have | ||
247 | it. */ | ||
248 | # if defined _WIN32 && !defined __CYGWIN__ | ||
249 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
250 | # undef fcloseall | ||
251 | # define fcloseall _fcloseall | ||
252 | # endif | ||
253 | _GL_CXXALIAS_MDA (fcloseall, int, (void)); | ||
254 | # else | ||
255 | # if @HAVE_DECL_FCLOSEALL@ | ||
256 | # if defined __FreeBSD__ || defined __DragonFly__ | ||
257 | _GL_CXXALIAS_SYS (fcloseall, void, (void)); | ||
258 | # else | ||
259 | _GL_CXXALIAS_SYS (fcloseall, int, (void)); | ||
260 | # endif | ||
261 | # endif | ||
262 | # endif | ||
263 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@ | ||
264 | _GL_CXXALIASWARN (fcloseall); | ||
265 | # endif | ||
266 | #endif | ||
267 | |||
173 | #if @GNULIB_FDOPEN@ | 268 | #if @GNULIB_FDOPEN@ |
174 | # if @REPLACE_FDOPEN@ | 269 | # if @REPLACE_FDOPEN@ |
175 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 270 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
176 | # undef fdopen | 271 | # undef fdopen |
177 | # define fdopen rpl_fdopen | 272 | # define fdopen rpl_fdopen |
178 | # endif | 273 | # endif |
179 | _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) | 274 | _GL_FUNCDECL_RPL (fdopen, FILE *, |
180 | _GL_ARG_NONNULL ((2))); | 275 | (int fd, const char *mode) |
276 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | ||
181 | _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); | 277 | _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); |
278 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
279 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
280 | # undef fdopen | ||
281 | # define fdopen _fdopen | ||
282 | # endif | ||
283 | _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); | ||
182 | # else | 284 | # else |
285 | # if __GNUC__ >= 11 | ||
286 | /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ | ||
287 | _GL_FUNCDECL_SYS (fdopen, FILE *, | ||
288 | (int fd, const char *mode) | ||
289 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | ||
290 | # endif | ||
183 | _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); | 291 | _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); |
184 | # endif | 292 | # endif |
185 | _GL_CXXALIASWARN (fdopen); | 293 | _GL_CXXALIASWARN (fdopen); |
186 | #elif defined GNULIB_POSIXCHECK | 294 | #else |
187 | # undef fdopen | 295 | # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen |
296 | /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ | ||
297 | _GL_FUNCDECL_SYS (fdopen, FILE *, | ||
298 | (int fd, const char *mode) | ||
299 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | ||
300 | # endif | ||
301 | # if defined GNULIB_POSIXCHECK | ||
302 | # undef fdopen | ||
188 | /* Assume fdopen is always declared. */ | 303 | /* Assume fdopen is always declared. */ |
189 | _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " | 304 | _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " |
190 | "use gnulib module fdopen for portability"); | 305 | "use gnulib module fdopen for portability"); |
306 | # elif @GNULIB_MDA_FDOPEN@ | ||
307 | /* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not | ||
308 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
309 | platforms by defining GNULIB_NAMESPACE::fdopen always. */ | ||
310 | # if defined _WIN32 && !defined __CYGWIN__ | ||
311 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
312 | # undef fdopen | ||
313 | # define fdopen _fdopen | ||
314 | # endif | ||
315 | _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); | ||
316 | # else | ||
317 | _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); | ||
318 | # endif | ||
319 | _GL_CXXALIASWARN (fdopen); | ||
320 | # endif | ||
191 | #endif | 321 | #endif |
192 | 322 | ||
193 | #if @GNULIB_FFLUSH@ | 323 | #if @GNULIB_FFLUSH@ |
@@ -206,7 +336,9 @@ _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); | |||
206 | # else | 336 | # else |
207 | _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); | 337 | _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); |
208 | # endif | 338 | # endif |
339 | # if __GLIBC__ >= 2 | ||
209 | _GL_CXXALIASWARN (fflush); | 340 | _GL_CXXALIASWARN (fflush); |
341 | # endif | ||
210 | #elif defined GNULIB_POSIXCHECK | 342 | #elif defined GNULIB_POSIXCHECK |
211 | # undef fflush | 343 | # undef fflush |
212 | /* Assume fflush is always declared. */ | 344 | /* Assume fflush is always declared. */ |
@@ -225,7 +357,9 @@ _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); | |||
225 | # else | 357 | # else |
226 | _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); | 358 | _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); |
227 | # endif | 359 | # endif |
360 | # if __GLIBC__ >= 2 | ||
228 | _GL_CXXALIASWARN (fgetc); | 361 | _GL_CXXALIASWARN (fgetc); |
362 | # endif | ||
229 | #endif | 363 | #endif |
230 | 364 | ||
231 | #if @GNULIB_FGETS@ | 365 | #if @GNULIB_FGETS@ |
@@ -234,13 +368,34 @@ _GL_CXXALIASWARN (fgetc); | |||
234 | # undef fgets | 368 | # undef fgets |
235 | # define fgets rpl_fgets | 369 | # define fgets rpl_fgets |
236 | # endif | 370 | # endif |
237 | _GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream) | 371 | _GL_FUNCDECL_RPL (fgets, char *, |
238 | _GL_ARG_NONNULL ((1, 3))); | 372 | (char *restrict s, int n, FILE *restrict stream) |
239 | _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream)); | 373 | _GL_ARG_NONNULL ((1, 3))); |
374 | _GL_CXXALIAS_RPL (fgets, char *, | ||
375 | (char *restrict s, int n, FILE *restrict stream)); | ||
240 | # else | 376 | # else |
241 | _GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); | 377 | _GL_CXXALIAS_SYS (fgets, char *, |
378 | (char *restrict s, int n, FILE *restrict stream)); | ||
242 | # endif | 379 | # endif |
380 | # if __GLIBC__ >= 2 | ||
243 | _GL_CXXALIASWARN (fgets); | 381 | _GL_CXXALIASWARN (fgets); |
382 | # endif | ||
383 | #endif | ||
384 | |||
385 | #if @GNULIB_MDA_FILENO@ | ||
386 | /* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not | ||
387 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
388 | platforms by defining GNULIB_NAMESPACE::fileno always. */ | ||
389 | # if defined _WIN32 && !defined __CYGWIN__ | ||
390 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
391 | # undef fileno | ||
392 | # define fileno _fileno | ||
393 | # endif | ||
394 | _GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream)); | ||
395 | # else | ||
396 | _GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream)); | ||
397 | # endif | ||
398 | _GL_CXXALIASWARN (fileno); | ||
244 | #endif | 399 | #endif |
245 | 400 | ||
246 | #if @GNULIB_FOPEN@ | 401 | #if @GNULIB_FOPEN@ |
@@ -249,18 +404,37 @@ _GL_CXXALIASWARN (fgets); | |||
249 | # undef fopen | 404 | # undef fopen |
250 | # define fopen rpl_fopen | 405 | # define fopen rpl_fopen |
251 | # endif | 406 | # endif |
252 | _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode) | 407 | _GL_FUNCDECL_RPL (fopen, FILE *, |
253 | _GL_ARG_NONNULL ((1, 2))); | 408 | (const char *restrict filename, const char *restrict mode) |
254 | _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); | 409 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); |
410 | _GL_CXXALIAS_RPL (fopen, FILE *, | ||
411 | (const char *restrict filename, const char *restrict mode)); | ||
255 | # else | 412 | # else |
256 | _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); | 413 | # if __GNUC__ >= 11 |
414 | /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ | ||
415 | _GL_FUNCDECL_SYS (fopen, FILE *, | ||
416 | (const char *restrict filename, const char *restrict mode) | ||
417 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | ||
418 | # endif | ||
419 | _GL_CXXALIAS_SYS (fopen, FILE *, | ||
420 | (const char *restrict filename, const char *restrict mode)); | ||
257 | # endif | 421 | # endif |
422 | # if __GLIBC__ >= 2 | ||
258 | _GL_CXXALIASWARN (fopen); | 423 | _GL_CXXALIASWARN (fopen); |
259 | #elif defined GNULIB_POSIXCHECK | 424 | # endif |
260 | # undef fopen | 425 | #else |
426 | # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen | ||
427 | /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ | ||
428 | _GL_FUNCDECL_SYS (fopen, FILE *, | ||
429 | (const char *restrict filename, const char *restrict mode) | ||
430 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | ||
431 | # endif | ||
432 | # if defined GNULIB_POSIXCHECK | ||
433 | # undef fopen | ||
261 | /* Assume fopen is always declared. */ | 434 | /* Assume fopen is always declared. */ |
262 | _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " | 435 | _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " |
263 | "use gnulib module fopen for portability"); | 436 | "use gnulib module fopen for portability"); |
437 | # endif | ||
264 | #endif | 438 | #endif |
265 | 439 | ||
266 | #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ | 440 | #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ |
@@ -271,19 +445,25 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian | |||
271 | # endif | 445 | # endif |
272 | # define GNULIB_overrides_fprintf 1 | 446 | # define GNULIB_overrides_fprintf 1 |
273 | # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ | 447 | # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ |
274 | _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) | 448 | _GL_FUNCDECL_RPL (fprintf, int, |
275 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | 449 | (FILE *restrict fp, const char *restrict format, ...) |
276 | _GL_ARG_NONNULL ((1, 2))); | 450 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) |
451 | _GL_ARG_NONNULL ((1, 2))); | ||
277 | # else | 452 | # else |
278 | _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) | 453 | _GL_FUNCDECL_RPL (fprintf, int, |
279 | _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) | 454 | (FILE *restrict fp, const char *restrict format, ...) |
280 | _GL_ARG_NONNULL ((1, 2))); | 455 | _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) |
456 | _GL_ARG_NONNULL ((1, 2))); | ||
281 | # endif | 457 | # endif |
282 | _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); | 458 | _GL_CXXALIAS_RPL (fprintf, int, |
459 | (FILE *restrict fp, const char *restrict format, ...)); | ||
283 | # else | 460 | # else |
284 | _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); | 461 | _GL_CXXALIAS_SYS (fprintf, int, |
462 | (FILE *restrict fp, const char *restrict format, ...)); | ||
285 | # endif | 463 | # endif |
464 | # if __GLIBC__ >= 2 | ||
286 | _GL_CXXALIASWARN (fprintf); | 465 | _GL_CXXALIASWARN (fprintf); |
466 | # endif | ||
287 | #endif | 467 | #endif |
288 | #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK | 468 | #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
289 | # if !GNULIB_overrides_fprintf | 469 | # if !GNULIB_overrides_fprintf |
@@ -334,7 +514,9 @@ _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); | |||
334 | # else | 514 | # else |
335 | _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); | 515 | _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); |
336 | # endif | 516 | # endif |
517 | # if __GLIBC__ >= 2 | ||
337 | _GL_CXXALIASWARN (fputc); | 518 | _GL_CXXALIASWARN (fputc); |
519 | # endif | ||
338 | #endif | 520 | #endif |
339 | 521 | ||
340 | #if @GNULIB_FPUTS@ | 522 | #if @GNULIB_FPUTS@ |
@@ -343,13 +525,18 @@ _GL_CXXALIASWARN (fputc); | |||
343 | # undef fputs | 525 | # undef fputs |
344 | # define fputs rpl_fputs | 526 | # define fputs rpl_fputs |
345 | # endif | 527 | # endif |
346 | _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream) | 528 | _GL_FUNCDECL_RPL (fputs, int, |
347 | _GL_ARG_NONNULL ((1, 2))); | 529 | (const char *restrict string, FILE *restrict stream) |
348 | _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); | 530 | _GL_ARG_NONNULL ((1, 2))); |
531 | _GL_CXXALIAS_RPL (fputs, int, | ||
532 | (const char *restrict string, FILE *restrict stream)); | ||
349 | # else | 533 | # else |
350 | _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); | 534 | _GL_CXXALIAS_SYS (fputs, int, |
535 | (const char *restrict string, FILE *restrict stream)); | ||
351 | # endif | 536 | # endif |
537 | # if __GLIBC__ >= 2 | ||
352 | _GL_CXXALIASWARN (fputs); | 538 | _GL_CXXALIASWARN (fputs); |
539 | # endif | ||
353 | #endif | 540 | #endif |
354 | 541 | ||
355 | #if @GNULIB_FREAD@ | 542 | #if @GNULIB_FREAD@ |
@@ -358,13 +545,21 @@ _GL_CXXALIASWARN (fputs); | |||
358 | # undef fread | 545 | # undef fread |
359 | # define fread rpl_fread | 546 | # define fread rpl_fread |
360 | # endif | 547 | # endif |
361 | _GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream) | 548 | _GL_FUNCDECL_RPL (fread, size_t, |
362 | _GL_ARG_NONNULL ((4))); | 549 | (void *restrict ptr, size_t s, size_t n, |
363 | _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); | 550 | FILE *restrict stream) |
551 | _GL_ARG_NONNULL ((4))); | ||
552 | _GL_CXXALIAS_RPL (fread, size_t, | ||
553 | (void *restrict ptr, size_t s, size_t n, | ||
554 | FILE *restrict stream)); | ||
364 | # else | 555 | # else |
365 | _GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); | 556 | _GL_CXXALIAS_SYS (fread, size_t, |
557 | (void *restrict ptr, size_t s, size_t n, | ||
558 | FILE *restrict stream)); | ||
366 | # endif | 559 | # endif |
560 | # if __GLIBC__ >= 2 | ||
367 | _GL_CXXALIASWARN (fread); | 561 | _GL_CXXALIASWARN (fread); |
562 | # endif | ||
368 | #endif | 563 | #endif |
369 | 564 | ||
370 | #if @GNULIB_FREOPEN@ | 565 | #if @GNULIB_FREOPEN@ |
@@ -374,15 +569,20 @@ _GL_CXXALIASWARN (fread); | |||
374 | # define freopen rpl_freopen | 569 | # define freopen rpl_freopen |
375 | # endif | 570 | # endif |
376 | _GL_FUNCDECL_RPL (freopen, FILE *, | 571 | _GL_FUNCDECL_RPL (freopen, FILE *, |
377 | (const char *filename, const char *mode, FILE *stream) | 572 | (const char *restrict filename, const char *restrict mode, |
573 | FILE *restrict stream) | ||
378 | _GL_ARG_NONNULL ((2, 3))); | 574 | _GL_ARG_NONNULL ((2, 3))); |
379 | _GL_CXXALIAS_RPL (freopen, FILE *, | 575 | _GL_CXXALIAS_RPL (freopen, FILE *, |
380 | (const char *filename, const char *mode, FILE *stream)); | 576 | (const char *restrict filename, const char *restrict mode, |
577 | FILE *restrict stream)); | ||
381 | # else | 578 | # else |
382 | _GL_CXXALIAS_SYS (freopen, FILE *, | 579 | _GL_CXXALIAS_SYS (freopen, FILE *, |
383 | (const char *filename, const char *mode, FILE *stream)); | 580 | (const char *restrict filename, const char *restrict mode, |
581 | FILE *restrict stream)); | ||
384 | # endif | 582 | # endif |
583 | # if __GLIBC__ >= 2 | ||
385 | _GL_CXXALIASWARN (freopen); | 584 | _GL_CXXALIASWARN (freopen); |
585 | # endif | ||
386 | #elif defined GNULIB_POSIXCHECK | 586 | #elif defined GNULIB_POSIXCHECK |
387 | # undef freopen | 587 | # undef freopen |
388 | /* Assume freopen is always declared. */ | 588 | /* Assume freopen is always declared. */ |
@@ -397,14 +597,19 @@ _GL_WARN_ON_USE (freopen, | |||
397 | # undef fscanf | 597 | # undef fscanf |
398 | # define fscanf rpl_fscanf | 598 | # define fscanf rpl_fscanf |
399 | # endif | 599 | # endif |
400 | _GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...) | 600 | _GL_FUNCDECL_RPL (fscanf, int, |
401 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) | 601 | (FILE *restrict stream, const char *restrict format, ...) |
402 | _GL_ARG_NONNULL ((1, 2))); | 602 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) |
403 | _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...)); | 603 | _GL_ARG_NONNULL ((1, 2))); |
604 | _GL_CXXALIAS_RPL (fscanf, int, | ||
605 | (FILE *restrict stream, const char *restrict format, ...)); | ||
404 | # else | 606 | # else |
405 | _GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); | 607 | _GL_CXXALIAS_SYS (fscanf, int, |
608 | (FILE *restrict stream, const char *restrict format, ...)); | ||
406 | # endif | 609 | # endif |
610 | # if __GLIBC__ >= 2 | ||
407 | _GL_CXXALIASWARN (fscanf); | 611 | _GL_CXXALIASWARN (fscanf); |
612 | # endif | ||
408 | #endif | 613 | #endif |
409 | 614 | ||
410 | 615 | ||
@@ -455,7 +660,9 @@ _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); | |||
455 | # else | 660 | # else |
456 | _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); | 661 | _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); |
457 | # endif | 662 | # endif |
663 | # if __GLIBC__ >= 2 | ||
458 | _GL_CXXALIASWARN (fseek); | 664 | _GL_CXXALIASWARN (fseek); |
665 | # endif | ||
459 | #endif | 666 | #endif |
460 | 667 | ||
461 | #if @GNULIB_FSEEKO@ | 668 | #if @GNULIB_FSEEKO@ |
@@ -518,7 +725,9 @@ _GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); | |||
518 | # else | 725 | # else |
519 | _GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); | 726 | _GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); |
520 | # endif | 727 | # endif |
728 | # if __GLIBC__ >= 2 | ||
521 | _GL_CXXALIASWARN (ftell); | 729 | _GL_CXXALIASWARN (ftell); |
730 | # endif | ||
522 | #endif | 731 | #endif |
523 | 732 | ||
524 | #if @GNULIB_FTELLO@ | 733 | #if @GNULIB_FTELLO@ |
@@ -567,16 +776,19 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " | |||
567 | # define fwrite rpl_fwrite | 776 | # define fwrite rpl_fwrite |
568 | # endif | 777 | # endif |
569 | _GL_FUNCDECL_RPL (fwrite, size_t, | 778 | _GL_FUNCDECL_RPL (fwrite, size_t, |
570 | (const void *ptr, size_t s, size_t n, FILE *stream) | 779 | (const void *restrict ptr, size_t s, size_t n, |
780 | FILE *restrict stream) | ||
571 | _GL_ARG_NONNULL ((1, 4))); | 781 | _GL_ARG_NONNULL ((1, 4))); |
572 | _GL_CXXALIAS_RPL (fwrite, size_t, | 782 | _GL_CXXALIAS_RPL (fwrite, size_t, |
573 | (const void *ptr, size_t s, size_t n, FILE *stream)); | 783 | (const void *restrict ptr, size_t s, size_t n, |
784 | FILE *restrict stream)); | ||
574 | # else | 785 | # else |
575 | _GL_CXXALIAS_SYS (fwrite, size_t, | 786 | _GL_CXXALIAS_SYS (fwrite, size_t, |
576 | (const void *ptr, size_t s, size_t n, FILE *stream)); | 787 | (const void *restrict ptr, size_t s, size_t n, |
788 | FILE *restrict stream)); | ||
577 | 789 | ||
578 | /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 | 790 | /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 |
579 | <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>, | 791 | <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>, |
580 | which sometimes causes an unwanted diagnostic for fwrite calls. | 792 | which sometimes causes an unwanted diagnostic for fwrite calls. |
581 | This affects only function declaration attributes under certain | 793 | This affects only function declaration attributes under certain |
582 | versions of gcc and clang, and is not needed for C++. */ | 794 | versions of gcc and clang, and is not needed for C++. */ |
@@ -598,7 +810,9 @@ extern size_t __REDIRECT (rpl_fwrite_unlocked, | |||
598 | # define fwrite_unlocked rpl_fwrite_unlocked | 810 | # define fwrite_unlocked rpl_fwrite_unlocked |
599 | # endif | 811 | # endif |
600 | # endif | 812 | # endif |
813 | # if __GLIBC__ >= 2 | ||
601 | _GL_CXXALIASWARN (fwrite); | 814 | _GL_CXXALIASWARN (fwrite); |
815 | # endif | ||
602 | #endif | 816 | #endif |
603 | 817 | ||
604 | #if @GNULIB_GETC@ | 818 | #if @GNULIB_GETC@ |
@@ -612,7 +826,9 @@ _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); | |||
612 | # else | 826 | # else |
613 | _GL_CXXALIAS_SYS (getc, int, (FILE *stream)); | 827 | _GL_CXXALIAS_SYS (getc, int, (FILE *stream)); |
614 | # endif | 828 | # endif |
829 | # if __GLIBC__ >= 2 | ||
615 | _GL_CXXALIASWARN (getc); | 830 | _GL_CXXALIASWARN (getc); |
831 | # endif | ||
616 | #endif | 832 | #endif |
617 | 833 | ||
618 | #if @GNULIB_GETCHAR@ | 834 | #if @GNULIB_GETCHAR@ |
@@ -626,7 +842,9 @@ _GL_CXXALIAS_RPL (getchar, int, (void)); | |||
626 | # else | 842 | # else |
627 | _GL_CXXALIAS_SYS (getchar, int, (void)); | 843 | _GL_CXXALIAS_SYS (getchar, int, (void)); |
628 | # endif | 844 | # endif |
845 | # if __GLIBC__ >= 2 | ||
629 | _GL_CXXALIASWARN (getchar); | 846 | _GL_CXXALIASWARN (getchar); |
847 | # endif | ||
630 | #endif | 848 | #endif |
631 | 849 | ||
632 | #if @GNULIB_GETDELIM@ | 850 | #if @GNULIB_GETDELIM@ |
@@ -642,22 +860,26 @@ _GL_CXXALIASWARN (getchar); | |||
642 | # define getdelim rpl_getdelim | 860 | # define getdelim rpl_getdelim |
643 | # endif | 861 | # endif |
644 | _GL_FUNCDECL_RPL (getdelim, ssize_t, | 862 | _GL_FUNCDECL_RPL (getdelim, ssize_t, |
645 | (char **lineptr, size_t *linesize, int delimiter, | 863 | (char **restrict lineptr, size_t *restrict linesize, |
646 | FILE *stream) | 864 | int delimiter, |
865 | FILE *restrict stream) | ||
647 | _GL_ARG_NONNULL ((1, 2, 4))); | 866 | _GL_ARG_NONNULL ((1, 2, 4))); |
648 | _GL_CXXALIAS_RPL (getdelim, ssize_t, | 867 | _GL_CXXALIAS_RPL (getdelim, ssize_t, |
649 | (char **lineptr, size_t *linesize, int delimiter, | 868 | (char **restrict lineptr, size_t *restrict linesize, |
650 | FILE *stream)); | 869 | int delimiter, |
870 | FILE *restrict stream)); | ||
651 | # else | 871 | # else |
652 | # if !@HAVE_DECL_GETDELIM@ | 872 | # if !@HAVE_DECL_GETDELIM@ |
653 | _GL_FUNCDECL_SYS (getdelim, ssize_t, | 873 | _GL_FUNCDECL_SYS (getdelim, ssize_t, |
654 | (char **lineptr, size_t *linesize, int delimiter, | 874 | (char **restrict lineptr, size_t *restrict linesize, |
655 | FILE *stream) | 875 | int delimiter, |
876 | FILE *restrict stream) | ||
656 | _GL_ARG_NONNULL ((1, 2, 4))); | 877 | _GL_ARG_NONNULL ((1, 2, 4))); |
657 | # endif | 878 | # endif |
658 | _GL_CXXALIAS_SYS (getdelim, ssize_t, | 879 | _GL_CXXALIAS_SYS (getdelim, ssize_t, |
659 | (char **lineptr, size_t *linesize, int delimiter, | 880 | (char **restrict lineptr, size_t *restrict linesize, |
660 | FILE *stream)); | 881 | int delimiter, |
882 | FILE *restrict stream)); | ||
661 | # endif | 883 | # endif |
662 | _GL_CXXALIASWARN (getdelim); | 884 | _GL_CXXALIASWARN (getdelim); |
663 | #elif defined GNULIB_POSIXCHECK | 885 | #elif defined GNULIB_POSIXCHECK |
@@ -681,18 +903,22 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " | |||
681 | # define getline rpl_getline | 903 | # define getline rpl_getline |
682 | # endif | 904 | # endif |
683 | _GL_FUNCDECL_RPL (getline, ssize_t, | 905 | _GL_FUNCDECL_RPL (getline, ssize_t, |
684 | (char **lineptr, size_t *linesize, FILE *stream) | 906 | (char **restrict lineptr, size_t *restrict linesize, |
907 | FILE *restrict stream) | ||
685 | _GL_ARG_NONNULL ((1, 2, 3))); | 908 | _GL_ARG_NONNULL ((1, 2, 3))); |
686 | _GL_CXXALIAS_RPL (getline, ssize_t, | 909 | _GL_CXXALIAS_RPL (getline, ssize_t, |
687 | (char **lineptr, size_t *linesize, FILE *stream)); | 910 | (char **restrict lineptr, size_t *restrict linesize, |
911 | FILE *restrict stream)); | ||
688 | # else | 912 | # else |
689 | # if !@HAVE_DECL_GETLINE@ | 913 | # if !@HAVE_DECL_GETLINE@ |
690 | _GL_FUNCDECL_SYS (getline, ssize_t, | 914 | _GL_FUNCDECL_SYS (getline, ssize_t, |
691 | (char **lineptr, size_t *linesize, FILE *stream) | 915 | (char **restrict lineptr, size_t *restrict linesize, |
916 | FILE *restrict stream) | ||
692 | _GL_ARG_NONNULL ((1, 2, 3))); | 917 | _GL_ARG_NONNULL ((1, 2, 3))); |
693 | # endif | 918 | # endif |
694 | _GL_CXXALIAS_SYS (getline, ssize_t, | 919 | _GL_CXXALIAS_SYS (getline, ssize_t, |
695 | (char **lineptr, size_t *linesize, FILE *stream)); | 920 | (char **restrict lineptr, size_t *restrict linesize, |
921 | FILE *restrict stream)); | ||
696 | # endif | 922 | # endif |
697 | # if @HAVE_DECL_GETLINE@ | 923 | # if @HAVE_DECL_GETLINE@ |
698 | _GL_CXXALIASWARN (getline); | 924 | _GL_CXXALIASWARN (getline); |
@@ -709,10 +935,25 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " | |||
709 | so any use of gets warrants an unconditional warning; besides, C11 | 935 | so any use of gets warrants an unconditional warning; besides, C11 |
710 | removed it. */ | 936 | removed it. */ |
711 | #undef gets | 937 | #undef gets |
712 | #if HAVE_RAW_DECL_GETS | 938 | #if HAVE_RAW_DECL_GETS && !defined __cplusplus |
713 | _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); | 939 | _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); |
714 | #endif | 940 | #endif |
715 | 941 | ||
942 | #if @GNULIB_MDA_GETW@ | ||
943 | /* On native Windows, map 'getw' to '_getw', so that -loldnames is not | ||
944 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
945 | platforms by defining GNULIB_NAMESPACE::getw always. */ | ||
946 | # if defined _WIN32 && !defined __CYGWIN__ | ||
947 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
948 | # undef getw | ||
949 | # define getw _getw | ||
950 | # endif | ||
951 | _GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream)); | ||
952 | # else | ||
953 | _GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); | ||
954 | # endif | ||
955 | _GL_CXXALIASWARN (getw); | ||
956 | #endif | ||
716 | 957 | ||
717 | #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ | 958 | #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ |
718 | struct obstack; | 959 | struct obstack; |
@@ -727,7 +968,7 @@ struct obstack; | |||
727 | # endif | 968 | # endif |
728 | _GL_FUNCDECL_RPL (obstack_printf, int, | 969 | _GL_FUNCDECL_RPL (obstack_printf, int, |
729 | (struct obstack *obs, const char *format, ...) | 970 | (struct obstack *obs, const char *format, ...) |
730 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | 971 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) |
731 | _GL_ARG_NONNULL ((1, 2))); | 972 | _GL_ARG_NONNULL ((1, 2))); |
732 | _GL_CXXALIAS_RPL (obstack_printf, int, | 973 | _GL_CXXALIAS_RPL (obstack_printf, int, |
733 | (struct obstack *obs, const char *format, ...)); | 974 | (struct obstack *obs, const char *format, ...)); |
@@ -735,7 +976,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int, | |||
735 | # if !@HAVE_DECL_OBSTACK_PRINTF@ | 976 | # if !@HAVE_DECL_OBSTACK_PRINTF@ |
736 | _GL_FUNCDECL_SYS (obstack_printf, int, | 977 | _GL_FUNCDECL_SYS (obstack_printf, int, |
737 | (struct obstack *obs, const char *format, ...) | 978 | (struct obstack *obs, const char *format, ...) |
738 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | 979 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) |
739 | _GL_ARG_NONNULL ((1, 2))); | 980 | _GL_ARG_NONNULL ((1, 2))); |
740 | # endif | 981 | # endif |
741 | _GL_CXXALIAS_SYS (obstack_printf, int, | 982 | _GL_CXXALIAS_SYS (obstack_printf, int, |
@@ -748,7 +989,7 @@ _GL_CXXALIASWARN (obstack_printf); | |||
748 | # endif | 989 | # endif |
749 | _GL_FUNCDECL_RPL (obstack_vprintf, int, | 990 | _GL_FUNCDECL_RPL (obstack_vprintf, int, |
750 | (struct obstack *obs, const char *format, va_list args) | 991 | (struct obstack *obs, const char *format, va_list args) |
751 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | 992 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) |
752 | _GL_ARG_NONNULL ((1, 2))); | 993 | _GL_ARG_NONNULL ((1, 2))); |
753 | _GL_CXXALIAS_RPL (obstack_vprintf, int, | 994 | _GL_CXXALIAS_RPL (obstack_vprintf, int, |
754 | (struct obstack *obs, const char *format, va_list args)); | 995 | (struct obstack *obs, const char *format, va_list args)); |
@@ -756,7 +997,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int, | |||
756 | # if !@HAVE_DECL_OBSTACK_PRINTF@ | 997 | # if !@HAVE_DECL_OBSTACK_PRINTF@ |
757 | _GL_FUNCDECL_SYS (obstack_vprintf, int, | 998 | _GL_FUNCDECL_SYS (obstack_vprintf, int, |
758 | (struct obstack *obs, const char *format, va_list args) | 999 | (struct obstack *obs, const char *format, va_list args) |
759 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | 1000 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) |
760 | _GL_ARG_NONNULL ((1, 2))); | 1001 | _GL_ARG_NONNULL ((1, 2))); |
761 | # endif | 1002 | # endif |
762 | _GL_CXXALIAS_SYS (obstack_vprintf, int, | 1003 | _GL_CXXALIAS_SYS (obstack_vprintf, int, |
@@ -792,7 +1033,9 @@ _GL_CXXALIAS_RPL (perror, void, (const char *string)); | |||
792 | # else | 1033 | # else |
793 | _GL_CXXALIAS_SYS (perror, void, (const char *string)); | 1034 | _GL_CXXALIAS_SYS (perror, void, (const char *string)); |
794 | # endif | 1035 | # endif |
1036 | # if __GLIBC__ >= 2 | ||
795 | _GL_CXXALIASWARN (perror); | 1037 | _GL_CXXALIASWARN (perror); |
1038 | # endif | ||
796 | #elif defined GNULIB_POSIXCHECK | 1039 | #elif defined GNULIB_POSIXCHECK |
797 | # undef perror | 1040 | # undef perror |
798 | /* Assume perror is always declared. */ | 1041 | /* Assume perror is always declared. */ |
@@ -806,43 +1049,53 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " | |||
806 | # undef popen | 1049 | # undef popen |
807 | # define popen rpl_popen | 1050 | # define popen rpl_popen |
808 | # endif | 1051 | # endif |
809 | _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) | 1052 | _GL_FUNCDECL_RPL (popen, FILE *, |
810 | _GL_ARG_NONNULL ((1, 2))); | 1053 | (const char *cmd, const char *mode) |
1054 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); | ||
811 | _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); | 1055 | _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); |
812 | # else | 1056 | # else |
813 | # if !@HAVE_POPEN@ | 1057 | # if !@HAVE_POPEN@ || __GNUC__ >= 11 |
814 | _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) | 1058 | _GL_FUNCDECL_SYS (popen, FILE *, |
815 | _GL_ARG_NONNULL ((1, 2))); | 1059 | (const char *cmd, const char *mode) |
1060 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); | ||
816 | # endif | 1061 | # endif |
817 | _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); | 1062 | _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); |
818 | # endif | 1063 | # endif |
819 | _GL_CXXALIASWARN (popen); | 1064 | _GL_CXXALIASWARN (popen); |
820 | #elif defined GNULIB_POSIXCHECK | 1065 | #else |
821 | # undef popen | 1066 | # if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen |
822 | # if HAVE_RAW_DECL_POPEN | 1067 | /* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ |
1068 | _GL_FUNCDECL_SYS (popen, FILE *, | ||
1069 | (const char *cmd, const char *mode) | ||
1070 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); | ||
1071 | # endif | ||
1072 | # if defined GNULIB_POSIXCHECK | ||
1073 | # undef popen | ||
1074 | # if HAVE_RAW_DECL_POPEN | ||
823 | _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " | 1075 | _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " |
824 | "use gnulib module popen or pipe for more portability"); | 1076 | "use gnulib module popen or pipe for more portability"); |
1077 | # endif | ||
825 | # endif | 1078 | # endif |
826 | #endif | 1079 | #endif |
827 | 1080 | ||
828 | #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ | 1081 | #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ |
829 | # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ | 1082 | # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ |
830 | || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) | 1083 | || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) |
831 | # if defined __GNUC__ | 1084 | # if defined __GNUC__ || defined __clang__ |
832 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1085 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
833 | /* Don't break __attribute__((format(printf,M,N))). */ | 1086 | /* Don't break __attribute__((format(printf,M,N))). */ |
834 | # define printf __printf__ | 1087 | # define printf __printf__ |
835 | # endif | 1088 | # endif |
836 | # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ | 1089 | # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ |
837 | _GL_FUNCDECL_RPL_1 (__printf__, int, | 1090 | _GL_FUNCDECL_RPL_1 (__printf__, int, |
838 | (const char *format, ...) | 1091 | (const char *restrict format, ...) |
839 | __asm__ (@ASM_SYMBOL_PREFIX@ | 1092 | __asm__ (@ASM_SYMBOL_PREFIX@ |
840 | _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) | 1093 | _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) |
841 | _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) | 1094 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) |
842 | _GL_ARG_NONNULL ((1))); | 1095 | _GL_ARG_NONNULL ((1))); |
843 | # else | 1096 | # else |
844 | _GL_FUNCDECL_RPL_1 (__printf__, int, | 1097 | _GL_FUNCDECL_RPL_1 (__printf__, int, |
845 | (const char *format, ...) | 1098 | (const char *restrict format, ...) |
846 | __asm__ (@ASM_SYMBOL_PREFIX@ | 1099 | __asm__ (@ASM_SYMBOL_PREFIX@ |
847 | _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) | 1100 | _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) |
848 | _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) | 1101 | _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) |
@@ -854,16 +1107,18 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); | |||
854 | # define printf rpl_printf | 1107 | # define printf rpl_printf |
855 | # endif | 1108 | # endif |
856 | _GL_FUNCDECL_RPL (printf, int, | 1109 | _GL_FUNCDECL_RPL (printf, int, |
857 | (const char *format, ...) | 1110 | (const char *restrict format, ...) |
858 | _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) | 1111 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) |
859 | _GL_ARG_NONNULL ((1))); | 1112 | _GL_ARG_NONNULL ((1))); |
860 | _GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); | 1113 | _GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); |
861 | # endif | 1114 | # endif |
862 | # define GNULIB_overrides_printf 1 | 1115 | # define GNULIB_overrides_printf 1 |
863 | # else | 1116 | # else |
864 | _GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); | 1117 | _GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...)); |
865 | # endif | 1118 | # endif |
1119 | # if __GLIBC__ >= 2 | ||
866 | _GL_CXXALIASWARN (printf); | 1120 | _GL_CXXALIASWARN (printf); |
1121 | # endif | ||
867 | #endif | 1122 | #endif |
868 | #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK | 1123 | #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
869 | # if !GNULIB_overrides_printf | 1124 | # if !GNULIB_overrides_printf |
@@ -886,7 +1141,9 @@ _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); | |||
886 | # else | 1141 | # else |
887 | _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); | 1142 | _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); |
888 | # endif | 1143 | # endif |
1144 | # if __GLIBC__ >= 2 | ||
889 | _GL_CXXALIASWARN (putc); | 1145 | _GL_CXXALIASWARN (putc); |
1146 | # endif | ||
890 | #endif | 1147 | #endif |
891 | 1148 | ||
892 | #if @GNULIB_PUTCHAR@ | 1149 | #if @GNULIB_PUTCHAR@ |
@@ -900,7 +1157,9 @@ _GL_CXXALIAS_RPL (putchar, int, (int c)); | |||
900 | # else | 1157 | # else |
901 | _GL_CXXALIAS_SYS (putchar, int, (int c)); | 1158 | _GL_CXXALIAS_SYS (putchar, int, (int c)); |
902 | # endif | 1159 | # endif |
1160 | # if __GLIBC__ >= 2 | ||
903 | _GL_CXXALIASWARN (putchar); | 1161 | _GL_CXXALIASWARN (putchar); |
1162 | # endif | ||
904 | #endif | 1163 | #endif |
905 | 1164 | ||
906 | #if @GNULIB_PUTS@ | 1165 | #if @GNULIB_PUTS@ |
@@ -914,7 +1173,25 @@ _GL_CXXALIAS_RPL (puts, int, (const char *string)); | |||
914 | # else | 1173 | # else |
915 | _GL_CXXALIAS_SYS (puts, int, (const char *string)); | 1174 | _GL_CXXALIAS_SYS (puts, int, (const char *string)); |
916 | # endif | 1175 | # endif |
1176 | # if __GLIBC__ >= 2 | ||
917 | _GL_CXXALIASWARN (puts); | 1177 | _GL_CXXALIASWARN (puts); |
1178 | # endif | ||
1179 | #endif | ||
1180 | |||
1181 | #if @GNULIB_MDA_PUTW@ | ||
1182 | /* On native Windows, map 'putw' to '_putw', so that -loldnames is not | ||
1183 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
1184 | platforms by defining GNULIB_NAMESPACE::putw always. */ | ||
1185 | # if defined _WIN32 && !defined __CYGWIN__ | ||
1186 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1187 | # undef putw | ||
1188 | # define putw _putw | ||
1189 | # endif | ||
1190 | _GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream)); | ||
1191 | # else | ||
1192 | _GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); | ||
1193 | # endif | ||
1194 | _GL_CXXALIASWARN (putw); | ||
918 | #endif | 1195 | #endif |
919 | 1196 | ||
920 | #if @GNULIB_REMOVE@ | 1197 | #if @GNULIB_REMOVE@ |
@@ -928,7 +1205,9 @@ _GL_CXXALIAS_RPL (remove, int, (const char *name)); | |||
928 | # else | 1205 | # else |
929 | _GL_CXXALIAS_SYS (remove, int, (const char *name)); | 1206 | _GL_CXXALIAS_SYS (remove, int, (const char *name)); |
930 | # endif | 1207 | # endif |
1208 | # if __GLIBC__ >= 2 | ||
931 | _GL_CXXALIASWARN (remove); | 1209 | _GL_CXXALIASWARN (remove); |
1210 | # endif | ||
932 | #elif defined GNULIB_POSIXCHECK | 1211 | #elif defined GNULIB_POSIXCHECK |
933 | # undef remove | 1212 | # undef remove |
934 | /* Assume remove is always declared. */ | 1213 | /* Assume remove is always declared. */ |
@@ -951,7 +1230,9 @@ _GL_CXXALIAS_RPL (rename, int, | |||
951 | _GL_CXXALIAS_SYS (rename, int, | 1230 | _GL_CXXALIAS_SYS (rename, int, |
952 | (const char *old_filename, const char *new_filename)); | 1231 | (const char *old_filename, const char *new_filename)); |
953 | # endif | 1232 | # endif |
1233 | # if __GLIBC__ >= 2 | ||
954 | _GL_CXXALIASWARN (rename); | 1234 | _GL_CXXALIASWARN (rename); |
1235 | # endif | ||
955 | #elif defined GNULIB_POSIXCHECK | 1236 | #elif defined GNULIB_POSIXCHECK |
956 | # undef rename | 1237 | # undef rename |
957 | /* Assume rename is always declared. */ | 1238 | /* Assume rename is always declared. */ |
@@ -990,33 +1271,35 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - " | |||
990 | 1271 | ||
991 | #if @GNULIB_SCANF@ | 1272 | #if @GNULIB_SCANF@ |
992 | # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ | 1273 | # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ |
993 | # if defined __GNUC__ | 1274 | # if defined __GNUC__ || defined __clang__ |
994 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1275 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
995 | # undef scanf | 1276 | # undef scanf |
996 | /* Don't break __attribute__((format(scanf,M,N))). */ | 1277 | /* Don't break __attribute__((format(scanf,M,N))). */ |
997 | # define scanf __scanf__ | 1278 | # define scanf __scanf__ |
998 | # endif | 1279 | # endif |
999 | _GL_FUNCDECL_RPL_1 (__scanf__, int, | 1280 | _GL_FUNCDECL_RPL_1 (__scanf__, int, |
1000 | (const char *format, ...) | 1281 | (const char *restrict format, ...) |
1001 | __asm__ (@ASM_SYMBOL_PREFIX@ | 1282 | __asm__ (@ASM_SYMBOL_PREFIX@ |
1002 | _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) | 1283 | _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) |
1003 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) | 1284 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) |
1004 | _GL_ARG_NONNULL ((1))); | 1285 | _GL_ARG_NONNULL ((1))); |
1005 | _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...)); | 1286 | _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); |
1006 | # else | 1287 | # else |
1007 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1288 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1008 | # undef scanf | 1289 | # undef scanf |
1009 | # define scanf rpl_scanf | 1290 | # define scanf rpl_scanf |
1010 | # endif | 1291 | # endif |
1011 | _GL_FUNCDECL_RPL (scanf, int, (const char *format, ...) | 1292 | _GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) |
1012 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) | 1293 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) |
1013 | _GL_ARG_NONNULL ((1))); | 1294 | _GL_ARG_NONNULL ((1))); |
1014 | _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...)); | 1295 | _GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); |
1015 | # endif | 1296 | # endif |
1016 | # else | 1297 | # else |
1017 | _GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); | 1298 | _GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...)); |
1018 | # endif | 1299 | # endif |
1300 | # if __GLIBC__ >= 2 | ||
1019 | _GL_CXXALIASWARN (scanf); | 1301 | _GL_CXXALIASWARN (scanf); |
1302 | # endif | ||
1020 | #endif | 1303 | #endif |
1021 | 1304 | ||
1022 | #if @GNULIB_SNPRINTF@ | 1305 | #if @GNULIB_SNPRINTF@ |
@@ -1024,23 +1307,30 @@ _GL_CXXALIASWARN (scanf); | |||
1024 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1307 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1025 | # define snprintf rpl_snprintf | 1308 | # define snprintf rpl_snprintf |
1026 | # endif | 1309 | # endif |
1310 | # define GNULIB_overrides_snprintf 1 | ||
1027 | _GL_FUNCDECL_RPL (snprintf, int, | 1311 | _GL_FUNCDECL_RPL (snprintf, int, |
1028 | (char *str, size_t size, const char *format, ...) | 1312 | (char *restrict str, size_t size, |
1029 | _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) | 1313 | const char *restrict format, ...) |
1314 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) | ||
1030 | _GL_ARG_NONNULL ((3))); | 1315 | _GL_ARG_NONNULL ((3))); |
1031 | _GL_CXXALIAS_RPL (snprintf, int, | 1316 | _GL_CXXALIAS_RPL (snprintf, int, |
1032 | (char *str, size_t size, const char *format, ...)); | 1317 | (char *restrict str, size_t size, |
1318 | const char *restrict format, ...)); | ||
1033 | # else | 1319 | # else |
1034 | # if !@HAVE_DECL_SNPRINTF@ | 1320 | # if !@HAVE_DECL_SNPRINTF@ |
1035 | _GL_FUNCDECL_SYS (snprintf, int, | 1321 | _GL_FUNCDECL_SYS (snprintf, int, |
1036 | (char *str, size_t size, const char *format, ...) | 1322 | (char *restrict str, size_t size, |
1037 | _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) | 1323 | const char *restrict format, ...) |
1324 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) | ||
1038 | _GL_ARG_NONNULL ((3))); | 1325 | _GL_ARG_NONNULL ((3))); |
1039 | # endif | 1326 | # endif |
1040 | _GL_CXXALIAS_SYS (snprintf, int, | 1327 | _GL_CXXALIAS_SYS (snprintf, int, |
1041 | (char *str, size_t size, const char *format, ...)); | 1328 | (char *restrict str, size_t size, |
1329 | const char *restrict format, ...)); | ||
1042 | # endif | 1330 | # endif |
1331 | # if __GLIBC__ >= 2 | ||
1043 | _GL_CXXALIASWARN (snprintf); | 1332 | _GL_CXXALIASWARN (snprintf); |
1333 | # endif | ||
1044 | #elif defined GNULIB_POSIXCHECK | 1334 | #elif defined GNULIB_POSIXCHECK |
1045 | # undef snprintf | 1335 | # undef snprintf |
1046 | # if HAVE_RAW_DECL_SNPRINTF | 1336 | # if HAVE_RAW_DECL_SNPRINTF |
@@ -1063,14 +1353,20 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " | |||
1063 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1353 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1064 | # define sprintf rpl_sprintf | 1354 | # define sprintf rpl_sprintf |
1065 | # endif | 1355 | # endif |
1066 | _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) | 1356 | # define GNULIB_overrides_sprintf 1 |
1067 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | 1357 | _GL_FUNCDECL_RPL (sprintf, int, |
1068 | _GL_ARG_NONNULL ((1, 2))); | 1358 | (char *restrict str, const char *restrict format, ...) |
1069 | _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); | 1359 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) |
1360 | _GL_ARG_NONNULL ((1, 2))); | ||
1361 | _GL_CXXALIAS_RPL (sprintf, int, | ||
1362 | (char *restrict str, const char *restrict format, ...)); | ||
1070 | # else | 1363 | # else |
1071 | _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); | 1364 | _GL_CXXALIAS_SYS (sprintf, int, |
1365 | (char *restrict str, const char *restrict format, ...)); | ||
1072 | # endif | 1366 | # endif |
1367 | # if __GLIBC__ >= 2 | ||
1073 | _GL_CXXALIASWARN (sprintf); | 1368 | _GL_CXXALIASWARN (sprintf); |
1369 | # endif | ||
1074 | #elif defined GNULIB_POSIXCHECK | 1370 | #elif defined GNULIB_POSIXCHECK |
1075 | # undef sprintf | 1371 | # undef sprintf |
1076 | /* Assume sprintf is always declared. */ | 1372 | /* Assume sprintf is always declared. */ |
@@ -1079,22 +1375,53 @@ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " | |||
1079 | "POSIX compliance"); | 1375 | "POSIX compliance"); |
1080 | #endif | 1376 | #endif |
1081 | 1377 | ||
1378 | #if @GNULIB_MDA_TEMPNAM@ | ||
1379 | /* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not | ||
1380 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
1381 | platforms by defining GNULIB_NAMESPACE::tempnam always. */ | ||
1382 | # if defined _WIN32 && !defined __CYGWIN__ | ||
1383 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1384 | # undef tempnam | ||
1385 | # define tempnam _tempnam | ||
1386 | # endif | ||
1387 | _GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix)); | ||
1388 | # else | ||
1389 | _GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix)); | ||
1390 | # endif | ||
1391 | _GL_CXXALIASWARN (tempnam); | ||
1392 | #endif | ||
1393 | |||
1082 | #if @GNULIB_TMPFILE@ | 1394 | #if @GNULIB_TMPFILE@ |
1083 | # if @REPLACE_TMPFILE@ | 1395 | # if @REPLACE_TMPFILE@ |
1084 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1396 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1085 | # define tmpfile rpl_tmpfile | 1397 | # define tmpfile rpl_tmpfile |
1086 | # endif | 1398 | # endif |
1087 | _GL_FUNCDECL_RPL (tmpfile, FILE *, (void)); | 1399 | _GL_FUNCDECL_RPL (tmpfile, FILE *, (void) |
1400 | _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | ||
1088 | _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); | 1401 | _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); |
1089 | # else | 1402 | # else |
1403 | # if __GNUC__ >= 11 | ||
1404 | /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ | ||
1405 | _GL_FUNCDECL_SYS (tmpfile, FILE *, (void) | ||
1406 | _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | ||
1407 | # endif | ||
1090 | _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); | 1408 | _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); |
1091 | # endif | 1409 | # endif |
1410 | # if __GLIBC__ >= 2 | ||
1092 | _GL_CXXALIASWARN (tmpfile); | 1411 | _GL_CXXALIASWARN (tmpfile); |
1093 | #elif defined GNULIB_POSIXCHECK | 1412 | # endif |
1094 | # undef tmpfile | 1413 | #else |
1095 | # if HAVE_RAW_DECL_TMPFILE | 1414 | # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile |
1415 | /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ | ||
1416 | _GL_FUNCDECL_SYS (tmpfile, FILE *, (void) | ||
1417 | _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | ||
1418 | # endif | ||
1419 | # if defined GNULIB_POSIXCHECK | ||
1420 | # undef tmpfile | ||
1421 | # if HAVE_RAW_DECL_TMPFILE | ||
1096 | _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " | 1422 | _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " |
1097 | "use gnulib module tmpfile for portability"); | 1423 | "use gnulib module tmpfile for portability"); |
1424 | # endif | ||
1098 | # endif | 1425 | # endif |
1099 | #endif | 1426 | #endif |
1100 | 1427 | ||
@@ -1107,9 +1434,10 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " | |||
1107 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1434 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1108 | # define asprintf rpl_asprintf | 1435 | # define asprintf rpl_asprintf |
1109 | # endif | 1436 | # endif |
1437 | # define GNULIB_overrides_asprintf | ||
1110 | _GL_FUNCDECL_RPL (asprintf, int, | 1438 | _GL_FUNCDECL_RPL (asprintf, int, |
1111 | (char **result, const char *format, ...) | 1439 | (char **result, const char *format, ...) |
1112 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | 1440 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) |
1113 | _GL_ARG_NONNULL ((1, 2))); | 1441 | _GL_ARG_NONNULL ((1, 2))); |
1114 | _GL_CXXALIAS_RPL (asprintf, int, | 1442 | _GL_CXXALIAS_RPL (asprintf, int, |
1115 | (char **result, const char *format, ...)); | 1443 | (char **result, const char *format, ...)); |
@@ -1117,7 +1445,7 @@ _GL_CXXALIAS_RPL (asprintf, int, | |||
1117 | # if !@HAVE_VASPRINTF@ | 1445 | # if !@HAVE_VASPRINTF@ |
1118 | _GL_FUNCDECL_SYS (asprintf, int, | 1446 | _GL_FUNCDECL_SYS (asprintf, int, |
1119 | (char **result, const char *format, ...) | 1447 | (char **result, const char *format, ...) |
1120 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | 1448 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) |
1121 | _GL_ARG_NONNULL ((1, 2))); | 1449 | _GL_ARG_NONNULL ((1, 2))); |
1122 | # endif | 1450 | # endif |
1123 | _GL_CXXALIAS_SYS (asprintf, int, | 1451 | _GL_CXXALIAS_SYS (asprintf, int, |
@@ -1128,9 +1456,10 @@ _GL_CXXALIASWARN (asprintf); | |||
1128 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1456 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1129 | # define vasprintf rpl_vasprintf | 1457 | # define vasprintf rpl_vasprintf |
1130 | # endif | 1458 | # endif |
1459 | # define GNULIB_overrides_vasprintf 1 | ||
1131 | _GL_FUNCDECL_RPL (vasprintf, int, | 1460 | _GL_FUNCDECL_RPL (vasprintf, int, |
1132 | (char **result, const char *format, va_list args) | 1461 | (char **result, const char *format, va_list args) |
1133 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | 1462 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) |
1134 | _GL_ARG_NONNULL ((1, 2))); | 1463 | _GL_ARG_NONNULL ((1, 2))); |
1135 | _GL_CXXALIAS_RPL (vasprintf, int, | 1464 | _GL_CXXALIAS_RPL (vasprintf, int, |
1136 | (char **result, const char *format, va_list args)); | 1465 | (char **result, const char *format, va_list args)); |
@@ -1138,7 +1467,7 @@ _GL_CXXALIAS_RPL (vasprintf, int, | |||
1138 | # if !@HAVE_VASPRINTF@ | 1467 | # if !@HAVE_VASPRINTF@ |
1139 | _GL_FUNCDECL_SYS (vasprintf, int, | 1468 | _GL_FUNCDECL_SYS (vasprintf, int, |
1140 | (char **result, const char *format, va_list args) | 1469 | (char **result, const char *format, va_list args) |
1141 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | 1470 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) |
1142 | _GL_ARG_NONNULL ((1, 2))); | 1471 | _GL_ARG_NONNULL ((1, 2))); |
1143 | # endif | 1472 | # endif |
1144 | _GL_CXXALIAS_SYS (vasprintf, int, | 1473 | _GL_CXXALIAS_SYS (vasprintf, int, |
@@ -1152,22 +1481,27 @@ _GL_CXXALIASWARN (vasprintf); | |||
1152 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1481 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1153 | # define vdprintf rpl_vdprintf | 1482 | # define vdprintf rpl_vdprintf |
1154 | # endif | 1483 | # endif |
1155 | _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) | 1484 | _GL_FUNCDECL_RPL (vdprintf, int, |
1156 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | 1485 | (int fd, const char *restrict format, va_list args) |
1157 | _GL_ARG_NONNULL ((2))); | 1486 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) |
1158 | _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); | 1487 | _GL_ARG_NONNULL ((2))); |
1488 | _GL_CXXALIAS_RPL (vdprintf, int, | ||
1489 | (int fd, const char *restrict format, va_list args)); | ||
1159 | # else | 1490 | # else |
1160 | # if !@HAVE_VDPRINTF@ | 1491 | # if !@HAVE_VDPRINTF@ |
1161 | _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) | 1492 | _GL_FUNCDECL_SYS (vdprintf, int, |
1162 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | 1493 | (int fd, const char *restrict format, va_list args) |
1163 | _GL_ARG_NONNULL ((2))); | 1494 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) |
1495 | _GL_ARG_NONNULL ((2))); | ||
1164 | # endif | 1496 | # endif |
1165 | /* Need to cast, because on Solaris, the third parameter will likely be | 1497 | /* Need to cast, because on Solaris, the third parameter will likely be |
1166 | __va_list args. */ | 1498 | __va_list args. */ |
1167 | _GL_CXXALIAS_SYS_CAST (vdprintf, int, | 1499 | _GL_CXXALIAS_SYS_CAST (vdprintf, int, |
1168 | (int fd, const char *format, va_list args)); | 1500 | (int fd, const char *restrict format, va_list args)); |
1169 | # endif | 1501 | # endif |
1502 | # if __GLIBC__ >= 2 | ||
1170 | _GL_CXXALIASWARN (vdprintf); | 1503 | _GL_CXXALIASWARN (vdprintf); |
1504 | # endif | ||
1171 | #elif defined GNULIB_POSIXCHECK | 1505 | #elif defined GNULIB_POSIXCHECK |
1172 | # undef vdprintf | 1506 | # undef vdprintf |
1173 | # if HAVE_RAW_DECL_VDPRINTF | 1507 | # if HAVE_RAW_DECL_VDPRINTF |
@@ -1184,23 +1518,32 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " | |||
1184 | # endif | 1518 | # endif |
1185 | # define GNULIB_overrides_vfprintf 1 | 1519 | # define GNULIB_overrides_vfprintf 1 |
1186 | # if @GNULIB_VFPRINTF_POSIX@ | 1520 | # if @GNULIB_VFPRINTF_POSIX@ |
1187 | _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) | 1521 | _GL_FUNCDECL_RPL (vfprintf, int, |
1188 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | 1522 | (FILE *restrict fp, |
1189 | _GL_ARG_NONNULL ((1, 2))); | 1523 | const char *restrict format, va_list args) |
1524 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) | ||
1525 | _GL_ARG_NONNULL ((1, 2))); | ||
1190 | # else | 1526 | # else |
1191 | _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) | 1527 | _GL_FUNCDECL_RPL (vfprintf, int, |
1192 | _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) | 1528 | (FILE *restrict fp, |
1193 | _GL_ARG_NONNULL ((1, 2))); | 1529 | const char *restrict format, va_list args) |
1530 | _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) | ||
1531 | _GL_ARG_NONNULL ((1, 2))); | ||
1194 | # endif | 1532 | # endif |
1195 | _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); | 1533 | _GL_CXXALIAS_RPL (vfprintf, int, |
1534 | (FILE *restrict fp, | ||
1535 | const char *restrict format, va_list args)); | ||
1196 | # else | 1536 | # else |
1197 | /* Need to cast, because on Solaris, the third parameter is | 1537 | /* Need to cast, because on Solaris, the third parameter is |
1198 | __va_list args | 1538 | __va_list args |
1199 | and GCC's fixincludes did not change this to __gnuc_va_list. */ | 1539 | and GCC's fixincludes did not change this to __gnuc_va_list. */ |
1200 | _GL_CXXALIAS_SYS_CAST (vfprintf, int, | 1540 | _GL_CXXALIAS_SYS_CAST (vfprintf, int, |
1201 | (FILE *fp, const char *format, va_list args)); | 1541 | (FILE *restrict fp, |
1542 | const char *restrict format, va_list args)); | ||
1202 | # endif | 1543 | # endif |
1544 | # if __GLIBC__ >= 2 | ||
1203 | _GL_CXXALIASWARN (vfprintf); | 1545 | _GL_CXXALIASWARN (vfprintf); |
1546 | # endif | ||
1204 | #endif | 1547 | #endif |
1205 | #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK | 1548 | #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
1206 | # if !GNULIB_overrides_vfprintf | 1549 | # if !GNULIB_overrides_vfprintf |
@@ -1219,16 +1562,21 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " | |||
1219 | # define vfscanf rpl_vfscanf | 1562 | # define vfscanf rpl_vfscanf |
1220 | # endif | 1563 | # endif |
1221 | _GL_FUNCDECL_RPL (vfscanf, int, | 1564 | _GL_FUNCDECL_RPL (vfscanf, int, |
1222 | (FILE *stream, const char *format, va_list args) | 1565 | (FILE *restrict stream, |
1566 | const char *restrict format, va_list args) | ||
1223 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) | 1567 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) |
1224 | _GL_ARG_NONNULL ((1, 2))); | 1568 | _GL_ARG_NONNULL ((1, 2))); |
1225 | _GL_CXXALIAS_RPL (vfscanf, int, | 1569 | _GL_CXXALIAS_RPL (vfscanf, int, |
1226 | (FILE *stream, const char *format, va_list args)); | 1570 | (FILE *restrict stream, |
1571 | const char *restrict format, va_list args)); | ||
1227 | # else | 1572 | # else |
1228 | _GL_CXXALIAS_SYS (vfscanf, int, | 1573 | _GL_CXXALIAS_SYS (vfscanf, int, |
1229 | (FILE *stream, const char *format, va_list args)); | 1574 | (FILE *restrict stream, |
1575 | const char *restrict format, va_list args)); | ||
1230 | # endif | 1576 | # endif |
1577 | # if __GLIBC__ >= 2 | ||
1231 | _GL_CXXALIASWARN (vfscanf); | 1578 | _GL_CXXALIASWARN (vfscanf); |
1579 | # endif | ||
1232 | #endif | 1580 | #endif |
1233 | 1581 | ||
1234 | #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ | 1582 | #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ |
@@ -1239,22 +1587,25 @@ _GL_CXXALIASWARN (vfscanf); | |||
1239 | # endif | 1587 | # endif |
1240 | # define GNULIB_overrides_vprintf 1 | 1588 | # define GNULIB_overrides_vprintf 1 |
1241 | # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ | 1589 | # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ |
1242 | _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) | 1590 | _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) |
1243 | _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) | 1591 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) |
1244 | _GL_ARG_NONNULL ((1))); | 1592 | _GL_ARG_NONNULL ((1))); |
1245 | # else | 1593 | # else |
1246 | _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) | 1594 | _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) |
1247 | _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) | 1595 | _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) |
1248 | _GL_ARG_NONNULL ((1))); | 1596 | _GL_ARG_NONNULL ((1))); |
1249 | # endif | 1597 | # endif |
1250 | _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); | 1598 | _GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args)); |
1251 | # else | 1599 | # else |
1252 | /* Need to cast, because on Solaris, the second parameter is | 1600 | /* Need to cast, because on Solaris, the second parameter is |
1253 | __va_list args | 1601 | __va_list args |
1254 | and GCC's fixincludes did not change this to __gnuc_va_list. */ | 1602 | and GCC's fixincludes did not change this to __gnuc_va_list. */ |
1255 | _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); | 1603 | _GL_CXXALIAS_SYS_CAST (vprintf, int, |
1604 | (const char *restrict format, va_list args)); | ||
1256 | # endif | 1605 | # endif |
1606 | # if __GLIBC__ >= 2 | ||
1257 | _GL_CXXALIASWARN (vprintf); | 1607 | _GL_CXXALIASWARN (vprintf); |
1608 | # endif | ||
1258 | #endif | 1609 | #endif |
1259 | #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK | 1610 | #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
1260 | # if !GNULIB_overrides_vprintf | 1611 | # if !GNULIB_overrides_vprintf |
@@ -1272,14 +1623,16 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " | |||
1272 | # undef vscanf | 1623 | # undef vscanf |
1273 | # define vscanf rpl_vscanf | 1624 | # define vscanf rpl_vscanf |
1274 | # endif | 1625 | # endif |
1275 | _GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args) | 1626 | _GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) |
1276 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) | 1627 | _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) |
1277 | _GL_ARG_NONNULL ((1))); | 1628 | _GL_ARG_NONNULL ((1))); |
1278 | _GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args)); | 1629 | _GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); |
1279 | # else | 1630 | # else |
1280 | _GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args)); | 1631 | _GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); |
1281 | # endif | 1632 | # endif |
1633 | # if __GLIBC__ >= 2 | ||
1282 | _GL_CXXALIASWARN (vscanf); | 1634 | _GL_CXXALIASWARN (vscanf); |
1635 | # endif | ||
1283 | #endif | 1636 | #endif |
1284 | 1637 | ||
1285 | #if @GNULIB_VSNPRINTF@ | 1638 | #if @GNULIB_VSNPRINTF@ |
@@ -1287,23 +1640,30 @@ _GL_CXXALIASWARN (vscanf); | |||
1287 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1640 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1288 | # define vsnprintf rpl_vsnprintf | 1641 | # define vsnprintf rpl_vsnprintf |
1289 | # endif | 1642 | # endif |
1643 | # define GNULIB_overrides_vsnprintf 1 | ||
1290 | _GL_FUNCDECL_RPL (vsnprintf, int, | 1644 | _GL_FUNCDECL_RPL (vsnprintf, int, |
1291 | (char *str, size_t size, const char *format, va_list args) | 1645 | (char *restrict str, size_t size, |
1292 | _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) | 1646 | const char *restrict format, va_list args) |
1647 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) | ||
1293 | _GL_ARG_NONNULL ((3))); | 1648 | _GL_ARG_NONNULL ((3))); |
1294 | _GL_CXXALIAS_RPL (vsnprintf, int, | 1649 | _GL_CXXALIAS_RPL (vsnprintf, int, |
1295 | (char *str, size_t size, const char *format, va_list args)); | 1650 | (char *restrict str, size_t size, |
1651 | const char *restrict format, va_list args)); | ||
1296 | # else | 1652 | # else |
1297 | # if !@HAVE_DECL_VSNPRINTF@ | 1653 | # if !@HAVE_DECL_VSNPRINTF@ |
1298 | _GL_FUNCDECL_SYS (vsnprintf, int, | 1654 | _GL_FUNCDECL_SYS (vsnprintf, int, |
1299 | (char *str, size_t size, const char *format, va_list args) | 1655 | (char *restrict str, size_t size, |
1300 | _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) | 1656 | const char *restrict format, va_list args) |
1657 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) | ||
1301 | _GL_ARG_NONNULL ((3))); | 1658 | _GL_ARG_NONNULL ((3))); |
1302 | # endif | 1659 | # endif |
1303 | _GL_CXXALIAS_SYS (vsnprintf, int, | 1660 | _GL_CXXALIAS_SYS (vsnprintf, int, |
1304 | (char *str, size_t size, const char *format, va_list args)); | 1661 | (char *restrict str, size_t size, |
1662 | const char *restrict format, va_list args)); | ||
1305 | # endif | 1663 | # endif |
1664 | # if __GLIBC__ >= 2 | ||
1306 | _GL_CXXALIASWARN (vsnprintf); | 1665 | _GL_CXXALIASWARN (vsnprintf); |
1666 | # endif | ||
1307 | #elif defined GNULIB_POSIXCHECK | 1667 | #elif defined GNULIB_POSIXCHECK |
1308 | # undef vsnprintf | 1668 | # undef vsnprintf |
1309 | # if HAVE_RAW_DECL_VSNPRINTF | 1669 | # if HAVE_RAW_DECL_VSNPRINTF |
@@ -1317,20 +1677,26 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " | |||
1317 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1677 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1318 | # define vsprintf rpl_vsprintf | 1678 | # define vsprintf rpl_vsprintf |
1319 | # endif | 1679 | # endif |
1680 | # define GNULIB_overrides_vsprintf 1 | ||
1320 | _GL_FUNCDECL_RPL (vsprintf, int, | 1681 | _GL_FUNCDECL_RPL (vsprintf, int, |
1321 | (char *str, const char *format, va_list args) | 1682 | (char *restrict str, |
1322 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | 1683 | const char *restrict format, va_list args) |
1684 | _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) | ||
1323 | _GL_ARG_NONNULL ((1, 2))); | 1685 | _GL_ARG_NONNULL ((1, 2))); |
1324 | _GL_CXXALIAS_RPL (vsprintf, int, | 1686 | _GL_CXXALIAS_RPL (vsprintf, int, |
1325 | (char *str, const char *format, va_list args)); | 1687 | (char *restrict str, |
1688 | const char *restrict format, va_list args)); | ||
1326 | # else | 1689 | # else |
1327 | /* Need to cast, because on Solaris, the third parameter is | 1690 | /* Need to cast, because on Solaris, the third parameter is |
1328 | __va_list args | 1691 | __va_list args |
1329 | and GCC's fixincludes did not change this to __gnuc_va_list. */ | 1692 | and GCC's fixincludes did not change this to __gnuc_va_list. */ |
1330 | _GL_CXXALIAS_SYS_CAST (vsprintf, int, | 1693 | _GL_CXXALIAS_SYS_CAST (vsprintf, int, |
1331 | (char *str, const char *format, va_list args)); | 1694 | (char *restrict str, |
1695 | const char *restrict format, va_list args)); | ||
1332 | # endif | 1696 | # endif |
1697 | # if __GLIBC__ >= 2 | ||
1333 | _GL_CXXALIASWARN (vsprintf); | 1698 | _GL_CXXALIASWARN (vsprintf); |
1699 | # endif | ||
1334 | #elif defined GNULIB_POSIXCHECK | 1700 | #elif defined GNULIB_POSIXCHECK |
1335 | # undef vsprintf | 1701 | # undef vsprintf |
1336 | /* Assume vsprintf is always declared. */ | 1702 | /* Assume vsprintf is always declared. */ |