1 /* A GNU-like <stdio.h>.
3 Copyright (C) 2004, 2007-2023 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 #define _GL_ALREADY_INCLUDING_STDIO_H
41 /* The include_next requires a split double-inclusion guard. */
42 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
44 #undef _GL_ALREADY_INCLUDING_STDIO_H
46 #ifndef _@GUARD_PREFIX@_STDIO_H
47 #define _@GUARD_PREFIX@_STDIO_H
49 /* Get va_list. Needed on many systems, including glibc 2.8. */
54 /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
56 May also define off_t to a 64-bit type on native Windows. */
57 #include <sys/types.h>
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__
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>
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__
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__
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
97 #ifndef _GL_ATTRIBUTE_DEALLOC
99 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
101 # define _GL_ATTRIBUTE_DEALLOC(f, i)
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))
115 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
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__
127 # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
130 /* An __attribute__ __format__ specifier for a function that takes a format
131 string and arguments, where the format string directives are the ones of the
132 system printf(), rather than the ones standardized by ISO C99 and POSIX.
133 _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM */
134 /* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to
135 the standards. The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates
136 whether this change is effective. On older mingw, it is not. */
137 #if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
138 # define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD
140 # define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__
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
147 #define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \
148 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument))
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))
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
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))
165 # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
166 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
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))
176 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
178 /* The definition of _GL_ARG_NONNULL is copied here. */
180 /* The definition of _GL_WARN_ON_USE is copied here. */
182 /* Macros for stringification. */
183 #define _GL_STDIO_STRINGIZE(token) #token
184 #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
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
197 # if @REPLACE_DPRINTF@
198 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
199 # define dprintf rpl_dprintf
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
, ...));
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)));
211 _GL_CXXALIAS_SYS (dprintf
, int, (int fd
, const char *restrict format
, ...));
213 _GL_CXXALIASWARN (dprintf
);
214 #elif defined GNULIB_POSIXCHECK
216 # if HAVE_RAW_DECL_DPRINTF
217 _GL_WARN_ON_USE (dprintf
, "dprintf is unportable - "
218 "use gnulib module dprintf for portability");
223 /* Close STREAM and its underlying file descriptor. */
224 # if @REPLACE_FCLOSE@
225 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
226 # define fclose rpl_fclose
228 _GL_FUNCDECL_RPL (fclose
, int, (FILE *stream
) _GL_ARG_NONNULL ((1)));
229 _GL_CXXALIAS_RPL (fclose
, int, (FILE *stream
));
231 _GL_CXXALIAS_SYS (fclose
, int, (FILE *stream
));
234 _GL_CXXALIASWARN (fclose
);
236 #elif defined GNULIB_POSIXCHECK
238 /* Assume fclose is always declared. */
239 _GL_WARN_ON_USE (fclose
, "fclose is not always POSIX compliant - "
240 "use gnulib module fclose for portable POSIX compliance");
243 #if @GNULIB_MDA_FCLOSEALL@
244 /* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is
245 not required. In C++ with GNULIB_NAMESPACE, avoid differences between
246 platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have
248 # if defined _WIN32 && !defined __CYGWIN__
249 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
251 # define fcloseall _fcloseall
253 _GL_CXXALIAS_MDA (fcloseall
, int, (void));
255 # if @HAVE_DECL_FCLOSEALL@
256 # if defined __FreeBSD__ || defined __DragonFly__
257 _GL_CXXALIAS_SYS (fcloseall
, void, (void));
259 _GL_CXXALIAS_SYS (fcloseall
, int, (void));
263 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@
264 _GL_CXXALIASWARN (fcloseall
);
269 # if @REPLACE_FDOPEN@
270 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
272 # define fdopen rpl_fdopen
274 _GL_FUNCDECL_RPL (fdopen
, FILE *,
275 (int fd
, const char *mode
)
276 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
277 _GL_CXXALIAS_RPL (fdopen
, FILE *, (int fd
, const char *mode
));
278 # elif defined _WIN32 && !defined __CYGWIN__
279 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
281 # define fdopen _fdopen
283 _GL_CXXALIAS_MDA (fdopen
, FILE *, (int fd
, const char *mode
));
286 /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
287 _GL_FUNCDECL_SYS (fdopen
, FILE *,
288 (int fd
, const char *mode
)
289 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
291 _GL_CXXALIAS_SYS (fdopen
, FILE *, (int fd
, const char *mode
));
293 _GL_CXXALIASWARN (fdopen
);
295 # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen
296 /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
297 _GL_FUNCDECL_SYS (fdopen
, FILE *,
298 (int fd
, const char *mode
)
299 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
301 # if defined GNULIB_POSIXCHECK
303 /* Assume fdopen is always declared. */
304 _GL_WARN_ON_USE (fdopen
, "fdopen on native Windows platforms is not POSIX compliant - "
305 "use gnulib module fdopen for portability");
306 # elif @GNULIB_MDA_FDOPEN@
307 /* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not
308 required. In C++ with GNULIB_NAMESPACE, avoid differences between
309 platforms by defining GNULIB_NAMESPACE::fdopen always. */
310 # if defined _WIN32 && !defined __CYGWIN__
311 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
313 # define fdopen _fdopen
315 _GL_CXXALIAS_MDA (fdopen
, FILE *, (int fd
, const char *mode
));
317 _GL_CXXALIAS_SYS (fdopen
, FILE *, (int fd
, const char *mode
));
319 _GL_CXXALIASWARN (fdopen
);
324 /* Flush all pending data on STREAM according to POSIX rules. Both
325 output and seekable input streams are supported.
326 Note! LOSS OF DATA can occur if fflush is applied on an input stream
327 that is _not_seekable_ or on an update stream that is _not_seekable_
328 and in which the most recent operation was input. Seekability can
329 be tested with lseek(fileno(fp),0,SEEK_CUR). */
330 # if @REPLACE_FFLUSH@
331 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
332 # define fflush rpl_fflush
334 _GL_FUNCDECL_RPL (fflush
, int, (FILE *gl_stream
));
335 _GL_CXXALIAS_RPL (fflush
, int, (FILE *gl_stream
));
337 _GL_CXXALIAS_SYS (fflush
, int, (FILE *gl_stream
));
340 _GL_CXXALIASWARN (fflush
);
342 #elif defined GNULIB_POSIXCHECK
344 /* Assume fflush is always declared. */
345 _GL_WARN_ON_USE (fflush
, "fflush is not always POSIX compliant - "
346 "use gnulib module fflush for portable POSIX compliance");
350 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
351 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
353 # define fgetc rpl_fgetc
355 _GL_FUNCDECL_RPL (fgetc
, int, (FILE *stream
) _GL_ARG_NONNULL ((1)));
356 _GL_CXXALIAS_RPL (fgetc
, int, (FILE *stream
));
358 _GL_CXXALIAS_SYS (fgetc
, int, (FILE *stream
));
361 _GL_CXXALIASWARN (fgetc
);
366 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
367 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
369 # define fgets rpl_fgets
371 _GL_FUNCDECL_RPL (fgets
, char *,
372 (char *restrict s
, int n
, FILE *restrict stream
)
373 _GL_ARG_NONNULL ((1, 3)));
374 _GL_CXXALIAS_RPL (fgets
, char *,
375 (char *restrict s
, int n
, FILE *restrict stream
));
377 _GL_CXXALIAS_SYS (fgets
, char *,
378 (char *restrict s
, int n
, FILE *restrict stream
));
381 _GL_CXXALIASWARN (fgets
);
385 #if @GNULIB_MDA_FILENO@
386 /* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not
387 required. In C++ with GNULIB_NAMESPACE, avoid differences between
388 platforms by defining GNULIB_NAMESPACE::fileno always. */
389 # if defined _WIN32 && !defined __CYGWIN__
390 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
392 # define fileno _fileno
394 _GL_CXXALIAS_MDA (fileno
, int, (FILE *restrict stream
));
396 _GL_CXXALIAS_SYS (fileno
, int, (FILE *restrict stream
));
398 _GL_CXXALIASWARN (fileno
);
402 # if (@GNULIB_FOPEN@ && @REPLACE_FOPEN@) \
403 || (@GNULIB_FOPEN_GNU@ && @REPLACE_FOPEN_FOR_FOPEN_GNU@)
404 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
406 # define fopen rpl_fopen
408 _GL_FUNCDECL_RPL (fopen
, FILE *,
409 (const char *restrict filename
, const char *restrict mode
)
410 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
411 _GL_CXXALIAS_RPL (fopen
, FILE *,
412 (const char *restrict filename
, const char *restrict mode
));
415 /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
416 _GL_FUNCDECL_SYS (fopen
, FILE *,
417 (const char *restrict filename
, const char *restrict mode
)
418 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
420 _GL_CXXALIAS_SYS (fopen
, FILE *,
421 (const char *restrict filename
, const char *restrict mode
));
424 _GL_CXXALIASWARN (fopen
);
427 # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen
428 /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
429 _GL_FUNCDECL_SYS (fopen
, FILE *,
430 (const char *restrict filename
, const char *restrict mode
)
431 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
433 # if defined GNULIB_POSIXCHECK
435 /* Assume fopen is always declared. */
436 _GL_WARN_ON_USE (fopen
, "fopen on native Windows platforms is not POSIX compliant - "
437 "use gnulib module fopen for portability");
441 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
442 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
443 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
444 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
445 # define fprintf rpl_fprintf
447 # define GNULIB_overrides_fprintf 1
448 # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
449 _GL_FUNCDECL_RPL (fprintf
, int,
450 (FILE *restrict fp
, const char *restrict format
, ...)
451 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
452 _GL_ARG_NONNULL ((1, 2)));
454 _GL_FUNCDECL_RPL (fprintf
, int,
455 (FILE *restrict fp
, const char *restrict format
, ...)
456 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
457 _GL_ARG_NONNULL ((1, 2)));
459 _GL_CXXALIAS_RPL (fprintf
, int,
460 (FILE *restrict fp
, const char *restrict format
, ...));
462 _GL_CXXALIAS_SYS (fprintf
, int,
463 (FILE *restrict fp
, const char *restrict format
, ...));
466 _GL_CXXALIASWARN (fprintf
);
469 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
470 # if !GNULIB_overrides_fprintf
473 /* Assume fprintf is always declared. */
474 _GL_WARN_ON_USE (fprintf
, "fprintf is not always POSIX compliant - "
475 "use gnulib module fprintf-posix for portable "
480 /* Discard all pending buffered I/O data on STREAM.
481 STREAM must not be wide-character oriented.
482 When discarding pending output, the file position is set back to where it
483 was before the write calls. When discarding pending input, the file
484 position is advanced to match the end of the previously read input.
485 Return 0 if successful. Upon error, return -1 and set errno. */
486 # if @REPLACE_FPURGE@
487 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
488 # define fpurge rpl_fpurge
490 _GL_FUNCDECL_RPL (fpurge
, int, (FILE *gl_stream
) _GL_ARG_NONNULL ((1)));
491 _GL_CXXALIAS_RPL (fpurge
, int, (FILE *gl_stream
));
493 # if !@HAVE_DECL_FPURGE@
494 _GL_FUNCDECL_SYS (fpurge
, int, (FILE *gl_stream
) _GL_ARG_NONNULL ((1)));
496 _GL_CXXALIAS_SYS (fpurge
, int, (FILE *gl_stream
));
498 _GL_CXXALIASWARN (fpurge
);
499 #elif defined GNULIB_POSIXCHECK
501 # if HAVE_RAW_DECL_FPURGE
502 _GL_WARN_ON_USE (fpurge
, "fpurge is not always present - "
503 "use gnulib module fpurge for portability");
508 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
509 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
511 # define fputc rpl_fputc
513 _GL_FUNCDECL_RPL (fputc
, int, (int c
, FILE *stream
) _GL_ARG_NONNULL ((2)));
514 _GL_CXXALIAS_RPL (fputc
, int, (int c
, FILE *stream
));
516 _GL_CXXALIAS_SYS (fputc
, int, (int c
, FILE *stream
));
519 _GL_CXXALIASWARN (fputc
);
524 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
525 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
527 # define fputs rpl_fputs
529 _GL_FUNCDECL_RPL (fputs
, int,
530 (const char *restrict string
, FILE *restrict stream
)
531 _GL_ARG_NONNULL ((1, 2)));
532 _GL_CXXALIAS_RPL (fputs
, int,
533 (const char *restrict string
, FILE *restrict stream
));
535 _GL_CXXALIAS_SYS (fputs
, int,
536 (const char *restrict string
, FILE *restrict stream
));
539 _GL_CXXALIASWARN (fputs
);
544 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
545 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
547 # define fread rpl_fread
549 _GL_FUNCDECL_RPL (fread
, size_t,
550 (void *restrict ptr
, size_t s
, size_t n
,
551 FILE *restrict stream
)
552 _GL_ARG_NONNULL ((4)));
553 _GL_CXXALIAS_RPL (fread
, size_t,
554 (void *restrict ptr
, size_t s
, size_t n
,
555 FILE *restrict stream
));
557 _GL_CXXALIAS_SYS (fread
, size_t,
558 (void *restrict ptr
, size_t s
, size_t n
,
559 FILE *restrict stream
));
562 _GL_CXXALIASWARN (fread
);
567 # if @REPLACE_FREOPEN@
568 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
570 # define freopen rpl_freopen
572 _GL_FUNCDECL_RPL (freopen
, FILE *,
573 (const char *restrict filename
, const char *restrict mode
,
574 FILE *restrict stream
)
575 _GL_ARG_NONNULL ((2, 3)));
576 _GL_CXXALIAS_RPL (freopen
, FILE *,
577 (const char *restrict filename
, const char *restrict mode
,
578 FILE *restrict stream
));
580 _GL_CXXALIAS_SYS (freopen
, FILE *,
581 (const char *restrict filename
, const char *restrict mode
,
582 FILE *restrict stream
));
585 _GL_CXXALIASWARN (freopen
);
587 #elif defined GNULIB_POSIXCHECK
589 /* Assume freopen is always declared. */
590 _GL_WARN_ON_USE (freopen
,
591 "freopen on native Windows platforms is not POSIX compliant - "
592 "use gnulib module freopen for portability");
596 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
597 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
599 # define fscanf rpl_fscanf
601 _GL_FUNCDECL_RPL (fscanf
, int,
602 (FILE *restrict stream
, const char *restrict format
, ...)
603 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
604 _GL_ARG_NONNULL ((1, 2)));
605 _GL_CXXALIAS_RPL (fscanf
, int,
606 (FILE *restrict stream
, const char *restrict format
, ...));
608 _GL_CXXALIAS_SYS (fscanf
, int,
609 (FILE *restrict stream
, const char *restrict format
, ...));
612 _GL_CXXALIASWARN (fscanf
);
617 /* Set up the following warnings, based on which modules are in use.
618 GNU Coding Standards discourage the use of fseek, since it imposes
619 an arbitrary limitation on some 32-bit hosts. Remember that the
620 fseek module depends on the fseeko module, so we only have three
623 1. The developer is not using either module. Issue a warning under
624 GNULIB_POSIXCHECK for both functions, to remind them that both
625 functions have bugs on some systems. _GL_NO_LARGE_FILES has no
626 impact on this warning.
628 2. The developer is using both modules. They may be unaware of the
629 arbitrary limitations of fseek, so issue a warning under
630 GNULIB_POSIXCHECK. On the other hand, they may be using both
631 modules intentionally, so the developer can define
632 _GL_NO_LARGE_FILES in the compilation units where the use of fseek
633 is safe, to silence the warning.
635 3. The developer is using the fseeko module, but not fseek. Gnulib
636 guarantees that fseek will still work around platform bugs in that
637 case, but we presume that the developer is aware of the pitfalls of
638 fseek and was trying to avoid it, so issue a warning even when
639 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
640 defined to silence the warning in particular compilation units.
641 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
642 fseek gets defined as a macro, it is recommended that the developer
643 uses the fseek module, even if he is not calling the fseek function.
645 Most gnulib clients that perform stream operations should fall into
649 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
650 # define _GL_FSEEK_WARN /* Category 2, above. */
654 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
656 # define fseek rpl_fseek
658 _GL_FUNCDECL_RPL (fseek
, int, (FILE *fp
, long offset
, int whence
)
659 _GL_ARG_NONNULL ((1)));
660 _GL_CXXALIAS_RPL (fseek
, int, (FILE *fp
, long offset
, int whence
));
662 _GL_CXXALIAS_SYS (fseek
, int, (FILE *fp
, long offset
, int whence
));
665 _GL_CXXALIASWARN (fseek
);
670 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
671 # define _GL_FSEEK_WARN /* Category 3, above. */
674 # if @REPLACE_FSEEKO@
675 /* Provide an fseeko function that is aware of a preceding fflush(), and which
677 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
679 # define fseeko rpl_fseeko
681 _GL_FUNCDECL_RPL (fseeko
, int, (FILE *fp
, off_t offset
, int whence
)
682 _GL_ARG_NONNULL ((1)));
683 _GL_CXXALIAS_RPL (fseeko
, int, (FILE *fp
, off_t offset
, int whence
));
685 # if ! @HAVE_DECL_FSEEKO@
686 _GL_FUNCDECL_SYS (fseeko
, int, (FILE *fp
, off_t offset
, int whence
)
687 _GL_ARG_NONNULL ((1)));
689 _GL_CXXALIAS_SYS (fseeko
, int, (FILE *fp
, off_t offset
, int whence
));
691 _GL_CXXALIASWARN (fseeko
);
692 #elif defined GNULIB_POSIXCHECK
693 # define _GL_FSEEK_WARN /* Category 1, above. */
696 # if HAVE_RAW_DECL_FSEEKO
697 _GL_WARN_ON_USE (fseeko
, "fseeko is unportable - "
698 "use gnulib module fseeko for portability");
702 #ifdef _GL_FSEEK_WARN
703 # undef _GL_FSEEK_WARN
704 /* Here, either fseek is undefined (but C89 guarantees that it is
705 declared), or it is defined as rpl_fseek (declared above). */
706 _GL_WARN_ON_USE (fseek
, "fseek cannot handle files larger than 4 GB "
707 "on 32-bit platforms - "
708 "use fseeko function for handling of large files");
712 /* ftell, ftello. See the comments on fseek/fseeko. */
715 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
716 # define _GL_FTELL_WARN /* Category 2, above. */
720 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
722 # define ftell rpl_ftell
724 _GL_FUNCDECL_RPL (ftell
, long, (FILE *fp
) _GL_ARG_NONNULL ((1)));
725 _GL_CXXALIAS_RPL (ftell
, long, (FILE *fp
));
727 _GL_CXXALIAS_SYS (ftell
, long, (FILE *fp
));
730 _GL_CXXALIASWARN (ftell
);
735 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
736 # define _GL_FTELL_WARN /* Category 3, above. */
739 # if @REPLACE_FTELLO@
740 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
742 # define ftello rpl_ftello
744 _GL_FUNCDECL_RPL (ftello
, off_t
, (FILE *fp
) _GL_ARG_NONNULL ((1)));
745 _GL_CXXALIAS_RPL (ftello
, off_t
, (FILE *fp
));
747 # if ! @HAVE_DECL_FTELLO@
748 _GL_FUNCDECL_SYS (ftello
, off_t
, (FILE *fp
) _GL_ARG_NONNULL ((1)));
750 _GL_CXXALIAS_SYS (ftello
, off_t
, (FILE *fp
));
752 _GL_CXXALIASWARN (ftello
);
753 #elif defined GNULIB_POSIXCHECK
754 # define _GL_FTELL_WARN /* Category 1, above. */
757 # if HAVE_RAW_DECL_FTELLO
758 _GL_WARN_ON_USE (ftello
, "ftello is unportable - "
759 "use gnulib module ftello for portability");
763 #ifdef _GL_FTELL_WARN
764 # undef _GL_FTELL_WARN
765 /* Here, either ftell is undefined (but C89 guarantees that it is
766 declared), or it is defined as rpl_ftell (declared above). */
767 _GL_WARN_ON_USE (ftell
, "ftell cannot handle files larger than 4 GB "
768 "on 32-bit platforms - "
769 "use ftello function for handling of large files");
774 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
775 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
777 # define fwrite rpl_fwrite
779 _GL_FUNCDECL_RPL (fwrite
, size_t,
780 (const void *restrict ptr
, size_t s
, size_t n
,
781 FILE *restrict stream
)
782 _GL_ARG_NONNULL ((1, 4)));
783 _GL_CXXALIAS_RPL (fwrite
, size_t,
784 (const void *restrict ptr
, size_t s
, size_t n
,
785 FILE *restrict stream
));
787 _GL_CXXALIAS_SYS (fwrite
, size_t,
788 (const void *restrict ptr
, size_t s
, size_t n
,
789 FILE *restrict stream
));
791 /* Work around bug 11959 when fortifying glibc 2.4 through 2.15
792 <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>,
793 which sometimes causes an unwanted diagnostic for fwrite calls.
794 This affects only function declaration attributes under certain
795 versions of gcc and clang, and is not needed for C++. */
796 # if (0 < __USE_FORTIFY_LEVEL \
797 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
798 && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
799 && !defined __cplusplus)
801 # undef fwrite_unlocked
802 extern size_t __REDIRECT (rpl_fwrite
,
803 (const void *__restrict
, size_t, size_t,
806 extern size_t __REDIRECT (rpl_fwrite_unlocked
,
807 (const void *__restrict
, size_t, size_t,
810 # define fwrite rpl_fwrite
811 # define fwrite_unlocked rpl_fwrite_unlocked
815 _GL_CXXALIASWARN (fwrite
);
820 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
821 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
823 # define getc rpl_fgetc
825 _GL_FUNCDECL_RPL (fgetc
, int, (FILE *stream
) _GL_ARG_NONNULL ((1)));
826 _GL_CXXALIAS_RPL_1 (getc
, rpl_fgetc
, int, (FILE *stream
));
828 _GL_CXXALIAS_SYS (getc
, int, (FILE *stream
));
831 _GL_CXXALIASWARN (getc
);
836 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
837 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
839 # define getchar rpl_getchar
841 _GL_FUNCDECL_RPL (getchar
, int, (void));
842 _GL_CXXALIAS_RPL (getchar
, int, (void));
844 _GL_CXXALIAS_SYS (getchar
, int, (void));
847 _GL_CXXALIASWARN (getchar
);
851 #if @GNULIB_GETDELIM@
852 /* Read input, up to (and including) the next occurrence of DELIMITER, from
853 STREAM, store it in *LINEPTR (and NUL-terminate it).
854 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
855 bytes of space. It is realloc'd as necessary.
856 Return the number of bytes read and stored at *LINEPTR (not including the
857 NUL terminator), or -1 on error or EOF. */
858 # if @REPLACE_GETDELIM@
859 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
861 # define getdelim rpl_getdelim
863 _GL_FUNCDECL_RPL (getdelim
, ssize_t
,
864 (char **restrict lineptr
, size_t *restrict linesize
,
866 FILE *restrict stream
)
867 _GL_ARG_NONNULL ((1, 2, 4)));
868 _GL_CXXALIAS_RPL (getdelim
, ssize_t
,
869 (char **restrict lineptr
, size_t *restrict linesize
,
871 FILE *restrict stream
));
873 # if !@HAVE_DECL_GETDELIM@
874 _GL_FUNCDECL_SYS (getdelim
, ssize_t
,
875 (char **restrict lineptr
, size_t *restrict linesize
,
877 FILE *restrict stream
)
878 _GL_ARG_NONNULL ((1, 2, 4)));
880 _GL_CXXALIAS_SYS (getdelim
, ssize_t
,
881 (char **restrict lineptr
, size_t *restrict linesize
,
883 FILE *restrict stream
));
885 _GL_CXXALIASWARN (getdelim
);
886 #elif defined GNULIB_POSIXCHECK
888 # if HAVE_RAW_DECL_GETDELIM
889 _GL_WARN_ON_USE (getdelim
, "getdelim is unportable - "
890 "use gnulib module getdelim for portability");
895 /* Read a line, up to (and including) the next newline, from STREAM, store it
896 in *LINEPTR (and NUL-terminate it).
897 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
898 bytes of space. It is realloc'd as necessary.
899 Return the number of bytes read and stored at *LINEPTR (not including the
900 NUL terminator), or -1 on error or EOF. */
901 # if @REPLACE_GETLINE@
902 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
904 # define getline rpl_getline
906 _GL_FUNCDECL_RPL (getline
, ssize_t
,
907 (char **restrict lineptr
, size_t *restrict linesize
,
908 FILE *restrict stream
)
909 _GL_ARG_NONNULL ((1, 2, 3)));
910 _GL_CXXALIAS_RPL (getline
, ssize_t
,
911 (char **restrict lineptr
, size_t *restrict linesize
,
912 FILE *restrict stream
));
914 # if !@HAVE_DECL_GETLINE@
915 _GL_FUNCDECL_SYS (getline
, ssize_t
,
916 (char **restrict lineptr
, size_t *restrict linesize
,
917 FILE *restrict stream
)
918 _GL_ARG_NONNULL ((1, 2, 3)));
920 _GL_CXXALIAS_SYS (getline
, ssize_t
,
921 (char **restrict lineptr
, size_t *restrict linesize
,
922 FILE *restrict stream
));
924 # if @HAVE_DECL_GETLINE@
925 _GL_CXXALIASWARN (getline
);
927 #elif defined GNULIB_POSIXCHECK
929 # if HAVE_RAW_DECL_GETLINE
930 _GL_WARN_ON_USE (getline
, "getline is unportable - "
931 "use gnulib module getline for portability");
935 /* It is very rare that the developer ever has full control of stdin,
936 so any use of gets warrants an unconditional warning; besides, C11
939 #if HAVE_RAW_DECL_GETS && !defined __cplusplus
940 _GL_WARN_ON_USE (gets
, "gets is a security hole - use fgets instead");
943 #if @GNULIB_MDA_GETW@
944 /* On native Windows, map 'getw' to '_getw', so that -loldnames is not
945 required. In C++ with GNULIB_NAMESPACE, avoid differences between
946 platforms by defining GNULIB_NAMESPACE::getw always. */
947 # if defined _WIN32 && !defined __CYGWIN__
948 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
952 _GL_CXXALIAS_MDA (getw
, int, (FILE *restrict stream
));
954 _GL_CXXALIAS_SYS (getw
, int, (FILE *restrict stream
));
956 _GL_CXXALIASWARN (getw
);
959 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
961 /* Grow an obstack with formatted output. Return the number of
962 bytes added to OBS. No trailing nul byte is added, and the
963 object should be closed with obstack_finish before use. Upon
964 memory allocation error, call obstack_alloc_failed_handler. Upon
965 other error, return -1. */
966 # if @REPLACE_OBSTACK_PRINTF@
967 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
968 # define obstack_printf rpl_obstack_printf
970 _GL_FUNCDECL_RPL (obstack_printf
, int,
971 (struct obstack
*obs
, const char *format
, ...)
972 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
973 _GL_ARG_NONNULL ((1, 2)));
974 _GL_CXXALIAS_RPL (obstack_printf
, int,
975 (struct obstack
*obs
, const char *format
, ...));
977 # if !@HAVE_DECL_OBSTACK_PRINTF@
978 _GL_FUNCDECL_SYS (obstack_printf
, int,
979 (struct obstack
*obs
, const char *format
, ...)
980 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
981 _GL_ARG_NONNULL ((1, 2)));
983 _GL_CXXALIAS_SYS (obstack_printf
, int,
984 (struct obstack
*obs
, const char *format
, ...));
986 _GL_CXXALIASWARN (obstack_printf
);
987 # if @REPLACE_OBSTACK_PRINTF@
988 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
989 # define obstack_vprintf rpl_obstack_vprintf
991 _GL_FUNCDECL_RPL (obstack_vprintf
, int,
992 (struct obstack
*obs
, const char *format
, va_list args
)
993 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
994 _GL_ARG_NONNULL ((1, 2)));
995 _GL_CXXALIAS_RPL (obstack_vprintf
, int,
996 (struct obstack
*obs
, const char *format
, va_list args
));
998 # if !@HAVE_DECL_OBSTACK_PRINTF@
999 _GL_FUNCDECL_SYS (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)));
1004 _GL_CXXALIAS_SYS (obstack_vprintf
, int,
1005 (struct obstack
*obs
, const char *format
, va_list args
));
1007 _GL_CXXALIASWARN (obstack_vprintf
);
1012 _GL_FUNCDECL_SYS (pclose
, int, (FILE *stream
) _GL_ARG_NONNULL ((1)));
1014 _GL_CXXALIAS_SYS (pclose
, int, (FILE *stream
));
1015 _GL_CXXALIASWARN (pclose
);
1016 #elif defined GNULIB_POSIXCHECK
1018 # if HAVE_RAW_DECL_PCLOSE
1019 _GL_WARN_ON_USE (pclose
, "pclose is unportable - "
1020 "use gnulib module pclose for more portability");
1025 /* Print a message to standard error, describing the value of ERRNO,
1026 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
1027 and terminated with a newline. */
1028 # if @REPLACE_PERROR@
1029 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1030 # define perror rpl_perror
1032 _GL_FUNCDECL_RPL (perror
, void, (const char *string
));
1033 _GL_CXXALIAS_RPL (perror
, void, (const char *string
));
1035 _GL_CXXALIAS_SYS (perror
, void, (const char *string
));
1038 _GL_CXXALIASWARN (perror
);
1040 #elif defined GNULIB_POSIXCHECK
1042 /* Assume perror is always declared. */
1043 _GL_WARN_ON_USE (perror
, "perror is not always POSIX compliant - "
1044 "use gnulib module perror for portability");
1048 # if @REPLACE_POPEN@
1049 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1051 # define popen rpl_popen
1053 _GL_FUNCDECL_RPL (popen
, FILE *,
1054 (const char *cmd
, const char *mode
)
1055 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose
, 1));
1056 _GL_CXXALIAS_RPL (popen
, FILE *, (const char *cmd
, const char *mode
));
1058 # if !@HAVE_POPEN@ || __GNUC__ >= 11
1059 _GL_FUNCDECL_SYS (popen
, FILE *,
1060 (const char *cmd
, const char *mode
)
1061 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose
, 1));
1063 _GL_CXXALIAS_SYS (popen
, FILE *, (const char *cmd
, const char *mode
));
1065 _GL_CXXALIASWARN (popen
);
1067 # if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen
1068 /* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */
1069 _GL_FUNCDECL_SYS (popen
, FILE *,
1070 (const char *cmd
, const char *mode
)
1071 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose
, 1));
1073 # if defined GNULIB_POSIXCHECK
1075 # if HAVE_RAW_DECL_POPEN
1076 _GL_WARN_ON_USE (popen
, "popen is buggy on some platforms - "
1077 "use gnulib module popen or pipe for more portability");
1082 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
1083 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
1084 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1085 # if defined __GNUC__ || defined __clang__
1086 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1087 /* Don't break __attribute__((format(printf,M,N))). */
1088 # define printf __printf__
1090 # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1091 _GL_FUNCDECL_RPL_1 (__printf__
, int,
1092 (const char *restrict format
, ...)
1093 __asm__ (@ASM_SYMBOL_PREFIX@
1094 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf
))
1095 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1096 _GL_ARG_NONNULL ((1)));
1098 _GL_FUNCDECL_RPL_1 (__printf__
, int,
1099 (const char *restrict format
, ...)
1100 __asm__ (@ASM_SYMBOL_PREFIX@
1101 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf
))
1102 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
1103 _GL_ARG_NONNULL ((1)));
1105 _GL_CXXALIAS_RPL_1 (printf
, __printf__
, int, (const char *format
, ...));
1107 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1108 # define printf rpl_printf
1110 _GL_FUNCDECL_RPL (printf
, int,
1111 (const char *restrict format
, ...)
1112 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1113 _GL_ARG_NONNULL ((1)));
1114 _GL_CXXALIAS_RPL (printf
, int, (const char *restrict format
, ...));
1116 # define GNULIB_overrides_printf 1
1118 _GL_CXXALIAS_SYS (printf
, int, (const char *restrict format
, ...));
1121 _GL_CXXALIASWARN (printf
);
1124 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1125 # if !GNULIB_overrides_printf
1128 /* Assume printf is always declared. */
1129 _GL_WARN_ON_USE (printf
, "printf is not always POSIX compliant - "
1130 "use gnulib module printf-posix for portable "
1131 "POSIX compliance");
1135 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
1136 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1138 # define putc rpl_fputc
1140 _GL_FUNCDECL_RPL (fputc
, int, (int c
, FILE *stream
) _GL_ARG_NONNULL ((2)));
1141 _GL_CXXALIAS_RPL_1 (putc
, rpl_fputc
, int, (int c
, FILE *stream
));
1143 _GL_CXXALIAS_SYS (putc
, int, (int c
, FILE *stream
));
1146 _GL_CXXALIASWARN (putc
);
1150 #if @GNULIB_PUTCHAR@
1151 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
1152 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1154 # define putchar rpl_putchar
1156 _GL_FUNCDECL_RPL (putchar
, int, (int c
));
1157 _GL_CXXALIAS_RPL (putchar
, int, (int c
));
1159 _GL_CXXALIAS_SYS (putchar
, int, (int c
));
1162 _GL_CXXALIASWARN (putchar
);
1167 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
1168 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1170 # define puts rpl_puts
1172 _GL_FUNCDECL_RPL (puts
, int, (const char *string
) _GL_ARG_NONNULL ((1)));
1173 _GL_CXXALIAS_RPL (puts
, int, (const char *string
));
1175 _GL_CXXALIAS_SYS (puts
, int, (const char *string
));
1178 _GL_CXXALIASWARN (puts
);
1182 #if @GNULIB_MDA_PUTW@
1183 /* On native Windows, map 'putw' to '_putw', so that -loldnames is not
1184 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1185 platforms by defining GNULIB_NAMESPACE::putw always. */
1186 # if defined _WIN32 && !defined __CYGWIN__
1187 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1191 _GL_CXXALIAS_MDA (putw
, int, (int w
, FILE *restrict stream
));
1193 _GL_CXXALIAS_SYS (putw
, int, (int w
, FILE *restrict stream
));
1195 _GL_CXXALIASWARN (putw
);
1199 # if @REPLACE_REMOVE@
1200 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1202 # define remove rpl_remove
1204 _GL_FUNCDECL_RPL (remove
, int, (const char *name
) _GL_ARG_NONNULL ((1)));
1205 _GL_CXXALIAS_RPL (remove
, int, (const char *name
));
1207 _GL_CXXALIAS_SYS (remove
, int, (const char *name
));
1210 _GL_CXXALIASWARN (remove
);
1212 #elif defined GNULIB_POSIXCHECK
1214 /* Assume remove is always declared. */
1215 _GL_WARN_ON_USE (remove
, "remove cannot handle directories on some platforms - "
1216 "use gnulib module remove for more portability");
1220 # if @REPLACE_RENAME@
1221 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1223 # define rename rpl_rename
1225 _GL_FUNCDECL_RPL (rename
, int,
1226 (const char *old_filename
, const char *new_filename
)
1227 _GL_ARG_NONNULL ((1, 2)));
1228 _GL_CXXALIAS_RPL (rename
, int,
1229 (const char *old_filename
, const char *new_filename
));
1231 _GL_CXXALIAS_SYS (rename
, int,
1232 (const char *old_filename
, const char *new_filename
));
1235 _GL_CXXALIASWARN (rename
);
1237 #elif defined GNULIB_POSIXCHECK
1239 /* Assume rename is always declared. */
1240 _GL_WARN_ON_USE (rename
, "rename is buggy on some platforms - "
1241 "use gnulib module rename for more portability");
1244 #if @GNULIB_RENAMEAT@
1245 # if @REPLACE_RENAMEAT@
1246 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1248 # define renameat rpl_renameat
1250 _GL_FUNCDECL_RPL (renameat
, int,
1251 (int fd1
, char const *file1
, int fd2
, char const *file2
)
1252 _GL_ARG_NONNULL ((2, 4)));
1253 _GL_CXXALIAS_RPL (renameat
, int,
1254 (int fd1
, char const *file1
, int fd2
, char const *file2
));
1256 # if !@HAVE_RENAMEAT@
1257 _GL_FUNCDECL_SYS (renameat
, int,
1258 (int fd1
, char const *file1
, int fd2
, char const *file2
)
1259 _GL_ARG_NONNULL ((2, 4)));
1261 _GL_CXXALIAS_SYS (renameat
, int,
1262 (int fd1
, char const *file1
, int fd2
, char const *file2
));
1264 _GL_CXXALIASWARN (renameat
);
1265 #elif defined GNULIB_POSIXCHECK
1267 # if HAVE_RAW_DECL_RENAMEAT
1268 _GL_WARN_ON_USE (renameat
, "renameat is not portable - "
1269 "use gnulib module renameat for portability");
1274 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1275 # if defined __GNUC__ || defined __clang__
1276 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1278 /* Don't break __attribute__((format(scanf,M,N))). */
1279 # define scanf __scanf__
1281 _GL_FUNCDECL_RPL_1 (__scanf__
, int,
1282 (const char *restrict format
, ...)
1283 __asm__ (@ASM_SYMBOL_PREFIX@
1284 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf
))
1285 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1286 _GL_ARG_NONNULL ((1)));
1287 _GL_CXXALIAS_RPL_1 (scanf
, __scanf__
, int, (const char *restrict format
, ...));
1289 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1291 # define scanf rpl_scanf
1293 _GL_FUNCDECL_RPL (scanf
, int, (const char *restrict format
, ...)
1294 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1295 _GL_ARG_NONNULL ((1)));
1296 _GL_CXXALIAS_RPL (scanf
, int, (const char *restrict format
, ...));
1299 _GL_CXXALIAS_SYS (scanf
, int, (const char *restrict format
, ...));
1302 _GL_CXXALIASWARN (scanf
);
1306 #if @GNULIB_SNPRINTF@
1307 # if @REPLACE_SNPRINTF@
1308 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1309 # define snprintf rpl_snprintf
1311 # define GNULIB_overrides_snprintf 1
1312 _GL_FUNCDECL_RPL (snprintf
, int,
1313 (char *restrict str
, size_t size
,
1314 const char *restrict format
, ...)
1315 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1316 _GL_ARG_NONNULL ((3)));
1317 _GL_CXXALIAS_RPL (snprintf
, int,
1318 (char *restrict str
, size_t size
,
1319 const char *restrict format
, ...));
1321 # if !@HAVE_DECL_SNPRINTF@
1322 _GL_FUNCDECL_SYS (snprintf
, int,
1323 (char *restrict str
, size_t size
,
1324 const char *restrict format
, ...)
1325 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1326 _GL_ARG_NONNULL ((3)));
1328 _GL_CXXALIAS_SYS (snprintf
, int,
1329 (char *restrict str
, size_t size
,
1330 const char *restrict format
, ...));
1333 _GL_CXXALIASWARN (snprintf
);
1335 #elif defined GNULIB_POSIXCHECK
1337 # if HAVE_RAW_DECL_SNPRINTF
1338 _GL_WARN_ON_USE (snprintf
, "snprintf is unportable - "
1339 "use gnulib module snprintf for portability");
1343 /* Some people would argue that all sprintf uses should be warned about
1344 (for example, OpenBSD issues a link warning for it),
1345 since it can cause security holes due to buffer overruns.
1346 However, we believe that sprintf can be used safely, and is more
1347 efficient than snprintf in those safe cases; and as proof of our
1348 belief, we use sprintf in several gnulib modules. So this header
1349 intentionally avoids adding a warning to sprintf except when
1350 GNULIB_POSIXCHECK is defined. */
1352 #if @GNULIB_SPRINTF_POSIX@
1353 # if @REPLACE_SPRINTF@
1354 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1355 # define sprintf rpl_sprintf
1357 # define GNULIB_overrides_sprintf 1
1358 _GL_FUNCDECL_RPL (sprintf
, int,
1359 (char *restrict str
, const char *restrict format
, ...)
1360 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1361 _GL_ARG_NONNULL ((1, 2)));
1362 _GL_CXXALIAS_RPL (sprintf
, int,
1363 (char *restrict str
, const char *restrict format
, ...));
1365 _GL_CXXALIAS_SYS (sprintf
, int,
1366 (char *restrict str
, const char *restrict format
, ...));
1369 _GL_CXXALIASWARN (sprintf
);
1371 #elif defined GNULIB_POSIXCHECK
1373 /* Assume sprintf is always declared. */
1374 _GL_WARN_ON_USE (sprintf
, "sprintf is not always POSIX compliant - "
1375 "use gnulib module sprintf-posix for portable "
1376 "POSIX compliance");
1379 #if @GNULIB_MDA_TEMPNAM@
1380 /* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not
1381 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1382 platforms by defining GNULIB_NAMESPACE::tempnam always. */
1383 # if defined _WIN32 && !defined __CYGWIN__
1384 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1386 # define tempnam _tempnam
1388 _GL_CXXALIAS_MDA (tempnam
, char *, (const char *dir
, const char *prefix
));
1390 _GL_CXXALIAS_SYS (tempnam
, char *, (const char *dir
, const char *prefix
));
1392 _GL_CXXALIASWARN (tempnam
);
1395 #if @GNULIB_TMPFILE@
1396 # if @REPLACE_TMPFILE@
1397 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1398 # define tmpfile rpl_tmpfile
1400 _GL_FUNCDECL_RPL (tmpfile
, FILE *, (void)
1401 _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
1402 _GL_CXXALIAS_RPL (tmpfile
, FILE *, (void));
1405 /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1406 _GL_FUNCDECL_SYS (tmpfile
, FILE *, (void)
1407 _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
1409 _GL_CXXALIAS_SYS (tmpfile
, FILE *, (void));
1412 _GL_CXXALIASWARN (tmpfile
);
1415 # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile
1416 /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1417 _GL_FUNCDECL_SYS (tmpfile
, FILE *, (void)
1418 _GL_ATTRIBUTE_DEALLOC (fclose
, 1));
1420 # if defined GNULIB_POSIXCHECK
1422 # if HAVE_RAW_DECL_TMPFILE
1423 _GL_WARN_ON_USE (tmpfile
, "tmpfile is not usable on mingw - "
1424 "use gnulib module tmpfile for portability");
1429 #if @GNULIB_VASPRINTF@
1430 /* Write formatted output to a string dynamically allocated with malloc().
1431 If the memory allocation succeeds, store the address of the string in
1432 *RESULT and return the number of resulting bytes, excluding the trailing
1433 NUL. Upon memory allocation error, or some other error, return -1. */
1434 # if @REPLACE_VASPRINTF@
1435 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1436 # define asprintf rpl_asprintf
1438 # define GNULIB_overrides_asprintf
1439 _GL_FUNCDECL_RPL (asprintf
, int,
1440 (char **result
, const char *format
, ...)
1441 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1442 _GL_ARG_NONNULL ((1, 2)));
1443 _GL_CXXALIAS_RPL (asprintf
, int,
1444 (char **result
, const char *format
, ...));
1446 # if !@HAVE_VASPRINTF@
1447 _GL_FUNCDECL_SYS (asprintf
, int,
1448 (char **result
, const char *format
, ...)
1449 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1450 _GL_ARG_NONNULL ((1, 2)));
1452 _GL_CXXALIAS_SYS (asprintf
, int,
1453 (char **result
, const char *format
, ...));
1455 _GL_CXXALIASWARN (asprintf
);
1456 # if @REPLACE_VASPRINTF@
1457 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1458 # define vasprintf rpl_vasprintf
1460 # define GNULIB_overrides_vasprintf 1
1461 _GL_FUNCDECL_RPL (vasprintf
, int,
1462 (char **result
, const char *format
, va_list args
)
1463 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1464 _GL_ARG_NONNULL ((1, 2)));
1465 _GL_CXXALIAS_RPL (vasprintf
, int,
1466 (char **result
, const char *format
, va_list args
));
1468 # if !@HAVE_VASPRINTF@
1469 _GL_FUNCDECL_SYS (vasprintf
, int,
1470 (char **result
, const char *format
, va_list args
)
1471 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1472 _GL_ARG_NONNULL ((1, 2)));
1474 _GL_CXXALIAS_SYS (vasprintf
, int,
1475 (char **result
, const char *format
, va_list args
));
1477 _GL_CXXALIASWARN (vasprintf
);
1480 #if @GNULIB_VDPRINTF@
1481 # if @REPLACE_VDPRINTF@
1482 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1483 # define vdprintf rpl_vdprintf
1485 _GL_FUNCDECL_RPL (vdprintf
, int,
1486 (int fd
, const char *restrict format
, va_list args
)
1487 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1488 _GL_ARG_NONNULL ((2)));
1489 _GL_CXXALIAS_RPL (vdprintf
, int,
1490 (int fd
, const char *restrict format
, va_list args
));
1492 # if !@HAVE_VDPRINTF@
1493 _GL_FUNCDECL_SYS (vdprintf
, int,
1494 (int fd
, const char *restrict format
, va_list args
)
1495 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1496 _GL_ARG_NONNULL ((2)));
1498 /* Need to cast, because on Solaris, the third parameter will likely be
1500 _GL_CXXALIAS_SYS_CAST (vdprintf
, int,
1501 (int fd
, const char *restrict format
, va_list args
));
1504 _GL_CXXALIASWARN (vdprintf
);
1506 #elif defined GNULIB_POSIXCHECK
1508 # if HAVE_RAW_DECL_VDPRINTF
1509 _GL_WARN_ON_USE (vdprintf
, "vdprintf is unportable - "
1510 "use gnulib module vdprintf for portability");
1514 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1515 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1516 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1517 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1518 # define vfprintf rpl_vfprintf
1520 # define GNULIB_overrides_vfprintf 1
1521 # if @GNULIB_VFPRINTF_POSIX@
1522 _GL_FUNCDECL_RPL (vfprintf
, int,
1524 const char *restrict format
, va_list args
)
1525 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1526 _GL_ARG_NONNULL ((1, 2)));
1528 _GL_FUNCDECL_RPL (vfprintf
, int,
1530 const char *restrict format
, va_list args
)
1531 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1532 _GL_ARG_NONNULL ((1, 2)));
1534 _GL_CXXALIAS_RPL (vfprintf
, int,
1536 const char *restrict format
, va_list args
));
1538 /* Need to cast, because on Solaris, the third parameter is
1540 and GCC's fixincludes did not change this to __gnuc_va_list. */
1541 _GL_CXXALIAS_SYS_CAST (vfprintf
, int,
1543 const char *restrict format
, va_list args
));
1546 _GL_CXXALIASWARN (vfprintf
);
1549 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1550 # if !GNULIB_overrides_vfprintf
1553 /* Assume vfprintf is always declared. */
1554 _GL_WARN_ON_USE (vfprintf
, "vfprintf is not always POSIX compliant - "
1555 "use gnulib module vfprintf-posix for portable "
1556 "POSIX compliance");
1559 #if @GNULIB_VFSCANF@
1560 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1561 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1563 # define vfscanf rpl_vfscanf
1565 _GL_FUNCDECL_RPL (vfscanf
, int,
1566 (FILE *restrict stream
,
1567 const char *restrict format
, va_list args
)
1568 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1569 _GL_ARG_NONNULL ((1, 2)));
1570 _GL_CXXALIAS_RPL (vfscanf
, int,
1571 (FILE *restrict stream
,
1572 const char *restrict format
, va_list args
));
1574 _GL_CXXALIAS_SYS (vfscanf
, int,
1575 (FILE *restrict stream
,
1576 const char *restrict format
, va_list args
));
1579 _GL_CXXALIASWARN (vfscanf
);
1583 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1584 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1585 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1586 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1587 # define vprintf rpl_vprintf
1589 # define GNULIB_overrides_vprintf 1
1590 # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1591 _GL_FUNCDECL_RPL (vprintf
, int, (const char *restrict format
, va_list args
)
1592 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1593 _GL_ARG_NONNULL ((1)));
1595 _GL_FUNCDECL_RPL (vprintf
, int, (const char *restrict format
, va_list args
)
1596 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1597 _GL_ARG_NONNULL ((1)));
1599 _GL_CXXALIAS_RPL (vprintf
, int, (const char *restrict format
, va_list args
));
1601 /* Need to cast, because on Solaris, the second parameter is
1603 and GCC's fixincludes did not change this to __gnuc_va_list. */
1604 _GL_CXXALIAS_SYS_CAST (vprintf
, int,
1605 (const char *restrict format
, va_list args
));
1608 _GL_CXXALIASWARN (vprintf
);
1611 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1612 # if !GNULIB_overrides_vprintf
1615 /* Assume vprintf is always declared. */
1616 _GL_WARN_ON_USE (vprintf
, "vprintf is not always POSIX compliant - "
1617 "use gnulib module vprintf-posix for portable "
1618 "POSIX compliance");
1622 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1623 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1625 # define vscanf rpl_vscanf
1627 _GL_FUNCDECL_RPL (vscanf
, int, (const char *restrict format
, va_list args
)
1628 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1629 _GL_ARG_NONNULL ((1)));
1630 _GL_CXXALIAS_RPL (vscanf
, int, (const char *restrict format
, va_list args
));
1632 _GL_CXXALIAS_SYS (vscanf
, int, (const char *restrict format
, va_list args
));
1635 _GL_CXXALIASWARN (vscanf
);
1639 #if @GNULIB_VSNPRINTF@
1640 # if @REPLACE_VSNPRINTF@
1641 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1642 # define vsnprintf rpl_vsnprintf
1644 # define GNULIB_overrides_vsnprintf 1
1645 _GL_FUNCDECL_RPL (vsnprintf
, int,
1646 (char *restrict str
, size_t size
,
1647 const char *restrict format
, va_list args
)
1648 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1649 _GL_ARG_NONNULL ((3)));
1650 _GL_CXXALIAS_RPL (vsnprintf
, int,
1651 (char *restrict str
, size_t size
,
1652 const char *restrict format
, va_list args
));
1654 # if !@HAVE_DECL_VSNPRINTF@
1655 _GL_FUNCDECL_SYS (vsnprintf
, int,
1656 (char *restrict str
, size_t size
,
1657 const char *restrict format
, va_list args
)
1658 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1659 _GL_ARG_NONNULL ((3)));
1661 _GL_CXXALIAS_SYS (vsnprintf
, int,
1662 (char *restrict str
, size_t size
,
1663 const char *restrict format
, va_list args
));
1666 _GL_CXXALIASWARN (vsnprintf
);
1668 #elif defined GNULIB_POSIXCHECK
1670 # if HAVE_RAW_DECL_VSNPRINTF
1671 _GL_WARN_ON_USE (vsnprintf
, "vsnprintf is unportable - "
1672 "use gnulib module vsnprintf for portability");
1676 #if @GNULIB_VSPRINTF_POSIX@
1677 # if @REPLACE_VSPRINTF@
1678 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1679 # define vsprintf rpl_vsprintf
1681 # define GNULIB_overrides_vsprintf 1
1682 _GL_FUNCDECL_RPL (vsprintf
, int,
1683 (char *restrict str
,
1684 const char *restrict format
, va_list args
)
1685 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1686 _GL_ARG_NONNULL ((1, 2)));
1687 _GL_CXXALIAS_RPL (vsprintf
, int,
1688 (char *restrict str
,
1689 const char *restrict format
, va_list args
));
1691 /* Need to cast, because on Solaris, the third parameter is
1693 and GCC's fixincludes did not change this to __gnuc_va_list. */
1694 _GL_CXXALIAS_SYS_CAST (vsprintf
, int,
1695 (char *restrict str
,
1696 const char *restrict format
, va_list args
));
1699 _GL_CXXALIASWARN (vsprintf
);
1701 #elif defined GNULIB_POSIXCHECK
1703 /* Assume vsprintf is always declared. */
1704 _GL_WARN_ON_USE (vsprintf
, "vsprintf is not always POSIX compliant - "
1705 "use gnulib module vsprintf-posix for portable "
1706 "POSIX compliance");
1709 #endif /* _@GUARD_PREFIX@_STDIO_H */
1710 #endif /* _@GUARD_PREFIX@_STDIO_H */