Debian Codegraph @

lib/stdio.in.h

raw symbols SCIP
1 /* A GNU-like <stdio.h>.
2
3 Copyright (C) 2004, 2007-2023 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file 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
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18 #if __GNUC__ >= 3
19 @PRAGMA_SYSTEM_HEADER@
20 #endif
21 @PRAGMA_COLUMNS@
22
23 #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
24 /* Special invocation convention:
25 - Inside glibc header files.
26 - On OSF/1 5.1 we have a sequence of nested includes
27 <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
28 <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
29 In this situation, the functions are not yet declared, therefore we cannot
30 provide the C++ aliases. */
31
32 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
33
34 #else
35 /* Normal invocation convention. */
36
37 #ifndef _@GUARD_PREFIX@_STDIO_H
38
39 #define _GL_ALREADY_INCLUDING_STDIO_H
40
41 /* The include_next requires a split double-inclusion guard. */
42 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
43
44 #undef _GL_ALREADY_INCLUDING_STDIO_H
45
46 #ifndef _@GUARD_PREFIX@_STDIO_H
47 #define _@GUARD_PREFIX@_STDIO_H
48
49 /* Get va_list. Needed on many systems, including glibc 2.8. */
50 #include <stdarg.h>
51
52 #include <stddef.h>
53
54 /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
55 and eglibc 2.11.2.
56 May also define off_t to a 64-bit type on native Windows. */
57 #include <sys/types.h>
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
105 /* The __attribute__ feature is available in gcc versions 2.5 and later.
106 The __-protected variants of the attributes 'format' and 'printf' are
107 accepted by gcc versions 2.6.4 (effectively 2.7) and later.
108 We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
109 gnulib and libintl do '#define printf __printf__' when they override
110 the 'printf' function. */
111 #ifndef _GL_ATTRIBUTE_FORMAT
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__
126 #else
127 # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
128 #endif
129
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
144 indicates to GCC that the function takes a format string and arguments,
145 where the format string directives are the ones standardized by ISO C99
146 and POSIX. */
147 #define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \
148 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument))
149
150 /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD,
151 except that it indicates to GCC that the supported format string directives
152 are the ones of the system printf(), rather than the ones standardized by
153 ISO C99 and POSIX. */
154 #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
155 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, formatstring_parameter, first_argument))
156
157 /* _GL_ATTRIBUTE_FORMAT_SCANF
158 indicates to GCC that the function takes a format string and arguments,
159 where the format string directives are the ones standardized by ISO C99
160 and POSIX. */
161 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
162 # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
163 _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
164 #else
165 # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
166 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
167 #endif
168
169 /* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
170 except that it indicates to GCC that the supported format string directives
171 are the ones of the system scanf(), rather than the ones standardized by
172 ISO C99 and POSIX. */
173 #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
174 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
175
176 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
177
178 /* The definition of _GL_ARG_NONNULL is copied here. */
179
180 /* The definition of _GL_WARN_ON_USE is copied here. */
181
182 /* Macros for stringification. */
183 #define _GL_STDIO_STRINGIZE(token) #token
184 #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
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
195
196 #if @GNULIB_DPRINTF@
197 # if @REPLACE_DPRINTF@
198 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
199 # define dprintf rpl_dprintf
200 # endif
201 _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...)
202 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
203 _GL_ARG_NONNULL ((2)));
204 _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
205 # else
206 # if !@HAVE_DPRINTF@
207 _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...)
208 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
209 _GL_ARG_NONNULL ((2)));
210 # endif
211 _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...));
212 # endif
213 # if __GLIBC__ >= 2
214 _GL_CXXALIASWARN (dprintf);
215 # endif
216 #elif defined GNULIB_POSIXCHECK
217 # undef dprintf
218 # if HAVE_RAW_DECL_DPRINTF
219 _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
220 "use gnulib module dprintf for portability");
221 # endif
222 #endif
223
224 #if @GNULIB_FCLOSE@
225 /* Close STREAM and its underlying file descriptor. */
226 # if @REPLACE_FCLOSE@
227 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
228 # define fclose rpl_fclose
229 # endif
230 _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
231 _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
232 # else
233 _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
234 # endif
235 # if __GLIBC__ >= 2
236 _GL_CXXALIASWARN (fclose);
237 # endif
238 #elif defined GNULIB_POSIXCHECK
239 # undef fclose
240 /* Assume fclose is always declared. */
241 _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
242 "use gnulib module fclose for portable POSIX compliance");
243 #endif
244
245 #if @GNULIB_MDA_FCLOSEALL@
246 /* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is
247 not required. In C++ with GNULIB_NAMESPACE, avoid differences between
248 platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have
249 it. */
250 # if defined _WIN32 && !defined __CYGWIN__
251 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
252 # undef fcloseall
253 # define fcloseall _fcloseall
254 # endif
255 _GL_CXXALIAS_MDA (fcloseall, int, (void));
256 # else
257 # if @HAVE_DECL_FCLOSEALL@
258 # if defined __FreeBSD__ || defined __DragonFly__
259 _GL_CXXALIAS_SYS (fcloseall, void, (void));
260 # else
261 _GL_CXXALIAS_SYS (fcloseall, int, (void));
262 # endif
263 # endif
264 # endif
265 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@
266 _GL_CXXALIASWARN (fcloseall);
267 # endif
268 #endif
269
270 #if @GNULIB_FDOPEN@
271 # if @REPLACE_FDOPEN@
272 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
273 # undef fdopen
274 # define fdopen rpl_fdopen
275 # endif
276 _GL_FUNCDECL_RPL (fdopen, FILE *,
277 (int fd, const char *mode)
278 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
279 _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
280 # elif defined _WIN32 && !defined __CYGWIN__
281 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
282 # undef fdopen
283 # define fdopen _fdopen
284 # endif
285 _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
286 # else
287 # if __GNUC__ >= 11
288 /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
289 _GL_FUNCDECL_SYS (fdopen, FILE *,
290 (int fd, const char *mode)
291 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
292 # endif
293 _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
294 # endif
295 _GL_CXXALIASWARN (fdopen);
296 #else
297 # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen
298 /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
299 _GL_FUNCDECL_SYS (fdopen, FILE *,
300 (int fd, const char *mode)
301 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
302 # endif
303 # if defined GNULIB_POSIXCHECK
304 # undef fdopen
305 /* Assume fdopen is always declared. */
306 _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
307 "use gnulib module fdopen for portability");
308 # elif @GNULIB_MDA_FDOPEN@
309 /* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not
310 required. In C++ with GNULIB_NAMESPACE, avoid differences between
311 platforms by defining GNULIB_NAMESPACE::fdopen always. */
312 # if defined _WIN32 && !defined __CYGWIN__
313 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
314 # undef fdopen
315 # define fdopen _fdopen
316 # endif
317 _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
318 # else
319 _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
320 # endif
321 _GL_CXXALIASWARN (fdopen);
322 # endif
323 #endif
324
325 #if @GNULIB_FFLUSH@
326 /* Flush all pending data on STREAM according to POSIX rules. Both
327 output and seekable input streams are supported.
328 Note! LOSS OF DATA can occur if fflush is applied on an input stream
329 that is _not_seekable_ or on an update stream that is _not_seekable_
330 and in which the most recent operation was input. Seekability can
331 be tested with lseek(fileno(fp),0,SEEK_CUR). */
332 # if @REPLACE_FFLUSH@
333 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
334 # define fflush rpl_fflush
335 # endif
336 _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
337 _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
338 # else
339 _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
340 # endif
341 # if __GLIBC__ >= 2
342 _GL_CXXALIASWARN (fflush);
343 # endif
344 #elif defined GNULIB_POSIXCHECK
345 # undef fflush
346 /* Assume fflush is always declared. */
347 _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
348 "use gnulib module fflush for portable POSIX compliance");
349 #endif
350
351 #if @GNULIB_FGETC@
352 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
353 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
354 # undef fgetc
355 # define fgetc rpl_fgetc
356 # endif
357 _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
358 _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
359 # else
360 _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
361 # endif
362 # if __GLIBC__ >= 2
363 _GL_CXXALIASWARN (fgetc);
364 # endif
365 #endif
366
367 #if @GNULIB_FGETS@
368 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
369 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
370 # undef fgets
371 # define fgets rpl_fgets
372 # endif
373 _GL_FUNCDECL_RPL (fgets, char *,
374 (char *restrict s, int n, FILE *restrict stream)
375 _GL_ARG_NONNULL ((1, 3)));
376 _GL_CXXALIAS_RPL (fgets, char *,
377 (char *restrict s, int n, FILE *restrict stream));
378 # else
379 _GL_CXXALIAS_SYS (fgets, char *,
380 (char *restrict s, int n, FILE *restrict stream));
381 # endif
382 # if __GLIBC__ >= 2
383 _GL_CXXALIASWARN (fgets);
384 # endif
385 #endif
386
387 #if @GNULIB_MDA_FILENO@
388 /* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not
389 required. In C++ with GNULIB_NAMESPACE, avoid differences between
390 platforms by defining GNULIB_NAMESPACE::fileno always. */
391 # if defined _WIN32 && !defined __CYGWIN__
392 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
393 # undef fileno
394 # define fileno _fileno
395 # endif
396 _GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream));
397 # else
398 _GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream));
399 # endif
400 _GL_CXXALIASWARN (fileno);
401 #endif
402
403 #if @GNULIB_FOPEN@
404 # if (@GNULIB_FOPEN@ && @REPLACE_FOPEN@) \
405 || (@GNULIB_FOPEN_GNU@ && @REPLACE_FOPEN_FOR_FOPEN_GNU@)
406 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
407 # undef fopen
408 # define fopen rpl_fopen
409 # endif
410 _GL_FUNCDECL_RPL (fopen, FILE *,
411 (const char *restrict filename, const char *restrict mode)
412 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
413 _GL_CXXALIAS_RPL (fopen, FILE *,
414 (const char *restrict filename, const char *restrict mode));
415 # else
416 # if __GNUC__ >= 11
417 /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
418 _GL_FUNCDECL_SYS (fopen, FILE *,
419 (const char *restrict filename, const char *restrict mode)
420 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
421 # endif
422 _GL_CXXALIAS_SYS (fopen, FILE *,
423 (const char *restrict filename, const char *restrict mode));
424 # endif
425 # if __GLIBC__ >= 2
426 _GL_CXXALIASWARN (fopen);
427 # endif
428 #else
429 # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen
430 /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
431 _GL_FUNCDECL_SYS (fopen, FILE *,
432 (const char *restrict filename, const char *restrict mode)
433 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
434 # endif
435 # if defined GNULIB_POSIXCHECK
436 # undef fopen
437 /* Assume fopen is always declared. */
438 _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
439 "use gnulib module fopen for portability");
440 # endif
441 #endif
442
443 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
444 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
445 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
446 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
447 # define fprintf rpl_fprintf
448 # endif
449 # define GNULIB_overrides_fprintf 1
450 # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
451 _GL_FUNCDECL_RPL (fprintf, int,
452 (FILE *restrict fp, const char *restrict format, ...)
453 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
454 _GL_ARG_NONNULL ((1, 2)));
455 # else
456 _GL_FUNCDECL_RPL (fprintf, int,
457 (FILE *restrict fp, const char *restrict format, ...)
458 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
459 _GL_ARG_NONNULL ((1, 2)));
460 # endif
461 _GL_CXXALIAS_RPL (fprintf, int,
462 (FILE *restrict fp, const char *restrict format, ...));
463 # else
464 _GL_CXXALIAS_SYS (fprintf, int,
465 (FILE *restrict fp, const char *restrict format, ...));
466 # endif
467 # if __GLIBC__ >= 2
468 _GL_CXXALIASWARN (fprintf);
469 # endif
470 #endif
471 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
472 # if !GNULIB_overrides_fprintf
473 # undef fprintf
474 # endif
475 /* Assume fprintf is always declared. */
476 _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
477 "use gnulib module fprintf-posix for portable "
478 "POSIX compliance");
479 #endif
480
481 #if @GNULIB_FPURGE@
482 /* Discard all pending buffered I/O data on STREAM.
483 STREAM must not be wide-character oriented.
484 When discarding pending output, the file position is set back to where it
485 was before the write calls. When discarding pending input, the file
486 position is advanced to match the end of the previously read input.
487 Return 0 if successful. Upon error, return -1 and set errno. */
488 # if @REPLACE_FPURGE@
489 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
490 # define fpurge rpl_fpurge
491 # endif
492 _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
493 _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
494 # else
495 # if !@HAVE_DECL_FPURGE@
496 _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
497 # endif
498 _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
499 # endif
500 _GL_CXXALIASWARN (fpurge);
501 #elif defined GNULIB_POSIXCHECK
502 # undef fpurge
503 # if HAVE_RAW_DECL_FPURGE
504 _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
505 "use gnulib module fpurge for portability");
506 # endif
507 #endif
508
509 #if @GNULIB_FPUTC@
510 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
511 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
512 # undef fputc
513 # define fputc rpl_fputc
514 # endif
515 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
516 _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
517 # else
518 _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
519 # endif
520 # if __GLIBC__ >= 2
521 _GL_CXXALIASWARN (fputc);
522 # endif
523 #endif
524
525 #if @GNULIB_FPUTS@
526 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
527 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
528 # undef fputs
529 # define fputs rpl_fputs
530 # endif
531 _GL_FUNCDECL_RPL (fputs, int,
532 (const char *restrict string, FILE *restrict stream)
533 _GL_ARG_NONNULL ((1, 2)));
534 _GL_CXXALIAS_RPL (fputs, int,
535 (const char *restrict string, FILE *restrict stream));
536 # else
537 _GL_CXXALIAS_SYS (fputs, int,
538 (const char *restrict string, FILE *restrict stream));
539 # endif
540 # if __GLIBC__ >= 2
541 _GL_CXXALIASWARN (fputs);
542 # endif
543 #endif
544
545 #if @GNULIB_FREAD@
546 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
547 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
548 # undef fread
549 # define fread rpl_fread
550 # endif
551 _GL_FUNCDECL_RPL (fread, size_t,
552 (void *restrict ptr, size_t s, size_t n,
553 FILE *restrict stream)
554 _GL_ARG_NONNULL ((4)));
555 _GL_CXXALIAS_RPL (fread, size_t,
556 (void *restrict ptr, size_t s, size_t n,
557 FILE *restrict stream));
558 # else
559 _GL_CXXALIAS_SYS (fread, size_t,
560 (void *restrict ptr, size_t s, size_t n,
561 FILE *restrict stream));
562 # endif
563 # if __GLIBC__ >= 2
564 _GL_CXXALIASWARN (fread);
565 # endif
566 #endif
567
568 #if @GNULIB_FREOPEN@
569 # if @REPLACE_FREOPEN@
570 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
571 # undef freopen
572 # define freopen rpl_freopen
573 # endif
574 _GL_FUNCDECL_RPL (freopen, FILE *,
575 (const char *restrict filename, const char *restrict mode,
576 FILE *restrict stream)
577 _GL_ARG_NONNULL ((2, 3)));
578 _GL_CXXALIAS_RPL (freopen, FILE *,
579 (const char *restrict filename, const char *restrict mode,
580 FILE *restrict stream));
581 # else
582 _GL_CXXALIAS_SYS (freopen, FILE *,
583 (const char *restrict filename, const char *restrict mode,
584 FILE *restrict stream));
585 # endif
586 # if __GLIBC__ >= 2
587 _GL_CXXALIASWARN (freopen);
588 # endif
589 #elif defined GNULIB_POSIXCHECK
590 # undef freopen
591 /* Assume freopen is always declared. */
592 _GL_WARN_ON_USE (freopen,
593 "freopen on native Windows platforms is not POSIX compliant - "
594 "use gnulib module freopen for portability");
595 #endif
596
597 #if @GNULIB_FSCANF@
598 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
599 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
600 # undef fscanf
601 # define fscanf rpl_fscanf
602 # endif
603 _GL_FUNCDECL_RPL (fscanf, int,
604 (FILE *restrict stream, const char *restrict format, ...)
605 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
606 _GL_ARG_NONNULL ((1, 2)));
607 _GL_CXXALIAS_RPL (fscanf, int,
608 (FILE *restrict stream, const char *restrict format, ...));
609 # else
610 _GL_CXXALIAS_SYS (fscanf, int,
611 (FILE *restrict stream, const char *restrict format, ...));
612 # endif
613 # if __GLIBC__ >= 2
614 _GL_CXXALIASWARN (fscanf);
615 # endif
616 #endif
617
618
619 /* Set up the following warnings, based on which modules are in use.
620 GNU Coding Standards discourage the use of fseek, since it imposes
621 an arbitrary limitation on some 32-bit hosts. Remember that the
622 fseek module depends on the fseeko module, so we only have three
623 cases to consider:
624
625 1. The developer is not using either module. Issue a warning under
626 GNULIB_POSIXCHECK for both functions, to remind them that both
627 functions have bugs on some systems. _GL_NO_LARGE_FILES has no
628 impact on this warning.
629
630 2. The developer is using both modules. They may be unaware of the
631 arbitrary limitations of fseek, so issue a warning under
632 GNULIB_POSIXCHECK. On the other hand, they may be using both
633 modules intentionally, so the developer can define
634 _GL_NO_LARGE_FILES in the compilation units where the use of fseek
635 is safe, to silence the warning.
636
637 3. The developer is using the fseeko module, but not fseek. Gnulib
638 guarantees that fseek will still work around platform bugs in that
639 case, but we presume that the developer is aware of the pitfalls of
640 fseek and was trying to avoid it, so issue a warning even when
641 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
642 defined to silence the warning in particular compilation units.
643 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
644 fseek gets defined as a macro, it is recommended that the developer
645 uses the fseek module, even if he is not calling the fseek function.
646
647 Most gnulib clients that perform stream operations should fall into
648 category 3. */
649
650 #if @GNULIB_FSEEK@
651 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
652 # define _GL_FSEEK_WARN /* Category 2, above. */
653 # undef fseek
654 # endif
655 # if @REPLACE_FSEEK@
656 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
657 # undef fseek
658 # define fseek rpl_fseek
659 # endif
660 _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
661 _GL_ARG_NONNULL ((1)));
662 _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
663 # else
664 _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
665 # endif
666 # if __GLIBC__ >= 2
667 _GL_CXXALIASWARN (fseek);
668 # endif
669 #endif
670
671 #if @GNULIB_FSEEKO@
672 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
673 # define _GL_FSEEK_WARN /* Category 3, above. */
674 # undef fseek
675 # endif
676 # if @REPLACE_FSEEKO@
677 /* Provide an fseeko function that is aware of a preceding fflush(), and which
678 detects pipes. */
679 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
680 # undef fseeko
681 # define fseeko rpl_fseeko
682 # endif
683 _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
684 _GL_ARG_NONNULL ((1)));
685 _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
686 # else
687 # if ! @HAVE_DECL_FSEEKO@
688 _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
689 _GL_ARG_NONNULL ((1)));
690 # endif
691 _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
692 # endif
693 _GL_CXXALIASWARN (fseeko);
694 #elif defined GNULIB_POSIXCHECK
695 # define _GL_FSEEK_WARN /* Category 1, above. */
696 # undef fseek
697 # undef fseeko
698 # if HAVE_RAW_DECL_FSEEKO
699 _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
700 "use gnulib module fseeko for portability");
701 # endif
702 #endif
703
704 #ifdef _GL_FSEEK_WARN
705 # undef _GL_FSEEK_WARN
706 /* Here, either fseek is undefined (but C89 guarantees that it is
707 declared), or it is defined as rpl_fseek (declared above). */
708 _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
709 "on 32-bit platforms - "
710 "use fseeko function for handling of large files");
711 #endif
712
713
714 /* ftell, ftello. See the comments on fseek/fseeko. */
715
716 #if @GNULIB_FTELL@
717 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
718 # define _GL_FTELL_WARN /* Category 2, above. */
719 # undef ftell
720 # endif
721 # if @REPLACE_FTELL@
722 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
723 # undef ftell
724 # define ftell rpl_ftell
725 # endif
726 _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
727 _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
728 # else
729 _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
730 # endif
731 # if __GLIBC__ >= 2
732 _GL_CXXALIASWARN (ftell);
733 # endif
734 #endif
735
736 #if @GNULIB_FTELLO@
737 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
738 # define _GL_FTELL_WARN /* Category 3, above. */
739 # undef ftell
740 # endif
741 # if @REPLACE_FTELLO@
742 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
743 # undef ftello
744 # define ftello rpl_ftello
745 # endif
746 _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
747 _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
748 # else
749 # if ! @HAVE_DECL_FTELLO@
750 _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
751 # endif
752 _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
753 # endif
754 _GL_CXXALIASWARN (ftello);
755 #elif defined GNULIB_POSIXCHECK
756 # define _GL_FTELL_WARN /* Category 1, above. */
757 # undef ftell
758 # undef ftello
759 # if HAVE_RAW_DECL_FTELLO
760 _GL_WARN_ON_USE (ftello, "ftello is unportable - "
761 "use gnulib module ftello for portability");
762 # endif
763 #endif
764
765 #ifdef _GL_FTELL_WARN
766 # undef _GL_FTELL_WARN
767 /* Here, either ftell is undefined (but C89 guarantees that it is
768 declared), or it is defined as rpl_ftell (declared above). */
769 _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
770 "on 32-bit platforms - "
771 "use ftello function for handling of large files");
772 #endif
773
774
775 #if @GNULIB_FWRITE@
776 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
777 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
778 # undef fwrite
779 # define fwrite rpl_fwrite
780 # endif
781 _GL_FUNCDECL_RPL (fwrite, size_t,
782 (const void *restrict ptr, size_t s, size_t n,
783 FILE *restrict stream)
784 _GL_ARG_NONNULL ((1, 4)));
785 _GL_CXXALIAS_RPL (fwrite, size_t,
786 (const void *restrict ptr, size_t s, size_t n,
787 FILE *restrict stream));
788 # else
789 _GL_CXXALIAS_SYS (fwrite, size_t,
790 (const void *restrict ptr, size_t s, size_t n,
791 FILE *restrict stream));
792
793 /* Work around bug 11959 when fortifying glibc 2.4 through 2.15
794 <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>,
795 which sometimes causes an unwanted diagnostic for fwrite calls.
796 This affects only function declaration attributes under certain
797 versions of gcc and clang, and is not needed for C++. */
798 # if (0 < __USE_FORTIFY_LEVEL \
799 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
800 && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
801 && !defined __cplusplus)
802 # undef fwrite
803 # undef fwrite_unlocked
804 extern size_t __REDIRECT (rpl_fwrite,
805 (const void *__restrict, size_t, size_t,
806 FILE *__restrict),
807 fwrite);
808 extern size_t __REDIRECT (rpl_fwrite_unlocked,
809 (const void *__restrict, size_t, size_t,
810 FILE *__restrict),
811 fwrite_unlocked);
812 # define fwrite rpl_fwrite
813 # define fwrite_unlocked rpl_fwrite_unlocked
814 # endif
815 # endif
816 # if __GLIBC__ >= 2
817 _GL_CXXALIASWARN (fwrite);
818 # endif
819 #endif
820
821 #if @GNULIB_GETC@
822 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
823 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
824 # undef getc
825 # define getc rpl_fgetc
826 # endif
827 _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
828 _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
829 # else
830 _GL_CXXALIAS_SYS (getc, int, (FILE *stream));
831 # endif
832 # if __GLIBC__ >= 2
833 _GL_CXXALIASWARN (getc);
834 # endif
835 #endif
836
837 #if @GNULIB_GETCHAR@
838 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
839 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
840 # undef getchar
841 # define getchar rpl_getchar
842 # endif
843 _GL_FUNCDECL_RPL (getchar, int, (void));
844 _GL_CXXALIAS_RPL (getchar, int, (void));
845 # else
846 _GL_CXXALIAS_SYS (getchar, int, (void));
847 # endif
848 # if __GLIBC__ >= 2
849 _GL_CXXALIASWARN (getchar);
850 # endif
851 #endif
852
853 #if @GNULIB_GETDELIM@
854 /* Read input, up to (and including) the next occurrence of DELIMITER, from
855 STREAM, store it in *LINEPTR (and NUL-terminate it).
856 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
857 bytes of space. It is realloc'd as necessary.
858 Return the number of bytes read and stored at *LINEPTR (not including the
859 NUL terminator), or -1 on error or EOF. */
860 # if @REPLACE_GETDELIM@
861 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
862 # undef getdelim
863 # define getdelim rpl_getdelim
864 # endif
865 _GL_FUNCDECL_RPL (getdelim, ssize_t,
866 (char **restrict lineptr, size_t *restrict linesize,
867 int delimiter,
868 FILE *restrict stream)
869 _GL_ARG_NONNULL ((1, 2, 4)));
870 _GL_CXXALIAS_RPL (getdelim, ssize_t,
871 (char **restrict lineptr, size_t *restrict linesize,
872 int delimiter,
873 FILE *restrict stream));
874 # else
875 # if !@HAVE_DECL_GETDELIM@
876 _GL_FUNCDECL_SYS (getdelim, ssize_t,
877 (char **restrict lineptr, size_t *restrict linesize,
878 int delimiter,
879 FILE *restrict stream)
880 _GL_ARG_NONNULL ((1, 2, 4)));
881 # endif
882 _GL_CXXALIAS_SYS (getdelim, ssize_t,
883 (char **restrict lineptr, size_t *restrict linesize,
884 int delimiter,
885 FILE *restrict stream));
886 # endif
887 # if __GLIBC__ >= 2
888 _GL_CXXALIASWARN (getdelim);
889 # endif
890 #elif defined GNULIB_POSIXCHECK
891 # undef getdelim
892 # if HAVE_RAW_DECL_GETDELIM
893 _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
894 "use gnulib module getdelim for portability");
895 # endif
896 #endif
897
898 #if @GNULIB_GETLINE@
899 /* Read a line, up to (and including) the next newline, from STREAM, store it
900 in *LINEPTR (and NUL-terminate it).
901 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
902 bytes of space. It is realloc'd as necessary.
903 Return the number of bytes read and stored at *LINEPTR (not including the
904 NUL terminator), or -1 on error or EOF. */
905 # if @REPLACE_GETLINE@
906 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
907 # undef getline
908 # define getline rpl_getline
909 # endif
910 _GL_FUNCDECL_RPL (getline, ssize_t,
911 (char **restrict lineptr, size_t *restrict linesize,
912 FILE *restrict stream)
913 _GL_ARG_NONNULL ((1, 2, 3)));
914 _GL_CXXALIAS_RPL (getline, ssize_t,
915 (char **restrict lineptr, size_t *restrict linesize,
916 FILE *restrict stream));
917 # else
918 # if !@HAVE_DECL_GETLINE@
919 _GL_FUNCDECL_SYS (getline, ssize_t,
920 (char **restrict lineptr, size_t *restrict linesize,
921 FILE *restrict stream)
922 _GL_ARG_NONNULL ((1, 2, 3)));
923 # endif
924 _GL_CXXALIAS_SYS (getline, ssize_t,
925 (char **restrict lineptr, size_t *restrict linesize,
926 FILE *restrict stream));
927 # endif
928 # if __GLIBC__ >= 2 && @HAVE_DECL_GETLINE@
929 _GL_CXXALIASWARN (getline);
930 # endif
931 #elif defined GNULIB_POSIXCHECK
932 # undef getline
933 # if HAVE_RAW_DECL_GETLINE
934 _GL_WARN_ON_USE (getline, "getline is unportable - "
935 "use gnulib module getline for portability");
936 # endif
937 #endif
938
939 /* It is very rare that the developer ever has full control of stdin,
940 so any use of gets warrants an unconditional warning; besides, C11
941 removed it. */
942 #undef gets
943 #if HAVE_RAW_DECL_GETS && !defined __cplusplus
944 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
945 #endif
946
947 #if @GNULIB_MDA_GETW@
948 /* On native Windows, map 'getw' to '_getw', so that -loldnames is not
949 required. In C++ with GNULIB_NAMESPACE, avoid differences between
950 platforms by defining GNULIB_NAMESPACE::getw always. */
951 # if defined _WIN32 && !defined __CYGWIN__
952 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
953 # undef getw
954 # define getw _getw
955 # endif
956 _GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream));
957 # else
958 # if @HAVE_DECL_GETW@
959 _GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream));
960 # endif
961 # endif
962 # if __GLIBC__ >= 2
963 _GL_CXXALIASWARN (getw);
964 # endif
965 #endif
966
967 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
968 struct obstack;
969 /* Grow an obstack with formatted output. Return the number of
970 bytes added to OBS. No trailing nul byte is added, and the
971 object should be closed with obstack_finish before use. Upon
972 memory allocation error, call obstack_alloc_failed_handler. Upon
973 other error, return -1. */
974 # if @REPLACE_OBSTACK_PRINTF@
975 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
976 # define obstack_printf rpl_obstack_printf
977 # endif
978 _GL_FUNCDECL_RPL (obstack_printf, int,
979 (struct obstack *obs, const char *format, ...)
980 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
981 _GL_ARG_NONNULL ((1, 2)));
982 _GL_CXXALIAS_RPL (obstack_printf, int,
983 (struct obstack *obs, const char *format, ...));
984 # else
985 # if !@HAVE_DECL_OBSTACK_PRINTF@
986 _GL_FUNCDECL_SYS (obstack_printf, int,
987 (struct obstack *obs, const char *format, ...)
988 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
989 _GL_ARG_NONNULL ((1, 2)));
990 # endif
991 _GL_CXXALIAS_SYS (obstack_printf, int,
992 (struct obstack *obs, const char *format, ...));
993 # endif
994 _GL_CXXALIASWARN (obstack_printf);
995 # if @REPLACE_OBSTACK_PRINTF@
996 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
997 # define obstack_vprintf rpl_obstack_vprintf
998 # endif
999 _GL_FUNCDECL_RPL (obstack_vprintf, int,
1000 (struct obstack *obs, const char *format, va_list args)
1001 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1002 _GL_ARG_NONNULL ((1, 2)));
1003 _GL_CXXALIAS_RPL (obstack_vprintf, int,
1004 (struct obstack *obs, const char *format, va_list args));
1005 # else
1006 # if !@HAVE_DECL_OBSTACK_PRINTF@
1007 _GL_FUNCDECL_SYS (obstack_vprintf, int,
1008 (struct obstack *obs, const char *format, va_list args)
1009 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1010 _GL_ARG_NONNULL ((1, 2)));
1011 # endif
1012 _GL_CXXALIAS_SYS (obstack_vprintf, int,
1013 (struct obstack *obs, const char *format, va_list args));
1014 # endif
1015 _GL_CXXALIASWARN (obstack_vprintf);
1016 #endif
1017
1018 #if @GNULIB_PCLOSE@
1019 # if !@HAVE_PCLOSE@
1020 _GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
1021 # endif
1022 _GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
1023 _GL_CXXALIASWARN (pclose);
1024 #elif defined GNULIB_POSIXCHECK
1025 # undef pclose
1026 # if HAVE_RAW_DECL_PCLOSE
1027 _GL_WARN_ON_USE (pclose, "pclose is unportable - "
1028 "use gnulib module pclose for more portability");
1029 # endif
1030 #endif
1031
1032 #if @GNULIB_PERROR@
1033 /* Print a message to standard error, describing the value of ERRNO,
1034 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
1035 and terminated with a newline. */
1036 # if @REPLACE_PERROR@
1037 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1038 # define perror rpl_perror
1039 # endif
1040 _GL_FUNCDECL_RPL (perror, void, (const char *string));
1041 _GL_CXXALIAS_RPL (perror, void, (const char *string));
1042 # else
1043 _GL_CXXALIAS_SYS (perror, void, (const char *string));
1044 # endif
1045 # if __GLIBC__ >= 2
1046 _GL_CXXALIASWARN (perror);
1047 # endif
1048 #elif defined GNULIB_POSIXCHECK
1049 # undef perror
1050 /* Assume perror is always declared. */
1051 _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
1052 "use gnulib module perror for portability");
1053 #endif
1054
1055 #if @GNULIB_POPEN@
1056 # if @REPLACE_POPEN@
1057 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1058 # undef popen
1059 # define popen rpl_popen
1060 # endif
1061 _GL_FUNCDECL_RPL (popen, FILE *,
1062 (const char *cmd, const char *mode)
1063 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1));
1064 _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
1065 # else
1066 # if !@HAVE_POPEN@ || __GNUC__ >= 11
1067 _GL_FUNCDECL_SYS (popen, FILE *,
1068 (const char *cmd, const char *mode)
1069 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1));
1070 # endif
1071 _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
1072 # endif
1073 _GL_CXXALIASWARN (popen);
1074 #else
1075 # if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen
1076 /* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */
1077 _GL_FUNCDECL_SYS (popen, FILE *,
1078 (const char *cmd, const char *mode)
1079 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1));
1080 # endif
1081 # if defined GNULIB_POSIXCHECK
1082 # undef popen
1083 # if HAVE_RAW_DECL_POPEN
1084 _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
1085 "use gnulib module popen or pipe for more portability");
1086 # endif
1087 # endif
1088 #endif
1089
1090 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
1091 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
1092 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1093 # if defined __GNUC__ || defined __clang__
1094 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1095 /* Don't break __attribute__((format(printf,M,N))). */
1096 # define printf __printf__
1097 # endif
1098 # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1099 _GL_FUNCDECL_RPL_1 (__printf__, int,
1100 (const char *restrict format, ...)
1101 __asm__ (@ASM_SYMBOL_PREFIX@
1102 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
1103 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1104 _GL_ARG_NONNULL ((1)));
1105 # else
1106 _GL_FUNCDECL_RPL_1 (__printf__, int,
1107 (const char *restrict format, ...)
1108 __asm__ (@ASM_SYMBOL_PREFIX@
1109 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
1110 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
1111 _GL_ARG_NONNULL ((1)));
1112 # endif
1113 _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
1114 # else
1115 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1116 # define printf rpl_printf
1117 # endif
1118 _GL_FUNCDECL_RPL (printf, int,
1119 (const char *restrict format, ...)
1120 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1121 _GL_ARG_NONNULL ((1)));
1122 _GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
1123 # endif
1124 # define GNULIB_overrides_printf 1
1125 # else
1126 _GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...));
1127 # endif
1128 # if __GLIBC__ >= 2
1129 _GL_CXXALIASWARN (printf);
1130 # endif
1131 #endif
1132 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1133 # if !GNULIB_overrides_printf
1134 # undef printf
1135 # endif
1136 /* Assume printf is always declared. */
1137 _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
1138 "use gnulib module printf-posix for portable "
1139 "POSIX compliance");
1140 #endif
1141
1142 #if @GNULIB_PUTC@
1143 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
1144 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1145 # undef putc
1146 # define putc rpl_fputc
1147 # endif
1148 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
1149 _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
1150 # else
1151 _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
1152 # endif
1153 # if __GLIBC__ >= 2
1154 _GL_CXXALIASWARN (putc);
1155 # endif
1156 #endif
1157
1158 #if @GNULIB_PUTCHAR@
1159 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
1160 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1161 # undef putchar
1162 # define putchar rpl_putchar
1163 # endif
1164 _GL_FUNCDECL_RPL (putchar, int, (int c));
1165 _GL_CXXALIAS_RPL (putchar, int, (int c));
1166 # else
1167 _GL_CXXALIAS_SYS (putchar, int, (int c));
1168 # endif
1169 # if __GLIBC__ >= 2
1170 _GL_CXXALIASWARN (putchar);
1171 # endif
1172 #endif
1173
1174 #if @GNULIB_PUTS@
1175 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
1176 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1177 # undef puts
1178 # define puts rpl_puts
1179 # endif
1180 _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
1181 _GL_CXXALIAS_RPL (puts, int, (const char *string));
1182 # else
1183 _GL_CXXALIAS_SYS (puts, int, (const char *string));
1184 # endif
1185 # if __GLIBC__ >= 2
1186 _GL_CXXALIASWARN (puts);
1187 # endif
1188 #endif
1189
1190 #if @GNULIB_MDA_PUTW@
1191 /* On native Windows, map 'putw' to '_putw', so that -loldnames is not
1192 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1193 platforms by defining GNULIB_NAMESPACE::putw always. */
1194 # if defined _WIN32 && !defined __CYGWIN__
1195 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1196 # undef putw
1197 # define putw _putw
1198 # endif
1199 _GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream));
1200 # else
1201 # if @HAVE_DECL_PUTW@
1202 _GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream));
1203 # endif
1204 # endif
1205 # if __GLIBC__ >= 2
1206 _GL_CXXALIASWARN (putw);
1207 # endif
1208 #endif
1209
1210 #if @GNULIB_REMOVE@
1211 # if @REPLACE_REMOVE@
1212 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1213 # undef remove
1214 # define remove rpl_remove
1215 # endif
1216 _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
1217 _GL_CXXALIAS_RPL (remove, int, (const char *name));
1218 # else
1219 _GL_CXXALIAS_SYS (remove, int, (const char *name));
1220 # endif
1221 # if __GLIBC__ >= 2
1222 _GL_CXXALIASWARN (remove);
1223 # endif
1224 #elif defined GNULIB_POSIXCHECK
1225 # undef remove
1226 /* Assume remove is always declared. */
1227 _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
1228 "use gnulib module remove for more portability");
1229 #endif
1230
1231 #if @GNULIB_RENAME@
1232 # if @REPLACE_RENAME@
1233 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1234 # undef rename
1235 # define rename rpl_rename
1236 # endif
1237 _GL_FUNCDECL_RPL (rename, int,
1238 (const char *old_filename, const char *new_filename)
1239 _GL_ARG_NONNULL ((1, 2)));
1240 _GL_CXXALIAS_RPL (rename, int,
1241 (const char *old_filename, const char *new_filename));
1242 # else
1243 _GL_CXXALIAS_SYS (rename, int,
1244 (const char *old_filename, const char *new_filename));
1245 # endif
1246 # if __GLIBC__ >= 2
1247 _GL_CXXALIASWARN (rename);
1248 # endif
1249 #elif defined GNULIB_POSIXCHECK
1250 # undef rename
1251 /* Assume rename is always declared. */
1252 _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
1253 "use gnulib module rename for more portability");
1254 #endif
1255
1256 #if @GNULIB_RENAMEAT@
1257 # if @REPLACE_RENAMEAT@
1258 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1259 # undef renameat
1260 # define renameat rpl_renameat
1261 # endif
1262 _GL_FUNCDECL_RPL (renameat, int,
1263 (int fd1, char const *file1, int fd2, char const *file2)
1264 _GL_ARG_NONNULL ((2, 4)));
1265 _GL_CXXALIAS_RPL (renameat, int,
1266 (int fd1, char const *file1, int fd2, char const *file2));
1267 # else
1268 # if !@HAVE_RENAMEAT@
1269 _GL_FUNCDECL_SYS (renameat, int,
1270 (int fd1, char const *file1, int fd2, char const *file2)
1271 _GL_ARG_NONNULL ((2, 4)));
1272 # endif
1273 _GL_CXXALIAS_SYS (renameat, int,
1274 (int fd1, char const *file1, int fd2, char const *file2));
1275 # endif
1276 _GL_CXXALIASWARN (renameat);
1277 #elif defined GNULIB_POSIXCHECK
1278 # undef renameat
1279 # if HAVE_RAW_DECL_RENAMEAT
1280 _GL_WARN_ON_USE (renameat, "renameat is not portable - "
1281 "use gnulib module renameat for portability");
1282 # endif
1283 #endif
1284
1285 #if @GNULIB_SCANF@
1286 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1287 # if defined __GNUC__ || defined __clang__
1288 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1289 # undef scanf
1290 /* Don't break __attribute__((format(scanf,M,N))). */
1291 # define scanf __scanf__
1292 # endif
1293 _GL_FUNCDECL_RPL_1 (__scanf__, int,
1294 (const char *restrict format, ...)
1295 __asm__ (@ASM_SYMBOL_PREFIX@
1296 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
1297 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1298 _GL_ARG_NONNULL ((1)));
1299 _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...));
1300 # else
1301 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1302 # undef scanf
1303 # define scanf rpl_scanf
1304 # endif
1305 _GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...)
1306 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1307 _GL_ARG_NONNULL ((1)));
1308 _GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
1309 # endif
1310 # else
1311 _GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...));
1312 # endif
1313 # if __GLIBC__ >= 2
1314 _GL_CXXALIASWARN (scanf);
1315 # endif
1316 #endif
1317
1318 #if @GNULIB_SNPRINTF@
1319 # if @REPLACE_SNPRINTF@
1320 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1321 # define snprintf rpl_snprintf
1322 # endif
1323 # define GNULIB_overrides_snprintf 1
1324 _GL_FUNCDECL_RPL (snprintf, int,
1325 (char *restrict str, size_t size,
1326 const char *restrict format, ...)
1327 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1328 _GL_ARG_NONNULL ((3)));
1329 _GL_CXXALIAS_RPL (snprintf, int,
1330 (char *restrict str, size_t size,
1331 const char *restrict format, ...));
1332 # else
1333 # if !@HAVE_DECL_SNPRINTF@
1334 _GL_FUNCDECL_SYS (snprintf, int,
1335 (char *restrict str, size_t size,
1336 const char *restrict format, ...)
1337 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1338 _GL_ARG_NONNULL ((3)));
1339 # endif
1340 _GL_CXXALIAS_SYS (snprintf, int,
1341 (char *restrict str, size_t size,
1342 const char *restrict format, ...));
1343 # endif
1344 # if __GLIBC__ >= 2
1345 _GL_CXXALIASWARN (snprintf);
1346 # endif
1347 #elif defined GNULIB_POSIXCHECK
1348 # undef snprintf
1349 # if HAVE_RAW_DECL_SNPRINTF
1350 _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1351 "use gnulib module snprintf for portability");
1352 # endif
1353 #endif
1354
1355 /* Some people would argue that all sprintf uses should be warned about
1356 (for example, OpenBSD issues a link warning for it),
1357 since it can cause security holes due to buffer overruns.
1358 However, we believe that sprintf can be used safely, and is more
1359 efficient than snprintf in those safe cases; and as proof of our
1360 belief, we use sprintf in several gnulib modules. So this header
1361 intentionally avoids adding a warning to sprintf except when
1362 GNULIB_POSIXCHECK is defined. */
1363
1364 #if @GNULIB_SPRINTF_POSIX@
1365 # if @REPLACE_SPRINTF@
1366 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1367 # define sprintf rpl_sprintf
1368 # endif
1369 # define GNULIB_overrides_sprintf 1
1370 _GL_FUNCDECL_RPL (sprintf, int,
1371 (char *restrict str, const char *restrict format, ...)
1372 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1373 _GL_ARG_NONNULL ((1, 2)));
1374 _GL_CXXALIAS_RPL (sprintf, int,
1375 (char *restrict str, const char *restrict format, ...));
1376 # else
1377 _GL_CXXALIAS_SYS (sprintf, int,
1378 (char *restrict str, const char *restrict format, ...));
1379 # endif
1380 # if __GLIBC__ >= 2
1381 _GL_CXXALIASWARN (sprintf);
1382 # endif
1383 #elif defined GNULIB_POSIXCHECK
1384 # undef sprintf
1385 /* Assume sprintf is always declared. */
1386 _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
1387 "use gnulib module sprintf-posix for portable "
1388 "POSIX compliance");
1389 #endif
1390
1391 #if @GNULIB_MDA_TEMPNAM@
1392 /* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not
1393 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1394 platforms by defining GNULIB_NAMESPACE::tempnam always. */
1395 # if defined _WIN32 && !defined __CYGWIN__
1396 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1397 # undef tempnam
1398 # define tempnam _tempnam
1399 # endif
1400 _GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix));
1401 # else
1402 _GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix));
1403 # endif
1404 _GL_CXXALIASWARN (tempnam);
1405 #endif
1406
1407 #if @GNULIB_TMPFILE@
1408 # if @REPLACE_TMPFILE@
1409 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1410 # define tmpfile rpl_tmpfile
1411 # endif
1412 _GL_FUNCDECL_RPL (tmpfile, FILE *, (void)
1413 _GL_ATTRIBUTE_DEALLOC (fclose, 1));
1414 _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1415 # else
1416 # if __GNUC__ >= 11
1417 /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1418 _GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
1419 _GL_ATTRIBUTE_DEALLOC (fclose, 1));
1420 # endif
1421 _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1422 # endif
1423 # if __GLIBC__ >= 2
1424 _GL_CXXALIASWARN (tmpfile);
1425 # endif
1426 #else
1427 # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile
1428 /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1429 _GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
1430 _GL_ATTRIBUTE_DEALLOC (fclose, 1));
1431 # endif
1432 # if defined GNULIB_POSIXCHECK
1433 # undef tmpfile
1434 # if HAVE_RAW_DECL_TMPFILE
1435 _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1436 "use gnulib module tmpfile for portability");
1437 # endif
1438 # endif
1439 #endif
1440
1441 #if @GNULIB_VASPRINTF@
1442 /* Write formatted output to a string dynamically allocated with malloc().
1443 If the memory allocation succeeds, store the address of the string in
1444 *RESULT and return the number of resulting bytes, excluding the trailing
1445 NUL. Upon memory allocation error, or some other error, return -1. */
1446 # if @REPLACE_VASPRINTF@
1447 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1448 # define asprintf rpl_asprintf
1449 # endif
1450 # define GNULIB_overrides_asprintf
1451 _GL_FUNCDECL_RPL (asprintf, int,
1452 (char **result, const char *format, ...)
1453 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1454 _GL_ARG_NONNULL ((1, 2)));
1455 _GL_CXXALIAS_RPL (asprintf, int,
1456 (char **result, const char *format, ...));
1457 # else
1458 # if !@HAVE_VASPRINTF@
1459 _GL_FUNCDECL_SYS (asprintf, int,
1460 (char **result, const char *format, ...)
1461 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1462 _GL_ARG_NONNULL ((1, 2)));
1463 # endif
1464 _GL_CXXALIAS_SYS (asprintf, int,
1465 (char **result, const char *format, ...));
1466 # endif
1467 _GL_CXXALIASWARN (asprintf);
1468 # if @REPLACE_VASPRINTF@
1469 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1470 # define vasprintf rpl_vasprintf
1471 # endif
1472 # define GNULIB_overrides_vasprintf 1
1473 _GL_FUNCDECL_RPL (vasprintf, int,
1474 (char **result, const char *format, va_list args)
1475 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1476 _GL_ARG_NONNULL ((1, 2)));
1477 _GL_CXXALIAS_RPL (vasprintf, int,
1478 (char **result, const char *format, va_list args));
1479 # else
1480 # if !@HAVE_VASPRINTF@
1481 _GL_FUNCDECL_SYS (vasprintf, int,
1482 (char **result, const char *format, va_list args)
1483 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1484 _GL_ARG_NONNULL ((1, 2)));
1485 # endif
1486 _GL_CXXALIAS_SYS (vasprintf, int,
1487 (char **result, const char *format, va_list args));
1488 # endif
1489 _GL_CXXALIASWARN (vasprintf);
1490 #endif
1491
1492 #if @GNULIB_VDPRINTF@
1493 # if @REPLACE_VDPRINTF@
1494 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1495 # define vdprintf rpl_vdprintf
1496 # endif
1497 _GL_FUNCDECL_RPL (vdprintf, int,
1498 (int fd, const char *restrict format, va_list args)
1499 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1500 _GL_ARG_NONNULL ((2)));
1501 _GL_CXXALIAS_RPL (vdprintf, int,
1502 (int fd, const char *restrict format, va_list args));
1503 # else
1504 # if !@HAVE_VDPRINTF@
1505 _GL_FUNCDECL_SYS (vdprintf, int,
1506 (int fd, const char *restrict format, va_list args)
1507 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1508 _GL_ARG_NONNULL ((2)));
1509 # endif
1510 /* Need to cast, because on Solaris, the third parameter will likely be
1511 __va_list args. */
1512 _GL_CXXALIAS_SYS_CAST (vdprintf, int,
1513 (int fd, const char *restrict format, va_list args));
1514 # endif
1515 # if __GLIBC__ >= 2
1516 _GL_CXXALIASWARN (vdprintf);
1517 # endif
1518 #elif defined GNULIB_POSIXCHECK
1519 # undef vdprintf
1520 # if HAVE_RAW_DECL_VDPRINTF
1521 _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1522 "use gnulib module vdprintf for portability");
1523 # endif
1524 #endif
1525
1526 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1527 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1528 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1529 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1530 # define vfprintf rpl_vfprintf
1531 # endif
1532 # define GNULIB_overrides_vfprintf 1
1533 # if @GNULIB_VFPRINTF_POSIX@
1534 _GL_FUNCDECL_RPL (vfprintf, int,
1535 (FILE *restrict fp,
1536 const char *restrict format, va_list args)
1537 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1538 _GL_ARG_NONNULL ((1, 2)));
1539 # else
1540 _GL_FUNCDECL_RPL (vfprintf, int,
1541 (FILE *restrict fp,
1542 const char *restrict format, va_list args)
1543 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1544 _GL_ARG_NONNULL ((1, 2)));
1545 # endif
1546 _GL_CXXALIAS_RPL (vfprintf, int,
1547 (FILE *restrict fp,
1548 const char *restrict format, va_list args));
1549 # else
1550 /* Need to cast, because on Solaris, the third parameter is
1551 __va_list args
1552 and GCC's fixincludes did not change this to __gnuc_va_list. */
1553 _GL_CXXALIAS_SYS_CAST (vfprintf, int,
1554 (FILE *restrict fp,
1555 const char *restrict format, va_list args));
1556 # endif
1557 # if __GLIBC__ >= 2
1558 _GL_CXXALIASWARN (vfprintf);
1559 # endif
1560 #endif
1561 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1562 # if !GNULIB_overrides_vfprintf
1563 # undef vfprintf
1564 # endif
1565 /* Assume vfprintf is always declared. */
1566 _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1567 "use gnulib module vfprintf-posix for portable "
1568 "POSIX compliance");
1569 #endif
1570
1571 #if @GNULIB_VFSCANF@
1572 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1573 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1574 # undef vfscanf
1575 # define vfscanf rpl_vfscanf
1576 # endif
1577 _GL_FUNCDECL_RPL (vfscanf, int,
1578 (FILE *restrict stream,
1579 const char *restrict format, va_list args)
1580 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1581 _GL_ARG_NONNULL ((1, 2)));
1582 _GL_CXXALIAS_RPL (vfscanf, int,
1583 (FILE *restrict stream,
1584 const char *restrict format, va_list args));
1585 # else
1586 _GL_CXXALIAS_SYS (vfscanf, int,
1587 (FILE *restrict stream,
1588 const char *restrict format, va_list args));
1589 # endif
1590 # if __GLIBC__ >= 2
1591 _GL_CXXALIASWARN (vfscanf);
1592 # endif
1593 #endif
1594
1595 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1596 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1597 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1598 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1599 # define vprintf rpl_vprintf
1600 # endif
1601 # define GNULIB_overrides_vprintf 1
1602 # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1603 _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
1604 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1605 _GL_ARG_NONNULL ((1)));
1606 # else
1607 _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
1608 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1609 _GL_ARG_NONNULL ((1)));
1610 # endif
1611 _GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args));
1612 # else
1613 /* Need to cast, because on Solaris, the second parameter is
1614 __va_list args
1615 and GCC's fixincludes did not change this to __gnuc_va_list. */
1616 _GL_CXXALIAS_SYS_CAST (vprintf, int,
1617 (const char *restrict format, va_list args));
1618 # endif
1619 # if __GLIBC__ >= 2
1620 _GL_CXXALIASWARN (vprintf);
1621 # endif
1622 #endif
1623 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1624 # if !GNULIB_overrides_vprintf
1625 # undef vprintf
1626 # endif
1627 /* Assume vprintf is always declared. */
1628 _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1629 "use gnulib module vprintf-posix for portable "
1630 "POSIX compliance");
1631 #endif
1632
1633 #if @GNULIB_VSCANF@
1634 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1635 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1636 # undef vscanf
1637 # define vscanf rpl_vscanf
1638 # endif
1639 _GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args)
1640 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1641 _GL_ARG_NONNULL ((1)));
1642 _GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
1643 # else
1644 _GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
1645 # endif
1646 # if __GLIBC__ >= 2
1647 _GL_CXXALIASWARN (vscanf);
1648 # endif
1649 #endif
1650
1651 #if @GNULIB_VSNPRINTF@
1652 # if @REPLACE_VSNPRINTF@
1653 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1654 # define vsnprintf rpl_vsnprintf
1655 # endif
1656 # define GNULIB_overrides_vsnprintf 1
1657 _GL_FUNCDECL_RPL (vsnprintf, int,
1658 (char *restrict str, size_t size,
1659 const char *restrict format, va_list args)
1660 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1661 _GL_ARG_NONNULL ((3)));
1662 _GL_CXXALIAS_RPL (vsnprintf, int,
1663 (char *restrict str, size_t size,
1664 const char *restrict format, va_list args));
1665 # else
1666 # if !@HAVE_DECL_VSNPRINTF@
1667 _GL_FUNCDECL_SYS (vsnprintf, int,
1668 (char *restrict str, size_t size,
1669 const char *restrict format, va_list args)
1670 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1671 _GL_ARG_NONNULL ((3)));
1672 # endif
1673 _GL_CXXALIAS_SYS (vsnprintf, int,
1674 (char *restrict str, size_t size,
1675 const char *restrict format, va_list args));
1676 # endif
1677 # if __GLIBC__ >= 2
1678 _GL_CXXALIASWARN (vsnprintf);
1679 # endif
1680 #elif defined GNULIB_POSIXCHECK
1681 # undef vsnprintf
1682 # if HAVE_RAW_DECL_VSNPRINTF
1683 _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1684 "use gnulib module vsnprintf for portability");
1685 # endif
1686 #endif
1687
1688 #if @GNULIB_VSPRINTF_POSIX@
1689 # if @REPLACE_VSPRINTF@
1690 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1691 # define vsprintf rpl_vsprintf
1692 # endif
1693 # define GNULIB_overrides_vsprintf 1
1694 _GL_FUNCDECL_RPL (vsprintf, int,
1695 (char *restrict str,
1696 const char *restrict format, va_list args)
1697 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1698 _GL_ARG_NONNULL ((1, 2)));
1699 _GL_CXXALIAS_RPL (vsprintf, int,
1700 (char *restrict str,
1701 const char *restrict format, va_list args));
1702 # else
1703 /* Need to cast, because on Solaris, the third parameter is
1704 __va_list args
1705 and GCC's fixincludes did not change this to __gnuc_va_list. */
1706 _GL_CXXALIAS_SYS_CAST (vsprintf, int,
1707 (char *restrict str,
1708 const char *restrict format, va_list args));
1709 # endif
1710 # if __GLIBC__ >= 2
1711 _GL_CXXALIASWARN (vsprintf);
1712 # endif
1713 #elif defined GNULIB_POSIXCHECK
1714 # undef vsprintf
1715 /* Assume vsprintf is always declared. */
1716 _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
1717 "use gnulib module vsprintf-posix for portable "
1718 "POSIX compliance");
1719 #endif
1720
1721 #endif /* _@GUARD_PREFIX@_STDIO_H */
1722 #endif /* _@GUARD_PREFIX@_STDIO_H */
1723 #endif