1 /* A GNU-like <stdio.h>.
3 Copyright (C) 2004, 2007-2024 Free Software Foundation, Inc.
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.
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.
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/>. */
19 @PRAGMA_SYSTEM_HEADER@
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. */
32 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
35 /* Normal invocation convention. */
37 #ifndef _@GUARD_PREFIX@_STDIO_H
39 /* Suppress macOS deprecation warnings for sprintf and vsprintf. */
40 #if (defined __APPLE__ && defined __MACH__) && !defined _POSIX_C_SOURCE
41 # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
42 # include <AvailabilityMacros.h>
44 # if (defined MAC_OS_X_VERSION_MIN_REQUIRED \
45 && 130000 <= MAC_OS_X_VERSION_MIN_REQUIRED)
46 # define _POSIX_C_SOURCE 200809L
47 # define _GL_DEFINED__POSIX_C_SOURCE
51 #define _GL_ALREADY_INCLUDING_STDIO_H
53 /* The include_next requires a split double-inclusion guard. */
54 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
56 #undef _GL_ALREADY_INCLUDING_STDIO_H
58 #ifdef _GL_DEFINED__POSIX_C_SOURCE
59 # undef _GL_DEFINED__POSIX_C_SOURCE
60 # undef _POSIX_C_SOURCE
63 #ifndef _@GUARD_PREFIX@_STDIO_H
64 #define _@GUARD_PREFIX@_STDIO_H
66 /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT,
67 _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK,
69 #if !_GL_CONFIG_H_INCLUDED
70 #error "Please include config.h first."
73 /* Get va_list. Needed on many systems, including glibc 2.8. */
78 /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
80 May also define off_t to a 64-bit type on native Windows. */
81 #include <sys/types.h>
83 /* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */
84 /* But in any case avoid namespace pollution on glibc systems. */
85 #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \
86 && ! defined __GLIBC__
90 /* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */
91 /* But in any case avoid namespace pollution on glibc systems. */
92 #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
93 && ! defined __GLIBC__
94 # include <sys/stat.h>
97 /* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include
98 it before we #define perror rpl_perror. */
99 /* But in any case avoid namespace pollution on glibc systems. */
100 #if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \
101 && (defined _WIN32 && ! defined __CYGWIN__) \
102 && ! defined __GLIBC__
106 /* MSVC declares 'remove' in <io.h>, not in <stdio.h>. We must include
107 it before we #define remove rpl_remove. */
108 /* MSVC declares 'rename' in <io.h>, not in <stdio.h>. We must include
109 it before we #define rename rpl_rename. */
110 /* But in any case avoid namespace pollution on glibc systems. */
111 #if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \
112 && (defined _WIN32 && ! defined __CYGWIN__) \
113 && ! defined __GLIBC__
118 /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
119 that can be freed by passing them as the Ith argument to the
121 #ifndef _GL_ATTRIBUTE_DEALLOC
123 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
125 # define _GL_ATTRIBUTE_DEALLOC(f, i)
129 /* The __attribute__ feature is available in gcc versions 2.5 and later.
130 The __-protected variants of the attributes 'format' and 'printf' are
131 accepted by gcc versions 2.6.4 (effectively 2.7) and later.
132 We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
133 gnulib and libintl do '#define printf __printf__' when they override
134 the 'printf' function. */
135 #ifndef _GL_ATTRIBUTE_FORMAT
136 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__
137 # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
139 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
143 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
145 #ifndef _GL_ATTRIBUTE_MALLOC
146 # if __GNUC__ >= 3 || defined __clang__
147 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
149 # define _GL_ATTRIBUTE_MALLOC
153 /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
155 #ifndef _GL_ATTRIBUTE_NOTHROW
156 # if defined __cplusplus
157 # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
158 # if __cplusplus >= 201103L
159 # define _GL_ATTRIBUTE_NOTHROW noexcept (true)
161 # define _GL_ATTRIBUTE_NOTHROW throw ()
164 # define _GL_ATTRIBUTE_NOTHROW
167 # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
168 # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
170 # define _GL_ATTRIBUTE_NOTHROW
175 /* An __attribute__ __format__ specifier for a function that takes a format
176 string and arguments, where the format string directives are the ones
177 standardized by ISO C99 and POSIX.
178 _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */
179 /* __gnu_printf__ is supported in GCC >= 4.4. */
180 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
181 # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
183 # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
186 /* An __attribute__ __format__ specifier for a function that takes a format
187 string and arguments, where the format string directives are the ones of the
188 system printf(), rather than the ones standardized by ISO C99 and POSIX.
189 _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM */
190 /* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to
191 the standards. The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates
192 whether this change is effective. On older mingw, it is not. */
193 #if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
194 # define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD
196 # define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__
199 /* _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD
200 indicates to GCC that the function takes a format string and arguments,
201 where the format string directives are the ones standardized by ISO C99
203 #define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \
204 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument))
206 /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD,
207 except that it indicates to GCC that the supported format string directives
208 are the ones of the system printf(), rather than the ones standardized by
209 ISO C99 and POSIX. */
210 #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
211 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, formatstring_parameter, first_argument))
213 /* _GL_ATTRIBUTE_FORMAT_SCANF
214 indicates to GCC that the function takes a format string and arguments,
215 where the format string directives are the ones standardized by ISO C99
217 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
218 # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
219 _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
221 # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
222 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
225 /* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
226 except that it indicates to GCC that the supported format string directives
227 are the ones of the system scanf(), rather than the ones standardized by
228 ISO C99 and POSIX. */
229 #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
230 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
232 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
234 /* The definition of _GL_ARG_NONNULL is copied here. */
236 /* The definition of _GL_WARN_ON_USE is copied here. */
238 /* Macros for stringification. */
239 #define _GL_STDIO_STRINGIZE(token) #token
240 #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
242 /* When also using extern inline, suppress the use of static inline in
243 standard headers of problematic Apple configurations, as Libc at
244 least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
245 <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>.
246 Perhaps Apple will fix this some day. */
247 #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
248 && defined __GNUC__ && defined __STDC__)
249 # undef putc_unlocked
253 /* Maximum number of characters produced by printing a NaN value. */
254 #ifndef _PRINTF_NAN_LEN_MAX
255 # if defined __FreeBSD__ || defined __DragonFly__ \
256 || defined __NetBSD__ \
257 || (defined __APPLE__ && defined __MACH__)
258 /* On BSD systems, a NaN value prints as just "nan", without a sign. */
259 # define _PRINTF_NAN_LEN_MAX 3
260 # elif (__GLIBC__ >= 2) || MUSL_LIBC || defined __OpenBSD__ || defined __sun || defined __CYGWIN__
261 /* glibc, musl libc, OpenBSD, Solaris libc, and Cygwin produce "[-]nan". */
262 # define _PRINTF_NAN_LEN_MAX 4
264 /* AIX produces "[-]NaNQ". */
265 # define _PRINTF_NAN_LEN_MAX 5
266 # elif defined _WIN32 && !defined __CYGWIN__
267 /* On native Windows, the output can be:
268 - with MSVC ucrt: "[-]nan" or "[-]nan(ind)" or "[-]nan(snan)",
269 - with mingw: "[-]1.#IND" or "[-]1.#QNAN". */
270 # define _PRINTF_NAN_LEN_MAX 10
272 /* On IRIX, the output typically is "[-]nan0xNNNNNNNN" with 8 hexadecimal
274 # define _PRINTF_NAN_LEN_MAX 14
276 /* We don't know, but 32 should be a safe maximum. */
277 # define _PRINTF_NAN_LEN_MAX 32
283 # if @REPLACE_DPRINTF@
284 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
285 # define dprintf rpl_dprintf
287 _GL_FUNCDECL_RPL (dprintf
, int, (int fd
, const char *restrict format
, ...)
288 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
289 _GL_ARG_NONNULL ((2)));
290 _GL_CXXALIAS_RPL (dprintf
, int, (int fd
, const char *restrict format
, ...));
293 _GL_FUNCDECL_SYS (dprintf
, int, (int fd
, const char *restrict format
, ...)
294 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
295 _GL_ARG_NONNULL ((2)));
297 _GL_CXXALIAS_SYS (dprintf
, int, (int fd
, const char *restrict format
, ...));
300 _GL_CXXALIASWARN (dprintf
);
302 #elif defined GNULIB_POSIXCHECK
304 # if HAVE_RAW_DECL_DPRINTF
305 _GL_WARN_ON_USE (dprintf
, "dprintf is unportable - "
306 "use gnulib module dprintf for portability");
311 /* Close STREAM and its underlying file descriptor. */
312 # if @REPLACE_FCLOSE@
313 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
314 # define fclose rpl_fclose
316 _GL_FUNCDECL_RPL (fclose
, int, (FILE *stream
) _GL_ARG_NONNULL ((1)));
317 _GL_CXXALIAS_RPL (fclose
, int, (FILE *stream
));
319 _GL_CXXALIAS_SYS (fclose
, int, (FILE *stream
));
322 _GL_CXXALIASWARN (fclose
);
324 #elif defined GNULIB_POSIXCHECK
326 /* Assume fclose is always declared. */
327 _GL_WARN_ON_USE (fclose
, "fclose is not always POSIX compliant - "
328 "use gnulib module fclose for portable POSIX compliance");
331 #if @GNULIB_MDA_FCLOSEALL@
332 /* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is
333 not required. In C++ with GNULIB_NAMESPACE, avoid differences between
334 platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have
336 # if defined _WIN32 && !defined __CYGWIN__
337 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
339 # define fcloseall _fcloseall
341 _GL_CXXALIAS_MDA (fcloseall
, int, (void));
343 # if @HAVE_DECL_FCLOSEALL@
344 # if defined __FreeBSD__ || defined __DragonFly__
345 _GL_CXXALIAS_SYS (fcloseall
, void, (void));
347 _GL_CXXALIAS_SYS (fcloseall
, int, (void));
351 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@
352 _GL_CXXALIASWARN (fcloseall
);
357 # if @REPLACE_FDOPEN@
358 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
360 # define fdopen rpl_fdopen
362 _GL_FUNCDECL_RPL (fdopen
, FILE *,
363 (int fd
, const char *mode
)
364 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1)
365 _GL_ATTRIBUTE_MALLOC
);
366 _GL_CXXALIAS_RPL (fdopen
, FILE *, (int fd
, const char *mode
));
367 # elif defined _WIN32 && !defined __CYGWIN__
368 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
370 # define fdopen _fdopen
372 _GL_CXXALIAS_MDA (fdopen
, FILE *, (int fd
, const char *mode
));
375 /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
376 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
377 _GL_FUNCDECL_SYS (fdopen
, FILE *,
378 (int fd
, const char *mode
)
379 _GL_ATTRIBUTE_NOTHROW
380 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1)
381 _GL_ATTRIBUTE_MALLOC
);
383 _GL_FUNCDECL_SYS (fdopen
, FILE *,
384 (int fd
, const char *mode
)
385 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1)
386 _GL_ATTRIBUTE_MALLOC
);
389 _GL_CXXALIAS_SYS (fdopen
, FILE *, (int fd
, const char *mode
));
391 _GL_CXXALIASWARN (fdopen
);
393 # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen
394 /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
395 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
396 _GL_FUNCDECL_SYS (fdopen
, FILE *,
397 (int fd
, const char *mode
)
398 _GL_ATTRIBUTE_NOTHROW
399 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1)
400 _GL_ATTRIBUTE_MALLOC
);
402 _GL_FUNCDECL_SYS (fdopen
, FILE *,
403 (int fd
, const char *mode
)
404 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1)
405 _GL_ATTRIBUTE_MALLOC
);
408 # if defined GNULIB_POSIXCHECK
410 /* Assume fdopen is always declared. */
411 _GL_WARN_ON_USE (fdopen
, "fdopen on native Windows platforms is not POSIX compliant - "
412 "use gnulib module fdopen for portability");
413 # elif @GNULIB_MDA_FDOPEN@
414 /* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not
415 required. In C++ with GNULIB_NAMESPACE, avoid differences between
416 platforms by defining GNULIB_NAMESPACE::fdopen always. */
417 # if defined _WIN32 && !defined __CYGWIN__
418 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
420 # define fdopen _fdopen
422 _GL_CXXALIAS_MDA (fdopen
, FILE *, (int fd
, const char *mode
));
424 _GL_CXXALIAS_SYS (fdopen
, FILE *, (int fd
, const char *mode
));
426 _GL_CXXALIASWARN (fdopen
);
431 /* Flush all pending data on STREAM according to POSIX rules. Both
432 output and seekable input streams are supported.
433 Note! LOSS OF DATA can occur if fflush is applied on an input stream
434 that is _not_seekable_ or on an update stream that is _not_seekable_
435 and in which the most recent operation was input. Seekability can
436 be tested with lseek(fileno(fp),0,SEEK_CUR). */
437 # if @REPLACE_FFLUSH@
438 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
439 # define fflush rpl_fflush
441 _GL_FUNCDECL_RPL (fflush
, int, (FILE *gl_stream
));
442 _GL_CXXALIAS_RPL (fflush
, int, (FILE *gl_stream
));
444 _GL_CXXALIAS_SYS (fflush
, int, (FILE *gl_stream
));
447 _GL_CXXALIASWARN (fflush
);
449 #elif defined GNULIB_POSIXCHECK
451 /* Assume fflush is always declared. */
452 _GL_WARN_ON_USE (fflush
, "fflush is not always POSIX compliant - "
453 "use gnulib module fflush for portable POSIX compliance");
457 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
458 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
460 # define fgetc rpl_fgetc
462 _GL_FUNCDECL_RPL (fgetc
, int, (FILE *stream
) _GL_ARG_NONNULL ((1)));
463 _GL_CXXALIAS_RPL (fgetc
, int, (FILE *stream
));
465 _GL_CXXALIAS_SYS (fgetc
, int, (FILE *stream
));
468 _GL_CXXALIASWARN (fgetc
);
473 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
474 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
476 # define fgets rpl_fgets
478 _GL_FUNCDECL_RPL (fgets
, char *,
479 (char *restrict s
, int n
, FILE *restrict stream
)
480 _GL_ARG_NONNULL ((1, 3)));
481 _GL_CXXALIAS_RPL (fgets
, char *,
482 (char *restrict s
, int n
, FILE *restrict stream
));
484 _GL_CXXALIAS_SYS (fgets
, char *,
485 (char *restrict s
, int n
, FILE *restrict stream
));
488 _GL_CXXALIASWARN (fgets
);
492 #if @GNULIB_MDA_FILENO@
493 /* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not
494 required. In C++ with GNULIB_NAMESPACE, avoid differences between
495 platforms by defining GNULIB_NAMESPACE::fileno always. */
496 # if defined _WIN32 && !defined __CYGWIN__
497 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
499 # define fileno _fileno
501 _GL_CXXALIAS_MDA (fileno
, int, (FILE *restrict stream
));
503 _GL_CXXALIAS_SYS (fileno
, int, (FILE *restrict stream
));
505 _GL_CXXALIASWARN (fileno
);
509 # if (@GNULIB_FOPEN@ && @REPLACE_FOPEN@) \
510 || (@GNULIB_FOPEN_GNU@ && @REPLACE_FOPEN_FOR_FOPEN_GNU@)
511 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
513 # define fopen rpl_fopen
515 _GL_FUNCDECL_RPL (fopen
, FILE *,
516 (const char *restrict filename
, const char *restrict mode
)
517 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1)
518 _GL_ATTRIBUTE_MALLOC
);
519 _GL_CXXALIAS_RPL (fopen
, FILE *,
520 (const char *restrict filename
, const char *restrict mode
));
523 /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
524 _GL_FUNCDECL_SYS (fopen
, FILE *,
525 (const char *restrict filename
, const char *restrict mode
)
526 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
528 _GL_CXXALIAS_SYS (fopen
, FILE *,
529 (const char *restrict filename
, const char *restrict mode
));
532 _GL_CXXALIASWARN (fopen
);
535 # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen
536 /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
537 _GL_FUNCDECL_SYS (fopen
, FILE *,
538 (const char *restrict filename
, const char *restrict mode
)
539 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
541 # if defined GNULIB_POSIXCHECK
543 /* Assume fopen is always declared. */
544 _GL_WARN_ON_USE (fopen
, "fopen on native Windows platforms is not POSIX compliant - "
545 "use gnulib module fopen for portability");
549 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
550 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
551 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
552 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
553 # define fprintf rpl_fprintf
555 # define GNULIB_overrides_fprintf 1
556 # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
557 _GL_FUNCDECL_RPL (fprintf
, int,
558 (FILE *restrict fp
, const char *restrict format
, ...)
559 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
560 _GL_ARG_NONNULL ((1, 2)));
562 _GL_FUNCDECL_RPL (fprintf
, int,
563 (FILE *restrict fp
, const char *restrict format
, ...)
564 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
565 _GL_ARG_NONNULL ((1, 2)));
567 _GL_CXXALIAS_RPL (fprintf
, int,
568 (FILE *restrict fp
, const char *restrict format
, ...));
570 _GL_CXXALIAS_SYS (fprintf
, int,
571 (FILE *restrict fp
, const char *restrict format
, ...));
574 _GL_CXXALIASWARN (fprintf
);
577 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
578 # if !GNULIB_overrides_fprintf
581 /* Assume fprintf is always declared. */
582 _GL_WARN_ON_USE (fprintf
, "fprintf is not always POSIX compliant - "
583 "use gnulib module fprintf-posix for portable "
588 /* Discard all pending buffered I/O data on STREAM.
589 STREAM must not be wide-character oriented.
590 When discarding pending output, the file position is set back to where it
591 was before the write calls. When discarding pending input, the file
592 position is advanced to match the end of the previously read input.
593 Return 0 if successful. Upon error, return -1 and set errno. */
594 # if @REPLACE_FPURGE@
595 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
596 # define fpurge rpl_fpurge
598 _GL_FUNCDECL_RPL (fpurge
, int, (FILE *gl_stream
) _GL_ARG_NONNULL ((1)));
599 _GL_CXXALIAS_RPL (fpurge
, int, (FILE *gl_stream
));
601 # if !@HAVE_DECL_FPURGE@
602 _GL_FUNCDECL_SYS (fpurge
, int, (FILE *gl_stream
) _GL_ARG_NONNULL ((1)));
604 _GL_CXXALIAS_SYS (fpurge
, int, (FILE *gl_stream
));
606 _GL_CXXALIASWARN (fpurge
);
607 #elif defined GNULIB_POSIXCHECK
609 # if HAVE_RAW_DECL_FPURGE
610 _GL_WARN_ON_USE (fpurge
, "fpurge is not always present - "
611 "use gnulib module fpurge for portability");
616 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
617 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
619 # define fputc rpl_fputc
621 _GL_FUNCDECL_RPL (fputc
, int, (int c
, FILE *stream
) _GL_ARG_NONNULL ((2)));
622 _GL_CXXALIAS_RPL (fputc
, int, (int c
, FILE *stream
));
624 _GL_CXXALIAS_SYS (fputc
, int, (int c
, FILE *stream
));
627 _GL_CXXALIASWARN (fputc
);
632 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
633 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
635 # define fputs rpl_fputs
637 _GL_FUNCDECL_RPL (fputs
, int,
638 (const char *restrict string
, FILE *restrict stream
)
639 _GL_ARG_NONNULL ((1, 2)));
640 _GL_CXXALIAS_RPL (fputs
, int,
641 (const char *restrict string
, FILE *restrict stream
));
643 _GL_CXXALIAS_SYS (fputs
, int,
644 (const char *restrict string
, FILE *restrict stream
));
647 _GL_CXXALIASWARN (fputs
);
652 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
653 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
655 # define fread rpl_fread
657 _GL_FUNCDECL_RPL (fread
, size_t,
658 (void *restrict ptr
, size_t s
, size_t n
,
659 FILE *restrict stream
)
660 _GL_ARG_NONNULL ((4)));
661 _GL_CXXALIAS_RPL (fread
, size_t,
662 (void *restrict ptr
, size_t s
, size_t n
,
663 FILE *restrict stream
));
665 _GL_CXXALIAS_SYS (fread
, size_t,
666 (void *restrict ptr
, size_t s
, size_t n
,
667 FILE *restrict stream
));
670 _GL_CXXALIASWARN (fread
);
675 # if @REPLACE_FREOPEN@
676 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
678 # define freopen rpl_freopen
680 _GL_FUNCDECL_RPL (freopen
, FILE *,
681 (const char *restrict filename
, const char *restrict mode
,
682 FILE *restrict stream
)
683 _GL_ARG_NONNULL ((2, 3)));
684 _GL_CXXALIAS_RPL (freopen
, FILE *,
685 (const char *restrict filename
, const char *restrict mode
,
686 FILE *restrict stream
));
688 _GL_CXXALIAS_SYS (freopen
, FILE *,
689 (const char *restrict filename
, const char *restrict mode
,
690 FILE *restrict stream
));
693 _GL_CXXALIASWARN (freopen
);
695 #elif defined GNULIB_POSIXCHECK
697 /* Assume freopen is always declared. */
698 _GL_WARN_ON_USE (freopen
,
699 "freopen on native Windows platforms is not POSIX compliant - "
700 "use gnulib module freopen for portability");
704 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
705 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
707 # define fscanf rpl_fscanf
709 _GL_FUNCDECL_RPL (fscanf
, int,
710 (FILE *restrict stream
, const char *restrict format
, ...)
711 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
712 _GL_ARG_NONNULL ((1, 2)));
713 _GL_CXXALIAS_RPL (fscanf
, int,
714 (FILE *restrict stream
, const char *restrict format
, ...));
716 _GL_CXXALIAS_SYS (fscanf
, int,
717 (FILE *restrict stream
, const char *restrict format
, ...));
720 _GL_CXXALIASWARN (fscanf
);
725 /* Set up the following warnings, based on which modules are in use.
726 GNU Coding Standards discourage the use of fseek, since it imposes
727 an arbitrary limitation on some 32-bit hosts. Remember that the
728 fseek module depends on the fseeko module, so we only have three
731 1. The developer is not using either module. Issue a warning under
732 GNULIB_POSIXCHECK for both functions, to remind them that both
733 functions have bugs on some systems. _GL_NO_LARGE_FILES has no
734 impact on this warning.
736 2. The developer is using both modules. They may be unaware of the
737 arbitrary limitations of fseek, so issue a warning under
738 GNULIB_POSIXCHECK. On the other hand, they may be using both
739 modules intentionally, so the developer can define
740 _GL_NO_LARGE_FILES in the compilation units where the use of fseek
741 is safe, to silence the warning.
743 3. The developer is using the fseeko module, but not fseek. Gnulib
744 guarantees that fseek will still work around platform bugs in that
745 case, but we presume that the developer is aware of the pitfalls of
746 fseek and was trying to avoid it, so issue a warning even when
747 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
748 defined to silence the warning in particular compilation units.
749 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
750 fseek gets defined as a macro, it is recommended that the developer
751 uses the fseek module, even if he is not calling the fseek function.
753 Most gnulib clients that perform stream operations should fall into
757 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
758 # define _GL_FSEEK_WARN /* Category 2, above. */
762 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
764 # define fseek rpl_fseek
766 _GL_FUNCDECL_RPL (fseek
, int, (FILE *fp
, long offset
, int whence
)
767 _GL_ARG_NONNULL ((1)));
768 _GL_CXXALIAS_RPL (fseek
, int, (FILE *fp
, long offset
, int whence
));
770 _GL_CXXALIAS_SYS (fseek
, int, (FILE *fp
, long offset
, int whence
));
773 _GL_CXXALIASWARN (fseek
);
778 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
779 # define _GL_FSEEK_WARN /* Category 3, above. */
782 # if @REPLACE_FSEEKO@
783 /* Provide an fseeko function that is aware of a preceding fflush(), and which
785 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
787 # define fseeko rpl_fseeko
789 _GL_FUNCDECL_RPL (fseeko
, int, (FILE *fp
, off_t offset
, int whence
)
790 _GL_ARG_NONNULL ((1)));
791 _GL_CXXALIAS_RPL (fseeko
, int, (FILE *fp
, off_t offset
, int whence
));
793 # if ! @HAVE_DECL_FSEEKO@
794 _GL_FUNCDECL_SYS (fseeko
, int, (FILE *fp
, off_t offset
, int whence
)
795 _GL_ARG_NONNULL ((1)));
797 _GL_CXXALIAS_SYS (fseeko
, int, (FILE *fp
, off_t offset
, int whence
));
799 _GL_CXXALIASWARN (fseeko
);
800 #elif defined GNULIB_POSIXCHECK
801 # define _GL_FSEEK_WARN /* Category 1, above. */
804 # if HAVE_RAW_DECL_FSEEKO
805 _GL_WARN_ON_USE (fseeko
, "fseeko is unportable - "
806 "use gnulib module fseeko for portability");
810 #ifdef _GL_FSEEK_WARN
811 # undef _GL_FSEEK_WARN
812 /* Here, either fseek is undefined (but C89 guarantees that it is
813 declared), or it is defined as rpl_fseek (declared above). */
814 _GL_WARN_ON_USE (fseek
, "fseek cannot handle files larger than 4 GB "
815 "on 32-bit platforms - "
816 "use fseeko function for handling of large files");
820 /* ftell, ftello. See the comments on fseek/fseeko. */
823 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
824 # define _GL_FTELL_WARN /* Category 2, above. */
828 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
830 # define ftell rpl_ftell
832 _GL_FUNCDECL_RPL (ftell
, long, (FILE *fp
) _GL_ARG_NONNULL ((1)));
833 _GL_CXXALIAS_RPL (ftell
, long, (FILE *fp
));
835 _GL_CXXALIAS_SYS (ftell
, long, (FILE *fp
));
838 _GL_CXXALIASWARN (ftell
);
843 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
844 # define _GL_FTELL_WARN /* Category 3, above. */
847 # if @REPLACE_FTELLO@
848 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
850 # define ftello rpl_ftello
852 _GL_FUNCDECL_RPL (ftello
, off_t
, (FILE *fp
) _GL_ARG_NONNULL ((1)));
853 _GL_CXXALIAS_RPL (ftello
, off_t
, (FILE *fp
));
855 # if ! @HAVE_DECL_FTELLO@
856 _GL_FUNCDECL_SYS (ftello
, off_t
, (FILE *fp
) _GL_ARG_NONNULL ((1)));
858 _GL_CXXALIAS_SYS (ftello
, off_t
, (FILE *fp
));
860 _GL_CXXALIASWARN (ftello
);
861 #elif defined GNULIB_POSIXCHECK
862 # define _GL_FTELL_WARN /* Category 1, above. */
865 # if HAVE_RAW_DECL_FTELLO
866 _GL_WARN_ON_USE (ftello
, "ftello is unportable - "
867 "use gnulib module ftello for portability");
871 #ifdef _GL_FTELL_WARN
872 # undef _GL_FTELL_WARN
873 /* Here, either ftell is undefined (but C89 guarantees that it is
874 declared), or it is defined as rpl_ftell (declared above). */
875 _GL_WARN_ON_USE (ftell
, "ftell cannot handle files larger than 4 GB "
876 "on 32-bit platforms - "
877 "use ftello function for handling of large files");
882 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
883 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
885 # define fwrite rpl_fwrite
887 _GL_FUNCDECL_RPL (fwrite
, size_t,
888 (const void *restrict ptr
, size_t s
, size_t n
,
889 FILE *restrict stream
)
890 _GL_ARG_NONNULL ((1, 4)));
891 _GL_CXXALIAS_RPL (fwrite
, size_t,
892 (const void *restrict ptr
, size_t s
, size_t n
,
893 FILE *restrict stream
));
895 _GL_CXXALIAS_SYS (fwrite
, size_t,
896 (const void *restrict ptr
, size_t s
, size_t n
,
897 FILE *restrict stream
));
899 /* Work around bug 11959 when fortifying glibc 2.4 through 2.15
900 <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>,
901 which sometimes causes an unwanted diagnostic for fwrite calls.
902 This affects only function declaration attributes under certain
903 versions of gcc and clang, and is not needed for C++. */
904 # if (0 < __USE_FORTIFY_LEVEL \
905 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
906 && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
907 && !defined __cplusplus)
909 # undef fwrite_unlocked
910 _GL_EXTERN_C
size_t __REDIRECT (rpl_fwrite
,
911 (const void *__restrict
, size_t, size_t,
914 _GL_EXTERN_C
size_t __REDIRECT (rpl_fwrite_unlocked
,
915 (const void *__restrict
, size_t, size_t,
918 # define fwrite rpl_fwrite
919 # define fwrite_unlocked rpl_fwrite_unlocked
923 _GL_CXXALIASWARN (fwrite
);
928 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
929 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
931 # define getc rpl_fgetc
933 _GL_FUNCDECL_RPL (fgetc
, int, (FILE *stream
) _GL_ARG_NONNULL ((1)));
934 _GL_CXXALIAS_RPL_1 (getc
, rpl_fgetc
, int, (FILE *stream
));
936 _GL_CXXALIAS_SYS (getc
, int, (FILE *stream
));
939 _GL_CXXALIASWARN (getc
);
944 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
945 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
947 # define getchar rpl_getchar
949 _GL_FUNCDECL_RPL (getchar
, int, (void));
950 _GL_CXXALIAS_RPL (getchar
, int, (void));
952 _GL_CXXALIAS_SYS (getchar
, int, (void));
955 _GL_CXXALIASWARN (getchar
);
959 #if @GNULIB_GETDELIM@
960 /* Read input, up to (and including) the next occurrence of DELIMITER, from
961 STREAM, store it in *LINEPTR (and NUL-terminate it).
962 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
963 bytes of space. It is realloc'd as necessary.
964 Return the number of bytes read and stored at *LINEPTR (not including the
965 NUL terminator), or -1 on error or EOF. */
966 # if @REPLACE_GETDELIM@
967 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
969 # define getdelim rpl_getdelim
971 _GL_FUNCDECL_RPL (getdelim
, ssize_t
,
972 (char **restrict lineptr
, size_t *restrict linesize
,
974 FILE *restrict stream
)
975 _GL_ARG_NONNULL ((1, 2, 4)));
976 _GL_CXXALIAS_RPL (getdelim
, ssize_t
,
977 (char **restrict lineptr
, size_t *restrict linesize
,
979 FILE *restrict stream
));
981 # if !@HAVE_DECL_GETDELIM@
982 _GL_FUNCDECL_SYS (getdelim
, ssize_t
,
983 (char **restrict lineptr
, size_t *restrict linesize
,
985 FILE *restrict stream
)
986 _GL_ARG_NONNULL ((1, 2, 4)));
988 _GL_CXXALIAS_SYS (getdelim
, ssize_t
,
989 (char **restrict lineptr
, size_t *restrict linesize
,
991 FILE *restrict stream
));
994 _GL_CXXALIASWARN (getdelim
);
996 #elif defined GNULIB_POSIXCHECK
998 # if HAVE_RAW_DECL_GETDELIM
999 _GL_WARN_ON_USE (getdelim
, "getdelim is unportable - "
1000 "use gnulib module getdelim for portability");
1004 #if @GNULIB_GETLINE@
1005 /* Read a line, up to (and including) the next newline, from STREAM, store it
1006 in *LINEPTR (and NUL-terminate it).
1007 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
1008 bytes of space. It is realloc'd as necessary.
1009 Return the number of bytes read and stored at *LINEPTR (not including the
1010 NUL terminator), or -1 on error or EOF. */
1011 # if @REPLACE_GETLINE@
1012 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1014 # define getline rpl_getline
1016 _GL_FUNCDECL_RPL (getline
, ssize_t
,
1017 (char **restrict lineptr
, size_t *restrict linesize
,
1018 FILE *restrict stream
)
1019 _GL_ARG_NONNULL ((1, 2, 3)));
1020 _GL_CXXALIAS_RPL (getline
, ssize_t
,
1021 (char **restrict lineptr
, size_t *restrict linesize
,
1022 FILE *restrict stream
));
1024 # if !@HAVE_DECL_GETLINE@
1025 _GL_FUNCDECL_SYS (getline
, ssize_t
,
1026 (char **restrict lineptr
, size_t *restrict linesize
,
1027 FILE *restrict stream
)
1028 _GL_ARG_NONNULL ((1, 2, 3)));
1030 _GL_CXXALIAS_SYS (getline
, ssize_t
,
1031 (char **restrict lineptr
, size_t *restrict linesize
,
1032 FILE *restrict stream
));
1034 # if __GLIBC__ >= 2 && @HAVE_DECL_GETLINE@
1035 _GL_CXXALIASWARN (getline
);
1037 #elif defined GNULIB_POSIXCHECK
1039 # if HAVE_RAW_DECL_GETLINE
1040 _GL_WARN_ON_USE (getline
, "getline is unportable - "
1041 "use gnulib module getline for portability");
1045 /* It is very rare that the developer ever has full control of stdin,
1046 so any use of gets warrants an unconditional warning; besides, C11
1049 #if HAVE_RAW_DECL_GETS && !defined __cplusplus
1050 _GL_WARN_ON_USE (gets
, "gets is a security hole - use fgets instead");
1053 #if @GNULIB_MDA_GETW@
1054 /* On native Windows, map 'getw' to '_getw', so that -loldnames is not
1055 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1056 platforms by defining GNULIB_NAMESPACE::getw always. */
1057 # if defined _WIN32 && !defined __CYGWIN__
1058 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1062 _GL_CXXALIAS_MDA (getw
, int, (FILE *restrict stream
));
1064 # if @HAVE_DECL_GETW@
1065 # if defined __APPLE__ && defined __MACH__
1066 /* The presence of the declaration depends on _POSIX_C_SOURCE. */
1067 _GL_FUNCDECL_SYS (getw
, int, (FILE *restrict stream
));
1069 _GL_CXXALIAS_SYS (getw
, int, (FILE *restrict stream
));
1073 _GL_CXXALIASWARN (getw
);
1077 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
1079 /* Grow an obstack with formatted output. Return the number of
1080 bytes added to OBS. No trailing nul byte is added, and the
1081 object should be closed with obstack_finish before use. Upon
1082 memory allocation error, call obstack_alloc_failed_handler. Upon
1083 other error, return -1. */
1084 # if @REPLACE_OBSTACK_PRINTF@
1085 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1086 # define obstack_printf rpl_obstack_printf
1088 _GL_FUNCDECL_RPL (obstack_printf
, int,
1089 (struct obstack
*obs
, const char *format
, ...)
1090 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1091 _GL_ARG_NONNULL ((1, 2)));
1092 _GL_CXXALIAS_RPL (obstack_printf
, int,
1093 (struct obstack
*obs
, const char *format
, ...));
1095 # if !@HAVE_DECL_OBSTACK_PRINTF@
1096 _GL_FUNCDECL_SYS (obstack_printf
, int,
1097 (struct obstack
*obs
, const char *format
, ...)
1098 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1099 _GL_ARG_NONNULL ((1, 2)));
1101 _GL_CXXALIAS_SYS (obstack_printf
, int,
1102 (struct obstack
*obs
, const char *format
, ...));
1104 _GL_CXXALIASWARN (obstack_printf
);
1105 # if @REPLACE_OBSTACK_PRINTF@
1106 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1107 # define obstack_vprintf rpl_obstack_vprintf
1109 _GL_FUNCDECL_RPL (obstack_vprintf
, int,
1110 (struct obstack
*obs
, const char *format
, va_list args
)
1111 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1112 _GL_ARG_NONNULL ((1, 2)));
1113 _GL_CXXALIAS_RPL (obstack_vprintf
, int,
1114 (struct obstack
*obs
, const char *format
, va_list args
));
1116 # if !@HAVE_DECL_OBSTACK_PRINTF@
1117 _GL_FUNCDECL_SYS (obstack_vprintf
, int,
1118 (struct obstack
*obs
, const char *format
, va_list args
)
1119 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1120 _GL_ARG_NONNULL ((1, 2)));
1122 _GL_CXXALIAS_SYS (obstack_vprintf
, int,
1123 (struct obstack
*obs
, const char *format
, va_list args
));
1125 _GL_CXXALIASWARN (obstack_vprintf
);
1130 _GL_FUNCDECL_SYS (pclose
, int, (FILE *stream
) _GL_ARG_NONNULL ((1)));
1132 _GL_CXXALIAS_SYS (pclose
, int, (FILE *stream
));
1133 _GL_CXXALIASWARN (pclose
);
1134 #elif defined GNULIB_POSIXCHECK
1136 # if HAVE_RAW_DECL_PCLOSE
1137 _GL_WARN_ON_USE (pclose
, "pclose is unportable - "
1138 "use gnulib module pclose for more portability");
1143 /* Print a message to standard error, describing the value of ERRNO,
1144 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
1145 and terminated with a newline. */
1146 # if @REPLACE_PERROR@
1147 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1148 # define perror rpl_perror
1150 _GL_FUNCDECL_RPL (perror
, void, (const char *string
));
1151 _GL_CXXALIAS_RPL (perror
, void, (const char *string
));
1153 _GL_CXXALIAS_SYS (perror
, void, (const char *string
));
1156 _GL_CXXALIASWARN (perror
);
1158 #elif defined GNULIB_POSIXCHECK
1160 /* Assume perror is always declared. */
1161 _GL_WARN_ON_USE (perror
, "perror is not always POSIX compliant - "
1162 "use gnulib module perror for portability");
1166 # if @REPLACE_POPEN@
1167 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1169 # define popen rpl_popen
1171 _GL_FUNCDECL_RPL (popen
, FILE *,
1172 (const char *cmd
, const char *mode
)
1173 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose
, 1)
1174 _GL_ATTRIBUTE_MALLOC
);
1175 _GL_CXXALIAS_RPL (popen
, FILE *, (const char *cmd
, const char *mode
));
1177 # if !@HAVE_POPEN@ || __GNUC__ >= 11
1178 _GL_FUNCDECL_SYS (popen
, FILE *,
1179 (const char *cmd
, const char *mode
)
1180 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose
, 1)
1181 _GL_ATTRIBUTE_MALLOC
);
1183 _GL_CXXALIAS_SYS (popen
, FILE *, (const char *cmd
, const char *mode
));
1185 _GL_CXXALIASWARN (popen
);
1187 # if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen
1188 /* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */
1189 _GL_FUNCDECL_SYS (popen
, FILE *,
1190 (const char *cmd
, const char *mode
)
1191 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose
, 1)
1192 _GL_ATTRIBUTE_MALLOC
);
1194 # if defined GNULIB_POSIXCHECK
1196 # if HAVE_RAW_DECL_POPEN
1197 _GL_WARN_ON_USE (popen
, "popen is buggy on some platforms - "
1198 "use gnulib module popen or pipe for more portability");
1203 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
1204 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
1205 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1206 # if defined __GNUC__ || defined __clang__
1207 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1208 /* Don't break __attribute__((format(printf,M,N))). */
1209 # define printf __printf__
1211 # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1212 _GL_FUNCDECL_RPL_1 (__printf__
, int,
1213 (const char *restrict format
, ...)
1214 __asm__ (@ASM_SYMBOL_PREFIX@
1215 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf
))
1216 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1217 _GL_ARG_NONNULL ((1)));
1219 _GL_FUNCDECL_RPL_1 (__printf__
, int,
1220 (const char *restrict format
, ...)
1221 __asm__ (@ASM_SYMBOL_PREFIX@
1222 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf
))
1223 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
1224 _GL_ARG_NONNULL ((1)));
1226 _GL_CXXALIAS_RPL_1 (printf
, __printf__
, int, (const char *format
, ...));
1228 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1229 # define printf rpl_printf
1231 _GL_FUNCDECL_RPL (printf
, int,
1232 (const char *restrict format
, ...)
1233 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1234 _GL_ARG_NONNULL ((1)));
1235 _GL_CXXALIAS_RPL (printf
, int, (const char *restrict format
, ...));
1237 # define GNULIB_overrides_printf 1
1239 _GL_CXXALIAS_SYS (printf
, int, (const char *restrict format
, ...));
1242 _GL_CXXALIASWARN (printf
);
1245 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1246 # if !GNULIB_overrides_printf
1249 /* Assume printf is always declared. */
1250 _GL_WARN_ON_USE (printf
, "printf is not always POSIX compliant - "
1251 "use gnulib module printf-posix for portable "
1252 "POSIX compliance");
1256 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
1257 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1259 # define putc rpl_fputc
1261 _GL_FUNCDECL_RPL (fputc
, int, (int c
, FILE *stream
) _GL_ARG_NONNULL ((2)));
1262 _GL_CXXALIAS_RPL_1 (putc
, rpl_fputc
, int, (int c
, FILE *stream
));
1264 _GL_CXXALIAS_SYS (putc
, int, (int c
, FILE *stream
));
1267 _GL_CXXALIASWARN (putc
);
1271 #if @GNULIB_PUTCHAR@
1272 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
1273 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1275 # define putchar rpl_putchar
1277 _GL_FUNCDECL_RPL (putchar
, int, (int c
));
1278 _GL_CXXALIAS_RPL (putchar
, int, (int c
));
1280 _GL_CXXALIAS_SYS (putchar
, int, (int c
));
1283 _GL_CXXALIASWARN (putchar
);
1288 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
1289 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1291 # define puts rpl_puts
1293 _GL_FUNCDECL_RPL (puts
, int, (const char *string
) _GL_ARG_NONNULL ((1)));
1294 _GL_CXXALIAS_RPL (puts
, int, (const char *string
));
1296 _GL_CXXALIAS_SYS (puts
, int, (const char *string
));
1299 _GL_CXXALIASWARN (puts
);
1303 #if @GNULIB_MDA_PUTW@
1304 /* On native Windows, map 'putw' to '_putw', so that -loldnames is not
1305 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1306 platforms by defining GNULIB_NAMESPACE::putw always. */
1307 # if defined _WIN32 && !defined __CYGWIN__
1308 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1312 _GL_CXXALIAS_MDA (putw
, int, (int w
, FILE *restrict stream
));
1314 # if @HAVE_DECL_PUTW@
1315 # if defined __APPLE__ && defined __MACH__
1316 /* The presence of the declaration depends on _POSIX_C_SOURCE. */
1317 _GL_FUNCDECL_SYS (putw
, int, (int w
, FILE *restrict stream
));
1319 _GL_CXXALIAS_SYS (putw
, int, (int w
, FILE *restrict stream
));
1323 _GL_CXXALIASWARN (putw
);
1328 # if @REPLACE_REMOVE@
1329 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1331 # define remove rpl_remove
1333 _GL_FUNCDECL_RPL (remove
, int, (const char *name
) _GL_ARG_NONNULL ((1)));
1334 _GL_CXXALIAS_RPL (remove
, int, (const char *name
));
1336 _GL_CXXALIAS_SYS (remove
, int, (const char *name
));
1339 _GL_CXXALIASWARN (remove
);
1341 #elif defined GNULIB_POSIXCHECK
1343 /* Assume remove is always declared. */
1344 _GL_WARN_ON_USE (remove
, "remove cannot handle directories on some platforms - "
1345 "use gnulib module remove for more portability");
1349 # if @REPLACE_RENAME@
1350 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1352 # define rename rpl_rename
1354 _GL_FUNCDECL_RPL (rename
, int,
1355 (const char *old_filename
, const char *new_filename
)
1356 _GL_ARG_NONNULL ((1, 2)));
1357 _GL_CXXALIAS_RPL (rename
, int,
1358 (const char *old_filename
, const char *new_filename
));
1360 _GL_CXXALIAS_SYS (rename
, int,
1361 (const char *old_filename
, const char *new_filename
));
1364 _GL_CXXALIASWARN (rename
);
1366 #elif defined GNULIB_POSIXCHECK
1368 /* Assume rename is always declared. */
1369 _GL_WARN_ON_USE (rename
, "rename is buggy on some platforms - "
1370 "use gnulib module rename for more portability");
1373 #if @GNULIB_RENAMEAT@
1374 # if @REPLACE_RENAMEAT@
1375 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1377 # define renameat rpl_renameat
1379 _GL_FUNCDECL_RPL (renameat
, int,
1380 (int fd1
, char const *file1
, int fd2
, char const *file2
)
1381 _GL_ARG_NONNULL ((2, 4)));
1382 _GL_CXXALIAS_RPL (renameat
, int,
1383 (int fd1
, char const *file1
, int fd2
, char const *file2
));
1385 # if !@HAVE_RENAMEAT@
1386 _GL_FUNCDECL_SYS (renameat
, int,
1387 (int fd1
, char const *file1
, int fd2
, char const *file2
)
1388 _GL_ARG_NONNULL ((2, 4)));
1390 _GL_CXXALIAS_SYS (renameat
, int,
1391 (int fd1
, char const *file1
, int fd2
, char const *file2
));
1393 _GL_CXXALIASWARN (renameat
);
1394 #elif defined GNULIB_POSIXCHECK
1396 # if HAVE_RAW_DECL_RENAMEAT
1397 _GL_WARN_ON_USE (renameat
, "renameat is not portable - "
1398 "use gnulib module renameat for portability");
1403 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1404 # if defined __GNUC__ || defined __clang__
1405 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1407 /* Don't break __attribute__((format(scanf,M,N))). */
1408 # define scanf __scanf__
1410 _GL_FUNCDECL_RPL_1 (__scanf__
, int,
1411 (const char *restrict format
, ...)
1412 __asm__ (@ASM_SYMBOL_PREFIX@
1413 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf
))
1414 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1415 _GL_ARG_NONNULL ((1)));
1416 _GL_CXXALIAS_RPL_1 (scanf
, __scanf__
, int, (const char *restrict format
, ...));
1418 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1420 # define scanf rpl_scanf
1422 _GL_FUNCDECL_RPL (scanf
, int, (const char *restrict format
, ...)
1423 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1424 _GL_ARG_NONNULL ((1)));
1425 _GL_CXXALIAS_RPL (scanf
, int, (const char *restrict format
, ...));
1428 _GL_CXXALIAS_SYS (scanf
, int, (const char *restrict format
, ...));
1431 _GL_CXXALIASWARN (scanf
);
1435 #if @GNULIB_SNPRINTF@
1436 # if @REPLACE_SNPRINTF@
1437 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1438 # define snprintf rpl_snprintf
1440 # define GNULIB_overrides_snprintf 1
1441 _GL_FUNCDECL_RPL (snprintf
, int,
1442 (char *restrict str
, size_t size
,
1443 const char *restrict format
, ...)
1444 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1445 _GL_ARG_NONNULL ((3)));
1446 _GL_CXXALIAS_RPL (snprintf
, int,
1447 (char *restrict str
, size_t size
,
1448 const char *restrict format
, ...));
1450 # if !@HAVE_DECL_SNPRINTF@
1451 _GL_FUNCDECL_SYS (snprintf
, int,
1452 (char *restrict str
, size_t size
,
1453 const char *restrict format
, ...)
1454 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1455 _GL_ARG_NONNULL ((3)));
1457 _GL_CXXALIAS_SYS (snprintf
, int,
1458 (char *restrict str
, size_t size
,
1459 const char *restrict format
, ...));
1462 _GL_CXXALIASWARN (snprintf
);
1464 #elif defined GNULIB_POSIXCHECK
1466 # if HAVE_RAW_DECL_SNPRINTF
1467 _GL_WARN_ON_USE (snprintf
, "snprintf is unportable - "
1468 "use gnulib module snprintf for portability");
1472 /* Some people would argue that all sprintf uses should be warned about
1473 (for example, OpenBSD issues a link warning for it),
1474 since it can cause security holes due to buffer overruns.
1475 However, we believe that sprintf can be used safely, and is more
1476 efficient than snprintf in those safe cases; and as proof of our
1477 belief, we use sprintf in several gnulib modules. So this header
1478 intentionally avoids adding a warning to sprintf except when
1479 GNULIB_POSIXCHECK is defined. */
1481 #if @GNULIB_SPRINTF_POSIX@
1482 # if @REPLACE_SPRINTF@
1483 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1484 # define sprintf rpl_sprintf
1486 # define GNULIB_overrides_sprintf 1
1487 _GL_FUNCDECL_RPL (sprintf
, int,
1488 (char *restrict str
, const char *restrict format
, ...)
1489 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1490 _GL_ARG_NONNULL ((1, 2)));
1491 _GL_CXXALIAS_RPL (sprintf
, int,
1492 (char *restrict str
, const char *restrict format
, ...));
1494 _GL_CXXALIAS_SYS (sprintf
, int,
1495 (char *restrict str
, const char *restrict format
, ...));
1498 _GL_CXXALIASWARN (sprintf
);
1500 #elif defined GNULIB_POSIXCHECK
1502 /* Assume sprintf is always declared. */
1503 _GL_WARN_ON_USE (sprintf
, "sprintf is not always POSIX compliant - "
1504 "use gnulib module sprintf-posix for portable "
1505 "POSIX compliance");
1508 #if @GNULIB_MDA_TEMPNAM@
1509 /* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not
1510 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1511 platforms by defining GNULIB_NAMESPACE::tempnam always. */
1512 # if defined _WIN32 && !defined __CYGWIN__
1513 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1515 # define tempnam _tempnam
1517 _GL_CXXALIAS_MDA (tempnam
, char *, (const char *dir
, const char *prefix
));
1519 _GL_CXXALIAS_SYS (tempnam
, char *, (const char *dir
, const char *prefix
));
1521 _GL_CXXALIASWARN (tempnam
);
1524 #if @GNULIB_TMPFILE@
1525 # if @REPLACE_TMPFILE@
1526 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1527 # define tmpfile rpl_tmpfile
1529 _GL_FUNCDECL_RPL (tmpfile
, FILE *, (void)
1530 _GL_ATTRIBUTE_DEALLOC (fclose
, 1)
1531 _GL_ATTRIBUTE_MALLOC
);
1532 _GL_CXXALIAS_RPL (tmpfile
, FILE *, (void));
1535 /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1536 _GL_FUNCDECL_SYS (tmpfile
, FILE *, (void)
1537 _GL_ATTRIBUTE_DEALLOC (fclose
, 1)
1538 _GL_ATTRIBUTE_MALLOC
);
1540 _GL_CXXALIAS_SYS (tmpfile
, FILE *, (void));
1543 _GL_CXXALIASWARN (tmpfile
);
1546 # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile
1547 /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1548 _GL_FUNCDECL_SYS (tmpfile
, FILE *, (void)
1549 _GL_ATTRIBUTE_DEALLOC (fclose
, 1)
1550 _GL_ATTRIBUTE_MALLOC
);
1552 # if defined GNULIB_POSIXCHECK
1554 # if HAVE_RAW_DECL_TMPFILE
1555 _GL_WARN_ON_USE (tmpfile
, "tmpfile is not usable on mingw - "
1556 "use gnulib module tmpfile for portability");
1561 #if @GNULIB_VASPRINTF@
1562 /* Write formatted output to a string dynamically allocated with malloc().
1563 If the memory allocation succeeds, store the address of the string in
1564 *RESULT and return the number of resulting bytes, excluding the trailing
1565 NUL. Upon memory allocation error, or some other error, return -1. */
1566 # if @REPLACE_VASPRINTF@
1567 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1568 # define asprintf rpl_asprintf
1570 # define GNULIB_overrides_asprintf
1571 _GL_FUNCDECL_RPL (asprintf
, int,
1572 (char **result
, const char *format
, ...)
1573 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1574 _GL_ARG_NONNULL ((1, 2)));
1575 _GL_CXXALIAS_RPL (asprintf
, int,
1576 (char **result
, const char *format
, ...));
1578 # if !@HAVE_VASPRINTF@
1579 _GL_FUNCDECL_SYS (asprintf
, int,
1580 (char **result
, const char *format
, ...)
1581 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1582 _GL_ARG_NONNULL ((1, 2)));
1584 _GL_CXXALIAS_SYS (asprintf
, int,
1585 (char **result
, const char *format
, ...));
1587 _GL_CXXALIASWARN (asprintf
);
1588 # if @REPLACE_VASPRINTF@
1589 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1590 # define vasprintf rpl_vasprintf
1592 # define GNULIB_overrides_vasprintf 1
1593 _GL_FUNCDECL_RPL (vasprintf
, int,
1594 (char **result
, const char *format
, va_list args
)
1595 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1596 _GL_ARG_NONNULL ((1, 2)));
1597 _GL_CXXALIAS_RPL (vasprintf
, int,
1598 (char **result
, const char *format
, va_list args
));
1600 # if !@HAVE_VASPRINTF@
1601 _GL_FUNCDECL_SYS (vasprintf
, int,
1602 (char **result
, const char *format
, va_list args
)
1603 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1604 _GL_ARG_NONNULL ((1, 2)));
1606 _GL_CXXALIAS_SYS (vasprintf
, int,
1607 (char **result
, const char *format
, va_list args
));
1609 _GL_CXXALIASWARN (vasprintf
);
1612 #if @GNULIB_VDPRINTF@
1613 # if @REPLACE_VDPRINTF@
1614 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1615 # define vdprintf rpl_vdprintf
1617 _GL_FUNCDECL_RPL (vdprintf
, int,
1618 (int fd
, const char *restrict format
, va_list args
)
1619 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1620 _GL_ARG_NONNULL ((2)));
1621 _GL_CXXALIAS_RPL (vdprintf
, int,
1622 (int fd
, const char *restrict format
, va_list args
));
1624 # if !@HAVE_VDPRINTF@
1625 _GL_FUNCDECL_SYS (vdprintf
, int,
1626 (int fd
, const char *restrict format
, va_list args
)
1627 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1628 _GL_ARG_NONNULL ((2)));
1630 /* Need to cast, because on Solaris, the third parameter will likely be
1632 _GL_CXXALIAS_SYS_CAST (vdprintf
, int,
1633 (int fd
, const char *restrict format
, va_list args
));
1636 _GL_CXXALIASWARN (vdprintf
);
1638 #elif defined GNULIB_POSIXCHECK
1640 # if HAVE_RAW_DECL_VDPRINTF
1641 _GL_WARN_ON_USE (vdprintf
, "vdprintf is unportable - "
1642 "use gnulib module vdprintf for portability");
1646 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1647 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1648 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1649 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1650 # define vfprintf rpl_vfprintf
1652 # define GNULIB_overrides_vfprintf 1
1653 # if @GNULIB_VFPRINTF_POSIX@
1654 _GL_FUNCDECL_RPL (vfprintf
, int,
1656 const char *restrict format
, va_list args
)
1657 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1658 _GL_ARG_NONNULL ((1, 2)));
1660 _GL_FUNCDECL_RPL (vfprintf
, int,
1662 const char *restrict format
, va_list args
)
1663 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1664 _GL_ARG_NONNULL ((1, 2)));
1666 _GL_CXXALIAS_RPL (vfprintf
, int,
1668 const char *restrict format
, va_list args
));
1670 /* Need to cast, because on Solaris, the third parameter is
1672 and GCC's fixincludes did not change this to __gnuc_va_list. */
1673 _GL_CXXALIAS_SYS_CAST (vfprintf
, int,
1675 const char *restrict format
, va_list args
));
1678 _GL_CXXALIASWARN (vfprintf
);
1681 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1682 # if !GNULIB_overrides_vfprintf
1685 /* Assume vfprintf is always declared. */
1686 _GL_WARN_ON_USE (vfprintf
, "vfprintf is not always POSIX compliant - "
1687 "use gnulib module vfprintf-posix for portable "
1688 "POSIX compliance");
1691 #if @GNULIB_VFSCANF@
1692 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1693 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1695 # define vfscanf rpl_vfscanf
1697 _GL_FUNCDECL_RPL (vfscanf
, int,
1698 (FILE *restrict stream
,
1699 const char *restrict format
, va_list args
)
1700 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1701 _GL_ARG_NONNULL ((1, 2)));
1702 _GL_CXXALIAS_RPL (vfscanf
, int,
1703 (FILE *restrict stream
,
1704 const char *restrict format
, va_list args
));
1706 _GL_CXXALIAS_SYS (vfscanf
, int,
1707 (FILE *restrict stream
,
1708 const char *restrict format
, va_list args
));
1711 _GL_CXXALIASWARN (vfscanf
);
1715 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1716 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1717 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1718 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1719 # define vprintf rpl_vprintf
1721 # define GNULIB_overrides_vprintf 1
1722 # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1723 _GL_FUNCDECL_RPL (vprintf
, int, (const char *restrict format
, va_list args
)
1724 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1725 _GL_ARG_NONNULL ((1)));
1727 _GL_FUNCDECL_RPL (vprintf
, int, (const char *restrict format
, va_list args
)
1728 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1729 _GL_ARG_NONNULL ((1)));
1731 _GL_CXXALIAS_RPL (vprintf
, int, (const char *restrict format
, va_list args
));
1733 /* Need to cast, because on Solaris, the second parameter is
1735 and GCC's fixincludes did not change this to __gnuc_va_list. */
1736 _GL_CXXALIAS_SYS_CAST (vprintf
, int,
1737 (const char *restrict format
, va_list args
));
1740 _GL_CXXALIASWARN (vprintf
);
1743 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1744 # if !GNULIB_overrides_vprintf
1747 /* Assume vprintf is always declared. */
1748 _GL_WARN_ON_USE (vprintf
, "vprintf is not always POSIX compliant - "
1749 "use gnulib module vprintf-posix for portable "
1750 "POSIX compliance");
1754 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1755 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1757 # define vscanf rpl_vscanf
1759 _GL_FUNCDECL_RPL (vscanf
, int, (const char *restrict format
, va_list args
)
1760 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1761 _GL_ARG_NONNULL ((1)));
1762 _GL_CXXALIAS_RPL (vscanf
, int, (const char *restrict format
, va_list args
));
1764 _GL_CXXALIAS_SYS (vscanf
, int, (const char *restrict format
, va_list args
));
1767 _GL_CXXALIASWARN (vscanf
);
1771 #if @GNULIB_VSNPRINTF@
1772 # if @REPLACE_VSNPRINTF@
1773 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1774 # define vsnprintf rpl_vsnprintf
1776 # define GNULIB_overrides_vsnprintf 1
1777 _GL_FUNCDECL_RPL (vsnprintf
, int,
1778 (char *restrict str
, size_t size
,
1779 const char *restrict format
, va_list args
)
1780 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1781 _GL_ARG_NONNULL ((3)));
1782 _GL_CXXALIAS_RPL (vsnprintf
, int,
1783 (char *restrict str
, size_t size
,
1784 const char *restrict format
, va_list args
));
1786 # if !@HAVE_DECL_VSNPRINTF@
1787 _GL_FUNCDECL_SYS (vsnprintf
, int,
1788 (char *restrict str
, size_t size
,
1789 const char *restrict format
, va_list args
)
1790 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1791 _GL_ARG_NONNULL ((3)));
1793 _GL_CXXALIAS_SYS (vsnprintf
, int,
1794 (char *restrict str
, size_t size
,
1795 const char *restrict format
, va_list args
));
1798 _GL_CXXALIASWARN (vsnprintf
);
1800 #elif defined GNULIB_POSIXCHECK
1802 # if HAVE_RAW_DECL_VSNPRINTF
1803 _GL_WARN_ON_USE (vsnprintf
, "vsnprintf is unportable - "
1804 "use gnulib module vsnprintf for portability");
1808 #if @GNULIB_VSPRINTF_POSIX@
1809 # if @REPLACE_VSPRINTF@
1810 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1811 # define vsprintf rpl_vsprintf
1813 # define GNULIB_overrides_vsprintf 1
1814 _GL_FUNCDECL_RPL (vsprintf
, int,
1815 (char *restrict str
,
1816 const char *restrict format
, va_list args
)
1817 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1818 _GL_ARG_NONNULL ((1, 2)));
1819 _GL_CXXALIAS_RPL (vsprintf
, int,
1820 (char *restrict str
,
1821 const char *restrict format
, va_list args
));
1823 /* Need to cast, because on Solaris, the third parameter is
1825 and GCC's fixincludes did not change this to __gnuc_va_list. */
1826 _GL_CXXALIAS_SYS_CAST (vsprintf
, int,
1827 (char *restrict str
,
1828 const char *restrict format
, va_list args
));
1831 _GL_CXXALIASWARN (vsprintf
);
1833 #elif defined GNULIB_POSIXCHECK
1835 /* Assume vsprintf is always declared. */
1836 _GL_WARN_ON_USE (vsprintf
, "vsprintf is not always POSIX compliant - "
1837 "use gnulib module vsprintf-posix for portable "
1838 "POSIX compliance");
1841 #endif /* _@GUARD_PREFIX@_STDIO_H */
1842 #endif /* _@GUARD_PREFIX@_STDIO_H */