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-2010 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@
25 #if defined __need_FILE || defined __need___FILE
26 /* Special invocation convention inside glibc header files. */
28 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
31 /* Normal invocation convention. */
35 /* The include_next requires a split double-inclusion guard. */
36 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
41 /* Get va_list. Needed on many systems, including glibc 2.8. */
46 /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8. */
47 #include <sys/types.h>
50 /* The __attribute__ feature is available in gcc versions 2.5 and later.
51 The __-protected variants of the attributes 'format' and 'printf' are
52 accepted by gcc versions 2.6.4 (effectively 2.7) and later.
53 We enable __attribute__ only if these are supported too, because
54 gnulib and libintl do '#define printf __printf__' when they override
55 the 'printf' function. */
56 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
57 # define __attribute__(Spec) /* empty */
62 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
64 /* The definition of _GL_ARG_NONNULL is copied here. */
66 /* The definition of _GL_WARN_ON_USE is copied here. */
70 # if @REPLACE_DPRINTF@
71 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
72 # define dprintf rpl_dprintf
74 _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
75 __attribute__ ((__format__ (__printf__, 2, 3)))
76 _GL_ARG_NONNULL ((2)));
77 _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
80 _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
81 __attribute__ ((__format__ (__printf__, 2, 3)))
82 _GL_ARG_NONNULL ((2)));
84 _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
86 _GL_CXXALIASWARN (dprintf);
87 #elif defined GNULIB_POSIXCHECK
89 # if HAVE_RAW_DECL_DPRINTF
90 _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
91 "use gnulib module dprintf for portability");
96 /* Close STREAM and its underlying file descriptor. */
98 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
99 # define fclose rpl_fclose
101 _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
102 _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
104 _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
106 _GL_CXXALIASWARN (fclose);
107 #elif defined GNULIB_POSIXCHECK
109 /* Assume fclose is always declared. */
110 _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
111 "use gnulib module fclose for portable POSIX compliance");
115 /* Flush all pending data on STREAM according to POSIX rules. Both
116 output and seekable input streams are supported.
117 Note! LOSS OF DATA can occur if fflush is applied on an input stream
118 that is _not_seekable_ or on an update stream that is _not_seekable_
119 and in which the most recent operation was input. Seekability can
120 be tested with lseek(fileno(fp),0,SEEK_CUR). */
121 # if @REPLACE_FFLUSH@
122 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
123 # define fflush rpl_fflush
125 _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
126 _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
128 _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
130 _GL_CXXALIASWARN (fflush);
131 #elif defined GNULIB_POSIXCHECK
133 /* Assume fflush is always declared. */
134 _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
135 "use gnulib module fflush for portable POSIX compliance");
138 /* It is very rare that the developer ever has full control of stdin,
139 so any use of gets warrants an unconditional warning. Assume it is
140 always declared, since it is required by C89. */
142 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
146 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
148 # define fopen rpl_fopen
150 _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
151 _GL_ARG_NONNULL ((1, 2)));
152 _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
154 _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
156 _GL_CXXALIASWARN (fopen);
157 #elif defined GNULIB_POSIXCHECK
159 /* Assume fopen is always declared. */
160 _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
161 "use gnulib module fopen for portability");
164 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
165 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
166 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
167 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
168 # define fprintf rpl_fprintf
170 # define GNULIB_overrides_fprintf 1
171 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
172 __attribute__ ((__format__ (__printf__, 2, 3)))
173 _GL_ARG_NONNULL ((1, 2)));
174 _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
176 _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
178 _GL_CXXALIASWARN (fprintf);
180 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
181 # if !GNULIB_overrides_fprintf
184 /* Assume fprintf is always declared. */
185 _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
186 "use gnulib module fprintf-posix for portable "
191 /* Discard all pending buffered I/O data on STREAM.
192 STREAM must not be wide-character oriented.
193 When discarding pending output, the file position is set back to where it
194 was before the write calls. When discarding pending input, the file
195 position is advanced to match the end of the previously read input.
196 Return 0 if successful. Upon error, return -1 and set errno. */
197 # if @REPLACE_FPURGE@
198 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
199 # define fpurge rpl_fpurge
201 _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
202 _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
204 # if !@HAVE_DECL_FPURGE@
205 _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
207 _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
209 _GL_CXXALIASWARN (fpurge);
210 #elif defined GNULIB_POSIXCHECK
212 # if HAVE_RAW_DECL_FPURGE
213 _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
214 "use gnulib module fpurge for portability");
219 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
220 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
222 # define fputc rpl_fputc
224 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
225 _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
227 _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
229 _GL_CXXALIASWARN (fputc);
233 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
234 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
236 # define fputs rpl_fputs
238 _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
239 _GL_ARG_NONNULL ((1, 2)));
240 _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
242 _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
244 _GL_CXXALIASWARN (fputs);
248 # if @REPLACE_FREOPEN@
249 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
251 # define freopen rpl_freopen
253 _GL_FUNCDECL_RPL (freopen, FILE *,
254 (const char *filename, const char *mode, FILE *stream)
255 _GL_ARG_NONNULL ((2, 3)));
256 _GL_CXXALIAS_RPL (freopen, FILE *,
257 (const char *filename, const char *mode, FILE *stream));
259 _GL_CXXALIAS_SYS (freopen, FILE *,
260 (const char *filename, const char *mode, FILE *stream));
262 _GL_CXXALIASWARN (freopen);
263 #elif defined GNULIB_POSIXCHECK
265 /* Assume freopen is always declared. */
266 _GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
267 "use gnulib module freopen for portability");
271 /* Set up the following warnings, based on which modules are in use.
272 GNU Coding Standards discourage the use of fseek, since it imposes
273 an arbitrary limitation on some 32-bit hosts. Remember that the
274 fseek module depends on the fseeko module, so we only have three
277 1. The developer is not using either module. Issue a warning under
278 GNULIB_POSIXCHECK for both functions, to remind them that both
279 functions have bugs on some systems. _GL_NO_LARGE_FILES has no
280 impact on this warning.
282 2. The developer is using both modules. They may be unaware of the
283 arbitrary limitations of fseek, so issue a warning under
284 GNULIB_POSIXCHECK. On the other hand, they may be using both
285 modules intentionally, so the developer can define
286 _GL_NO_LARGE_FILES in the compilation units where the use of fseek
287 is safe, to silence the warning.
289 3. The developer is using the fseeko module, but not fseek. Gnulib
290 guarantees that fseek will still work around platform bugs in that
291 case, but we presume that the developer is aware of the pitfalls of
292 fseek and was trying to avoid it, so issue a warning even when
293 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
294 defined to silence the warning in particular compilation units.
295 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
296 fseek gets defined as a macro, it is recommended that the developer
297 uses the fseek module, even if he is not calling the fseek function.
299 Most gnulib clients that perform stream operations should fall into
303 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
304 # define _GL_FSEEK_WARN /* Category 2, above. */
308 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
310 # define fseek rpl_fseek
312 _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
313 _GL_ARG_NONNULL ((1)));
314 _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
316 _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
318 _GL_CXXALIASWARN (fseek);
322 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
323 # define _GL_FSEEK_WARN /* Category 3, above. */
326 # if @REPLACE_FSEEKO@
327 /* Provide fseek, fseeko functions that are aware of a preceding
328 fflush(), and which detect pipes. */
329 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
331 # define fseeko rpl_fseeko
333 _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
334 _GL_ARG_NONNULL ((1)));
336 /* In order to avoid that fseek gets defined as a macro here, the
337 developer can request the 'fseek' module. */
339 # define fseek rpl_fseek
340 static inline int _GL_ARG_NONNULL ((1))
341 rpl_fseek (FILE *fp, long offset, int whence)
343 return fseeko (fp, offset, whence);
346 _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
348 _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
350 _GL_CXXALIASWARN (fseeko);
351 #elif defined GNULIB_POSIXCHECK
352 # define _GL_FSEEK_WARN /* Category 1, above. */
355 # if HAVE_RAW_DECL_FSEEKO
356 _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
357 "use gnulib module fseeko for portability");
361 #ifdef _GL_FSEEK_WARN
362 # undef _GL_FSEEK_WARN
363 /* Here, either fseek is undefined (but C89 guarantees that it is
364 declared), or it is defined as rpl_fseek (declared above). */
365 _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
366 "on 32-bit platforms - "
367 "use fseeko function for handling of large files");
371 /* ftell, ftello. See the comments on fseek/fseeko. */
374 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
375 # define _GL_FTELL_WARN /* Category 2, above. */
379 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
381 # define ftell rpl_ftell
383 _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
384 _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
386 _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
388 _GL_CXXALIASWARN (ftell);
392 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
393 # define _GL_FTELL_WARN /* Category 3, above. */
396 # if @REPLACE_FTELLO@
397 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
399 # define ftello rpl_ftello
401 _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
403 /* In order to avoid that ftell gets defined as a macro here, the
404 developer can request the 'ftell' module. */
406 # define ftell rpl_ftell
407 static inline long _GL_ARG_NONNULL ((1))
413 _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
415 _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
417 _GL_CXXALIASWARN (ftello);
418 #elif defined GNULIB_POSIXCHECK
419 # define _GL_FTELL_WARN /* Category 1, above. */
422 # if HAVE_RAW_DECL_FTELLO
423 _GL_WARN_ON_USE (ftello, "ftello is unportable - "
424 "use gnulib module ftello for portability");
428 #ifdef _GL_FTELL_WARN
429 # undef _GL_FTELL_WARN
430 /* Here, either ftell is undefined (but C89 guarantees that it is
431 declared), or it is defined as rpl_ftell (declared above). */
432 _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
433 "on 32-bit platforms - "
434 "use ftello function for handling of large files");
439 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
440 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
442 # define fwrite rpl_fwrite
444 _GL_FUNCDECL_RPL (fwrite, size_t,
445 (const void *ptr, size_t s, size_t n, FILE *stream)
446 _GL_ARG_NONNULL ((1, 4)));
447 _GL_CXXALIAS_RPL (fwrite, size_t,
448 (const void *ptr, size_t s, size_t n, FILE *stream));
450 _GL_CXXALIAS_SYS (fwrite, size_t,
451 (const void *ptr, size_t s, size_t n, FILE *stream));
453 _GL_CXXALIASWARN (fwrite);
456 #if @GNULIB_GETDELIM@
457 /* Read input, up to (and including) the next occurrence of DELIMITER, from
458 STREAM, store it in *LINEPTR (and NUL-terminate it).
459 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
460 bytes of space. It is realloc'd as necessary.
461 Return the number of bytes read and stored at *LINEPTR (not including the
462 NUL terminator), or -1 on error or EOF. */
463 # if @REPLACE_GETDELIM@
464 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
466 # define getdelim rpl_getdelim
468 _GL_FUNCDECL_RPL (getdelim, ssize_t,
469 (char **lineptr, size_t *linesize, int delimiter,
471 _GL_ARG_NONNULL ((1, 2, 4)));
472 _GL_CXXALIAS_RPL (getdelim, ssize_t,
473 (char **lineptr, size_t *linesize, int delimiter,
476 # if !@HAVE_DECL_GETDELIM@
477 _GL_FUNCDECL_SYS (getdelim, ssize_t,
478 (char **lineptr, size_t *linesize, int delimiter,
480 _GL_ARG_NONNULL ((1, 2, 4)));
482 _GL_CXXALIAS_SYS (getdelim, ssize_t,
483 (char **lineptr, size_t *linesize, int delimiter,
486 _GL_CXXALIASWARN (getdelim);
487 #elif defined GNULIB_POSIXCHECK
489 # if HAVE_RAW_DECL_GETDELIM
490 _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
491 "use gnulib module getdelim for portability");
496 /* Read a line, up to (and including) the next newline, from STREAM, store it
497 in *LINEPTR (and NUL-terminate it).
498 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
499 bytes of space. It is realloc'd as necessary.
500 Return the number of bytes read and stored at *LINEPTR (not including the
501 NUL terminator), or -1 on error or EOF. */
502 # if @REPLACE_GETLINE@
503 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
505 # define getline rpl_getline
507 _GL_FUNCDECL_RPL (getline, ssize_t,
508 (char **lineptr, size_t *linesize, FILE *stream)
509 _GL_ARG_NONNULL ((1, 2, 3)));
510 _GL_CXXALIAS_RPL (getline, ssize_t,
511 (char **lineptr, size_t *linesize, FILE *stream));
513 # if !@HAVE_DECL_GETLINE@
514 _GL_FUNCDECL_SYS (getline, ssize_t,
515 (char **lineptr, size_t *linesize, FILE *stream)
516 _GL_ARG_NONNULL ((1, 2, 3)));
518 _GL_CXXALIAS_SYS (getline, ssize_t,
519 (char **lineptr, size_t *linesize, FILE *stream));
521 _GL_CXXALIASWARN (getline);
522 #elif defined GNULIB_POSIXCHECK
524 # if HAVE_RAW_DECL_GETLINE
525 _GL_WARN_ON_USE (getline, "getline is unportable - "
526 "use gnulib module getline for portability");
530 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
532 /* Grow an obstack with formatted output. Return the number of
533 bytes added to OBS. No trailing nul byte is added, and the
534 object should be closed with obstack_finish before use. Upon
535 memory allocation error, call obstack_alloc_failed_handler. Upon
536 other error, return -1. */
537 # if @REPLACE_OBSTACK_PRINTF@
538 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
539 # define obstack_printf rpl_obstack_printf
541 _GL_FUNCDECL_RPL (obstack_printf, int,
542 (struct obstack *obs, const char *format, ...)
543 __attribute__ ((__format__ (__printf__, 2, 3)))
544 _GL_ARG_NONNULL ((1, 2)));
545 _GL_CXXALIAS_RPL (obstack_printf, int,
546 (struct obstack *obs, const char *format, ...));
548 # if !@HAVE_DECL_OBSTACK_PRINTF@
549 _GL_FUNCDECL_SYS (obstack_printf, int,
550 (struct obstack *obs, const char *format, ...)
551 __attribute__ ((__format__ (__printf__, 2, 3)))
552 _GL_ARG_NONNULL ((1, 2)));
554 _GL_CXXALIAS_SYS (obstack_printf, int,
555 (struct obstack *obs, const char *format, ...));
557 _GL_CXXALIASWARN (obstack_printf);
558 # if @REPLACE_OBSTACK_PRINTF@
559 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
560 # define obstack_vprintf rpl_obstack_vprintf
562 _GL_FUNCDECL_RPL (obstack_vprintf, int,
563 (struct obstack *obs, const char *format, va_list args)
564 __attribute__ ((__format__ (__printf__, 2, 0)))
565 _GL_ARG_NONNULL ((1, 2)));
566 _GL_CXXALIAS_RPL (obstack_vprintf, int,
567 (struct obstack *obs, const char *format, va_list args));
569 # if !@HAVE_DECL_OBSTACK_PRINTF@
570 _GL_FUNCDECL_SYS (obstack_vprintf, int,
571 (struct obstack *obs, const char *format, va_list args)
572 __attribute__ ((__format__ (__printf__, 2, 0)))
573 _GL_ARG_NONNULL ((1, 2)));
575 _GL_CXXALIAS_SYS (obstack_vprintf, int,
576 (struct obstack *obs, const char *format, va_list args));
578 _GL_CXXALIASWARN (obstack_vprintf);
582 /* Print a message to standard error, describing the value of ERRNO,
583 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
584 and terminated with a newline. */
585 # if @REPLACE_PERROR@
586 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
587 # define perror rpl_perror
589 _GL_FUNCDECL_RPL (perror, void, (const char *string));
590 _GL_CXXALIAS_RPL (perror, void, (const char *string));
592 _GL_CXXALIAS_SYS (perror, void, (const char *string));
594 _GL_CXXALIASWARN (perror);
595 #elif defined GNULIB_POSIXCHECK
597 /* Assume perror is always declared. */
598 _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
599 "use gnulib module perror for portability");
604 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
606 # define popen rpl_popen
608 _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
609 _GL_ARG_NONNULL ((1, 2)));
610 _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
612 _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
614 _GL_CXXALIASWARN (popen);
615 #elif defined GNULIB_POSIXCHECK
617 # if HAVE_RAW_DECL_POPEN
618 _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
619 "use gnulib module popen or pipe for more portability");
623 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
624 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
625 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
626 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
627 /* Don't break __attribute__((format(printf,M,N))). */
628 # define printf __printf__
630 # define GNULIB_overrides_printf 1
631 _GL_FUNCDECL_RPL_1 (__printf__, int,
632 (const char *format, ...)
633 __attribute__ ((__format__ (__printf__, 1, 2)))
634 _GL_ARG_NONNULL ((1)));
635 _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
637 _GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
639 _GL_CXXALIASWARN (printf);
641 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
642 # if !GNULIB_overrides_printf
645 /* Assume printf is always declared. */
646 _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
647 "use gnulib module printf-posix for portable "
652 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
653 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
655 # define putc rpl_fputc
657 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
658 _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
660 _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
662 _GL_CXXALIASWARN (putc);
666 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
667 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
669 # define putchar rpl_putchar
671 _GL_FUNCDECL_RPL (putchar, int, (int c));
672 _GL_CXXALIAS_RPL (putchar, int, (int c));
674 _GL_CXXALIAS_SYS (putchar, int, (int c));
676 _GL_CXXALIASWARN (putchar);
680 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
681 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
683 # define puts rpl_puts
685 _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
686 _GL_CXXALIAS_RPL (puts, int, (const char *string));
688 _GL_CXXALIAS_SYS (puts, int, (const char *string));
690 _GL_CXXALIASWARN (puts);
694 # if @REPLACE_REMOVE@
695 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
697 # define remove rpl_remove
699 _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
700 _GL_CXXALIAS_RPL (remove, int, (const char *name));
702 _GL_CXXALIAS_SYS (remove, int, (const char *name));
704 _GL_CXXALIASWARN (remove);
705 #elif defined GNULIB_POSIXCHECK
707 /* Assume remove is always declared. */
708 _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
709 "use gnulib module remove for more portability");
713 # if @REPLACE_RENAME@
714 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
716 # define rename rpl_rename
718 _GL_FUNCDECL_RPL (rename, int,
719 (const char *old_filename, const char *new_filename)
720 _GL_ARG_NONNULL ((1, 2)));
721 _GL_CXXALIAS_RPL (rename, int,
722 (const char *old_filename, const char *new_filename));
724 _GL_CXXALIAS_SYS (rename, int,
725 (const char *old_filename, const char *new_filename));
727 _GL_CXXALIASWARN (rename);
728 #elif defined GNULIB_POSIXCHECK
730 /* Assume rename is always declared. */
731 _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
732 "use gnulib module rename for more portability");
735 #if @GNULIB_RENAMEAT@
736 # if @REPLACE_RENAMEAT@
737 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
739 # define renameat rpl_renameat
741 _GL_FUNCDECL_RPL (renameat, int,
742 (int fd1, char const *file1, int fd2, char const *file2)
743 _GL_ARG_NONNULL ((2, 4)));
744 _GL_CXXALIAS_RPL (renameat, int,
745 (int fd1, char const *file1, int fd2, char const *file2));
747 # if !@HAVE_RENAMEAT@
748 _GL_FUNCDECL_SYS (renameat, int,
749 (int fd1, char const *file1, int fd2, char const *file2)
750 _GL_ARG_NONNULL ((2, 4)));
752 _GL_CXXALIAS_SYS (renameat, int,
753 (int fd1, char const *file1, int fd2, char const *file2));
755 _GL_CXXALIASWARN (renameat);
756 #elif defined GNULIB_POSIXCHECK
758 # if HAVE_RAW_DECL_RENAMEAT
759 _GL_WARN_ON_USE (renameat, "renameat is not portable - "
760 "use gnulib module renameat for portability");
764 #if @GNULIB_SNPRINTF@
765 # if @REPLACE_SNPRINTF@
766 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
767 # define snprintf rpl_snprintf
769 _GL_FUNCDECL_RPL (snprintf, int,
770 (char *str, size_t size, const char *format, ...)
771 __attribute__ ((__format__ (__printf__, 3, 4)))
772 _GL_ARG_NONNULL ((3)));
773 _GL_CXXALIAS_RPL (snprintf, int,
774 (char *str, size_t size, const char *format, ...));
776 # if !@HAVE_DECL_SNPRINTF@
777 _GL_FUNCDECL_SYS (snprintf, int,
778 (char *str, size_t size, const char *format, ...)
779 __attribute__ ((__format__ (__printf__, 3, 4)))
780 _GL_ARG_NONNULL ((3)));
782 _GL_CXXALIAS_SYS (snprintf, int,
783 (char *str, size_t size, const char *format, ...));
785 _GL_CXXALIASWARN (snprintf);
786 #elif defined GNULIB_POSIXCHECK
788 # if HAVE_RAW_DECL_SNPRINTF
789 _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
790 "use gnulib module snprintf for portability");
794 /* Some people would argue that sprintf should be handled like gets
795 (for example, OpenBSD issues a link warning for both functions),
796 since both can cause security holes due to buffer overruns.
797 However, we believe that sprintf can be used safely, and is more
798 efficient than snprintf in those safe cases; and as proof of our
799 belief, we use sprintf in several gnulib modules. So this header
800 intentionally avoids adding a warning to sprintf except when
801 GNULIB_POSIXCHECK is defined. */
803 #if @GNULIB_SPRINTF_POSIX@
804 # if @REPLACE_SPRINTF@
805 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
806 # define sprintf rpl_sprintf
808 _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
809 __attribute__ ((__format__ (__printf__, 2, 3)))
810 _GL_ARG_NONNULL ((1, 2)));
811 _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
813 _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
815 _GL_CXXALIASWARN (sprintf);
816 #elif defined GNULIB_POSIXCHECK
818 /* Assume sprintf is always declared. */
819 _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
820 "use gnulib module sprintf-posix for portable "
824 #if @GNULIB_VASPRINTF@
825 /* Write formatted output to a string dynamically allocated with malloc().
826 If the memory allocation succeeds, store the address of the string in
827 *RESULT and return the number of resulting bytes, excluding the trailing
828 NUL. Upon memory allocation error, or some other error, return -1. */
829 # if @REPLACE_VASPRINTF@
830 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
831 # define asprintf rpl_asprintf
833 _GL_FUNCDECL_RPL (asprintf, int,
834 (char **result, const char *format, ...)
835 __attribute__ ((__format__ (__printf__, 2, 3)))
836 _GL_ARG_NONNULL ((1, 2)));
837 _GL_CXXALIAS_RPL (asprintf, int,
838 (char **result, const char *format, ...));
840 # if !@HAVE_VASPRINTF@
841 _GL_FUNCDECL_SYS (asprintf, int,
842 (char **result, const char *format, ...)
843 __attribute__ ((__format__ (__printf__, 2, 3)))
844 _GL_ARG_NONNULL ((1, 2)));
846 _GL_CXXALIAS_SYS (asprintf, int,
847 (char **result, const char *format, ...));
849 _GL_CXXALIASWARN (asprintf);
850 # if @REPLACE_VASPRINTF@
851 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
852 # define vasprintf rpl_vasprintf
854 _GL_FUNCDECL_RPL (vasprintf, int,
855 (char **result, const char *format, va_list args)
856 __attribute__ ((__format__ (__printf__, 2, 0)))
857 _GL_ARG_NONNULL ((1, 2)));
858 _GL_CXXALIAS_RPL (vasprintf, int,
859 (char **result, const char *format, va_list args));
861 # if !@HAVE_VASPRINTF@
862 _GL_FUNCDECL_SYS (vasprintf, int,
863 (char **result, const char *format, va_list args)
864 __attribute__ ((__format__ (__printf__, 2, 0)))
865 _GL_ARG_NONNULL ((1, 2)));
867 _GL_CXXALIAS_SYS (vasprintf, int,
868 (char **result, const char *format, va_list args));
870 _GL_CXXALIASWARN (vasprintf);
873 #if @GNULIB_VDPRINTF@
874 # if @REPLACE_VDPRINTF@
875 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
876 # define vdprintf rpl_vdprintf
878 _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
879 __attribute__ ((__format__ (__printf__, 2, 0)))
880 _GL_ARG_NONNULL ((2)));
881 _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
883 # if !@HAVE_VDPRINTF@
884 _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
885 __attribute__ ((__format__ (__printf__, 2, 0)))
886 _GL_ARG_NONNULL ((2)));
888 _GL_CXXALIAS_SYS (vdprintf, int, (int fd, const char *format, va_list args));
890 _GL_CXXALIASWARN (vdprintf);
891 #elif defined GNULIB_POSIXCHECK
893 # if HAVE_RAW_DECL_VDPRINTF
894 _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
895 "use gnulib module vdprintf for portability");
899 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
900 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
901 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
902 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
903 # define vfprintf rpl_vfprintf
905 # define GNULIB_overrides_vfprintf 1
906 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
907 __attribute__ ((__format__ (__printf__, 2, 0)))
908 _GL_ARG_NONNULL ((1, 2)));
909 _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
911 _GL_CXXALIAS_SYS (vfprintf, int, (FILE *fp, const char *format, va_list args));
913 _GL_CXXALIASWARN (vfprintf);
915 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
916 # if !GNULIB_overrides_vfprintf
919 /* Assume vfprintf is always declared. */
920 _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
921 "use gnulib module vfprintf-posix for portable "
925 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
926 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
927 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
928 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
929 # define vprintf rpl_vprintf
931 # define GNULIB_overrides_vprintf 1
932 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
933 __attribute__ ((__format__ (__printf__, 1, 0)))
934 _GL_ARG_NONNULL ((1)));
935 _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
937 _GL_CXXALIAS_SYS (vprintf, int, (const char *format, va_list args));
939 _GL_CXXALIASWARN (vprintf);
941 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
942 # if !GNULIB_overrides_vprintf
945 /* Assume vprintf is always declared. */
946 _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
947 "use gnulib module vprintf-posix for portable "
951 #if @GNULIB_VSNPRINTF@
952 # if @REPLACE_VSNPRINTF@
953 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
954 # define vsnprintf rpl_vsnprintf
956 _GL_FUNCDECL_RPL (vsnprintf, int,
957 (char *str, size_t size, const char *format, va_list args)
958 __attribute__ ((__format__ (__printf__, 3, 0)))
959 _GL_ARG_NONNULL ((3)));
960 _GL_CXXALIAS_RPL (vsnprintf, int,
961 (char *str, size_t size, const char *format, va_list args));
963 # if !@HAVE_DECL_VSNPRINTF@
964 _GL_FUNCDECL_SYS (vsnprintf, int,
965 (char *str, size_t size, const char *format, va_list args)
966 __attribute__ ((__format__ (__printf__, 3, 0)))
967 _GL_ARG_NONNULL ((3)));
969 _GL_CXXALIAS_SYS (vsnprintf, int,
970 (char *str, size_t size, const char *format, va_list args));
972 _GL_CXXALIASWARN (vsnprintf);
973 #elif defined GNULIB_POSIXCHECK
975 # if HAVE_RAW_DECL_VSNPRINTF
976 _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
977 "use gnulib module vsnprintf for portability");
981 #if @GNULIB_VSPRINTF_POSIX@
982 # if @REPLACE_VSPRINTF@
983 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
984 # define vsprintf rpl_vsprintf
986 _GL_FUNCDECL_RPL (vsprintf, int,
987 (char *str, const char *format, va_list args)
988 __attribute__ ((__format__ (__printf__, 2, 0)))
989 _GL_ARG_NONNULL ((1, 2)));
990 _GL_CXXALIAS_RPL (vsprintf, int,
991 (char *str, const char *format, va_list args));
993 _GL_CXXALIAS_SYS (vsprintf, int,
994 (char *str, const char *format, va_list args));
996 _GL_CXXALIASWARN (vsprintf);
997 #elif defined GNULIB_POSIXCHECK
999 /* Assume vsprintf is always declared. */
1000 _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
1001 "use gnulib module vsprintf-posix for portable "
1002 "POSIX compliance");
1006 #endif /* _GL_STDIO_H */
1007 #endif /* _GL_STDIO_H */