1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A GNU-like <stdio.h>.
5 Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
22 @PRAGMA_SYSTEM_HEADER@
26 #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
27 /* Special invocation convention:
28 - Inside glibc header files.
29 - On OSF/1 5.1 we have a sequence of nested includes
30 <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
31 <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
32 In this situation, the functions are not yet declared, therefore we cannot
33 provide the C++ aliases. */
35 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
38 /* Normal invocation convention. */
40 #ifndef _@GUARD_PREFIX@_STDIO_H
42 #define _GL_ALREADY_INCLUDING_STDIO_H
44 /* The include_next requires a split double-inclusion guard. */
45 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
47 #undef _GL_ALREADY_INCLUDING_STDIO_H
49 #ifndef _@GUARD_PREFIX@_STDIO_H
50 #define _@GUARD_PREFIX@_STDIO_H
52 /* Get va_list. Needed on many systems, including glibc 2.8. */
57 /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
59 #include <sys/types.h>
61 /* The __attribute__ feature is available in gcc versions 2.5 and later.
62 The __-protected variants of the attributes 'format' and 'printf' are
63 accepted by gcc versions 2.6.4 (effectively 2.7) and later.
64 We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
65 gnulib and libintl do '#define printf __printf__' when they override
66 the 'printf' function. */
67 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
68 # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
70 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
73 /* _GL_ATTRIBUTE_FORMAT_PRINTF
74 indicates to GCC that the function takes a format string and arguments,
75 where the format string directives are the ones standardized by ISO C99
77 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
78 # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
79 _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
81 # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
82 _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
85 /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
86 except that it indicates to GCC that the supported format string directives
87 are the ones of the system printf(), rather than the ones standardized by
89 #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
90 _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
92 /* _GL_ATTRIBUTE_FORMAT_SCANF
93 indicates to GCC that the function takes a format string and arguments,
94 where the format string directives are the ones standardized by ISO C99
96 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
97 # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
98 _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
100 # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
101 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
104 /* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
105 except that it indicates to GCC that the supported format string directives
106 are the ones of the system scanf(), rather than the ones standardized by
107 ISO C99 and POSIX. */
108 #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
109 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
111 /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
112 /* But in any case avoid namespace pollution on glibc systems. */
113 #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
114 && ! defined __GLIBC__
119 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
121 /* The definition of _GL_ARG_NONNULL is copied here. */
123 /* The definition of _GL_WARN_ON_USE is copied here. */
125 /* Macros for stringification. */
126 #define _GL_STDIO_STRINGIZE(token) #token
127 #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
131 # if @REPLACE_DPRINTF@
132 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
133 # define dprintf rpl_dprintf
135 _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
136 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
137 _GL_ARG_NONNULL ((2)));
138 _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
141 _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
142 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
143 _GL_ARG_NONNULL ((2)));
145 _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
147 _GL_CXXALIASWARN (dprintf);
148 #elif defined GNULIB_POSIXCHECK
150 # if HAVE_RAW_DECL_DPRINTF
151 _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
152 "use gnulib module dprintf for portability");
157 /* Close STREAM and its underlying file descriptor. */
158 # if @REPLACE_FCLOSE@
159 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
160 # define fclose rpl_fclose
162 _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
163 _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
165 _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
167 _GL_CXXALIASWARN (fclose);
168 #elif defined GNULIB_POSIXCHECK
170 /* Assume fclose is always declared. */
171 _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
172 "use gnulib module fclose for portable POSIX compliance");
176 /* Flush all pending data on STREAM according to POSIX rules. Both
177 output and seekable input streams are supported.
178 Note! LOSS OF DATA can occur if fflush is applied on an input stream
179 that is _not_seekable_ or on an update stream that is _not_seekable_
180 and in which the most recent operation was input. Seekability can
181 be tested with lseek(fileno(fp),0,SEEK_CUR). */
182 # if @REPLACE_FFLUSH@
183 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
184 # define fflush rpl_fflush
186 _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
187 _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
189 _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
191 _GL_CXXALIASWARN (fflush);
192 #elif defined GNULIB_POSIXCHECK
194 /* Assume fflush is always declared. */
195 _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
196 "use gnulib module fflush for portable POSIX compliance");
200 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
201 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
203 # define fgetc rpl_fgetc
205 _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
206 _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
208 _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
210 _GL_CXXALIASWARN (fgetc);
214 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
215 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
217 # define fgets rpl_fgets
219 _GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
220 _GL_ARG_NONNULL ((1, 3)));
221 _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
223 _GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
225 _GL_CXXALIASWARN (fgets);
230 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
232 # define fopen rpl_fopen
234 _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
235 _GL_ARG_NONNULL ((1, 2)));
236 _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
238 _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
240 _GL_CXXALIASWARN (fopen);
241 #elif defined GNULIB_POSIXCHECK
243 /* Assume fopen is always declared. */
244 _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
245 "use gnulib module fopen for portability");
248 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
249 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
250 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
251 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
252 # define fprintf rpl_fprintf
254 # define GNULIB_overrides_fprintf 1
255 # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
256 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
257 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
258 _GL_ARG_NONNULL ((1, 2)));
260 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
261 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
262 _GL_ARG_NONNULL ((1, 2)));
264 _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
266 _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
268 _GL_CXXALIASWARN (fprintf);
270 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
271 # if !GNULIB_overrides_fprintf
274 /* Assume fprintf is always declared. */
275 _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
276 "use gnulib module fprintf-posix for portable "
281 /* Discard all pending buffered I/O data on STREAM.
282 STREAM must not be wide-character oriented.
283 When discarding pending output, the file position is set back to where it
284 was before the write calls. When discarding pending input, the file
285 position is advanced to match the end of the previously read input.
286 Return 0 if successful. Upon error, return -1 and set errno. */
287 # if @REPLACE_FPURGE@
288 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
289 # define fpurge rpl_fpurge
291 _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
292 _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
294 # if !@HAVE_DECL_FPURGE@
295 _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
297 _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
299 _GL_CXXALIASWARN (fpurge);
300 #elif defined GNULIB_POSIXCHECK
302 # if HAVE_RAW_DECL_FPURGE
303 _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
304 "use gnulib module fpurge for portability");
309 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
310 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
312 # define fputc rpl_fputc
314 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
315 _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
317 _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
319 _GL_CXXALIASWARN (fputc);
323 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
324 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
326 # define fputs rpl_fputs
328 _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
329 _GL_ARG_NONNULL ((1, 2)));
330 _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
332 _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
334 _GL_CXXALIASWARN (fputs);
338 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
339 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
341 # define fread rpl_fread
343 _GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
344 _GL_ARG_NONNULL ((4)));
345 _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
347 _GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
349 _GL_CXXALIASWARN (fread);
353 # if @REPLACE_FREOPEN@
354 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
356 # define freopen rpl_freopen
358 _GL_FUNCDECL_RPL (freopen, FILE *,
359 (const char *filename, const char *mode, FILE *stream)
360 _GL_ARG_NONNULL ((2, 3)));
361 _GL_CXXALIAS_RPL (freopen, FILE *,
362 (const char *filename, const char *mode, FILE *stream));
364 _GL_CXXALIAS_SYS (freopen, FILE *,
365 (const char *filename, const char *mode, FILE *stream));
367 _GL_CXXALIASWARN (freopen);
368 #elif defined GNULIB_POSIXCHECK
370 /* Assume freopen is always declared. */
371 _GL_WARN_ON_USE (freopen,
372 "freopen on Win32 platforms is not POSIX compatible - "
373 "use gnulib module freopen for portability");
377 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
378 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
380 # define fscanf rpl_fscanf
382 _GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
383 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
384 _GL_ARG_NONNULL ((1, 2)));
385 _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
387 _GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
389 _GL_CXXALIASWARN (fscanf);
393 /* Set up the following warnings, based on which modules are in use.
394 GNU Coding Standards discourage the use of fseek, since it imposes
395 an arbitrary limitation on some 32-bit hosts. Remember that the
396 fseek module depends on the fseeko module, so we only have three
399 1. The developer is not using either module. Issue a warning under
400 GNULIB_POSIXCHECK for both functions, to remind them that both
401 functions have bugs on some systems. _GL_NO_LARGE_FILES has no
402 impact on this warning.
404 2. The developer is using both modules. They may be unaware of the
405 arbitrary limitations of fseek, so issue a warning under
406 GNULIB_POSIXCHECK. On the other hand, they may be using both
407 modules intentionally, so the developer can define
408 _GL_NO_LARGE_FILES in the compilation units where the use of fseek
409 is safe, to silence the warning.
411 3. The developer is using the fseeko module, but not fseek. Gnulib
412 guarantees that fseek will still work around platform bugs in that
413 case, but we presume that the developer is aware of the pitfalls of
414 fseek and was trying to avoid it, so issue a warning even when
415 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
416 defined to silence the warning in particular compilation units.
417 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
418 fseek gets defined as a macro, it is recommended that the developer
419 uses the fseek module, even if he is not calling the fseek function.
421 Most gnulib clients that perform stream operations should fall into
425 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
426 # define _GL_FSEEK_WARN /* Category 2, above. */
430 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
432 # define fseek rpl_fseek
434 _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
435 _GL_ARG_NONNULL ((1)));
436 _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
438 _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
440 _GL_CXXALIASWARN (fseek);
444 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
445 # define _GL_FSEEK_WARN /* Category 3, above. */
448 # if @REPLACE_FSEEKO@
449 /* Provide an fseeko function that is aware of a preceding fflush(), and which
451 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
453 # define fseeko rpl_fseeko
455 _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
456 _GL_ARG_NONNULL ((1)));
457 _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
459 # if ! @HAVE_DECL_FSEEKO@
460 _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
461 _GL_ARG_NONNULL ((1)));
463 _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
465 _GL_CXXALIASWARN (fseeko);
466 #elif defined GNULIB_POSIXCHECK
467 # define _GL_FSEEK_WARN /* Category 1, above. */
470 # if HAVE_RAW_DECL_FSEEKO
471 _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
472 "use gnulib module fseeko for portability");
476 #ifdef _GL_FSEEK_WARN
477 # undef _GL_FSEEK_WARN
478 /* Here, either fseek is undefined (but C89 guarantees that it is
479 declared), or it is defined as rpl_fseek (declared above). */
480 _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
481 "on 32-bit platforms - "
482 "use fseeko function for handling of large files");
486 /* ftell, ftello. See the comments on fseek/fseeko. */
489 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
490 # define _GL_FTELL_WARN /* Category 2, above. */
494 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
496 # define ftell rpl_ftell
498 _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
499 _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
501 _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
503 _GL_CXXALIASWARN (ftell);
507 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
508 # define _GL_FTELL_WARN /* Category 3, above. */
511 # if @REPLACE_FTELLO@
512 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
514 # define ftello rpl_ftello
516 _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
517 _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
519 # if ! @HAVE_DECL_FTELLO@
520 _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
522 _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
524 _GL_CXXALIASWARN (ftello);
525 #elif defined GNULIB_POSIXCHECK
526 # define _GL_FTELL_WARN /* Category 1, above. */
529 # if HAVE_RAW_DECL_FTELLO
530 _GL_WARN_ON_USE (ftello, "ftello is unportable - "
531 "use gnulib module ftello for portability");
535 #ifdef _GL_FTELL_WARN
536 # undef _GL_FTELL_WARN
537 /* Here, either ftell is undefined (but C89 guarantees that it is
538 declared), or it is defined as rpl_ftell (declared above). */
539 _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
540 "on 32-bit platforms - "
541 "use ftello function for handling of large files");
546 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
547 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
549 # define fwrite rpl_fwrite
551 _GL_FUNCDECL_RPL (fwrite, size_t,
552 (const void *ptr, size_t s, size_t n, FILE *stream)
553 _GL_ARG_NONNULL ((1, 4)));
554 _GL_CXXALIAS_RPL (fwrite, size_t,
555 (const void *ptr, size_t s, size_t n, FILE *stream));
557 _GL_CXXALIAS_SYS (fwrite, size_t,
558 (const void *ptr, size_t s, size_t n, FILE *stream));
560 /* Work around glibc bug 11959
561 <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
562 which sometimes causes an unwanted diagnostic for fwrite calls.
563 This affects only function declaration attributes, so it's not
565 # if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL
566 static inline size_t _GL_ARG_NONNULL ((1, 4))
567 rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
569 size_t r = fwrite (ptr, s, n, stream);
574 # define fwrite rpl_fwrite
577 _GL_CXXALIASWARN (fwrite);
581 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
582 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
584 # define getc rpl_fgetc
586 _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
587 _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
589 _GL_CXXALIAS_SYS (getc, int, (FILE *stream));
591 _GL_CXXALIASWARN (getc);
595 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
596 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
598 # define getchar rpl_getchar
600 _GL_FUNCDECL_RPL (getchar, int, (void));
601 _GL_CXXALIAS_RPL (getchar, int, (void));
603 _GL_CXXALIAS_SYS (getchar, int, (void));
605 _GL_CXXALIASWARN (getchar);
608 #if @GNULIB_GETDELIM@
609 /* Read input, up to (and including) the next occurrence of DELIMITER, from
610 STREAM, store it in *LINEPTR (and NUL-terminate it).
611 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
612 bytes of space. It is realloc'd as necessary.
613 Return the number of bytes read and stored at *LINEPTR (not including the
614 NUL terminator), or -1 on error or EOF. */
615 # if @REPLACE_GETDELIM@
616 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
618 # define getdelim rpl_getdelim
620 _GL_FUNCDECL_RPL (getdelim, ssize_t,
621 (char **lineptr, size_t *linesize, int delimiter,
623 _GL_ARG_NONNULL ((1, 2, 4)));
624 _GL_CXXALIAS_RPL (getdelim, ssize_t,
625 (char **lineptr, size_t *linesize, int delimiter,
628 # if !@HAVE_DECL_GETDELIM@
629 _GL_FUNCDECL_SYS (getdelim, ssize_t,
630 (char **lineptr, size_t *linesize, int delimiter,
632 _GL_ARG_NONNULL ((1, 2, 4)));
634 _GL_CXXALIAS_SYS (getdelim, ssize_t,
635 (char **lineptr, size_t *linesize, int delimiter,
638 _GL_CXXALIASWARN (getdelim);
639 #elif defined GNULIB_POSIXCHECK
641 # if HAVE_RAW_DECL_GETDELIM
642 _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
643 "use gnulib module getdelim for portability");
648 /* Read a line, up to (and including) the next newline, from STREAM, store it
649 in *LINEPTR (and NUL-terminate it).
650 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
651 bytes of space. It is realloc'd as necessary.
652 Return the number of bytes read and stored at *LINEPTR (not including the
653 NUL terminator), or -1 on error or EOF. */
654 # if @REPLACE_GETLINE@
655 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
657 # define getline rpl_getline
659 _GL_FUNCDECL_RPL (getline, ssize_t,
660 (char **lineptr, size_t *linesize, FILE *stream)
661 _GL_ARG_NONNULL ((1, 2, 3)));
662 _GL_CXXALIAS_RPL (getline, ssize_t,
663 (char **lineptr, size_t *linesize, FILE *stream));
665 # if !@HAVE_DECL_GETLINE@
666 _GL_FUNCDECL_SYS (getline, ssize_t,
667 (char **lineptr, size_t *linesize, FILE *stream)
668 _GL_ARG_NONNULL ((1, 2, 3)));
670 _GL_CXXALIAS_SYS (getline, ssize_t,
671 (char **lineptr, size_t *linesize, FILE *stream));
673 # if @HAVE_DECL_GETLINE@
674 _GL_CXXALIASWARN (getline);
676 #elif defined GNULIB_POSIXCHECK
678 # if HAVE_RAW_DECL_GETLINE
679 _GL_WARN_ON_USE (getline, "getline is unportable - "
680 "use gnulib module getline for portability");
685 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
686 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
688 # define gets rpl_gets
690 _GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
691 _GL_CXXALIAS_RPL (gets, char *, (char *s));
693 _GL_CXXALIAS_SYS (gets, char *, (char *s));
696 _GL_CXXALIASWARN (gets);
697 /* It is very rare that the developer ever has full control of stdin,
698 so any use of gets warrants an unconditional warning. Assume it is
699 always declared, since it is required by C89. */
700 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
704 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
706 /* Grow an obstack with formatted output. Return the number of
707 bytes added to OBS. No trailing nul byte is added, and the
708 object should be closed with obstack_finish before use. Upon
709 memory allocation error, call obstack_alloc_failed_handler. Upon
710 other error, return -1. */
711 # if @REPLACE_OBSTACK_PRINTF@
712 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
713 # define obstack_printf rpl_obstack_printf
715 _GL_FUNCDECL_RPL (obstack_printf, int,
716 (struct obstack *obs, const char *format, ...)
717 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
718 _GL_ARG_NONNULL ((1, 2)));
719 _GL_CXXALIAS_RPL (obstack_printf, int,
720 (struct obstack *obs, const char *format, ...));
722 # if !@HAVE_DECL_OBSTACK_PRINTF@
723 _GL_FUNCDECL_SYS (obstack_printf, int,
724 (struct obstack *obs, const char *format, ...)
725 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
726 _GL_ARG_NONNULL ((1, 2)));
728 _GL_CXXALIAS_SYS (obstack_printf, int,
729 (struct obstack *obs, const char *format, ...));
731 _GL_CXXALIASWARN (obstack_printf);
732 # if @REPLACE_OBSTACK_PRINTF@
733 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
734 # define obstack_vprintf rpl_obstack_vprintf
736 _GL_FUNCDECL_RPL (obstack_vprintf, int,
737 (struct obstack *obs, const char *format, va_list args)
738 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
739 _GL_ARG_NONNULL ((1, 2)));
740 _GL_CXXALIAS_RPL (obstack_vprintf, int,
741 (struct obstack *obs, const char *format, va_list args));
743 # if !@HAVE_DECL_OBSTACK_PRINTF@
744 _GL_FUNCDECL_SYS (obstack_vprintf, int,
745 (struct obstack *obs, const char *format, va_list args)
746 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
747 _GL_ARG_NONNULL ((1, 2)));
749 _GL_CXXALIAS_SYS (obstack_vprintf, int,
750 (struct obstack *obs, const char *format, va_list args));
752 _GL_CXXALIASWARN (obstack_vprintf);
756 /* Print a message to standard error, describing the value of ERRNO,
757 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
758 and terminated with a newline. */
759 # if @REPLACE_PERROR@
760 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
761 # define perror rpl_perror
763 _GL_FUNCDECL_RPL (perror, void, (const char *string));
764 _GL_CXXALIAS_RPL (perror, void, (const char *string));
766 _GL_CXXALIAS_SYS (perror, void, (const char *string));
768 _GL_CXXALIASWARN (perror);
769 #elif defined GNULIB_POSIXCHECK
771 /* Assume perror is always declared. */
772 _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
773 "use gnulib module perror for portability");
778 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
780 # define popen rpl_popen
782 _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
783 _GL_ARG_NONNULL ((1, 2)));
784 _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
786 _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
788 _GL_CXXALIASWARN (popen);
789 #elif defined GNULIB_POSIXCHECK
791 # if HAVE_RAW_DECL_POPEN
792 _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
793 "use gnulib module popen or pipe for more portability");
797 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
798 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
799 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
800 # if defined __GNUC__
801 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
802 /* Don't break __attribute__((format(printf,M,N))). */
803 # define printf __printf__
805 # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
806 _GL_FUNCDECL_RPL_1 (__printf__, int,
807 (const char *format, ...)
808 __asm__ (@ASM_SYMBOL_PREFIX@
809 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
810 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
811 _GL_ARG_NONNULL ((1)));
813 _GL_FUNCDECL_RPL_1 (__printf__, int,
814 (const char *format, ...)
815 __asm__ (@ASM_SYMBOL_PREFIX@
816 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
817 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
818 _GL_ARG_NONNULL ((1)));
820 _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
822 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
823 # define printf rpl_printf
825 _GL_FUNCDECL_RPL (printf, int,
826 (const char *format, ...)
827 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
828 _GL_ARG_NONNULL ((1)));
829 _GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
831 # define GNULIB_overrides_printf 1
833 _GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
835 _GL_CXXALIASWARN (printf);
837 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
838 # if !GNULIB_overrides_printf
841 /* Assume printf is always declared. */
842 _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
843 "use gnulib module printf-posix for portable "
848 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
849 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
851 # define putc rpl_fputc
853 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
854 _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
856 _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
858 _GL_CXXALIASWARN (putc);
862 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
863 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
865 # define putchar rpl_putchar
867 _GL_FUNCDECL_RPL (putchar, int, (int c));
868 _GL_CXXALIAS_RPL (putchar, int, (int c));
870 _GL_CXXALIAS_SYS (putchar, int, (int c));
872 _GL_CXXALIASWARN (putchar);
876 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
877 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
879 # define puts rpl_puts
881 _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
882 _GL_CXXALIAS_RPL (puts, int, (const char *string));
884 _GL_CXXALIAS_SYS (puts, int, (const char *string));
886 _GL_CXXALIASWARN (puts);
890 # if @REPLACE_REMOVE@
891 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
893 # define remove rpl_remove
895 _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
896 _GL_CXXALIAS_RPL (remove, int, (const char *name));
898 _GL_CXXALIAS_SYS (remove, int, (const char *name));
900 _GL_CXXALIASWARN (remove);
901 #elif defined GNULIB_POSIXCHECK
903 /* Assume remove is always declared. */
904 _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
905 "use gnulib module remove for more portability");
909 # if @REPLACE_RENAME@
910 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
912 # define rename rpl_rename
914 _GL_FUNCDECL_RPL (rename, int,
915 (const char *old_filename, const char *new_filename)
916 _GL_ARG_NONNULL ((1, 2)));
917 _GL_CXXALIAS_RPL (rename, int,
918 (const char *old_filename, const char *new_filename));
920 _GL_CXXALIAS_SYS (rename, int,
921 (const char *old_filename, const char *new_filename));
923 _GL_CXXALIASWARN (rename);
924 #elif defined GNULIB_POSIXCHECK
926 /* Assume rename is always declared. */
927 _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
928 "use gnulib module rename for more portability");
931 #if @GNULIB_RENAMEAT@
932 # if @REPLACE_RENAMEAT@
933 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
935 # define renameat rpl_renameat
937 _GL_FUNCDECL_RPL (renameat, int,
938 (int fd1, char const *file1, int fd2, char const *file2)
939 _GL_ARG_NONNULL ((2, 4)));
940 _GL_CXXALIAS_RPL (renameat, int,
941 (int fd1, char const *file1, int fd2, char const *file2));
943 # if !@HAVE_RENAMEAT@
944 _GL_FUNCDECL_SYS (renameat, int,
945 (int fd1, char const *file1, int fd2, char const *file2)
946 _GL_ARG_NONNULL ((2, 4)));
948 _GL_CXXALIAS_SYS (renameat, int,
949 (int fd1, char const *file1, int fd2, char const *file2));
951 _GL_CXXALIASWARN (renameat);
952 #elif defined GNULIB_POSIXCHECK
954 # if HAVE_RAW_DECL_RENAMEAT
955 _GL_WARN_ON_USE (renameat, "renameat is not portable - "
956 "use gnulib module renameat for portability");
961 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
962 # if defined __GNUC__
963 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
965 /* Don't break __attribute__((format(scanf,M,N))). */
966 # define scanf __scanf__
968 _GL_FUNCDECL_RPL_1 (__scanf__, int,
969 (const char *format, ...)
970 __asm__ (@ASM_SYMBOL_PREFIX@
971 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
972 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
973 _GL_ARG_NONNULL ((1)));
974 _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
976 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
978 # define scanf rpl_scanf
980 _GL_FUNCDECL_RPL (scanf, int, (const char *format, ...)
981 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
982 _GL_ARG_NONNULL ((1)));
983 _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
986 _GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
988 _GL_CXXALIASWARN (scanf);
991 #if @GNULIB_SNPRINTF@
992 # if @REPLACE_SNPRINTF@
993 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
994 # define snprintf rpl_snprintf
996 _GL_FUNCDECL_RPL (snprintf, int,
997 (char *str, size_t size, const char *format, ...)
998 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
999 _GL_ARG_NONNULL ((3)));
1000 _GL_CXXALIAS_RPL (snprintf, int,
1001 (char *str, size_t size, const char *format, ...));
1003 # if !@HAVE_DECL_SNPRINTF@
1004 _GL_FUNCDECL_SYS (snprintf, int,
1005 (char *str, size_t size, const char *format, ...)
1006 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
1007 _GL_ARG_NONNULL ((3)));
1009 _GL_CXXALIAS_SYS (snprintf, int,
1010 (char *str, size_t size, const char *format, ...));
1012 _GL_CXXALIASWARN (snprintf);
1013 #elif defined GNULIB_POSIXCHECK
1015 # if HAVE_RAW_DECL_SNPRINTF
1016 _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1017 "use gnulib module snprintf for portability");
1021 /* Some people would argue that sprintf should be handled like gets
1022 (for example, OpenBSD issues a link warning for both functions),
1023 since both can cause security holes due to buffer overruns.
1024 However, we believe that sprintf can be used safely, and is more
1025 efficient than snprintf in those safe cases; and as proof of our
1026 belief, we use sprintf in several gnulib modules. So this header
1027 intentionally avoids adding a warning to sprintf except when
1028 GNULIB_POSIXCHECK is defined. */
1030 #if @GNULIB_SPRINTF_POSIX@
1031 # if @REPLACE_SPRINTF@
1032 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1033 # define sprintf rpl_sprintf
1035 _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
1036 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1037 _GL_ARG_NONNULL ((1, 2)));
1038 _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
1040 _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
1042 _GL_CXXALIASWARN (sprintf);
1043 #elif defined GNULIB_POSIXCHECK
1045 /* Assume sprintf is always declared. */
1046 _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
1047 "use gnulib module sprintf-posix for portable "
1048 "POSIX compliance");
1051 #if @GNULIB_TMPFILE@
1052 # if @REPLACE_TMPFILE@
1053 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1054 # define tmpfile rpl_tmpfile
1056 _GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
1057 _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1059 _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1061 _GL_CXXALIASWARN (tmpfile);
1062 #elif defined GNULIB_POSIXCHECK
1064 # if HAVE_RAW_DECL_TMPFILE
1065 _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1066 "use gnulib module tmpfile for portability");
1070 #if @GNULIB_VASPRINTF@
1071 /* Write formatted output to a string dynamically allocated with malloc().
1072 If the memory allocation succeeds, store the address of the string in
1073 *RESULT and return the number of resulting bytes, excluding the trailing
1074 NUL. Upon memory allocation error, or some other error, return -1. */
1075 # if @REPLACE_VASPRINTF@
1076 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1077 # define asprintf rpl_asprintf
1079 _GL_FUNCDECL_RPL (asprintf, int,
1080 (char **result, const char *format, ...)
1081 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1082 _GL_ARG_NONNULL ((1, 2)));
1083 _GL_CXXALIAS_RPL (asprintf, int,
1084 (char **result, const char *format, ...));
1086 # if !@HAVE_VASPRINTF@
1087 _GL_FUNCDECL_SYS (asprintf, int,
1088 (char **result, const char *format, ...)
1089 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1090 _GL_ARG_NONNULL ((1, 2)));
1092 _GL_CXXALIAS_SYS (asprintf, int,
1093 (char **result, const char *format, ...));
1095 _GL_CXXALIASWARN (asprintf);
1096 # if @REPLACE_VASPRINTF@
1097 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1098 # define vasprintf rpl_vasprintf
1100 _GL_FUNCDECL_RPL (vasprintf, int,
1101 (char **result, const char *format, va_list args)
1102 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1103 _GL_ARG_NONNULL ((1, 2)));
1104 _GL_CXXALIAS_RPL (vasprintf, int,
1105 (char **result, const char *format, va_list args));
1107 # if !@HAVE_VASPRINTF@
1108 _GL_FUNCDECL_SYS (vasprintf, int,
1109 (char **result, const char *format, va_list args)
1110 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1111 _GL_ARG_NONNULL ((1, 2)));
1113 _GL_CXXALIAS_SYS (vasprintf, int,
1114 (char **result, const char *format, va_list args));
1116 _GL_CXXALIASWARN (vasprintf);
1119 #if @GNULIB_VDPRINTF@
1120 # if @REPLACE_VDPRINTF@
1121 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1122 # define vdprintf rpl_vdprintf
1124 _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
1125 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1126 _GL_ARG_NONNULL ((2)));
1127 _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
1129 # if !@HAVE_VDPRINTF@
1130 _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
1131 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1132 _GL_ARG_NONNULL ((2)));
1134 /* Need to cast, because on Solaris, the third parameter will likely be
1136 _GL_CXXALIAS_SYS_CAST (vdprintf, int,
1137 (int fd, const char *format, va_list args));
1139 _GL_CXXALIASWARN (vdprintf);
1140 #elif defined GNULIB_POSIXCHECK
1142 # if HAVE_RAW_DECL_VDPRINTF
1143 _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1144 "use gnulib module vdprintf for portability");
1148 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1149 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1150 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1151 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1152 # define vfprintf rpl_vfprintf
1154 # define GNULIB_overrides_vfprintf 1
1155 # if @GNULIB_VFPRINTF_POSIX@
1156 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
1157 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1158 _GL_ARG_NONNULL ((1, 2)));
1160 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
1161 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1162 _GL_ARG_NONNULL ((1, 2)));
1164 _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
1166 /* Need to cast, because on Solaris, the third parameter is
1168 and GCC's fixincludes did not change this to __gnuc_va_list. */
1169 _GL_CXXALIAS_SYS_CAST (vfprintf, int,
1170 (FILE *fp, const char *format, va_list args));
1172 _GL_CXXALIASWARN (vfprintf);
1174 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1175 # if !GNULIB_overrides_vfprintf
1178 /* Assume vfprintf is always declared. */
1179 _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1180 "use gnulib module vfprintf-posix for portable "
1181 "POSIX compliance");
1184 #if @GNULIB_VFSCANF@
1185 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1186 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1188 # define vfscanf rpl_vfscanf
1190 _GL_FUNCDECL_RPL (vfscanf, int,
1191 (FILE *stream, const char *format, va_list args)
1192 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1193 _GL_ARG_NONNULL ((1, 2)));
1194 _GL_CXXALIAS_RPL (vfscanf, int,
1195 (FILE *stream, const char *format, va_list args));
1197 _GL_CXXALIAS_SYS (vfscanf, int,
1198 (FILE *stream, const char *format, va_list args));
1200 _GL_CXXALIASWARN (vfscanf);
1203 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1204 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1205 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1206 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1207 # define vprintf rpl_vprintf
1209 # define GNULIB_overrides_vprintf 1
1210 # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1211 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
1212 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
1213 _GL_ARG_NONNULL ((1)));
1215 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
1216 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1217 _GL_ARG_NONNULL ((1)));
1219 _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
1221 /* Need to cast, because on Solaris, the second parameter is
1223 and GCC's fixincludes did not change this to __gnuc_va_list. */
1224 _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
1226 _GL_CXXALIASWARN (vprintf);
1228 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1229 # if !GNULIB_overrides_vprintf
1232 /* Assume vprintf is always declared. */
1233 _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1234 "use gnulib module vprintf-posix for portable "
1235 "POSIX compliance");
1239 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1240 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1242 # define vscanf rpl_vscanf
1244 _GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args)
1245 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1246 _GL_ARG_NONNULL ((1)));
1247 _GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
1249 _GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
1251 _GL_CXXALIASWARN (vscanf);
1254 #if @GNULIB_VSNPRINTF@
1255 # if @REPLACE_VSNPRINTF@
1256 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1257 # define vsnprintf rpl_vsnprintf
1259 _GL_FUNCDECL_RPL (vsnprintf, int,
1260 (char *str, size_t size, const char *format, va_list args)
1261 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1262 _GL_ARG_NONNULL ((3)));
1263 _GL_CXXALIAS_RPL (vsnprintf, int,
1264 (char *str, size_t size, const char *format, va_list args));
1266 # if !@HAVE_DECL_VSNPRINTF@
1267 _GL_FUNCDECL_SYS (vsnprintf, int,
1268 (char *str, size_t size, const char *format, va_list args)
1269 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1270 _GL_ARG_NONNULL ((3)));
1272 _GL_CXXALIAS_SYS (vsnprintf, int,
1273 (char *str, size_t size, const char *format, va_list args));
1275 _GL_CXXALIASWARN (vsnprintf);
1276 #elif defined GNULIB_POSIXCHECK
1278 # if HAVE_RAW_DECL_VSNPRINTF
1279 _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1280 "use gnulib module vsnprintf for portability");
1284 #if @GNULIB_VSPRINTF_POSIX@
1285 # if @REPLACE_VSPRINTF@
1286 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1287 # define vsprintf rpl_vsprintf
1289 _GL_FUNCDECL_RPL (vsprintf, int,
1290 (char *str, const char *format, va_list args)
1291 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1292 _GL_ARG_NONNULL ((1, 2)));
1293 _GL_CXXALIAS_RPL (vsprintf, int,
1294 (char *str, const char *format, va_list args));
1296 /* Need to cast, because on Solaris, the third parameter is
1298 and GCC's fixincludes did not change this to __gnuc_va_list. */
1299 _GL_CXXALIAS_SYS_CAST (vsprintf, int,
1300 (char *str, const char *format, va_list args));
1302 _GL_CXXALIASWARN (vsprintf);
1303 #elif defined GNULIB_POSIXCHECK
1305 /* Assume vsprintf is always declared. */
1306 _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
1307 "use gnulib module vsprintf-posix for portable "
1308 "POSIX compliance");
1312 #endif /* _@GUARD_PREFIX@_STDIO_H */
1313 #endif /* _@GUARD_PREFIX@_STDIO_H */